From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796514665; b=kMUanFHzhitiA5G3cVeJ6aIXbFdoNcpBXy2+EKa5anPJZ+6FjZeBphaNacqQ+KQAeiH8 3jsMstkFdREg8w3DsNhliJbna30LW1TIJ3/3cUDKuMJtHM0Urp/X/PvpTkZ/CbuYZXULK kWnyNjzK9XAymraKYOMI2P7sLUTyj9Fkydax6k4GRbL5qORkklAWvC5vscWAiTn7tp/0V bzGqnff8i5FHtAwPDJHPtDtG698zOlawfDB7qiwAbHfmkrrDbVuuGbRJMyjvj+q9SC/x8 3xASfqIpm7S1hbP2/hSDVkzPzZpDNK+Cglq5xIGzs9qGD5ZGlNhUrROQzzBCZVMYp+Q== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796514665; h=Received:DKIM-Signature:Date:From:To:Cc:Subject:Message-ID: MIME-Version:Content-Type:Content-Disposition:In-Reply-To; bh=GH6V5Udb5djWhI/+w0NNtmvfbfBLo6jNVGaltOgDzhI=; b=WoiayqqI7ee71oxL2M+znS0FIXQP/CWyf3LYFfz/KlyjrLQFNmRX3RoGmDhSXd5ZSVqV EcUxWjYAcckU2QLer4FUYxryQocsLPcqPMpQiycHQl4YKz/FOMB+UYrHQ/gN5Na57yO1N O9ltyQc2t99uzzAPSpKrKafSkC4NKYMu7mj6dK417U3/GCcrq0e0eaJazyoFrznQ6KLoW NfVgeeiD6g7pi7cNaE1apBJEsjy/xrFWtUP5jY+IoZicaBOjUv0vbbbIVJ+b2XrnIm7dh C2dGHR5kPUag819PojT6iig68gDbH3VEPbmtFLp9hB0cu3CaRg8U5sKyQkmPiS0DrHw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=Wi+WUQ4t; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 178E9606A31F; Sat, 5 Dec 2026 23:51:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=Wi+WUQ4t Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5CDF41F0092B; Sat, 5 Dec 2026 23:51:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796514664; bh=GH6V5Udb5djWhI/+w0NNtmvfbfBLo6jNVGaltOgDzhI=; h=Date:From:To:Cc:Subject:In-Reply-To; b=Wi+WUQ4tTbh6atz/ESB5PYOU5KN+mOve7yCO9igoGpDJEU09m07Ra0e40fdKpPeG8 0qrn7zbM4uRZsUtUfijQJ07upyx5YDFlsimGiIf3BIO0/pAtsqZOsE+KGJJKLM3QF2 KzFvQKYuE9W3c0Dy47C6wXmS5J8xvyLsgYoUtbkXWHu3udpYpnAiPN5JQPdMEBpCda sXA1sOUVotFx95jLrYAVrxDvgu6NRPlJc9f1DsdFhYNcBOLgBumYMR9wS0+bjT1nU/ h+e7S0l2xEbNf8g2zenB0Ta+jZckQBrpSeOn3sN3qMvv3uZvUqlC9fdSkwy+v7NfVX fsS+9QXO98Gsw== Date: Sat, 5 Dec 2026 17:51:03 -0600 From: Bjorn Helgaas To: Kuppuswamy Sathyanarayanan Cc: Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H . Peter Anvin" , Lukas Wunner , Mika Westerberg , "Rafael J . Wysocki" , linux-pci@vger.kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v5] PCI/PME: Resume Catlow Lake Root Ports on PME with PME Status clear Message-ID: <20261205235103.GA1171302@bhelgaas> X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20261103193136.2410148-1-sathyanarayanan.kuppuswamy@linux.intel.com> On Tue, Nov 03, 2026 at 11:31:36AM -0800, Kuppuswamy Sathyanarayanan wrote: > Intel Catlow Lake PCH Root Ports do not set PME Status in the Root > Status register when they generate a PME for their own hotplug event. > The PME interrupt itself is delivered. PMEs from devices below the Root > Port are reported correctly. > > PME and hotplug share the same interrupt. When a hotplug Root Port > runtime suspends to D3hot, pciehp disables hotplug interrupts and relies > on PME to resume the Port. On a hot-add the Port signals PME, but Root > Status stays clear. pcie_pme_irq() then returns IRQ_NONE. pciehp_isr() > also returns IRQ_NONE because hotplug interrupts are disabled. The Port > stays in D3hot and the new device is never enumerated. > > Mark the affected Root Ports with a new PCI_DEV_FLAGS_PME_UNRELIABLE > flag. If such a Port interrupts while not in D0 and PME Status is > clear, pcie_pme_irq() resumes the Port. pciehp re-enables hotplug > interrupts on runtime resume, and pciehp_check_presence() finds the new > device. pciehp itself is unchanged. > > The workaround only applies to quirked Ports that are not in D0. AER, > DPC and bandwidth notification also share the interrupt and stay enabled > in D3hot. If one of them fires while a quirked Port is in D3hot, the > Port is resumed without need and runtime suspends again later. > > This affects all steppings of the Catlow Lake PCH. A public erratum is > not available yet. > > Suggested-by: Lukas Wunner > Link: https://lore.kernel.org/linux-pci/ara-_IPXV_i90if1@wunner.de/ > Signed-off-by: Kuppuswamy Sathyanarayanan > --- > Changes since v4: > * Moved the workaround from pciehp to the PME driver (Lukas). pciehp > now keeps clearing HPIE on suspend as before (Bjorn). > * Noted in the commit log and in pcie_pme_irq() that PME and hotplug > share the same interrupt (Bjorn). > * Dropped the PME Requester ID reference, since the code doesn't use > it (Bjorn). > * Dropped the "D3hot to D0 transitions" wording (Bjorn). > * Updated the quirk comment and message for the PME driver approach. > * Dropped Reviewed-by from Lukas since the approach changed. > * The v4 approach in pciehp also fixes the issue on Catlow Lake. I am > happy to go back to it if that is preferred. > > Changes since v3: > * Moved quirk from drivers/pci/quirks.c to arch/x86/pci/fixup.c (Lukas) > * Renamed function to intel_pcie_pme_unreliable for x86-specific context. > * Added Reviewed-by tag from Lukas > > Changes since v2: > * Switched from pm_runtime_disable() to PCI_DEV_FLAGS_PME_UNRELIABLE > flag approach to avoid power regression (feedback from Rafael and Lukas) > * Keep hotplug interrupts (HPIE) enabled during D3hot instead of > preventing D3hot entry entirely > * Port still enters D3hot for power savings; testing confirms no impact > on PC6 package C-state residency > * Modified pciehp to check pme_is_broken() before disabling/enabling > hotplug interrupts during suspend/resume > * Made quirk comment generic to cover both PME notification and status > update issues, with Catlow Lake specifics documented separately > > Changes since v1: > * Removed hack in hotplug driver and disabled runtime PM on affected ports. > * Fixed the commit log and comments accordingly. > > v4: https://lore.kernel.org/linux-pci/20260323223056.3119060-1-sathyanarayanan.kuppuswamy@linux.intel.com/ > v3: https://lore.kernel.org/linux-pci/20260316220807.2433661-1-sathyanarayanan.kuppuswamy@linux.intel.com/ > v2: https://lore.kernel.org/linux-pci/20260213231428.613164-1-sathyanarayanan.kuppuswamy@linux.intel.com/ > v1: https://lore.kernel.org/linux-pci/20260210172231.1465275-1-sathyanarayanan.kuppuswamy@linux.intel.com/ > > arch/x86/pci/fixup.c | 46 ++++++++++++++++++++++++++++++++++++++++++ > drivers/pci/pcie/pme.c | 24 +++++++++++++++++++++- > include/linux/pci.h | 2 ++ > 3 files changed, 71 insertions(+), 1 deletion(-) Applied to pci/pm for v7.5, thank you, and sorry for the delay. > diff --git a/arch/x86/pci/fixup.c b/arch/x86/pci/fixup.c > index 795d81c7a4de..eb3703e1cdbe 100644 > --- a/arch/x86/pci/fixup.c > +++ b/arch/x86/pci/fixup.c > @@ -1180,3 +1180,49 @@ static void quirk_tuxeo_rp_d3(struct pci_dev *pdev) > } > DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AMD, 0x1502, quirk_tuxeo_rp_d3); > #endif /* CONFIG_SUSPEND */ > + > +/* > + * Intel Catlow Lake PCH Root Ports do not set PME Status in the Root > + * Status register for a PME they generate for their own hotplug events, > + * although the PME interrupt is delivered. PMEs from devices below the > + * Port are reported correctly. > + * > + * pciehp disables hotplug interrupts when the Port runtime suspends and > + * relies on PME to resume it. With PME Status clear, pcie_pme_irq() > + * ignores the interrupt, the Port stays in D3hot and the hot-add is > + * lost. Mark these Ports so that the PME driver resumes them instead. > + */ > +static void intel_pcie_pme_unreliable(struct pci_dev *dev) > +{ > + dev->dev_flags |= PCI_DEV_FLAGS_PME_UNRELIABLE; > + pci_info(dev, "PME status unreliable, resuming port on PME interrupt in D3hot\n"); > +} > +/* Apply quirk to Catlow Lake PCH root ports (0x7a30 - 0x7a4b) */ > +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x7a30, intel_pcie_pme_unreliable); > +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x7a31, intel_pcie_pme_unreliable); > +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x7a32, intel_pcie_pme_unreliable); > +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x7a33, intel_pcie_pme_unreliable); > +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x7a34, intel_pcie_pme_unreliable); > +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x7a35, intel_pcie_pme_unreliable); > +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x7a36, intel_pcie_pme_unreliable); > +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x7a37, intel_pcie_pme_unreliable); > +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x7a38, intel_pcie_pme_unreliable); > +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x7a39, intel_pcie_pme_unreliable); > +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x7a3a, intel_pcie_pme_unreliable); > +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x7a3b, intel_pcie_pme_unreliable); > +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x7a3c, intel_pcie_pme_unreliable); > +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x7a3d, intel_pcie_pme_unreliable); > +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x7a3e, intel_pcie_pme_unreliable); > +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x7a3f, intel_pcie_pme_unreliable); > +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x7a40, intel_pcie_pme_unreliable); > +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x7a41, intel_pcie_pme_unreliable); > +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x7a42, intel_pcie_pme_unreliable); > +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x7a43, intel_pcie_pme_unreliable); > +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x7a44, intel_pcie_pme_unreliable); > +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x7a45, intel_pcie_pme_unreliable); > +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x7a46, intel_pcie_pme_unreliable); > +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x7a47, intel_pcie_pme_unreliable); > +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x7a48, intel_pcie_pme_unreliable); > +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x7a49, intel_pcie_pme_unreliable); > +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x7a4a, intel_pcie_pme_unreliable); > +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x7a4b, intel_pcie_pme_unreliable); > diff --git a/drivers/pci/pcie/pme.c b/drivers/pci/pcie/pme.c > index 4996cc4789f3..56c22e416788 100644 > --- a/drivers/pci/pcie/pme.c > +++ b/drivers/pci/pcie/pme.c > @@ -276,11 +276,33 @@ static irqreturn_t pcie_pme_irq(int irq, void *context) > spin_lock_irqsave(&data->lock, flags); > pcie_capability_read_dword(port, PCI_EXP_RTSTA, &rtsta); > > - if (PCI_POSSIBLE_ERROR(rtsta) || !(rtsta & PCI_EXP_RTSTA_PME)) { > + if (PCI_POSSIBLE_ERROR(rtsta)) { > spin_unlock_irqrestore(&data->lock, flags); > return IRQ_NONE; > } > > + if (!(rtsta & PCI_EXP_RTSTA_PME)) { > + spin_unlock_irqrestore(&data->lock, flags); > + > + /* > + * Some Root Ports don't set PME Status for a PME they > + * generate for their own hotplug events. PME shares its > + * interrupt with hotplug and the other Port services, so > + * only do this while the Port is not in D0. Then PME is > + * the only interrupt it can signal for such events, so > + * resume it and let pciehp pick up the event. > + */ > + if ((port->dev_flags & PCI_DEV_FLAGS_PME_UNRELIABLE) && > + port->current_state != PCI_D0) { > + pci_dbg(port, "PME Status clear in %s, resuming Port\n", > + pci_power_name(port->current_state)); > + pci_wakeup_event(port); > + pm_request_resume(&port->dev); > + return IRQ_HANDLED; > + } > + return IRQ_NONE; > + } > + > pcie_pme_interrupt_enable(port, false); > spin_unlock_irqrestore(&data->lock, flags); > > diff --git a/include/linux/pci.h b/include/linux/pci.h > index aa3765a20a96..d3915a3d59b9 100644 > --- a/include/linux/pci.h > +++ b/include/linux/pci.h > @@ -266,6 +266,8 @@ enum pci_dev_flags { > * integrated with the downstream devices and doesn't use real PCI. > */ > PCI_DEV_FLAGS_PCI_BRIDGE_NO_ALIAS = (__force pci_dev_flags_t) (1 << 14), > + /* Root Port does not set PME Status for its own hotplug PMEs */ > + PCI_DEV_FLAGS_PME_UNRELIABLE = (__force pci_dev_flags_t) (1 << 15), > }; > > enum pci_irq_reroute_variant { > -- > 2.43.0 >