@@ -274,8 +274,6 @@ pub mod aarch64 {
274
274
vcpus. push ( vcpu) ;
275
275
}
276
276
277
- setup_interrupt_controller ( vm, vcpu_count) ?;
278
-
279
277
Ok ( vcpus)
280
278
}
281
279
@@ -317,6 +315,9 @@ pub mod aarch64 {
317
315
let vcpus = create_vcpus ( & mut vmm. vm , vm_config. vcpu_count , & vmm. vcpus_exit_evt )
318
316
. map_err ( StartMicrovmError :: Internal ) ?;
319
317
318
+ setup_interrupt_controller ( & mut vmm. vm , vm_config. vcpu_count )
319
+ . map_err ( StartMicrovmError :: Internal ) ?;
320
+
320
321
Ok ( ( vmm, vcpus) )
321
322
}
322
323
}
@@ -459,6 +460,11 @@ pub mod x86_64 {
459
460
kvm_capabilities,
460
461
) ?;
461
462
463
+ setup_interrupt_controller ( & mut vmm. vm ) . map_err ( StartMicrovmError :: Internal ) ?;
464
+ vmm. pio_device_manager
465
+ . register_devices ( vmm. vm . fd ( ) )
466
+ . unwrap ( ) ;
467
+
462
468
let vcpus = create_vcpus ( & mut vmm. vm , vm_config. vcpu_count , & vmm. vcpus_exit_evt )
463
469
. map_err ( StartMicrovmError :: Internal ) ?;
464
470
@@ -477,10 +483,7 @@ fn build_vmm(
477
483
478
484
// Set up Kvm Vm and register memory regions.
479
485
// Build custom CPU config if a custom template is provided.
480
- //
481
- // allow unused_mut for the aarch64 platform.
482
- #[ allow( unused_mut) ]
483
- let mut vm = Vm :: new ( kvm_capabilities)
486
+ let vm = Vm :: new ( kvm_capabilities)
484
487
. map_err ( VmmError :: Vm )
485
488
. map_err ( Internal ) ?;
486
489
vm. memory_init ( & guest_memory, vm_config. track_dirty_pages )
@@ -513,15 +516,9 @@ fn build_vmm(
513
516
. map_err ( VmmError :: EventFd )
514
517
. map_err ( Internal ) ?;
515
518
516
- x86_64:: setup_interrupt_controller ( & mut vm) . map_err ( Internal ) ?;
517
-
518
519
// create pio dev manager with legacy devices
519
- let pio_device_manager = {
520
- // TODO Remove these unwraps.
521
- let mut pio_dev_mgr = PortIODeviceManager :: new ( serial_device, reset_evt) . unwrap ( ) ;
522
- pio_dev_mgr. register_devices ( vm. fd ( ) ) . unwrap ( ) ;
523
- pio_dev_mgr
524
- } ;
520
+ // TODO: remove this unwrap
521
+ let pio_device_manager = PortIODeviceManager :: new ( serial_device, reset_evt) . unwrap ( ) ;
525
522
526
523
pio_device_manager
527
524
} ;
0 commit comments