https://bugzilla.kernel.org/show_bug.cgi?id=222331

            Bug ID: 222331
           Summary: ACPI: EC: Lenovo V15-IIL (82C5): ECDT EC GPE is wrong
                    (0x6E vs DSDT _GPE 0x43) -> GPE 0x43 storm, IRQ 9
                    disabled at every boot, no EC events / lid
           Product: ACPI
           Version: 2.5
    Kernel Version: 7.0.0-44-generic (Ubuntu); also 7.0.0-38, 7.0.0-43
          Hardware: Intel
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P3
         Component: EC
          Assignee: [email protected]
          Reporter: [email protected]
        Regression: No

Created attachment 311587
  --> https://bugzilla.kernel.org/attachment.cgi?id=311587&action=edit
ECDT (original + patched GPE 0x43) and dmesg with/without fix (zip)

------------------------------------------------------------------------
SYSTEM

  Vendor/Product : LENOVO 82C5 "Lenovo V15-IIL" (board LNVNB161216)
  CPU            : Intel Core i5-1035G1 (Ice Lake)
  BIOS           : DKCN51WW, 12/23/2020 (BIOS/EC release 1.51)
  Kernel         : 7.0.0-44-generic (Ubuntu); same behaviour on 7.0.0-38 and
7.0.0-43
  ECDT           : LENOVO CB-01, OEM revision 0x00000001

------------------------------------------------------------------------
SYMPTOMS

- No ACPI events at all from the EC: Fn hotkeys that go through the EC
  (brightness via Video Bus, mic mute / rfkill / camera via ideapad_laptop)
  produce nothing in evtest. Keys handled by the keyboard controller
  (volume, Super+L, Super+P) work.
- The lid switch never generates events (logind never logs "Lid closed").
- The hotkeys appear (with up to 1 s delay) only while something keeps
  doing EC transactions, e.g. reading /sys/kernel/debug/ideapad/status or
  /sys/bus/platform/devices/VPC2004:00/fan_mode every second. This matches
  bug 221419 (IdeaPad 3 15IIL05, same Ice Lake platform), which I believe
  has the same root cause (see below).

------------------------------------------------------------------------
ROOT CAUSE

1) At every boot (20 of 20 boots with kernel logs in the journal, kernels
   7.0.0-38/43/44), 10-23 s after boot:

     irq 9: nobody cared (try booting with the "irqpoll" option)
     handlers:
     [<...>] irq_default_primary_handler threaded [<...>] acpi_irq
     Disabling IRQ #9

   With the SCI disabled, no GPE is ever handled. /proc/interrupts shows
   IRQ 9 frozen at 200001 (or 100001), and the spurious-IRQ poller makes
   /sys/firmware/acpi/interrupts/sci_not grow by ~10/s (~1,000,000 after
   23 h of uptime).

2) The flooding GPE is 0x43. Before the fix:

     gpe43:  0  EN STS invalid   unmasked
     gpe6E:  0  EN     enabled   unmasked   <- EC GPE used by Linux, never
fires

   GPE 0x43 is enabled in hardware with its status latched, but has no
   _L43/_E43 and is not enabled by the OS, so ACPICA never handles or clears
   it, the SCI stays asserted and the kernel disables IRQ 9.

3) GPE 0x43 IS the EC GPE according to the DSDT, but the ECDT says 0x6E:

   - ECDT: GPE_BIT = 0x6E, EC_ID = "\_SB.PCI0.LPCB.H_EC" (this path does not
     even exist; the EC device is \_SB.PCI0.LPCB.EC0).
   - DSDT, \_SB.PCI0.LPCB.EC0 (PNP0C09):

       Method (_GPE, 0, NotSerialized)
       {
           Local0 = GGPE (0x06040003)
           Return (Local0)
       }

     GGPE(0x06040003) is pad GPP_E3 / CPU_GP_0 (pin 186 of INT3455:00),
     which is mapped to GPE0_DW2 bit 3 = GPE 0x43. It is the only pad with
     GPIROUTSCI set: PADCFG DW0 = 0x80880102 (GPIROUTSCI, RXINV, level,
     LOCKED, owned by ACPI).

   ec.c keeps the ECDT GPE when the DSDT EC has the same ports as the boot
   EC ("trust ECDT GPE rather than _GPE"), unless EC_FLAGS_TRUST_DSDT_GPE is
   set. So Linux listens on 0x6E, which is never raised, while the real EC
   SCI (0x43) floods IRQ 9. Windows presumably uses _GPE.

------------------------------------------------------------------------
WHAT DID NOT WORK

- acpi_mask_gpe=0x43: the kernel logs "ACPI: Masking GPE 0x43." and
  sysfs shows "masked", but the hardware EN bit stays set ("EN STS"), the
  storm continues and IRQ 9 is still disabled. (Masking is also the wrong
  direction: this is the GPE the EC driver needs.)

------------------------------------------------------------------------
VERIFIED WORKAROUND

ECDT upgrade via an early initrd: same table with GPE_BIT 0x6E -> 0x43,
OEM revision 1 -> 2, checksum fixed. Result:

     ACPI: Table Upgrade: override [ECDT-LENOVO-CB-01   ]
     ACPI: EC: GPE=0x43
     ACPI: \_SB_.PCI0.LPCB.EC0_: Boot ECDT EC initialization complete
     (no "nobody cared", no "Disabling IRQ #9")

     gpe43:  309  EN  enabled  unmasked
     sci_not: 0, IRQ 9 keeps counting, 0 GPEs while idle

- Brightness keys work instantly, without any polling.
- Mic mute (ideapad VPC, EC query 0x44) works.
- Lid events are delivered ("Lid closed." / "Lid opened." from logind)
  for the first time.

------------------------------------------------------------------------
SUGGESTED FIX

Add a DMI quirk using the existing ec_honor_dsdt_gpe / EC_FLAGS_TRUST_DSDT_GPE
(introduced for the HP Pavilion Gaming Laptop 15-cx0xxx, bug 209989), e.g.:

     {
         /* Lenovo V15-IIL: ECDT GPE 0x6E is wrong, DSDT _GPE (0x43) is right
*/
         .callback = ec_honor_dsdt_gpe,
         .matches = {
             DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
             DMI_MATCH(DMI_PRODUCT_VERSION, "Lenovo V15-IIL"),
         },
     },

The same BIOS family (DKCN) covers S145-14IIL, S145-15IIL, V14-IIL and
V15-IIL, and the IdeaPad 3 15IIL05 in bug 221419 has the same symptoms.
They may need the same quirk; a check would be whether those machines also
log "Disabling IRQ #9" and whether their ECDT GPE differs from EC0._GPE.

Attachment (zip): ecdt-original.aml, ecdt-corregida.aml (patched ECDT),
dmesg-sin-arreglo.txt (boot without fix), dmesg-con-ecdt-corregida.txt
(boot with patched ECDT). Hostname, home paths, MAC addresses and serials
were redacted.

I can test patches on this machine.

-- 
You are receiving this mail because:
You are watching the assignee of the bug.

_______________________________________________
acpi-bugzilla mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/acpi-bugzilla

Reply via email to