From 0b004420229f247ed2f6840fddd79c5d4c900d66 Mon Sep 17 00:00:00 2001 From: Sebastien Boeuf Date: Wed, 21 Apr 2021 09:45:26 +0200 Subject: [PATCH] vmm: acpi: Allow reading from B0EJ field Windows guests read this field upon PCI device ejection. Let's make sure we don't return an error as this is valid. We simply return an empty u32 since the ejection is done right away upon write access, which means there's no pending ejection that might be reported to the guest. Here is the error that was shown during PCI device removal: ERROR:vmm/src/device_manager.rs:3960 -- Accessing unknown location at base 0x7ffffee000, offset 0x8 Signed-off-by: Sebastien Boeuf --- vmm/src/device_manager.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/vmm/src/device_manager.rs b/vmm/src/device_manager.rs index 59b35cf0d..48f66c3f6 100644 --- a/vmm/src/device_manager.rs +++ b/vmm/src/device_manager.rs @@ -3943,6 +3943,12 @@ impl BusDevice for DeviceManager { // Clear the PCID bitmap self.pci_devices_down = 0; } + B0EJ_FIELD_OFFSET => { + assert!(data.len() == B0EJ_FIELD_SIZE); + // Always return an empty bitmap since the eject is always + // taken care of right away during a write access. + data.copy_from_slice(&[0, 0, 0, 0]); + } _ => error!( "Accessing unknown location at base 0x{:x}, offset 0x{:x}", base, offset