* [BUG] AMD Strix Point USB4 (1022:150a): mid-s2idle pciehp hot-add causes D3cold->D0 failure and hard hang
@ 2026-11-25 21:40 Marco Sousa
2026-11-26 6:48 ` Mika Westerberg
0 siblings, 1 reply; 5+ messages in thread
From: Marco Sousa @ 2026-11-25 21:40 UTC (permalink / raw)
To: linux-usb, linux-pci, linux-pm
Cc: westeri, bhelgaas, lukas, rafael, superm1, Shyam-sundar.S-k
Hi all,
I filed a bug report with full sanitized dmesg logs, lspci topology,
controlled A/B test results, and a thunderbolt.dyndbg=+p boot log here:
https://bugzilla.kernel.org/show_bug.cgi?id=222327
Short summary:
On an ASUS Zenbook S 16 UM5606WA (AMD Ryzen AI 9 HX 370 / Strix Point,
BIOS UM5606WA.321, s2idle-only) docked to an HP Thunderbolt Dock G4
(Intel Goshen Ridge 8086:0b26 + igc 8086:5502), reproduced on vanilla
6.18.65-lts and 7.2.4..7.3.6-arch1-1:
1. At boot, tb_acpi_add_link() creates the device link from 0000:00:01.1
[1022:150a] (consumer) to 0000:c6:00.5 [1022:151c] (supplier):
[ 5.005536] thunderbolt 0000:c6:00.5: created link from 0000:00:01.1
2. Host router reset tears down the firmware PCIe tunnel:
[ 5.008763] thunderbolt 0000:c6:00.5: 0: resetting
[ 5.008813] pcieport 0000:00:01.1: pciehp: Slot(0): Link Down
[ 5.008895] pcieport 0000:00:01.1: pciehp: Slot(0): Card not present
0000:00:01.1 then runtime-suspends into D3cold (power resource
\_SB_.PCI0.GPP0.PWRS).
3. After dock authorization, tb_tunnel_pci() activates the PCIe tunnel
cleanly:
[ 9.429077] thunderbolt 0000:c6:00.5: 0:5 <-> 2:9 (PCI): activating
[ 9.430721] thunderbolt 0000:c6:00.5: PCIe Down path activation complete
[ 9.432080] thunderbolt 0000:c6:00.5: PCIe Up path activation complete
Yet 0000:00:01.1 remains asleep in D3cold and never wakes to enumerate
0000:01:00.0 / 0000:60:00.0 (igc).
4. On the first s2idle entry, pci_pm_suspend() runtime-resumes
0000:00:01.1 mid-suspend, invoking pciehp_runtime_resume() ->
pciehp_check_presence() concurrently with device_suspend:
pci 0000:01:00.0: PM: parent 0000:00:01.1 should not be sleeping
pcieport 0000:02:0x.0: Unable to change power state from D3cold
to D0, device inaccessible
pcieport 0000:02:0x.0: pciehp: Slot #8191 ... /
pcie_do_write_cmd: no response from device
igc 0000:60:00.0: PCIe link lost, device now detached
Entering s2idle in this unenumerated/wedged state causes a complete
hard hang requiring a ~30 s power-button EC reset.
5. Controlled A/B proof on 7.3.6: waking 0000:00:01.1 from D3cold once
before suspend (power/control=on + lspci, then restoring auto) makes
pciehp immediately see Slot(0): Card present / Link Up, enumerates
0000:01:00.0 + igc, and makes s2idle 100% reliable with full hardware
S0i3 residency (11-27 s, Last S0i3 Status: Success).
Also attached on Bug 222327 is a secondary drivers/thunderbolt/nhi.c:143
(ring_interrupt_active) WARNING + Call Trace seen on dock hot-unplug.
I have the hardware on my desk and am happy to write and test a patch.
Could you advise where the proper fix belongs?
- Should tb_tunnel_pci() runtime-resume the linked host PCIe root port
when activating a PCIe tunnel?
- Should pciehp_runtime_resume() avoid hot-adding devices while system
suspend is in progress?
- Or is 1022:150a expected to receive a hardware/ACPI wake from D3cold
on tunnel activation?
Happy to collect any extra dumps (sudo lspci -vvnn, acpidump, amd-s2idle)
or test debug patches.
Thanks,
Marco
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [BUG] AMD Strix Point USB4 (1022:150a): mid-s2idle pciehp hot-add causes D3cold->D0 failure and hard hang 2026-11-25 21:40 [BUG] AMD Strix Point USB4 (1022:150a): mid-s2idle pciehp hot-add causes D3cold->D0 failure and hard hang Marco Sousa @ 2026-11-26 6:48 ` Mika Westerberg 2026-11-28 7:55 ` Marco Sousa 0 siblings, 1 reply; 5+ messages in thread From: Mika Westerberg @ 2026-11-26 6:48 UTC (permalink / raw) To: Marco Sousa Cc: linux-usb, linux-pci, linux-pm, westeri, bhelgaas, lukas, rafael, superm1, Shyam-sundar.S-k Hi, On Wed, Nov 25, 2026 at 10:40:56PM +0100, Marco Sousa wrote: > Hi all, > I filed a bug report with full sanitized dmesg logs, lspci topology, > controlled A/B test results, and a thunderbolt.dyndbg=+p boot log here: > > https://bugzilla.kernel.org/show_bug.cgi?id=222327 > > Short summary: > On an ASUS Zenbook S 16 UM5606WA (AMD Ryzen AI 9 HX 370 / Strix Point, > BIOS UM5606WA.321, s2idle-only) docked to an HP Thunderbolt Dock G4 > (Intel Goshen Ridge 8086:0b26 + igc 8086:5502), reproduced on vanilla > 6.18.65-lts and 7.2.4..7.3.6-arch1-1: > > 1. At boot, tb_acpi_add_link() creates the device link from 0000:00:01.1 > [1022:150a] (consumer) to 0000:c6:00.5 [1022:151c] (supplier): > [ 5.005536] thunderbolt 0000:c6:00.5: created link from 0000:00:01.1 > 2. Host router reset tears down the firmware PCIe tunnel: > [ 5.008763] thunderbolt 0000:c6:00.5: 0: resetting > [ 5.008813] pcieport 0000:00:01.1: pciehp: Slot(0): Link Down > [ 5.008895] pcieport 0000:00:01.1: pciehp: Slot(0): Card not present > 0000:00:01.1 then runtime-suspends into D3cold (power resource > \_SB_.PCI0.GPP0.PWRS). > 3. After dock authorization, tb_tunnel_pci() activates the PCIe tunnel > cleanly: > [ 9.429077] thunderbolt 0000:c6:00.5: 0:5 <-> 2:9 (PCI): activating > [ 9.430721] thunderbolt 0000:c6:00.5: PCIe Down path activation complete > [ 9.432080] thunderbolt 0000:c6:00.5: PCIe Up path activation complete > Yet 0000:00:01.1 remains asleep in D3cold and never wakes to enumerate > 0000:01:00.0 / 0000:60:00.0 (igc). > 4. On the first s2idle entry, pci_pm_suspend() runtime-resumes > 0000:00:01.1 mid-suspend, invoking pciehp_runtime_resume() -> > pciehp_check_presence() concurrently with device_suspend: > pci 0000:01:00.0: PM: parent 0000:00:01.1 should not be sleeping > pcieport 0000:02:0x.0: Unable to change power state from D3cold > to D0, device inaccessible > pcieport 0000:02:0x.0: pciehp: Slot #8191 ... / > pcie_do_write_cmd: no response from device > igc 0000:60:00.0: PCIe link lost, device now detached > Entering s2idle in this unenumerated/wedged state causes a complete > hard hang requiring a ~30 s power-button EC reset. > 5. Controlled A/B proof on 7.3.6: waking 0000:00:01.1 from D3cold once > before suspend (power/control=on + lspci, then restoring auto) makes > pciehp immediately see Slot(0): Card present / Link Up, enumerates > 0000:01:00.0 + igc, and makes s2idle 100% reliable with full hardware > S0i3 residency (11-27 s, Last S0i3 Status: Success). > > Also attached on Bug 222327 is a secondary drivers/thunderbolt/nhi.c:143 > (ring_interrupt_active) WARNING + Call Trace seen on dock hot-unplug. > > I have the hardware on my desk and am happy to write and test a patch. > Could you advise where the proper fix belongs? I would start checking if you are running the latest BIOS for this machine? This pretty much sounds like that something is mising on the BIOS side. The AMD guys that are in Cc: hopefully can help to check if the "power contract" _DSD is in place. It looks like it from the above but better to check. ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [BUG] AMD Strix Point USB4 (1022:150a): mid-s2idle pciehp hot-add causes D3cold->D0 failure and hard hang 2026-11-26 6:48 ` Mika Westerberg @ 2026-11-28 7:55 ` Marco Sousa 2026-11-30 6:33 ` Mika Westerberg 0 siblings, 1 reply; 5+ messages in thread From: Marco Sousa @ 2026-11-28 7:55 UTC (permalink / raw) To: Mika Westerberg Cc: linux-usb, linux-pci, linux-pm, westeri, bhelgaas, lukas, rafael, superm1, Shyam-sundar.S-k Hi Mika, Thanks for the quick reply! 1. BIOS version: Confirmed, UM5606WA.321 (built 2025-10-14, published 2025-11-20 on ASUS Support) is the latest official BIOS for the ASUS Zenbook S 16 UM5606WA. 2. ACPI dump & _DSD check: I captured an acpidump (MSDM stripped) and extracted the relevant INTGPPC_ SSDT ASL blocks and attached both to Bug 222327: https://bugzilla.kernel.org/show_bug.cgi?id=222327 Quick summary of what is in SSDT "INTGPPC_" for GPP0 (0000:00:01.1) and NHI0 (0000:c6:00.5): - \_SB.PCI0.GPP0 (and GPP1) has all four _DSD UUIDs: * fdf06fad-f744-4451-bb64-ecd792215b10: FundamentalDeviceResetTriggeredOnD3ToD0 = 1 * 6211e2c0-58a3-4af3-90e1-927a4e0c55a4: HotPlugSupportInD3 = 1 * efcc06cc-73ac-4bc3-bff0-76143807c389: ExternalFacingPort = 1, UID = 0 * daffd814-6eba-4d8c-8a91-bc9bbf4aa301: usb4-host-interface = \_SB.PCI0.GPPC.NHI0, usb4-port-number = 1 * _S0W returns \P4D3 (0x04 / D3cold), _PRW returns {0x1A, 0x04}, _PR0/_PR3 = PWRS (dummy PW3S flag). - \_SB.PCI0.GPPC.XHC3.RHUB.PRT2 (and XHC4) also has usb4-host-interface pointing to NHI0 (and NHI1). - \_SB.PCI0.GPPC.NHI0 (and NHI1) has NO _DSD block at all; _S0W returns \G5D3 (0x04), _PRW returns {0x1A, 0x00} (comment says {0x1A, 0x04}), and _PS3 calls CpmSendPmeTurnOff(0, 1, 1) + \_SB.ALIB(0x14, 1). - \_GPE._L1A exists and emits Notify(..., 0x02) on GPPC, NHI0/1, XHC0/3/4, GPP0/1, and SWUS. However, in Linux /sys/firmware/acpi/interrupts/gpe1A shows: 0 EN enabled unmasked — GPE 0x1A never fires when tb_tunnel_pci() activates 0:5 <-> 2:9 while 0000:00:01.1 is in D3cold. Mario / Shyam — could you check the attached acpidump / INTGPPC_ excerpt on Bug 222327 to see if the USB4 power-contract / GPE 0x1A wake wiring is complete, or if something is missing in ASUS BIOS 321? Thanks, ------------------------------------- Marco Sousa El jue, 26 nov 2026 a las 7:48, Mika Westerberg (<mika.westerberg@linux.intel.com>) escribió: > > Hi, > > On Wed, Nov 25, 2026 at 10:40:56PM +0100, Marco Sousa wrote: > > Hi all, > > I filed a bug report with full sanitized dmesg logs, lspci topology, > > controlled A/B test results, and a thunderbolt.dyndbg=+p boot log here: > > > > https://bugzilla.kernel.org/show_bug.cgi?id=222327 > > > > Short summary: > > On an ASUS Zenbook S 16 UM5606WA (AMD Ryzen AI 9 HX 370 / Strix Point, > > BIOS UM5606WA.321, s2idle-only) docked to an HP Thunderbolt Dock G4 > > (Intel Goshen Ridge 8086:0b26 + igc 8086:5502), reproduced on vanilla > > 6.18.65-lts and 7.2.4..7.3.6-arch1-1: > > > > 1. At boot, tb_acpi_add_link() creates the device link from 0000:00:01.1 > > [1022:150a] (consumer) to 0000:c6:00.5 [1022:151c] (supplier): > > [ 5.005536] thunderbolt 0000:c6:00.5: created link from 0000:00:01.1 > > 2. Host router reset tears down the firmware PCIe tunnel: > > [ 5.008763] thunderbolt 0000:c6:00.5: 0: resetting > > [ 5.008813] pcieport 0000:00:01.1: pciehp: Slot(0): Link Down > > [ 5.008895] pcieport 0000:00:01.1: pciehp: Slot(0): Card not present > > 0000:00:01.1 then runtime-suspends into D3cold (power resource > > \_SB_.PCI0.GPP0.PWRS). > > 3. After dock authorization, tb_tunnel_pci() activates the PCIe tunnel > > cleanly: > > [ 9.429077] thunderbolt 0000:c6:00.5: 0:5 <-> 2:9 (PCI): activating > > [ 9.430721] thunderbolt 0000:c6:00.5: PCIe Down path activation complete > > [ 9.432080] thunderbolt 0000:c6:00.5: PCIe Up path activation complete > > Yet 0000:00:01.1 remains asleep in D3cold and never wakes to enumerate > > 0000:01:00.0 / 0000:60:00.0 (igc). > > 4. On the first s2idle entry, pci_pm_suspend() runtime-resumes > > 0000:00:01.1 mid-suspend, invoking pciehp_runtime_resume() -> > > pciehp_check_presence() concurrently with device_suspend: > > pci 0000:01:00.0: PM: parent 0000:00:01.1 should not be sleeping > > pcieport 0000:02:0x.0: Unable to change power state from D3cold > > to D0, device inaccessible > > pcieport 0000:02:0x.0: pciehp: Slot #8191 ... / > > pcie_do_write_cmd: no response from device > > igc 0000:60:00.0: PCIe link lost, device now detached > > Entering s2idle in this unenumerated/wedged state causes a complete > > hard hang requiring a ~30 s power-button EC reset. > > 5. Controlled A/B proof on 7.3.6: waking 0000:00:01.1 from D3cold once > > before suspend (power/control=on + lspci, then restoring auto) makes > > pciehp immediately see Slot(0): Card present / Link Up, enumerates > > 0000:01:00.0 + igc, and makes s2idle 100% reliable with full hardware > > S0i3 residency (11-27 s, Last S0i3 Status: Success). > > > > Also attached on Bug 222327 is a secondary drivers/thunderbolt/nhi.c:143 > > (ring_interrupt_active) WARNING + Call Trace seen on dock hot-unplug. > > > > I have the hardware on my desk and am happy to write and test a patch. > > Could you advise where the proper fix belongs? > > I would start checking if you are running the latest BIOS for this machine? > This pretty much sounds like that something is mising on the BIOS side. The > AMD guys that are in Cc: hopefully can help to check if the "power > contract" _DSD is in place. It looks like it from the above but better to > check. ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [BUG] AMD Strix Point USB4 (1022:150a): mid-s2idle pciehp hot-add causes D3cold->D0 failure and hard hang 2026-11-28 7:55 ` Marco Sousa @ 2026-11-30 6:33 ` Mika Westerberg 2026-11-30 23:23 ` Mario Limonciello 0 siblings, 1 reply; 5+ messages in thread From: Mika Westerberg @ 2026-11-30 6:33 UTC (permalink / raw) To: Marco Sousa Cc: linux-usb, linux-pci, linux-pm, westeri, bhelgaas, lukas, rafael, superm1, Shyam-sundar.S-k Hi, On Sat, Nov 28, 2026 at 08:55:43AM +0100, Marco Sousa wrote: > Hi Mika, > > Thanks for the quick reply! > > 1. BIOS version: > Confirmed, UM5606WA.321 (built 2025-10-14, published 2025-11-20 on > ASUS Support) is the latest official BIOS for the ASUS Zenbook S 16 > UM5606WA. > > 2. ACPI dump & _DSD check: > I captured an acpidump (MSDM stripped) and extracted the relevant > INTGPPC_ SSDT ASL blocks and attached both to Bug 222327: > https://bugzilla.kernel.org/show_bug.cgi?id=222327 > > Quick summary of what is in SSDT "INTGPPC_" for GPP0 (0000:00:01.1) > and NHI0 (0000:c6:00.5): > - \_SB.PCI0.GPP0 (and GPP1) has all four _DSD UUIDs: > * fdf06fad-f744-4451-bb64-ecd792215b10: > FundamentalDeviceResetTriggeredOnD3ToD0 = 1 > * 6211e2c0-58a3-4af3-90e1-927a4e0c55a4: HotPlugSupportInD3 = 1 > * efcc06cc-73ac-4bc3-bff0-76143807c389: ExternalFacingPort = 1, UID = 0 > * daffd814-6eba-4d8c-8a91-bc9bbf4aa301: usb4-host-interface = > \_SB.PCI0.GPPC.NHI0, usb4-port-number = 1 This looks correct to me. > * _S0W returns \P4D3 (0x04 / D3cold), _PRW returns {0x1A, 0x04}, > _PR0/_PR3 = PWRS (dummy PW3S flag). > - \_SB.PCI0.GPPC.XHC3.RHUB.PRT2 (and XHC4) also has usb4-host-interface > pointing to NHI0 (and NHI1). > - \_SB.PCI0.GPPC.NHI0 (and NHI1) has NO _DSD block at all; _S0W returns > \G5D3 (0x04), _PRW returns {0x1A, 0x00} (comment says {0x1A, 0x04}), > and _PS3 calls CpmSendPmeTurnOff(0, 1, 1) + \_SB.ALIB(0x14, 1). > - \_GPE._L1A exists and emits Notify(..., 0x02) on GPPC, NHI0/1, > XHC0/3/4, GPP0/1, and SWUS. However, in Linux > /sys/firmware/acpi/interrupts/gpe1A shows: > 0 EN enabled unmasked > — GPE 0x1A never fires when tb_tunnel_pci() activates 0:5 <-> 2:9 > while 0000:00:01.1 is in D3cold. I do remember that some AMD systems had similar issue? That the hotplug/PME GPE did not trigger. Not sure if that was fixed on the BIOS side. Anyways let's wait for the AMD folks to chime in. ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [BUG] AMD Strix Point USB4 (1022:150a): mid-s2idle pciehp hot-add causes D3cold->D0 failure and hard hang 2026-11-30 6:33 ` Mika Westerberg @ 2026-11-30 23:23 ` Mario Limonciello 0 siblings, 0 replies; 5+ messages in thread From: Mario Limonciello @ 2026-11-30 23:23 UTC (permalink / raw) To: Mika Westerberg, Marco Sousa Cc: linux-usb, linux-pci, linux-pm, westeri, bhelgaas, lukas, rafael, Shyam-sundar.S-k [-- Attachment #1: Type: text/plain, Size: 2850 bytes --] On 11/30/26 00:33, Mika Westerberg wrote: > Hi, > > On Sat, Nov 28, 2026 at 08:55:43AM +0100, Marco Sousa wrote: >> Hi Mika, >> >> Thanks for the quick reply! >> >> 1. BIOS version: >> Confirmed, UM5606WA.321 (built 2025-10-14, published 2025-11-20 on >> ASUS Support) is the latest official BIOS for the ASUS Zenbook S 16 >> UM5606WA. >> >> 2. ACPI dump & _DSD check: >> I captured an acpidump (MSDM stripped) and extracted the relevant >> INTGPPC_ SSDT ASL blocks and attached both to Bug 222327: >> https://bugzilla.kernel.org/show_bug.cgi?id=222327 >> >> Quick summary of what is in SSDT "INTGPPC_" for GPP0 (0000:00:01.1) >> and NHI0 (0000:c6:00.5): >> - \_SB.PCI0.GPP0 (and GPP1) has all four _DSD UUIDs: >> * fdf06fad-f744-4451-bb64-ecd792215b10: >> FundamentalDeviceResetTriggeredOnD3ToD0 = 1 >> * 6211e2c0-58a3-4af3-90e1-927a4e0c55a4: HotPlugSupportInD3 = 1 >> * efcc06cc-73ac-4bc3-bff0-76143807c389: ExternalFacingPort = 1, UID = 0 >> * daffd814-6eba-4d8c-8a91-bc9bbf4aa301: usb4-host-interface = >> \_SB.PCI0.GPPC.NHI0, usb4-port-number = 1 > > This looks correct to me. > >> * _S0W returns \P4D3 (0x04 / D3cold), _PRW returns {0x1A, 0x04}, >> _PR0/_PR3 = PWRS (dummy PW3S flag). >> - \_SB.PCI0.GPPC.XHC3.RHUB.PRT2 (and XHC4) also has usb4-host-interface >> pointing to NHI0 (and NHI1). >> - \_SB.PCI0.GPPC.NHI0 (and NHI1) has NO _DSD block at all; _S0W returns >> \G5D3 (0x04), _PRW returns {0x1A, 0x00} (comment says {0x1A, 0x04}), >> and _PS3 calls CpmSendPmeTurnOff(0, 1, 1) + \_SB.ALIB(0x14, 1). >> - \_GPE._L1A exists and emits Notify(..., 0x02) on GPPC, NHI0/1, >> XHC0/3/4, GPP0/1, and SWUS. However, in Linux >> /sys/firmware/acpi/interrupts/gpe1A shows: >> 0 EN enabled unmasked >> — GPE 0x1A never fires when tb_tunnel_pci() activates 0:5 <-> 2:9 >> while 0000:00:01.1 is in D3cold. > > I do remember that some AMD systems had similar issue? That the hotplug/PME > GPE did not trigger. Not sure if that was fixed on the BIOS side. Anyways > let's wait for the AMD folks to chime in. So in talking to Shyam offline and looking at some tickets the wake sequence should be coming through PCIEXP_WAKE_STS which AFAICT we are not using. - ACPICA's fixed-event table has five entries and bit 14 is not one of them, so acpi_ev_fixed_event_detect() ignores it. An SCI raised from it is reported unhandled. - The bit is only cleared in acpi_hw_clear_acpi_status() on S3 transitions. Nothing touches it in S0 or s2idle. - acpi_s2idle_wake() validates wakeups with acpi_any_fixed_event_status_set(), which also ignores it, so a PCIe wake delivered this way during s2idle is treated as spurious. Can you please try this attached patch with dyndbg="file drivers/pci/pci-acpi.c +p" in place? [-- Attachment #2: 0001-PCI-ACPI-Handle-PCIe-wake-events-signaled-through-PM.patch --] [-- Type: text/x-patch, Size: 11759 bytes --] From 2e08cd9a3a3bd9165f72bdfceb65cbeecfeed143 Mon Sep 17 00:00:00 2001 From: Mario Limonciello <mario.limonciello@amd.com> Date: Mon, 30 Nov 2026 17:19:03 -0600 Subject: [PATCH] PCI/ACPI: Handle PCIe wake events signaled through PM1 PCIEXP_WAKE_STS ACPI 6.5, Section 4.8.4.1.1 defines PCIEXP_WAKE_STS in the PM1 Status register. Hardware sets it when the PCIe WAKE# pin is asserted, a Root Port is in the beacon state or a Root Port receives a PME Message. The spec describes it as a non-S0 to S0 wake status bit, but some platforms also raise the SCI from it while in S0 and use it as the only indication that a Root Port in D3 signaled PME. On AMD Strix Point the FCH routes PME Messages coming from the PCIe controller to PM1_STS[PCIEXP_WAKE_STS] and raises the SCI when PM1_EN[PCIEXP_WAKE_DIS] is clear. No GPE is associated with that event. This matters for the Root Ports whose downstream link is a USB4 PCIe tunnel: they runtime suspend into D3cold (via a power resource) as soon as the tunnel is torn down and are expected to signal PME when the tunnel comes back up and the hot-plug controller sees presence detect change. Linux never looks at PCIEXP_WAKE_STS outside of acpi_hw_clear_acpi_status() during S3 transitions. ACPICA does not treat it as a fixed event, so acpi_ev_fixed_event_detect() ignores it, the SCI is reported as unhandled and the Root Port stays in D3cold forever. Likewise acpi_s2idle_wake() relies on acpi_any_fixed_event_status_set(), which also ignores it, so a PCIe wake signaled this way during suspend-to-idle is treated as spurious. The visible symptom on an ASUS Zenbook S 16 UM5606WA docked to a Thunderbolt dock is that the tunneled Root Port 0000:00:01.1 never enumerates the dock after the tunnel is activated. Later, the first s2idle entry runtime resumes the port in the middle of device suspend, pciehp hot-adds the dock concurrently with the suspend sequence, the devices below it end up inaccessible and the system hard hangs. Waking the Root Port once by hand before suspending avoids all of that. Add handling for PCIEXP_WAKE_STS to the PCI/ACPI glue: - Install an ACPICA SCI handler. When the status bit is set, mask the event through PCIEXP_WAKE_DIS (unless firmware already had it set), clear the status and schedule a work item. Masking is needed because the inputs to the status bit are level-sensitive, so clearing the status alone would not deassert the SCI while the source is pending. - In the work item, look for the source of the event. Root Ports in D3hot or shallower (and the devices below them) are checked for PME Status and resumed if it is set. Root Ports in D0 are skipped as the native PME service handles PMEs received by those. A Root Port in D3cold cannot be queried, so resume the hot-plug capable ones that were armed for wakeup, which is what a hot-plug event on a tunneled port looks like. If no evidence is found at all, resume every Root Port in D3cold armed for wakeup once and back off exponentially (up to 30 s) before unmasking again so that an unclaimed level cannot keep the system busy or keep waking ports. - Register a wakeup handler on the SCI so that acpi_s2idle_wake() treats a set PCIEXP_WAKE_STS as a genuine wakeup reason. - Flush the work from a PM notifier so that the system never enters suspend with the event masked. The handler is only installed on legacy (non reduced hardware) systems whose FADT advertises PCIEXP_WAKE support. Reported-by: Marco Sousa <marcomsousa@gmail.com> Closes: https://bugzilla.kernel.org/show_bug.cgi?id=222327 Link: https://lore.kernel.org/linux-usb/CAHRsBfbYF3wocif+a0FRyBBkhcL+FtKF2qm=ne0jgLCzL8cH9w@mail.gmail.com/ --- drivers/pci/pci-acpi.c | 236 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 236 insertions(+) diff --git a/drivers/pci/pci-acpi.c b/drivers/pci/pci-acpi.c index 1150f2fbabf41..17062eefa993f 100644 --- a/drivers/pci/pci-acpi.c +++ b/drivers/pci/pci-acpi.c @@ -20,6 +20,7 @@ #include <linux/pm_runtime.h> #include <linux/pm_qos.h> #include <linux/rwsem.h> +#include <linux/suspend.h> #include "pci.h" /* @@ -888,6 +889,241 @@ acpi_status pci_acpi_add_pm_notifier(struct acpi_device *dev, return acpi_add_pm_notifier(dev, &pci_dev->dev, pci_acpi_wake_dev); } +/* + * PM1 PCIEXP_WAKE_STS handling. + * + * ACPI 6.5, Section 4.8.4.1.1: PCIEXP_WAKE_STS is set by hardware when the + * PCIe WAKE# pin is asserted, a Root Port is in the beacon state or a Root + * Port receives a PME Message. The spec describes it as a non-S0 to S0 wake + * status bit, but some platforms (AMD FCH for instance) also raise the SCI + * from it in S0 and use it as the only indication that a Root Port in D3 + * signaled PME, e.g. due to a hot-plug event on a port whose downstream + * link is a USB4 PCIe tunnel. No GPE is associated with it in that case. + * + * ACPICA does not treat PCIEXP_WAKE_STS as a fixed event, so nothing ever + * consumes it: the SCI is reported as unhandled and the Root Port never + * resumes. Handle it here by looking for Root Ports with PME pending and + * resuming them. + */ +static atomic_t pci_acpi_pciexp_wake_masked; +static unsigned int pci_acpi_pciexp_wake_misses; +static struct work_struct pci_acpi_pciexp_wake_work; +static struct delayed_work pci_acpi_pciexp_wake_unmask_work; + +static void pci_acpi_pciexp_wake_unmask_fn(struct work_struct *work) +{ + if (!atomic_xchg(&pci_acpi_pciexp_wake_masked, 0)) + return; + + /* Clear stale status so that only a new event re-triggers the SCI */ + acpi_write_bit_register(ACPI_BITREG_PCIEXP_WAKE_STATUS, + ACPI_CLEAR_STATUS); + acpi_write_bit_register(ACPI_BITREG_PCIEXP_WAKE_DISABLE, 0); +} + +static void pci_acpi_pciexp_wake_resume(struct pci_dev *dev, int *found) +{ + pci_dbg(dev, "resuming for PCIe wake event\n"); + pci_wakeup_event(dev); + pm_request_resume(&dev->dev); + (*found)++; +} + +static int pci_acpi_pciexp_wake_check_dev(struct pci_dev *dev, void *data) +{ + /* Config space of a device in D3cold cannot be read */ + if (dev->current_state == PCI_D3cold) + return 0; + + if (pci_check_pme_status(dev)) { + if (dev->pme_poll) + dev->pme_poll = false; + + pci_acpi_pciexp_wake_resume(dev, data); + } + + return 0; +} + +static bool pci_acpi_pciexp_wake_root_port(struct pci_dev *dev) +{ + return pci_is_pcie(dev) && + pci_pcie_type(dev) == PCI_EXP_TYPE_ROOT_PORT; +} + +static void pci_acpi_pciexp_wake_work_fn(struct work_struct *work) +{ + struct pci_dev *port = NULL; + unsigned long delay = 0; + int found = 0; + + /* + * A Root Port in D3hot or a shallower state (and the devices below + * it) can be asked whether it has PME pending. A Root Port in + * D3cold cannot be, but one armed for wakeup that is hot-plug capable + * is the most likely source: it signals PME on presence detect or + * data link layer state changes while in D3. + */ + for_each_pci_dev(port) { + int before = found; + + if (!pci_acpi_pciexp_wake_root_port(port)) + continue; + + if (port->current_state == PCI_D3cold) { + if (port->wakeup_prepared && port->is_hotplug_bridge) + pci_acpi_pciexp_wake_resume(port, &found); + continue; + } + + /* PMEs received by a Root Port in D0 are handled natively */ + if (port->current_state == PCI_D0) + continue; + + pci_acpi_pciexp_wake_check_dev(port, &found); + if (port->subordinate) + pci_walk_bus(port->subordinate, + pci_acpi_pciexp_wake_check_dev, &found); + + /* + * The Root Port could not signal the interrupt for this PME + * while in D3hot, so nothing else is going to clear it. + */ + if (found != before) + pcie_clear_root_pme_status(port); + } + + if (found) { + pci_acpi_pciexp_wake_misses = 0; + goto unmask; + } + + /* + * No evidence found. The first time around, assume it was WAKE# + * from something below a Root Port in D3cold and resume every such + * Root Port armed for wakeup. The inputs to PCIEXP_WAKE_STS are + * level-sensitive, so if the event keeps coming back without anyone + * claiming it, leave it masked for increasingly long periods instead + * of waking those ports over and over again. + */ + if (!pci_acpi_pciexp_wake_misses) { + for_each_pci_dev(port) { + if (pci_acpi_pciexp_wake_root_port(port) && + port->current_state == PCI_D3cold && + port->wakeup_prepared) + pci_acpi_pciexp_wake_resume(port, &found); + } + } + + pr_debug("PCI/ACPI: PCIe wake status set but no device claimed it\n"); + delay = min(HZ << pci_acpi_pciexp_wake_misses, 30 * HZ); + if (pci_acpi_pciexp_wake_misses < 5) + pci_acpi_pciexp_wake_misses++; + +unmask: + mod_delayed_work(system_wq, &pci_acpi_pciexp_wake_unmask_work, delay); +} + +/* + * Called by ACPICA for every SCI, at interrupt level with the GPE lock held. + */ +static u32 pci_acpi_pciexp_wake_sci(void *context) +{ + u32 sts, dis; + + if (ACPI_FAILURE(acpi_read_bit_register(ACPI_BITREG_PCIEXP_WAKE_STATUS, + &sts)) || !sts) + return ACPI_INTERRUPT_NOT_HANDLED; + + /* + * Mask the event while it is being processed. Clearing the status + * alone is not enough to deassert the SCI if the source (a Root Port + * with PME pending) is still asserting its input. Leave the mask + * alone if the firmware had already set it. + */ + if (ACPI_SUCCESS(acpi_read_bit_register(ACPI_BITREG_PCIEXP_WAKE_DISABLE, + &dis)) && !dis) { + acpi_write_bit_register(ACPI_BITREG_PCIEXP_WAKE_DISABLE, 1); + atomic_set(&pci_acpi_pciexp_wake_masked, 1); + } + acpi_write_bit_register(ACPI_BITREG_PCIEXP_WAKE_STATUS, + ACPI_CLEAR_STATUS); + + schedule_work(&pci_acpi_pciexp_wake_work); + + return ACPI_INTERRUPT_HANDLED; +} + +/* + * Called from acpi_s2idle_wake() to decide whether an SCI that woke the + * system from suspend-to-idle was a genuine wakeup event. ACPICA only + * considers the fixed events it knows about, which do not include + * PCIEXP_WAKE_STS, so a PCIe wake signaled this way would otherwise be + * treated as spurious and the system would go back to sleep. + */ +static bool pci_acpi_pciexp_wake_check(void *context) +{ + u32 sts; + + if (ACPI_FAILURE(acpi_read_bit_register(ACPI_BITREG_PCIEXP_WAKE_STATUS, + &sts))) + return false; + + if (sts) + pm_pr_dbg("PCIe wake status set\n"); + + return sts; +} + +static int pci_acpi_pciexp_wake_pm_notifier(struct notifier_block *nb, + unsigned long action, void *data) +{ + switch (action) { + case PM_HIBERNATION_PREPARE: + case PM_SUSPEND_PREPARE: + /* Do not go to sleep with the event masked */ + flush_work(&pci_acpi_pciexp_wake_work); + flush_delayed_work(&pci_acpi_pciexp_wake_unmask_work); + break; + } + + return NOTIFY_DONE; +} + +static struct notifier_block pci_acpi_pciexp_wake_nb = { + .notifier_call = pci_acpi_pciexp_wake_pm_notifier, +}; + +static int __init pci_acpi_pciexp_wake_init(void) +{ + acpi_status status; + + if (acpi_disabled || acpi_pci_disabled || acpi_gbl_reduced_hardware || + !acpi_sci_irq_valid()) + return 0; + + if (!(acpi_gbl_FADT.flags & ACPI_FADT_PCI_EXPRESS_WAKE)) + return 0; + + INIT_WORK(&pci_acpi_pciexp_wake_work, pci_acpi_pciexp_wake_work_fn); + INIT_DELAYED_WORK(&pci_acpi_pciexp_wake_unmask_work, + pci_acpi_pciexp_wake_unmask_fn); + + status = acpi_install_sci_handler(pci_acpi_pciexp_wake_sci, NULL); + if (ACPI_FAILURE(status)) { + pr_warn("PCI/ACPI: Failed to install PCIe wake SCI handler: %s\n", + acpi_format_exception(status)); + return 0; + } + + acpi_register_wakeup_handler(acpi_sci_irq, pci_acpi_pciexp_wake_check, + NULL); + register_pm_notifier(&pci_acpi_pciexp_wake_nb); + + return 0; +} +device_initcall(pci_acpi_pciexp_wake_init); + /* * _SxD returns the D-state with the highest power * (lowest D-state number) supported in the S-state "x". -- 2.43.0 ^ permalink raw reply related [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-11-30 23:23 UTC | newest] Thread overview: 5+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2026-11-25 21:40 [BUG] AMD Strix Point USB4 (1022:150a): mid-s2idle pciehp hot-add causes D3cold->D0 failure and hard hang Marco Sousa 2026-11-26 6:48 ` Mika Westerberg 2026-11-28 7:55 ` Marco Sousa 2026-11-30 6:33 ` Mika Westerberg 2026-11-30 23:23 ` Mario Limonciello
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox