linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] PCI: Consolidate PCIe message routing definitions and remove driver-specific duplicates
@ 2025-06-07 15:49 Hans Zhang
  2025-06-07 15:49 ` [PATCH 1/2] PCI: cadence: Replace private message routing enums with PCI core definitions Hans Zhang
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Hans Zhang @ 2025-06-07 15:49 UTC (permalink / raw)
  To: lpieralisi, bhelgaas, kwilczynski, shawn.lin, heiko
  Cc: robh, linux-rockchip, linux-arm-kernel, linux-pci, linux-kernel,
	Hans Zhang

This series consolidates PCIe message routing definitions into the common
PCI core header, eliminating redundant enums in the Cadence and Rockchip
drivers. By using standardized macros (PCIE_MSG_TYPE_R_* and
PCIE_MSG_CODE_*) from drivers/pci/pci.h, we ensure alignment with the PCIe
r6.0 specification, reduce code duplication, and improve maintainability
across the PCI subsystem.

Hans Zhang (2):
  PCI: cadence: Replace private message routing enums with PCI core
    definitions
  PCI: rockchip: Remove redundant PCIe message routing definitions

 .../pci/controller/cadence/pcie-cadence-ep.c  |  2 +-
 drivers/pci/controller/cadence/pcie-cadence.h | 20 -------------------
 drivers/pci/controller/pcie-rockchip.h        | 14 -------------
 3 files changed, 1 insertion(+), 35 deletions(-)


base-commit: ec7714e4947909190ffb3041a03311a975350fe0
-- 
2.25.1


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

* [PATCH 1/2] PCI: cadence: Replace private message routing enums with PCI core definitions
  2025-06-07 15:49 [PATCH 0/2] PCI: Consolidate PCIe message routing definitions and remove driver-specific duplicates Hans Zhang
@ 2025-06-07 15:49 ` Hans Zhang
  2025-06-07 15:49 ` [PATCH 2/2] PCI: rockchip: Remove redundant PCIe message routing definitions Hans Zhang
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 7+ messages in thread
From: Hans Zhang @ 2025-06-07 15:49 UTC (permalink / raw)
  To: lpieralisi, bhelgaas, kwilczynski, shawn.lin, heiko
  Cc: robh, linux-rockchip, linux-arm-kernel, linux-pci, linux-kernel,
	Hans Zhang

The Cadence driver previously defined its own message routing enums (e.g.,
MSG_ROUTING_LOCAL) and message codes, which duplicated existing PCI core
macros (PCIE_MSG_TYPE_R_LOCAL, PCIE_MSG_CODE_ASSERT_INTA, etc.) in
drivers/pci/pci.h. These core definitions align with the PCIe r6.0 spec.

Remove the driver-specific enums and switch to the centralized PCI core
macros. This eliminates redundancy, ensures consistency, and simplifies
future updates. No functional changes are introduced.

Signed-off-by: Hans Zhang <18255117159@163.com>
---
 .../pci/controller/cadence/pcie-cadence-ep.c  |  2 +-
 drivers/pci/controller/cadence/pcie-cadence.h | 20 -------------------
 2 files changed, 1 insertion(+), 21 deletions(-)

diff --git a/drivers/pci/controller/cadence/pcie-cadence-ep.c b/drivers/pci/controller/cadence/pcie-cadence-ep.c
index 8ab6cf70c18e..77c5a19b2ab1 100644
--- a/drivers/pci/controller/cadence/pcie-cadence-ep.c
+++ b/drivers/pci/controller/cadence/pcie-cadence-ep.c
@@ -353,7 +353,7 @@ static void cdns_pcie_ep_assert_intx(struct cdns_pcie_ep *ep, u8 fn, u8 intx,
 	}
 	spin_unlock_irqrestore(&ep->lock, flags);
 
-	offset = CDNS_PCIE_NORMAL_MSG_ROUTING(MSG_ROUTING_LOCAL) |
+	offset = CDNS_PCIE_NORMAL_MSG_ROUTING(PCIE_MSG_TYPE_R_LOCAL) |
 		 CDNS_PCIE_NORMAL_MSG_CODE(msg_code);
 	writel(0, ep->irq_cpu_addr + offset);
 }
diff --git a/drivers/pci/controller/cadence/pcie-cadence.h b/drivers/pci/controller/cadence/pcie-cadence.h
index a149845d341a..1d81c4bf6c6d 100644
--- a/drivers/pci/controller/cadence/pcie-cadence.h
+++ b/drivers/pci/controller/cadence/pcie-cadence.h
@@ -250,26 +250,6 @@ struct cdns_pcie_rp_ib_bar {
 
 struct cdns_pcie;
 
-enum cdns_pcie_msg_routing {
-	/* Route to Root Complex */
-	MSG_ROUTING_TO_RC,
-
-	/* Use Address Routing */
-	MSG_ROUTING_BY_ADDR,
-
-	/* Use ID Routing */
-	MSG_ROUTING_BY_ID,
-
-	/* Route as Broadcast Message from Root Complex */
-	MSG_ROUTING_BCAST,
-
-	/* Local message; terminate at receiver (INTx messages) */
-	MSG_ROUTING_LOCAL,
-
-	/* Gather & route to Root Complex (PME_TO_Ack message) */
-	MSG_ROUTING_GATHER,
-};
-
 struct cdns_pcie_ops {
 	int	(*start_link)(struct cdns_pcie *pcie);
 	void	(*stop_link)(struct cdns_pcie *pcie);
-- 
2.25.1


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

* [PATCH 2/2] PCI: rockchip: Remove redundant PCIe message routing definitions
  2025-06-07 15:49 [PATCH 0/2] PCI: Consolidate PCIe message routing definitions and remove driver-specific duplicates Hans Zhang
  2025-06-07 15:49 ` [PATCH 1/2] PCI: cadence: Replace private message routing enums with PCI core definitions Hans Zhang
@ 2025-06-07 15:49 ` Hans Zhang
  2025-06-20 15:42   ` Bjorn Helgaas
  2025-06-19 12:52 ` (subset) [PATCH 0/2] PCI: Consolidate PCIe message routing definitions and remove driver-specific duplicates Manivannan Sadhasivam
  2025-06-19 12:56 ` Manivannan Sadhasivam
  3 siblings, 1 reply; 7+ messages in thread
From: Hans Zhang @ 2025-06-07 15:49 UTC (permalink / raw)
  To: lpieralisi, bhelgaas, kwilczynski, shawn.lin, heiko
  Cc: robh, linux-rockchip, linux-arm-kernel, linux-pci, linux-kernel,
	Hans Zhang

The Rockchip driver contained duplicated message routing and INTx code
definitions (e.g., ROCKCHIP_PCIE_MSG_ROUTING_TO_RC,
ROCKCHIP_PCIE_MSG_CODE_ASSERT_INTA). These are already provided by the
PCI core in drivers/pci/pci.h as PCIE_MSG_TYPE_R_RC and
PCIE_MSG_CODE_ASSERT_INTA, respectively.

Remove the driver-specific definitions and use the common PCIe macros
instead. This aligns the driver with the PCIe specification and reduces
maintenance overhead.

Signed-off-by: Hans Zhang <18255117159@163.com>
---
 drivers/pci/controller/pcie-rockchip.h | 14 --------------
 1 file changed, 14 deletions(-)

diff --git a/drivers/pci/controller/pcie-rockchip.h b/drivers/pci/controller/pcie-rockchip.h
index 5864a20323f2..12bc8da59d73 100644
--- a/drivers/pci/controller/pcie-rockchip.h
+++ b/drivers/pci/controller/pcie-rockchip.h
@@ -215,20 +215,6 @@
 #define RC_REGION_0_TYPE_MASK			GENMASK(3, 0)
 #define MAX_AXI_WRAPPER_REGION_NUM		33
 
-#define ROCKCHIP_PCIE_MSG_ROUTING_TO_RC		0x0
-#define ROCKCHIP_PCIE_MSG_ROUTING_VIA_ADDR		0x1
-#define ROCKCHIP_PCIE_MSG_ROUTING_VIA_ID		0x2
-#define ROCKCHIP_PCIE_MSG_ROUTING_BROADCAST		0x3
-#define ROCKCHIP_PCIE_MSG_ROUTING_LOCAL_INTX		0x4
-#define ROCKCHIP_PCIE_MSG_ROUTING_PME_ACK		0x5
-#define ROCKCHIP_PCIE_MSG_CODE_ASSERT_INTA		0x20
-#define ROCKCHIP_PCIE_MSG_CODE_ASSERT_INTB		0x21
-#define ROCKCHIP_PCIE_MSG_CODE_ASSERT_INTC		0x22
-#define ROCKCHIP_PCIE_MSG_CODE_ASSERT_INTD		0x23
-#define ROCKCHIP_PCIE_MSG_CODE_DEASSERT_INTA		0x24
-#define ROCKCHIP_PCIE_MSG_CODE_DEASSERT_INTB		0x25
-#define ROCKCHIP_PCIE_MSG_CODE_DEASSERT_INTC		0x26
-#define ROCKCHIP_PCIE_MSG_CODE_DEASSERT_INTD		0x27
 #define ROCKCHIP_PCIE_MSG_ROUTING_MASK			GENMASK(7, 5)
 #define ROCKCHIP_PCIE_MSG_ROUTING(route) \
 	(((route) << 5) & ROCKCHIP_PCIE_MSG_ROUTING_MASK)
-- 
2.25.1


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

* Re: (subset) [PATCH 0/2] PCI: Consolidate PCIe message routing definitions and remove driver-specific duplicates
  2025-06-07 15:49 [PATCH 0/2] PCI: Consolidate PCIe message routing definitions and remove driver-specific duplicates Hans Zhang
  2025-06-07 15:49 ` [PATCH 1/2] PCI: cadence: Replace private message routing enums with PCI core definitions Hans Zhang
  2025-06-07 15:49 ` [PATCH 2/2] PCI: rockchip: Remove redundant PCIe message routing definitions Hans Zhang
@ 2025-06-19 12:52 ` Manivannan Sadhasivam
  2025-06-19 12:56 ` Manivannan Sadhasivam
  3 siblings, 0 replies; 7+ messages in thread
From: Manivannan Sadhasivam @ 2025-06-19 12:52 UTC (permalink / raw)
  To: lpieralisi, bhelgaas, kwilczynski, shawn.lin, heiko, Hans Zhang
  Cc: robh, linux-rockchip, linux-arm-kernel, linux-pci, linux-kernel


On Sat, 07 Jun 2025 23:49:11 +0800, Hans Zhang wrote:
> This series consolidates PCIe message routing definitions into the common
> PCI core header, eliminating redundant enums in the Cadence and Rockchip
> drivers. By using standardized macros (PCIE_MSG_TYPE_R_* and
> PCIE_MSG_CODE_*) from drivers/pci/pci.h, we ensure alignment with the PCIe
> r6.0 specification, reduce code duplication, and improve maintainability
> across the PCI subsystem.
> 
> [...]

Applied, thanks!

[1/2] PCI: cadence: Replace private message routing enums with PCI core definitions
      commit: f28413fe0899591492d8ca3cdf5fd35558d9c05d

Best regards,
-- 
Manivannan Sadhasivam <mani@kernel.org>


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

* Re: (subset) [PATCH 0/2] PCI: Consolidate PCIe message routing definitions and remove driver-specific duplicates
  2025-06-07 15:49 [PATCH 0/2] PCI: Consolidate PCIe message routing definitions and remove driver-specific duplicates Hans Zhang
                   ` (2 preceding siblings ...)
  2025-06-19 12:52 ` (subset) [PATCH 0/2] PCI: Consolidate PCIe message routing definitions and remove driver-specific duplicates Manivannan Sadhasivam
@ 2025-06-19 12:56 ` Manivannan Sadhasivam
  3 siblings, 0 replies; 7+ messages in thread
From: Manivannan Sadhasivam @ 2025-06-19 12:56 UTC (permalink / raw)
  To: lpieralisi, bhelgaas, kwilczynski, shawn.lin, heiko, Hans Zhang
  Cc: robh, linux-rockchip, linux-arm-kernel, linux-pci, linux-kernel


On Sat, 07 Jun 2025 23:49:11 +0800, Hans Zhang wrote:
> This series consolidates PCIe message routing definitions into the common
> PCI core header, eliminating redundant enums in the Cadence and Rockchip
> drivers. By using standardized macros (PCIE_MSG_TYPE_R_* and
> PCIE_MSG_CODE_*) from drivers/pci/pci.h, we ensure alignment with the PCIe
> r6.0 specification, reduce code duplication, and improve maintainability
> across the PCI subsystem.
> 
> [...]

Applied, thanks!

[2/2] PCI: rockchip: Remove redundant PCIe message routing definitions
      commit: 1a69c63fdf1c9095e132096081e27ac85a4d48a5

Best regards,
-- 
Manivannan Sadhasivam <mani@kernel.org>


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

* Re: [PATCH 2/2] PCI: rockchip: Remove redundant PCIe message routing definitions
  2025-06-07 15:49 ` [PATCH 2/2] PCI: rockchip: Remove redundant PCIe message routing definitions Hans Zhang
@ 2025-06-20 15:42   ` Bjorn Helgaas
  2025-06-20 15:58     ` Hans Zhang
  0 siblings, 1 reply; 7+ messages in thread
From: Bjorn Helgaas @ 2025-06-20 15:42 UTC (permalink / raw)
  To: Hans Zhang
  Cc: lpieralisi, bhelgaas, kwilczynski, shawn.lin, heiko, robh,
	linux-rockchip, linux-arm-kernel, linux-pci, linux-kernel

On Sat, Jun 07, 2025 at 11:49:13PM +0800, Hans Zhang wrote:
> The Rockchip driver contained duplicated message routing and INTx code
> definitions (e.g., ROCKCHIP_PCIE_MSG_ROUTING_TO_RC,
> ROCKCHIP_PCIE_MSG_CODE_ASSERT_INTA). These are already provided by the
> PCI core in drivers/pci/pci.h as PCIE_MSG_TYPE_R_RC and
> PCIE_MSG_CODE_ASSERT_INTA, respectively.
> 
> Remove the driver-specific definitions and use the common PCIe macros
> instead. This aligns the driver with the PCIe specification and reduces
> maintenance overhead.
> 
> Signed-off-by: Hans Zhang <18255117159@163.com>
> ---
>  drivers/pci/controller/pcie-rockchip.h | 14 --------------
>  1 file changed, 14 deletions(-)
> 
> diff --git a/drivers/pci/controller/pcie-rockchip.h b/drivers/pci/controller/pcie-rockchip.h
> index 5864a20323f2..12bc8da59d73 100644
> --- a/drivers/pci/controller/pcie-rockchip.h
> +++ b/drivers/pci/controller/pcie-rockchip.h
> @@ -215,20 +215,6 @@
>  #define RC_REGION_0_TYPE_MASK			GENMASK(3, 0)
>  #define MAX_AXI_WRAPPER_REGION_NUM		33
>  
> -#define ROCKCHIP_PCIE_MSG_ROUTING_TO_RC		0x0
> -#define ROCKCHIP_PCIE_MSG_ROUTING_VIA_ADDR		0x1
> -#define ROCKCHIP_PCIE_MSG_ROUTING_VIA_ID		0x2
> -#define ROCKCHIP_PCIE_MSG_ROUTING_BROADCAST		0x3
> -#define ROCKCHIP_PCIE_MSG_ROUTING_LOCAL_INTX		0x4
> -#define ROCKCHIP_PCIE_MSG_ROUTING_PME_ACK		0x5
> -#define ROCKCHIP_PCIE_MSG_CODE_ASSERT_INTA		0x20
> -#define ROCKCHIP_PCIE_MSG_CODE_ASSERT_INTB		0x21
> -#define ROCKCHIP_PCIE_MSG_CODE_ASSERT_INTC		0x22
> -#define ROCKCHIP_PCIE_MSG_CODE_ASSERT_INTD		0x23
> -#define ROCKCHIP_PCIE_MSG_CODE_DEASSERT_INTA		0x24
> -#define ROCKCHIP_PCIE_MSG_CODE_DEASSERT_INTB		0x25
> -#define ROCKCHIP_PCIE_MSG_CODE_DEASSERT_INTC		0x26
> -#define ROCKCHIP_PCIE_MSG_CODE_DEASSERT_INTD		0x27

Thanks for doing this!  In fact, these definitions are not only
redundant, they're not even used at all.

>  #define ROCKCHIP_PCIE_MSG_ROUTING_MASK			GENMASK(7, 5)
>  #define ROCKCHIP_PCIE_MSG_ROUTING(route) \
>  	(((route) << 5) & ROCKCHIP_PCIE_MSG_ROUTING_MASK)

And neither are these ROUTING and CODE definitions.

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

* Re: [PATCH 2/2] PCI: rockchip: Remove redundant PCIe message routing definitions
  2025-06-20 15:42   ` Bjorn Helgaas
@ 2025-06-20 15:58     ` Hans Zhang
  0 siblings, 0 replies; 7+ messages in thread
From: Hans Zhang @ 2025-06-20 15:58 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: lpieralisi, bhelgaas, kwilczynski, shawn.lin, heiko, robh,
	linux-rockchip, linux-arm-kernel, linux-pci, linux-kernel



On 2025/6/20 23:42, Bjorn Helgaas wrote:
> On Sat, Jun 07, 2025 at 11:49:13PM +0800, Hans Zhang wrote:
>> The Rockchip driver contained duplicated message routing and INTx code
>> definitions (e.g., ROCKCHIP_PCIE_MSG_ROUTING_TO_RC,
>> ROCKCHIP_PCIE_MSG_CODE_ASSERT_INTA). These are already provided by the
>> PCI core in drivers/pci/pci.h as PCIE_MSG_TYPE_R_RC and
>> PCIE_MSG_CODE_ASSERT_INTA, respectively.
>>
>> Remove the driver-specific definitions and use the common PCIe macros
>> instead. This aligns the driver with the PCIe specification and reduces
>> maintenance overhead.
>>
>> Signed-off-by: Hans Zhang <18255117159@163.com>
>> ---
>>   drivers/pci/controller/pcie-rockchip.h | 14 --------------
>>   1 file changed, 14 deletions(-)
>>
>> diff --git a/drivers/pci/controller/pcie-rockchip.h b/drivers/pci/controller/pcie-rockchip.h
>> index 5864a20323f2..12bc8da59d73 100644
>> --- a/drivers/pci/controller/pcie-rockchip.h
>> +++ b/drivers/pci/controller/pcie-rockchip.h
>> @@ -215,20 +215,6 @@
>>   #define RC_REGION_0_TYPE_MASK			GENMASK(3, 0)
>>   #define MAX_AXI_WRAPPER_REGION_NUM		33
>>   
>> -#define ROCKCHIP_PCIE_MSG_ROUTING_TO_RC		0x0
>> -#define ROCKCHIP_PCIE_MSG_ROUTING_VIA_ADDR		0x1
>> -#define ROCKCHIP_PCIE_MSG_ROUTING_VIA_ID		0x2
>> -#define ROCKCHIP_PCIE_MSG_ROUTING_BROADCAST		0x3
>> -#define ROCKCHIP_PCIE_MSG_ROUTING_LOCAL_INTX		0x4
>> -#define ROCKCHIP_PCIE_MSG_ROUTING_PME_ACK		0x5
>> -#define ROCKCHIP_PCIE_MSG_CODE_ASSERT_INTA		0x20
>> -#define ROCKCHIP_PCIE_MSG_CODE_ASSERT_INTB		0x21
>> -#define ROCKCHIP_PCIE_MSG_CODE_ASSERT_INTC		0x22
>> -#define ROCKCHIP_PCIE_MSG_CODE_ASSERT_INTD		0x23
>> -#define ROCKCHIP_PCIE_MSG_CODE_DEASSERT_INTA		0x24
>> -#define ROCKCHIP_PCIE_MSG_CODE_DEASSERT_INTB		0x25
>> -#define ROCKCHIP_PCIE_MSG_CODE_DEASSERT_INTC		0x26
>> -#define ROCKCHIP_PCIE_MSG_CODE_DEASSERT_INTD		0x27
> 
> Thanks for doing this!  In fact, these definitions are not only
> redundant, they're not even used at all.
> 
>>   #define ROCKCHIP_PCIE_MSG_ROUTING_MASK			GENMASK(7, 5)
>>   #define ROCKCHIP_PCIE_MSG_ROUTING(route) \
>>   	(((route) << 5) & ROCKCHIP_PCIE_MSG_ROUTING_MASK)
> 
> And neither are these ROUTING and CODE definitions.

Dear Bjorn,

Yes, this driver has too many unused definitions. I can delete the other 
unused definitions next. For this series, I just delete the similar 
macro definitions in drivers/pci/pci.h.

Best regards,
Hans


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

end of thread, other threads:[~2025-06-20 15:59 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-07 15:49 [PATCH 0/2] PCI: Consolidate PCIe message routing definitions and remove driver-specific duplicates Hans Zhang
2025-06-07 15:49 ` [PATCH 1/2] PCI: cadence: Replace private message routing enums with PCI core definitions Hans Zhang
2025-06-07 15:49 ` [PATCH 2/2] PCI: rockchip: Remove redundant PCIe message routing definitions Hans Zhang
2025-06-20 15:42   ` Bjorn Helgaas
2025-06-20 15:58     ` Hans Zhang
2025-06-19 12:52 ` (subset) [PATCH 0/2] PCI: Consolidate PCIe message routing definitions and remove driver-specific duplicates Manivannan Sadhasivam
2025-06-19 12:56 ` Manivannan Sadhasivam

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).