public inbox for linux-pci@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] PCI/PME: Replace RMW of Root Status register with direct write
@ 2025-10-26 16:57 Lukas Wunner
  2026-01-22  9:01 ` Lukas Wunner
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Lukas Wunner @ 2025-10-26 16:57 UTC (permalink / raw)
  To: Bjorn Helgaas; +Cc: linux-pci

As of PCIe r7.0, the Root Status register contains a single writeable bit
(PME Status, type RW1C) and otherwise just read-only bits and RsvdZ bits
(which software must write as zero, PCIe r7.0 sec 7.4).

Thus, when clearing the PME Status bit, there's no need to perform a
read-modify-write of the register.  Instead, the bit can be written
directly.

Signed-off-by: Lukas Wunner <lukas@wunner.de>
---
 drivers/pci/pci.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index b14dd064006c..411a0b88841e 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -2285,7 +2285,7 @@ void pcie_clear_device_status(struct pci_dev *dev)
  */
 void pcie_clear_root_pme_status(struct pci_dev *dev)
 {
-	pcie_capability_set_dword(dev, PCI_EXP_RTSTA, PCI_EXP_RTSTA_PME);
+	pcie_capability_write_dword(dev, PCI_EXP_RTSTA, PCI_EXP_RTSTA_PME);
 }
 
 /**
-- 
2.51.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] PCI/PME: Replace RMW of Root Status register with direct write
  2025-10-26 16:57 [PATCH] PCI/PME: Replace RMW of Root Status register with direct write Lukas Wunner
@ 2026-01-22  9:01 ` Lukas Wunner
  2026-01-22 10:22 ` Ilpo Järvinen
  2026-02-06 22:42 ` Bjorn Helgaas
  2 siblings, 0 replies; 4+ messages in thread
From: Lukas Wunner @ 2026-01-22  9:01 UTC (permalink / raw)
  To: Bjorn Helgaas; +Cc: linux-pci

On Sun, Oct 26, 2025 at 05:57:57PM +0100, Lukas Wunner wrote:
> As of PCIe r7.0, the Root Status register contains a single writeable bit
> (PME Status, type RW1C) and otherwise just read-only bits and RsvdZ bits
> (which software must write as zero, PCIe r7.0 sec 7.4).
> 
> Thus, when clearing the PME Status bit, there's no need to perform a
> read-modify-write of the register.  Instead, the bit can be written
> directly.

Hm, I just noticed that this patch is marked "Not Applicable" in patchwork:

https://patchwork.kernel.org/project/linux-pci/patch/39f87c99f6c44be3c0371c79e454e6fde7be0d4d.1761497583.git.lukas@wunner.de/

It didn't get any on-list replies and didn't get applied AFAICS.
I'm not sure why it's marked this way in patchwork or what to do about it.

There's one other patch sharing the same fate:

https://patchwork.kernel.org/project/linux-pci/patch/75e4ae507fa4faddd063a3a9e17d319ed84529b6.1757562971.git.lukas@wunner.de/

Thanks!

Lukas

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] PCI/PME: Replace RMW of Root Status register with direct write
  2025-10-26 16:57 [PATCH] PCI/PME: Replace RMW of Root Status register with direct write Lukas Wunner
  2026-01-22  9:01 ` Lukas Wunner
@ 2026-01-22 10:22 ` Ilpo Järvinen
  2026-02-06 22:42 ` Bjorn Helgaas
  2 siblings, 0 replies; 4+ messages in thread
From: Ilpo Järvinen @ 2026-01-22 10:22 UTC (permalink / raw)
  To: Lukas Wunner; +Cc: Bjorn Helgaas, linux-pci

[-- Attachment #1: Type: text/plain, Size: 1098 bytes --]

On Sun, 26 Oct 2025, Lukas Wunner wrote:

> As of PCIe r7.0, the Root Status register contains a single writeable bit
> (PME Status, type RW1C) and otherwise just read-only bits and RsvdZ bits
> (which software must write as zero, PCIe r7.0 sec 7.4).
> 
> Thus, when clearing the PME Status bit, there's no need to perform a
> read-modify-write of the register.  Instead, the bit can be written
> directly.
> 
> Signed-off-by: Lukas Wunner <lukas@wunner.de>
> ---
>  drivers/pci/pci.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
> index b14dd064006c..411a0b88841e 100644
> --- a/drivers/pci/pci.c
> +++ b/drivers/pci/pci.c
> @@ -2285,7 +2285,7 @@ void pcie_clear_device_status(struct pci_dev *dev)
>   */
>  void pcie_clear_root_pme_status(struct pci_dev *dev)
>  {
> -	pcie_capability_set_dword(dev, PCI_EXP_RTSTA, PCI_EXP_RTSTA_PME);
> +	pcie_capability_write_dword(dev, PCI_EXP_RTSTA, PCI_EXP_RTSTA_PME);
>  }
>  
>  /**
> 

Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>

-- 
 i.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] PCI/PME: Replace RMW of Root Status register with direct write
  2025-10-26 16:57 [PATCH] PCI/PME: Replace RMW of Root Status register with direct write Lukas Wunner
  2026-01-22  9:01 ` Lukas Wunner
  2026-01-22 10:22 ` Ilpo Järvinen
@ 2026-02-06 22:42 ` Bjorn Helgaas
  2 siblings, 0 replies; 4+ messages in thread
From: Bjorn Helgaas @ 2026-02-06 22:42 UTC (permalink / raw)
  To: Lukas Wunner; +Cc: linux-pci

On Sun, Oct 26, 2025 at 05:57:57PM +0100, Lukas Wunner wrote:
> As of PCIe r7.0, the Root Status register contains a single writeable bit
> (PME Status, type RW1C) and otherwise just read-only bits and RsvdZ bits
> (which software must write as zero, PCIe r7.0 sec 7.4).
> 
> Thus, when clearing the PME Status bit, there's no need to perform a
> read-modify-write of the register.  Instead, the bit can be written
> directly.
> 
> Signed-off-by: Lukas Wunner <lukas@wunner.de>

Applied to pci/enumeration for v6.20, thanks!

Thanks for the ping; I don't remember but suspect I just bulk-archived
old things in patchwork because it was so overwhelming.

> ---
>  drivers/pci/pci.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
> index b14dd064006c..411a0b88841e 100644
> --- a/drivers/pci/pci.c
> +++ b/drivers/pci/pci.c
> @@ -2285,7 +2285,7 @@ void pcie_clear_device_status(struct pci_dev *dev)
>   */
>  void pcie_clear_root_pme_status(struct pci_dev *dev)
>  {
> -	pcie_capability_set_dword(dev, PCI_EXP_RTSTA, PCI_EXP_RTSTA_PME);
> +	pcie_capability_write_dword(dev, PCI_EXP_RTSTA, PCI_EXP_RTSTA_PME);
>  }
>  
>  /**
> -- 
> 2.51.0
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-02-06 22:42 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-26 16:57 [PATCH] PCI/PME: Replace RMW of Root Status register with direct write Lukas Wunner
2026-01-22  9:01 ` Lukas Wunner
2026-01-22 10:22 ` Ilpo Järvinen
2026-02-06 22:42 ` Bjorn Helgaas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox