* [PATCH v2 0/2] PCI: rzg3s-host: Cleanups
@ 2025-12-17 11:15 Claudiu
2025-12-17 11:15 ` [PATCH v2 1/2] PCI: rzg3s-host: Use pci_generic_config_write() for the root bus Claudiu
` (3 more replies)
0 siblings, 4 replies; 9+ messages in thread
From: Claudiu @ 2025-12-17 11:15 UTC (permalink / raw)
To: bhelgaas, lpieralisi, kwilczynski, mani, robh
Cc: claudiu.beznea, linux-pci, linux-renesas-soc, linux-kernel,
Claudiu Beznea
From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
Hi,
Series adds cleanups for the Renesas RZ/G3S host controller driver
as discussed in [1].
Thank you,
Claudiu
Changes in v2:
- added fixes tag for patch 1/2
[1] https://lore.kernel.org/all/20251125183754.GA2755815@bhelgaas/
Claudiu Beznea (2):
PCI: rzg3s-host: Use pci_generic_config_write() for the root bus
PCI: rzg3s-host: Drop the lock on RZG3S_PCI_MSIRS and
RZG3S_PCI_PINTRCVIS
drivers/pci/controller/pcie-rzg3s-host.c | 34 +++++-------------------
1 file changed, 7 insertions(+), 27 deletions(-)
--
2.43.0
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v2 1/2] PCI: rzg3s-host: Use pci_generic_config_write() for the root bus
2025-12-17 11:15 [PATCH v2 0/2] PCI: rzg3s-host: Cleanups Claudiu
@ 2025-12-17 11:15 ` Claudiu
2025-12-20 8:24 ` Wolfram Sang
2025-12-17 11:15 ` [PATCH v2 2/2] PCI: rzg3s-host: Drop the lock on RZG3S_PCI_MSIRS and RZG3S_PCI_PINTRCVIS Claudiu
` (2 subsequent siblings)
3 siblings, 1 reply; 9+ messages in thread
From: Claudiu @ 2025-12-17 11:15 UTC (permalink / raw)
To: bhelgaas, lpieralisi, kwilczynski, mani, robh
Cc: claudiu.beznea, linux-pci, linux-renesas-soc, linux-kernel,
Claudiu Beznea, Bjorn Helgaas
From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
The Renesas RZ/G3S host controller allows writing to read-only PCIe
configuration registers when the RZG3S_PCI_PERM_CFG_HWINIT_EN bit is set in
the RZG3S_PCI_PERM register. However, callers of struct pci_ops::write
expect the semantics defined by the PCIe specification, meaning that writes
to read-only registers must not be allowed.
The previous custom struct pci_ops::write implementation for the root bus
temporarily enabled write access before calling pci_generic_config_write().
This breaks the expected semantics.
Remove the custom implementation and simply use pci_generic_config_write().
Along with this change, the updates of the PCI_PRIMARY_BUS,
PCI_SECONDARY_BUS, and PCI_SUBORDINATE_BUS registers were moved so that
they no longer depends on the RZG3S_PCI_PERM_CFG_HWINIT_EN bit in the
RZG3S_PCI_PERM_CFG register, since these registers are R/W.
Fixes: 7ef502fb35b2 ("PCI: Add Renesas RZ/G3S host controller driver")
Suggested-by: Bjorn Helgaas <helgaas@kernel.org>
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
---
Changes in v2:
- added fixes tag
drivers/pci/controller/pcie-rzg3s-host.c | 27 ++++--------------------
1 file changed, 4 insertions(+), 23 deletions(-)
diff --git a/drivers/pci/controller/pcie-rzg3s-host.c b/drivers/pci/controller/pcie-rzg3s-host.c
index 83ec66a70823..ae6d9c7dc2c1 100644
--- a/drivers/pci/controller/pcie-rzg3s-host.c
+++ b/drivers/pci/controller/pcie-rzg3s-host.c
@@ -439,28 +439,9 @@ static void __iomem *rzg3s_pcie_root_map_bus(struct pci_bus *bus,
return host->pcie + where;
}
-/* Serialized by 'pci_lock' */
-static int rzg3s_pcie_root_write(struct pci_bus *bus, unsigned int devfn,
- int where, int size, u32 val)
-{
- struct rzg3s_pcie_host *host = bus->sysdata;
- int ret;
-
- /* Enable access control to the CFGU */
- writel_relaxed(RZG3S_PCI_PERM_CFG_HWINIT_EN,
- host->axi + RZG3S_PCI_PERM);
-
- ret = pci_generic_config_write(bus, devfn, where, size, val);
-
- /* Disable access control to the CFGU */
- writel_relaxed(0, host->axi + RZG3S_PCI_PERM);
-
- return ret;
-}
-
static struct pci_ops rzg3s_pcie_root_ops = {
.read = pci_generic_config_read,
- .write = rzg3s_pcie_root_write,
+ .write = pci_generic_config_write,
.map_bus = rzg3s_pcie_root_map_bus,
};
@@ -1065,14 +1046,14 @@ static int rzg3s_pcie_config_init(struct rzg3s_pcie_host *host)
writel_relaxed(0xffffffff, host->pcie + RZG3S_PCI_CFG_BARMSK00L);
writel_relaxed(0xffffffff, host->pcie + RZG3S_PCI_CFG_BARMSK00U);
+ /* Disable access control to the CFGU */
+ writel_relaxed(0, host->axi + RZG3S_PCI_PERM);
+
/* Update bus info */
writeb_relaxed(primary_bus, host->pcie + PCI_PRIMARY_BUS);
writeb_relaxed(secondary_bus, host->pcie + PCI_SECONDARY_BUS);
writeb_relaxed(subordinate_bus, host->pcie + PCI_SUBORDINATE_BUS);
- /* Disable access control to the CFGU */
- writel_relaxed(0, host->axi + RZG3S_PCI_PERM);
-
return 0;
}
--
2.43.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH v2 2/2] PCI: rzg3s-host: Drop the lock on RZG3S_PCI_MSIRS and RZG3S_PCI_PINTRCVIS
2025-12-17 11:15 [PATCH v2 0/2] PCI: rzg3s-host: Cleanups Claudiu
2025-12-17 11:15 ` [PATCH v2 1/2] PCI: rzg3s-host: Use pci_generic_config_write() for the root bus Claudiu
@ 2025-12-17 11:15 ` Claudiu
2025-12-20 8:24 ` Wolfram Sang
2025-12-19 11:42 ` [PATCH v2 0/2] PCI: rzg3s-host: Cleanups Wolfram Sang
2025-12-30 17:13 ` Manivannan Sadhasivam
3 siblings, 1 reply; 9+ messages in thread
From: Claudiu @ 2025-12-17 11:15 UTC (permalink / raw)
To: bhelgaas, lpieralisi, kwilczynski, mani, robh
Cc: claudiu.beznea, linux-pci, linux-renesas-soc, linux-kernel,
Claudiu Beznea
From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
The RZG3S_PCI_MSIRS and RZG3S_PCI_PINTRCVIS registers are of the R/W1C
type. According to the RZ/G3S HW Manual, Rev. 1.10, chapter 34.2.1
Register Type, R/W1C register bits are cleared to 0b by writing 1b, while
writing 0b has no effect. Therefore, there is no need to take a lock
around writes to these registers.
Drop the locking.
Along with this, add a note about the R/W1C register type to the register
offset definitions.
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
---
Changes in v2:
- none
drivers/pci/controller/pcie-rzg3s-host.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/drivers/pci/controller/pcie-rzg3s-host.c b/drivers/pci/controller/pcie-rzg3s-host.c
index ae6d9c7dc2c1..5aa58638903f 100644
--- a/drivers/pci/controller/pcie-rzg3s-host.c
+++ b/drivers/pci/controller/pcie-rzg3s-host.c
@@ -73,6 +73,7 @@
#define RZG3S_PCI_PINTRCVIE_INTX(i) BIT(i)
#define RZG3S_PCI_PINTRCVIE_MSI BIT(4)
+/* Register is R/W1C, it doesn't require locking. */
#define RZG3S_PCI_PINTRCVIS 0x114
#define RZG3S_PCI_PINTRCVIS_INTX(i) BIT(i)
#define RZG3S_PCI_PINTRCVIS_MSI BIT(4)
@@ -114,6 +115,8 @@
#define RZG3S_PCI_MSIRE_ENA BIT(0)
#define RZG3S_PCI_MSIRM(id) (0x608 + (id) * 0x10)
+
+/* Register is R/W1C, it doesn't require locking. */
#define RZG3S_PCI_MSIRS(id) (0x60c + (id) * 0x10)
#define RZG3S_PCI_AWBASEL(id) (0x1000 + (id) * 0x20)
@@ -507,8 +510,6 @@ static void rzg3s_pcie_msi_irq_ack(struct irq_data *d)
u8 reg_bit = d->hwirq % RZG3S_PCI_MSI_INT_PER_REG;
u8 reg_id = d->hwirq / RZG3S_PCI_MSI_INT_PER_REG;
- guard(raw_spinlock_irqsave)(&host->hw_lock);
-
writel_relaxed(BIT(reg_bit), host->axi + RZG3S_PCI_MSIRS(reg_id));
}
@@ -840,8 +841,6 @@ static void rzg3s_pcie_intx_irq_ack(struct irq_data *d)
{
struct rzg3s_pcie_host *host = irq_data_get_irq_chip_data(d);
- guard(raw_spinlock_irqsave)(&host->hw_lock);
-
rzg3s_pcie_update_bits(host->axi, RZG3S_PCI_PINTRCVIS,
RZG3S_PCI_PINTRCVIS_INTX(d->hwirq),
RZG3S_PCI_PINTRCVIS_INTX(d->hwirq));
--
2.43.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH v2 0/2] PCI: rzg3s-host: Cleanups
2025-12-17 11:15 [PATCH v2 0/2] PCI: rzg3s-host: Cleanups Claudiu
2025-12-17 11:15 ` [PATCH v2 1/2] PCI: rzg3s-host: Use pci_generic_config_write() for the root bus Claudiu
2025-12-17 11:15 ` [PATCH v2 2/2] PCI: rzg3s-host: Drop the lock on RZG3S_PCI_MSIRS and RZG3S_PCI_PINTRCVIS Claudiu
@ 2025-12-19 11:42 ` Wolfram Sang
2025-12-19 17:21 ` Claudiu Beznea
2025-12-30 17:13 ` Manivannan Sadhasivam
3 siblings, 1 reply; 9+ messages in thread
From: Wolfram Sang @ 2025-12-19 11:42 UTC (permalink / raw)
To: Claudiu
Cc: bhelgaas, lpieralisi, kwilczynski, mani, robh, linux-pci,
linux-renesas-soc, linux-kernel, Claudiu Beznea
[-- Attachment #1: Type: text/plain, Size: 261 bytes --]
Hi Claudiu,
> Series adds cleanups for the Renesas RZ/G3S host controller driver
> as discussed in [1].
Is there a branch for testing somewhere? DT parts seem to be not
upstream yet and I don't know all the dependencies probably.
Happy hacking,
Wolfram
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v2 0/2] PCI: rzg3s-host: Cleanups
2025-12-19 11:42 ` [PATCH v2 0/2] PCI: rzg3s-host: Cleanups Wolfram Sang
@ 2025-12-19 17:21 ` Claudiu Beznea
2025-12-20 8:24 ` Wolfram Sang
0 siblings, 1 reply; 9+ messages in thread
From: Claudiu Beznea @ 2025-12-19 17:21 UTC (permalink / raw)
To: Wolfram Sang
Cc: bhelgaas, lpieralisi, kwilczynski, mani, robh, linux-pci,
linux-renesas-soc, linux-kernel, Claudiu Beznea
Hi, Wolfram,
On 12/19/25 13:42, Wolfram Sang wrote:
> Hi Claudiu,
>
>> Series adds cleanups for the Renesas RZ/G3S host controller driver
>> as discussed in [1].
>
> Is there a branch for testing somewhere? DT parts seem to be not
> upstream yet and I don't know all the dependencies probably.
I pushed it here:
https://github.com/claudiubeznea/linux/commits/claudiu/pcie/follow-up-v2/
Thank you for checking it,
Claudiu
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v2 0/2] PCI: rzg3s-host: Cleanups
2025-12-19 17:21 ` Claudiu Beznea
@ 2025-12-20 8:24 ` Wolfram Sang
0 siblings, 0 replies; 9+ messages in thread
From: Wolfram Sang @ 2025-12-20 8:24 UTC (permalink / raw)
To: Claudiu Beznea
Cc: bhelgaas, lpieralisi, kwilczynski, mani, robh, linux-pci,
linux-renesas-soc, linux-kernel, Claudiu Beznea
[-- Attachment #1: Type: text/plain, Size: 260 bytes --]
Hi Claudiu,
> I pushed it here:
> https://github.com/claudiubeznea/linux/commits/claudiu/pcie/follow-up-v2/
Thank you! Needed two tries because the VC3 driver got disabled in my
current config, but now it works with a PCI-USB card and attached USB
devices.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v2 1/2] PCI: rzg3s-host: Use pci_generic_config_write() for the root bus
2025-12-17 11:15 ` [PATCH v2 1/2] PCI: rzg3s-host: Use pci_generic_config_write() for the root bus Claudiu
@ 2025-12-20 8:24 ` Wolfram Sang
0 siblings, 0 replies; 9+ messages in thread
From: Wolfram Sang @ 2025-12-20 8:24 UTC (permalink / raw)
To: Claudiu
Cc: bhelgaas, lpieralisi, kwilczynski, mani, robh, linux-pci,
linux-renesas-soc, linux-kernel, Claudiu Beznea, Bjorn Helgaas
[-- Attachment #1: Type: text/plain, Size: 1293 bytes --]
On Wed, Dec 17, 2025 at 01:15:09PM +0200, Claudiu wrote:
> From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
>
> The Renesas RZ/G3S host controller allows writing to read-only PCIe
> configuration registers when the RZG3S_PCI_PERM_CFG_HWINIT_EN bit is set in
> the RZG3S_PCI_PERM register. However, callers of struct pci_ops::write
> expect the semantics defined by the PCIe specification, meaning that writes
> to read-only registers must not be allowed.
>
> The previous custom struct pci_ops::write implementation for the root bus
> temporarily enabled write access before calling pci_generic_config_write().
> This breaks the expected semantics.
>
> Remove the custom implementation and simply use pci_generic_config_write().
>
> Along with this change, the updates of the PCI_PRIMARY_BUS,
> PCI_SECONDARY_BUS, and PCI_SUBORDINATE_BUS registers were moved so that
> they no longer depends on the RZG3S_PCI_PERM_CFG_HWINIT_EN bit in the
> RZG3S_PCI_PERM_CFG register, since these registers are R/W.
>
> Fixes: 7ef502fb35b2 ("PCI: Add Renesas RZ/G3S host controller driver")
> Suggested-by: Bjorn Helgaas <helgaas@kernel.org>
> Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
Tested-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v2 2/2] PCI: rzg3s-host: Drop the lock on RZG3S_PCI_MSIRS and RZG3S_PCI_PINTRCVIS
2025-12-17 11:15 ` [PATCH v2 2/2] PCI: rzg3s-host: Drop the lock on RZG3S_PCI_MSIRS and RZG3S_PCI_PINTRCVIS Claudiu
@ 2025-12-20 8:24 ` Wolfram Sang
0 siblings, 0 replies; 9+ messages in thread
From: Wolfram Sang @ 2025-12-20 8:24 UTC (permalink / raw)
To: Claudiu
Cc: bhelgaas, lpieralisi, kwilczynski, mani, robh, linux-pci,
linux-renesas-soc, linux-kernel, Claudiu Beznea
[-- Attachment #1: Type: text/plain, Size: 716 bytes --]
On Wed, Dec 17, 2025 at 01:15:10PM +0200, Claudiu wrote:
> From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
>
> The RZG3S_PCI_MSIRS and RZG3S_PCI_PINTRCVIS registers are of the R/W1C
> type. According to the RZ/G3S HW Manual, Rev. 1.10, chapter 34.2.1
> Register Type, R/W1C register bits are cleared to 0b by writing 1b, while
> writing 0b has no effect. Therefore, there is no need to take a lock
> around writes to these registers.
>
> Drop the locking.
>
> Along with this, add a note about the R/W1C register type to the register
> offset definitions.
>
> Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
Tested-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v2 0/2] PCI: rzg3s-host: Cleanups
2025-12-17 11:15 [PATCH v2 0/2] PCI: rzg3s-host: Cleanups Claudiu
` (2 preceding siblings ...)
2025-12-19 11:42 ` [PATCH v2 0/2] PCI: rzg3s-host: Cleanups Wolfram Sang
@ 2025-12-30 17:13 ` Manivannan Sadhasivam
3 siblings, 0 replies; 9+ messages in thread
From: Manivannan Sadhasivam @ 2025-12-30 17:13 UTC (permalink / raw)
To: bhelgaas, lpieralisi, kwilczynski, robh, Claudiu
Cc: linux-pci, linux-renesas-soc, linux-kernel, Claudiu Beznea
On Wed, 17 Dec 2025 13:15:08 +0200, Claudiu wrote:
> From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
>
> Hi,
>
> Series adds cleanups for the Renesas RZ/G3S host controller driver
> as discussed in [1].
>
> [...]
Applied, thanks!
[1/2] PCI: rzg3s-host: Use pci_generic_config_write() for the root bus
commit: 4b86eff47e205819eb862097493ec20e25ac8f56
[2/2] PCI: rzg3s-host: Drop the lock on RZG3S_PCI_MSIRS and RZG3S_PCI_PINTRCVIS
commit: 62d4911290f9cbb16f5b6ba6782660148a656fc7
Best regards,
--
Manivannan Sadhasivam <mani@kernel.org>
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2025-12-30 17:13 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-12-17 11:15 [PATCH v2 0/2] PCI: rzg3s-host: Cleanups Claudiu
2025-12-17 11:15 ` [PATCH v2 1/2] PCI: rzg3s-host: Use pci_generic_config_write() for the root bus Claudiu
2025-12-20 8:24 ` Wolfram Sang
2025-12-17 11:15 ` [PATCH v2 2/2] PCI: rzg3s-host: Drop the lock on RZG3S_PCI_MSIRS and RZG3S_PCI_PINTRCVIS Claudiu
2025-12-20 8:24 ` Wolfram Sang
2025-12-19 11:42 ` [PATCH v2 0/2] PCI: rzg3s-host: Cleanups Wolfram Sang
2025-12-19 17:21 ` Claudiu Beznea
2025-12-20 8:24 ` Wolfram Sang
2025-12-30 17:13 ` Manivannan Sadhasivam
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox