From c62db97a817e48746de3c71a1251431e1ef62bb0 Mon Sep 17 00:00:00 2001 From: Sebastien Boeuf Date: Thu, 27 Feb 2020 09:15:15 +0100 Subject: [PATCH] vmm: acpi: Add _EJ0 to each PCI device slot The _EJ0 method provides the guest OS a way to notify the VMM that the device has been properly ejected from the guest OS. Only after this point, the VMM can fully remove the device. Signed-off-by: Sebastien Boeuf --- vmm/src/device_manager.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/vmm/src/device_manager.rs b/vmm/src/device_manager.rs index a6aa4b4e4..887087502 100644 --- a/vmm/src/device_manager.rs +++ b/vmm/src/device_manager.rs @@ -1582,6 +1582,15 @@ impl Aml for PciDevSlot { vec![ &aml::Name::new("_SUN".into(), &sun), &aml::Name::new("_ADR".into(), &adr), + &aml::Method::new( + "_EJ0".into(), + 1, + true, + vec![&aml::MethodCall::new( + "\\_SB_.PHPR.PCEJ".into(), + vec![&aml::Path::new("_SUN")], + )], + ), ], ) .to_aml_bytes()