@@ -299,15 +299,13 @@ pub mod aarch64 {
299
299
300
300
pub fn create_vmm_and_vcpus (
301
301
instance_info : & InstanceInfo ,
302
- event_manager : & mut EventManager ,
303
302
guest_memory : GuestMemoryMmap ,
304
303
uffd : Option < Uffd > ,
305
304
vm_config : & VmConfig ,
306
305
kvm_capabilities : Vec < KvmCapability > ,
307
306
) -> Result < ( Vmm , Vec < Vcpu > ) , StartMicrovmError > {
308
307
let mut vmm = build_vmm (
309
308
instance_info,
310
- event_manager,
311
309
guest_memory,
312
310
uffd,
313
311
vm_config,
@@ -449,15 +447,13 @@ pub mod x86_64 {
449
447
450
448
pub fn create_vmm_and_vcpus (
451
449
instance_info : & InstanceInfo ,
452
- event_manager : & mut EventManager ,
453
450
guest_memory : GuestMemoryMmap ,
454
451
uffd : Option < Uffd > ,
455
452
vm_config : & VmConfig ,
456
453
kvm_capabilities : Vec < KvmCapability > ,
457
454
) -> Result < ( Vmm , Vec < Vcpu > ) , StartMicrovmError > {
458
455
let mut vmm = build_vmm (
459
456
instance_info,
460
- event_manager,
461
457
guest_memory,
462
458
uffd,
463
459
vm_config,
@@ -473,7 +469,6 @@ pub mod x86_64 {
473
469
474
470
fn build_vmm (
475
471
instance_info : & InstanceInfo ,
476
- event_manager : & mut EventManager ,
477
472
guest_memory : GuestMemoryMmap ,
478
473
uffd : Option < Uffd > ,
479
474
vm_config : & VmConfig ,
@@ -508,7 +503,7 @@ fn build_vmm(
508
503
let pio_device_manager = {
509
504
// Serial device setup.
510
505
let serial_device =
511
- setup_serial_device ( event_manager , std:: io:: stdin ( ) , io:: stdout ( ) ) . map_err ( Internal ) ?;
506
+ setup_serial_device ( std:: io:: stdin ( ) , io:: stdout ( ) ) . map_err ( Internal ) ?;
512
507
513
508
// x86_64 uses the i8042 reset event as the Vmm exit event.
514
509
let reset_evt = vcpus_exit_evt
@@ -583,16 +578,17 @@ pub fn build_microvm_for_boot(
583
578
#[ cfg( target_arch = "x86_64" ) ]
584
579
let ( mut vmm, mut vcpus) = x86_64:: create_vmm_and_vcpus (
585
580
instance_info,
586
- event_manager,
587
581
guest_memory,
588
582
None ,
589
583
& vm_resources. vm_config ,
590
584
cpu_template. kvm_capabilities . clone ( ) ,
591
585
) ?;
586
+ #[ cfg( target_arch = "x86_64" ) ]
587
+ event_manager. add_subscriber ( vmm. pio_device_manager . stdio_serial . clone ( ) ) ;
588
+
592
589
#[ cfg( target_arch = "aarch64" ) ]
593
590
let ( mut vmm, mut vcpus) = aarch64:: create_vmm_and_vcpus (
594
591
instance_info,
595
- event_manager,
596
592
guest_memory,
597
593
None ,
598
594
& vm_resources. vm_config ,
@@ -794,16 +790,16 @@ pub fn build_microvm_from_snapshot(
794
790
#[ cfg( target_arch = "x86_64" ) ]
795
791
let ( mut vmm, mut vcpus) = x86_64:: create_vmm_and_vcpus (
796
792
instance_info,
797
- event_manager,
798
793
guest_memory. clone ( ) ,
799
794
uffd,
800
795
& vm_resources. vm_config ,
801
796
microvm_state. vm_state . kvm_cap_modifiers . clone ( ) ,
802
797
) ?;
798
+ #[ cfg( target_arch = "x86_64" ) ]
799
+ event_manager. add_subscriber ( vmm. pio_device_manager . stdio_serial . clone ( ) ) ;
803
800
#[ cfg( target_arch = "aarch64" ) ]
804
801
let ( mut vmm, mut vcpus) = aarch64:: create_vmm_and_vcpus (
805
802
instance_info,
806
- event_manager,
807
803
guest_memory. clone ( ) ,
808
804
uffd,
809
805
& vm_resources. vm_config ,
@@ -968,7 +964,6 @@ where
968
964
969
965
/// Sets up the serial device.
970
966
pub fn setup_serial_device (
971
- event_manager : & mut EventManager ,
972
967
input : std:: io:: Stdin ,
973
968
out : std:: io:: Stdout ,
974
969
) -> Result < Arc < Mutex < BusDevice > > , VmmError > {
@@ -985,7 +980,7 @@ pub fn setup_serial_device(
985
980
) ,
986
981
input : Some ( input) ,
987
982
} ) ) ) ;
988
- event_manager . add_subscriber ( serial . clone ( ) ) ;
983
+
989
984
Ok ( serial)
990
985
}
991
986
0 commit comments