Skip to content

Commit 1afb6ad

Browse files
committed
refactor: drop uffd parameter from create_vmm_and_vcpus
This way the non-snapshot path doesnt have to deal with passing in `None`. Signed-off-by: Patrick Roy <[email protected]>
1 parent bbadadb commit 1afb6ad

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

src/vmm/src/arch/aarch64/vm.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ use serde::{Deserialize, Serialize};
55

66
use crate::Kvm;
77
use crate::arch::aarch64::gic::GicState;
8-
use crate::vstate::vm::{VmCommon, VmError};
98
use crate::vstate::memory::{GuestMemoryExtension, GuestMemoryState};
9+
use crate::vstate::vm::{VmCommon, VmError};
1010

1111
/// Structure representing the current architecture's understand of what a "virtual machine" is.
1212
#[derive(Debug)]

src/vmm/src/builder.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,6 @@ impl std::convert::From<linux_loader::cmdline::Error> for StartMicrovmError {
154154
fn create_vmm_and_vcpus(
155155
instance_info: &InstanceInfo,
156156
event_manager: &mut EventManager,
157-
uffd: Option<Uffd>,
158157
vcpu_count: u8,
159158
kvm_capabilities: Vec<KvmCapability>,
160159
) -> Result<(Vmm, Vec<Vcpu>), VmmError> {
@@ -197,7 +196,7 @@ fn create_vmm_and_vcpus(
197196
shutdown_exit_code: None,
198197
kvm,
199198
vm,
200-
uffd,
199+
uffd: None,
201200
vcpus_handles: Vec::new(),
202201
vcpus_exit_evt,
203202
resource_allocator,
@@ -248,7 +247,6 @@ pub fn build_microvm_for_boot(
248247
let (mut vmm, mut vcpus) = create_vmm_and_vcpus(
249248
instance_info,
250249
event_manager,
251-
None,
252250
vm_resources.machine_config.vcpu_count,
253251
cpu_template.kvm_capabilities.clone(),
254252
)?;
@@ -447,7 +445,6 @@ pub fn build_microvm_from_snapshot(
447445
let (mut vmm, mut vcpus) = create_vmm_and_vcpus(
448446
instance_info,
449447
event_manager,
450-
uffd,
451448
vm_resources.machine_config.vcpu_count,
452449
microvm_state.kvm_state.kvm_cap_modifiers.clone(),
453450
)
@@ -457,6 +454,7 @@ pub fn build_microvm_from_snapshot(
457454
.register_memory_regions(guest_memory)
458455
.map_err(VmmError::Vm)
459456
.map_err(StartMicrovmError::Internal)?;
457+
vmm.uffd = uffd;
460458

461459
#[cfg(target_arch = "x86_64")]
462460
{

src/vmm/src/vstate/vm.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@ use vmm_sys_util::eventfd::EventFd;
1414
use crate::Vcpu;
1515
pub use crate::arch::{ArchVm as Vm, ArchVmError, VmState};
1616
use crate::logger::info;
17-
use crate::vstate::memory::{Address, GuestMemory, GuestMemoryMmap, GuestMemoryRegion, GuestRegionMmap};
17+
use crate::vstate::memory::{
18+
Address, GuestMemory, GuestMemoryMmap, GuestMemoryRegion, GuestRegionMmap,
19+
};
1820
use crate::vstate::vcpu::VcpuError;
1921

2022
/// Architecture independent parts of a VM.

0 commit comments

Comments
 (0)