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 <sebastien.boeuf@intel.com>
This commit is contained in:
Sebastien Boeuf 2021-04-21 09:45:26 +02:00 committed by Rob Bradford
parent 7c457378e5
commit 0b00442022

View File

@ -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