From f35129885bb110ea175e186fa0f3d3d0408df0c1 Mon Sep 17 00:00:00 2001 From: Tomasz Nowicki Date: Fri, 4 Feb 2022 21:46:49 +0000 Subject: [PATCH] device: acpi: Fix SCI IRQ setup to be level-triggered IRQ KVM irqchip treats differently edge vs level triggered IRQ. By registering SCI without resample event, we might see unexpected misbehavior. Since SCI is level-triggered IRQ pass corresponding resample event even though we don't utilize it right now. Also store the new event as part of ACPIPMResource for future usage. BUG=b:205072342 TEST=inject GPE and inspect /sys/firmware/acpi/interrupts/ Change-Id: Ib27f98bbef56ea4ca18da5bf4428bf45bf115882 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3439888 Reviewed-by: Micah Morton Tested-by: kokoro Reviewed-by: Dmitry Torokhov Commit-Queue: Grzegorz Jaszczyk --- devices/src/acpi.rs | 9 ++++++++- x86_64/src/lib.rs | 6 ++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/devices/src/acpi.rs b/devices/src/acpi.rs index e6e1c652fe..c50e82fdb7 100644 --- a/devices/src/acpi.rs +++ b/devices/src/acpi.rs @@ -11,6 +11,7 @@ use vm_control::PmResource; #[allow(dead_code)] pub struct ACPIPMResource { sci_evt: Event, + sci_evt_resample: Event, suspend_evt: Event, exit_evt: Event, pm1_status: u16, @@ -23,9 +24,15 @@ pub struct ACPIPMResource { impl ACPIPMResource { /// Constructs ACPI Power Management Resouce. #[allow(dead_code)] - pub fn new(sci_evt: Event, suspend_evt: Event, exit_evt: Event) -> ACPIPMResource { + pub fn new( + sci_evt: Event, + sci_evt_resample: Event, + suspend_evt: Event, + exit_evt: Event, + ) -> ACPIPMResource { ACPIPMResource { sci_evt, + sci_evt_resample, suspend_evt, exit_evt, pm1_status: 0, diff --git a/x86_64/src/lib.rs b/x86_64/src/lib.rs index 7a08eaa408..a8239eb5d1 100644 --- a/x86_64/src/lib.rs +++ b/x86_64/src/lib.rs @@ -1295,10 +1295,12 @@ impl X8664arch { pcie_vcfg.to_aml_bytes(&mut amls); let pm_sci_evt = Event::new().map_err(Error::CreateEvent)?; + let pm_sci_evt_resample = Event::new().map_err(Error::CreateEvent)?; irq_chip - .register_irq_event(sci_irq, &pm_sci_evt, None) + .register_irq_event(sci_irq, &pm_sci_evt, Some(&pm_sci_evt_resample)) .map_err(Error::RegisterIrqfd)?; - let pmresource = devices::ACPIPMResource::new(pm_sci_evt, suspend_evt, exit_evt); + let pmresource = + devices::ACPIPMResource::new(pm_sci_evt, pm_sci_evt_resample, suspend_evt, exit_evt); pmresource.to_aml_bytes(&mut amls); let mut crs_entries: Vec> = vec![