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 <mortonm@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Dmitry Torokhov <dtor@chromium.org>
Commit-Queue: Grzegorz Jaszczyk <jaszczyk@google.com>
This commit is contained in:
Tomasz Nowicki 2022-02-04 21:46:49 +00:00 committed by Commit Bot
parent 925e7b54d8
commit f35129885b
2 changed files with 12 additions and 3 deletions

View file

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

View file

@ -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<Box<dyn Aml>> = vec![