From d0218e94a33b8cf5c4daabb45bb57c0d0c6ddc19 Mon Sep 17 00:00:00 2001 From: Sebastien Boeuf Date: Thu, 27 Feb 2020 14:50:52 +0100 Subject: [PATCH] vmm: Trigger hotplug notification to the guest Whenever the user wants to hotplug a new VFIO PCI device, the VMM will have to trigger a hotplug notification through the GED device. Signed-off-by: Sebastien Boeuf --- devices/src/lib.rs | 1 + vmm/src/vm.rs | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/devices/src/lib.rs b/devices/src/lib.rs index 540b8fec0..042e8f064 100644 --- a/devices/src/lib.rs +++ b/devices/src/lib.rs @@ -75,5 +75,6 @@ bitflags! { const NO_DEVICES_CHANGED = 0; const CPU_DEVICES_CHANGED = 0b1; const MEMORY_DEVICES_CHANGED = 0b10; + const PCI_DEVICES_CHANGED = 0b100; } } diff --git a/vmm/src/vm.rs b/vmm/src/vm.rs index 329cc085f..a813c091c 100755 --- a/vmm/src/vm.rs +++ b/vmm/src/vm.rs @@ -547,6 +547,12 @@ impl Vm { .add_device(path) .map_err(Error::DeviceManager)?; + self.devices + .lock() + .unwrap() + .notify_hotplug(HotPlugNotificationFlags::PCI_DEVICES_CHANGED) + .map_err(Error::DeviceManager)?; + Ok(()) }