devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v5 0/3] Add support for Versal Net CPM5N Root Port controller
@ 2025-02-24 15:50 Thippeswamy Havalige
  2025-02-24 15:50 ` [PATCH v5 1/3] PCI: xilinx-cpm: Fix IRQ domain leak in error path of probe Thippeswamy Havalige
                   ` (3 more replies)
  0 siblings, 4 replies; 13+ messages in thread
From: Thippeswamy Havalige @ 2025-02-24 15:50 UTC (permalink / raw)
  To: bhelgaas, lpieralisi, kw, manivannan.sadhasivam, robh, krzk+dt,
	conor+dt
  Cc: linux-pci, devicetree, linux-kernel, michal.simek,
	bharat.kumar.gogada, Thippeswamy Havalige

Add support for Versal Net CPM5NC Root Port controller 0.

The Versal-Net ACAP devices include CCIX-PCIe Module (CPM). The integrated
block for CPM5NC along with the integrated bridge can function as PCIe Root
Port.

Bridge error in Versal-Net CPM5NC are handled using Versal-Net CPM5N
specific interrupt line & there is no support for legacy interrupts.

Thippeswamy Havalige (3):
  PCI: xilinx-cpm: Fix IRQ domain leak in error path of probe.
  dt-bindings: PCI: xilinx-cpm: Add compatible string for CPM5NC Versal
    Net host
  PCI: xilinx-cpm: Add support for Versal Net CPM5NC Root Port
    controller

 .../bindings/pci/xilinx-versal-cpm.yaml       |  1 +
 drivers/pci/controller/pcie-xilinx-cpm.c      | 44 ++++++++++++++-----
 2 files changed, 33 insertions(+), 12 deletions(-)

-- 
2.43.0


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

* [PATCH v5 1/3] PCI: xilinx-cpm: Fix IRQ domain leak in error path of probe.
  2025-02-24 15:50 [PATCH v5 0/3] Add support for Versal Net CPM5N Root Port controller Thippeswamy Havalige
@ 2025-02-24 15:50 ` Thippeswamy Havalige
  2025-02-27  5:52   ` Havalige, Thippeswamy
  2025-03-04 15:46   ` Manivannan Sadhasivam
  2025-02-24 15:50 ` [PATCH v5 2/3] dt-bindings: PCI: xilinx-cpm: Add compatible string for CPM5NC Versal Net host Thippeswamy Havalige
                   ` (2 subsequent siblings)
  3 siblings, 2 replies; 13+ messages in thread
From: Thippeswamy Havalige @ 2025-02-24 15:50 UTC (permalink / raw)
  To: bhelgaas, lpieralisi, kw, manivannan.sadhasivam, robh, krzk+dt,
	conor+dt
  Cc: linux-pci, devicetree, linux-kernel, michal.simek,
	bharat.kumar.gogada, Thippeswamy Havalige

The IRQ domain allocated for the PCIe controller is not freed if
resource_list_first_type returns NULL, leading to a resource leak.

This fix ensures properly cleaning up the allocated IRQ domain in the error
path.

Signed-off-by: Thippeswamy Havalige <thippeswamy.havalige@amd.com>
---
 drivers/pci/controller/pcie-xilinx-cpm.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/pci/controller/pcie-xilinx-cpm.c b/drivers/pci/controller/pcie-xilinx-cpm.c
index 81e8bfae53d0..660b12fc4631 100644
--- a/drivers/pci/controller/pcie-xilinx-cpm.c
+++ b/drivers/pci/controller/pcie-xilinx-cpm.c
@@ -583,8 +583,10 @@ static int xilinx_cpm_pcie_probe(struct platform_device *pdev)
 		return err;
 
 	bus = resource_list_first_type(&bridge->windows, IORESOURCE_BUS);
-	if (!bus)
+	if (!bus) {
+		xilinx_cpm_free_irq_domains(port);
 		return -ENODEV;
+	}
 
 	port->variant = of_device_get_match_data(dev);
 
-- 
2.43.0


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

* [PATCH v5 2/3] dt-bindings: PCI: xilinx-cpm: Add compatible string for CPM5NC Versal Net host
  2025-02-24 15:50 [PATCH v5 0/3] Add support for Versal Net CPM5N Root Port controller Thippeswamy Havalige
  2025-02-24 15:50 ` [PATCH v5 1/3] PCI: xilinx-cpm: Fix IRQ domain leak in error path of probe Thippeswamy Havalige
@ 2025-02-24 15:50 ` Thippeswamy Havalige
  2025-02-24 15:50 ` [PATCH v5 3/3] PCI: xilinx-cpm: Add support for Versal Net CPM5NC Root Port controller Thippeswamy Havalige
  2025-03-09 17:30 ` [PATCH v5 0/3] Add support for Versal Net CPM5N " Krzysztof Wilczyński
  3 siblings, 0 replies; 13+ messages in thread
From: Thippeswamy Havalige @ 2025-02-24 15:50 UTC (permalink / raw)
  To: bhelgaas, lpieralisi, kw, manivannan.sadhasivam, robh, krzk+dt,
	conor+dt
  Cc: linux-pci, devicetree, linux-kernel, michal.simek,
	bharat.kumar.gogada, Thippeswamy Havalige, Conor Dooley

The Xilinx Versal Net series has Coherency and PCIe Gen5 Module
Next-Generation compact (CPM5NC) block which supports Root Port
controller functionality at Gen5 speed.

Error interrupts are handled CPM5NC specific interrupt line and
INTx interrupt is not support.

Signed-off-by: Thippeswamy Havalige <thippeswamy.havalige@amd.com>
Acked-by: Conor Dooley <conor.dooley@microchip.com>
Acked-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
---
Changes in v2:
- Update commit message to INTx
Changes in v3:
- None
---
 Documentation/devicetree/bindings/pci/xilinx-versal-cpm.yaml | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/pci/xilinx-versal-cpm.yaml b/Documentation/devicetree/bindings/pci/xilinx-versal-cpm.yaml
index b63a759ec2d7..d674a24c8ccc 100644
--- a/Documentation/devicetree/bindings/pci/xilinx-versal-cpm.yaml
+++ b/Documentation/devicetree/bindings/pci/xilinx-versal-cpm.yaml
@@ -18,6 +18,7 @@ properties:
       - xlnx,versal-cpm-host-1.00
       - xlnx,versal-cpm5-host
       - xlnx,versal-cpm5-host1
+      - xlnx,versal-cpm5nc-host
 
   reg:
     items:
-- 
2.43.0


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

* [PATCH v5 3/3] PCI: xilinx-cpm: Add support for Versal Net CPM5NC Root Port controller
  2025-02-24 15:50 [PATCH v5 0/3] Add support for Versal Net CPM5N Root Port controller Thippeswamy Havalige
  2025-02-24 15:50 ` [PATCH v5 1/3] PCI: xilinx-cpm: Fix IRQ domain leak in error path of probe Thippeswamy Havalige
  2025-02-24 15:50 ` [PATCH v5 2/3] dt-bindings: PCI: xilinx-cpm: Add compatible string for CPM5NC Versal Net host Thippeswamy Havalige
@ 2025-02-24 15:50 ` Thippeswamy Havalige
  2025-03-10 17:07   ` Bjorn Helgaas
  2025-03-09 17:30 ` [PATCH v5 0/3] Add support for Versal Net CPM5N " Krzysztof Wilczyński
  3 siblings, 1 reply; 13+ messages in thread
From: Thippeswamy Havalige @ 2025-02-24 15:50 UTC (permalink / raw)
  To: bhelgaas, lpieralisi, kw, manivannan.sadhasivam, robh, krzk+dt,
	conor+dt
  Cc: linux-pci, devicetree, linux-kernel, michal.simek,
	bharat.kumar.gogada, Thippeswamy Havalige

The Versal Net ACAP (Adaptive Compute Acceleration Platform) devices
incorporate the Coherency and PCIe Gen5 Module, specifically the
Next-Generation Compact Module (CPM5NC).

The integrated CPM5NC block, along with the built-in bridge, can function
as a PCIe Root Port & supports the PCIe Gen5 protocol with data transfer
rates of up to 32 GT/s, capable of supporting up to a x16 lane-width
configuration.

Bridge errors are managed using a specific interrupt line designed for
CPM5N. INTx interrupt support is not available.

Currently in this commit platform specific Bridge errors support is not
added.

Signed-off-by: Thippeswamy Havalige <thippeswamy.havalige@amd.com>
Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
---
Changes in v2:
- Update commit message.
Changes in v3:
- Address review comments.
Changes in v4:
- Add reviewed by.
---
 drivers/pci/controller/pcie-xilinx-cpm.c | 40 +++++++++++++++++-------
 1 file changed, 29 insertions(+), 11 deletions(-)

diff --git a/drivers/pci/controller/pcie-xilinx-cpm.c b/drivers/pci/controller/pcie-xilinx-cpm.c
index 660b12fc4631..55a8b14473be 100644
--- a/drivers/pci/controller/pcie-xilinx-cpm.c
+++ b/drivers/pci/controller/pcie-xilinx-cpm.c
@@ -84,6 +84,7 @@ enum xilinx_cpm_version {
 	CPM,
 	CPM5,
 	CPM5_HOST1,
+	CPM5NC_HOST,
 };
 
 /**
@@ -478,6 +479,9 @@ static void xilinx_cpm_pcie_init_port(struct xilinx_cpm_pcie *port)
 {
 	const struct xilinx_cpm_variant *variant = port->variant;
 
+	if (variant->version != CPM5NC_HOST)
+		return;
+
 	if (cpm_pcie_link_up(port))
 		dev_info(port->dev, "PCIe Link is UP\n");
 	else
@@ -578,9 +582,13 @@ static int xilinx_cpm_pcie_probe(struct platform_device *pdev)
 
 	port->dev = dev;
 
-	err = xilinx_cpm_pcie_init_irq_domain(port);
-	if (err)
-		return err;
+	port->variant = of_device_get_match_data(dev);
+
+	if (port->variant->version != CPM5NC_HOST) {
+		err = xilinx_cpm_pcie_init_irq_domain(port);
+		if (err)
+			return err;
+	}
 
 	bus = resource_list_first_type(&bridge->windows, IORESOURCE_BUS);
 	if (!bus) {
@@ -588,8 +596,6 @@ static int xilinx_cpm_pcie_probe(struct platform_device *pdev)
 		return -ENODEV;
 	}
 
-	port->variant = of_device_get_match_data(dev);
-
 	err = xilinx_cpm_pcie_parse_dt(port, bus->res);
 	if (err) {
 		dev_err(dev, "Parsing DT failed\n");
@@ -598,10 +604,12 @@ static int xilinx_cpm_pcie_probe(struct platform_device *pdev)
 
 	xilinx_cpm_pcie_init_port(port);
 
-	err = xilinx_cpm_setup_irq(port);
-	if (err) {
-		dev_err(dev, "Failed to set up interrupts\n");
-		goto err_setup_irq;
+	if (port->variant->version != CPM5NC_HOST) {
+		err = xilinx_cpm_setup_irq(port);
+		if (err) {
+			dev_err(dev, "Failed to set up interrupts\n");
+			goto err_setup_irq;
+		}
 	}
 
 	bridge->sysdata = port->cfg;
@@ -614,11 +622,13 @@ static int xilinx_cpm_pcie_probe(struct platform_device *pdev)
 	return 0;
 
 err_host_bridge:
-	xilinx_cpm_free_interrupts(port);
+	if (port->variant->version != CPM5NC_HOST)
+		xilinx_cpm_free_interrupts(port);
 err_setup_irq:
 	pci_ecam_free(port->cfg);
 err_parse_dt:
-	xilinx_cpm_free_irq_domains(port);
+	if (port->variant->version != CPM5NC_HOST)
+		xilinx_cpm_free_irq_domains(port);
 	return err;
 }
 
@@ -641,6 +651,10 @@ static const struct xilinx_cpm_variant cpm5_host1 = {
 	.ir_enable = XILINX_CPM_PCIE1_IR_ENABLE,
 };
 
+static const struct xilinx_cpm_variant cpm5n_host = {
+	.version = CPM5NC_HOST,
+};
+
 static const struct of_device_id xilinx_cpm_pcie_of_match[] = {
 	{
 		.compatible = "xlnx,versal-cpm-host-1.00",
@@ -654,6 +668,10 @@ static const struct of_device_id xilinx_cpm_pcie_of_match[] = {
 		.compatible = "xlnx,versal-cpm5-host1",
 		.data = &cpm5_host1,
 	},
+	{
+		.compatible = "xlnx,versal-cpm5nc-host",
+		.data = &cpm5n_host,
+	},
 	{}
 };
 
-- 
2.43.0


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

* RE: [PATCH v5 1/3] PCI: xilinx-cpm: Fix IRQ domain leak in error path of probe.
  2025-02-24 15:50 ` [PATCH v5 1/3] PCI: xilinx-cpm: Fix IRQ domain leak in error path of probe Thippeswamy Havalige
@ 2025-02-27  5:52   ` Havalige, Thippeswamy
  2025-03-04 15:46   ` Manivannan Sadhasivam
  1 sibling, 0 replies; 13+ messages in thread
From: Havalige, Thippeswamy @ 2025-02-27  5:52 UTC (permalink / raw)
  To: Havalige, Thippeswamy, bhelgaas@google.com, lpieralisi@kernel.org,
	kw@linux.com, manivannan.sadhasivam@linaro.org, robh@kernel.org,
	krzk+dt@kernel.org, conor+dt@kernel.org
  Cc: linux-pci@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org, Simek, Michal, Gogada, Bharat Kumar

[AMD Official Use Only - AMD Internal Distribution Only]

Hi Manivannan/Bjorn,

Can you please provide update on this patch.

Regards,
Thippeswamy H

> -----Original Message-----
> From: Thippeswamy Havalige <thippeswamy.havalige@amd.com>
> Sent: Monday, February 24, 2025 9:20 PM
> To: bhelgaas@google.com; lpieralisi@kernel.org; kw@linux.com;
> manivannan.sadhasivam@linaro.org; robh@kernel.org; krzk+dt@kernel.org;
> conor+dt@kernel.org
> Cc: linux-pci@vger.kernel.org; devicetree@vger.kernel.org; linux-
> kernel@vger.kernel.org; Simek, Michal <michal.simek@amd.com>; Gogada,
> Bharat Kumar <bharat.kumar.gogada@amd.com>; Havalige, Thippeswamy
> <thippeswamy.havalige@amd.com>
> Subject: [PATCH v5 1/3] PCI: xilinx-cpm: Fix IRQ domain leak in error path of
> probe.
>
> The IRQ domain allocated for the PCIe controller is not freed if
> resource_list_first_type returns NULL, leading to a resource leak.
>
> This fix ensures properly cleaning up the allocated IRQ domain in the error
> path.
>
> Signed-off-by: Thippeswamy Havalige <thippeswamy.havalige@amd.com>
> ---
>  drivers/pci/controller/pcie-xilinx-cpm.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/pci/controller/pcie-xilinx-cpm.c
> b/drivers/pci/controller/pcie-xilinx-cpm.c
> index 81e8bfae53d0..660b12fc4631 100644
> --- a/drivers/pci/controller/pcie-xilinx-cpm.c
> +++ b/drivers/pci/controller/pcie-xilinx-cpm.c
> @@ -583,8 +583,10 @@ static int xilinx_cpm_pcie_probe(struct
> platform_device *pdev)
>               return err;
>
>       bus = resource_list_first_type(&bridge->windows, IORESOURCE_BUS);
> -     if (!bus)
> +     if (!bus) {
> +             xilinx_cpm_free_irq_domains(port);
>               return -ENODEV;
> +     }
>
>       port->variant = of_device_get_match_data(dev);
>
> --
> 2.43.0


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

* Re: [PATCH v5 1/3] PCI: xilinx-cpm: Fix IRQ domain leak in error path of probe.
  2025-02-24 15:50 ` [PATCH v5 1/3] PCI: xilinx-cpm: Fix IRQ domain leak in error path of probe Thippeswamy Havalige
  2025-02-27  5:52   ` Havalige, Thippeswamy
@ 2025-03-04 15:46   ` Manivannan Sadhasivam
  2025-03-09 17:35     ` Krzysztof Wilczyński
  1 sibling, 1 reply; 13+ messages in thread
From: Manivannan Sadhasivam @ 2025-03-04 15:46 UTC (permalink / raw)
  To: Thippeswamy Havalige
  Cc: bhelgaas, lpieralisi, kw, robh, krzk+dt, conor+dt, linux-pci,
	devicetree, linux-kernel, michal.simek, bharat.kumar.gogada

On Mon, Feb 24, 2025 at 09:20:22PM +0530, Thippeswamy Havalige wrote:
> The IRQ domain allocated for the PCIe controller is not freed if
> resource_list_first_type returns NULL, leading to a resource leak.
> 
> This fix ensures properly cleaning up the allocated IRQ domain in the error
> path.
> 

Missing Fixes tag.

> Signed-off-by: Thippeswamy Havalige <thippeswamy.havalige@amd.com>
> ---
>  drivers/pci/controller/pcie-xilinx-cpm.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/pci/controller/pcie-xilinx-cpm.c b/drivers/pci/controller/pcie-xilinx-cpm.c
> index 81e8bfae53d0..660b12fc4631 100644
> --- a/drivers/pci/controller/pcie-xilinx-cpm.c
> +++ b/drivers/pci/controller/pcie-xilinx-cpm.c
> @@ -583,8 +583,10 @@ static int xilinx_cpm_pcie_probe(struct platform_device *pdev)
>  		return err;
>  
>  	bus = resource_list_first_type(&bridge->windows, IORESOURCE_BUS);
> -	if (!bus)
> +	if (!bus) {
> +		xilinx_cpm_free_irq_domains(port);

Why can't you use existing 'err_parse_dt' label? If the reason is the name, just
change it to actual error case. Like, 'err_free_irq_domains'.

- Mani

-- 
மணிவண்ணன் சதாசிவம்

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

* Re: [PATCH v5 0/3] Add support for Versal Net CPM5N Root Port controller
  2025-02-24 15:50 [PATCH v5 0/3] Add support for Versal Net CPM5N Root Port controller Thippeswamy Havalige
                   ` (2 preceding siblings ...)
  2025-02-24 15:50 ` [PATCH v5 3/3] PCI: xilinx-cpm: Add support for Versal Net CPM5NC Root Port controller Thippeswamy Havalige
@ 2025-03-09 17:30 ` Krzysztof Wilczyński
  2025-03-10  5:07   ` Havalige, Thippeswamy
  3 siblings, 1 reply; 13+ messages in thread
From: Krzysztof Wilczyński @ 2025-03-09 17:30 UTC (permalink / raw)
  To: Thippeswamy Havalige
  Cc: bhelgaas, lpieralisi, manivannan.sadhasivam, robh, krzk+dt,
	conor+dt, linux-pci, devicetree, linux-kernel, michal.simek,
	bharat.kumar.gogada

Hello,

> Add support for Versal Net CPM5NC Root Port controller 0.
> 
> The Versal-Net ACAP devices include CCIX-PCIe Module (CPM). The integrated
> block for CPM5NC along with the integrated bridge can function as PCIe Root
> Port.
> 
> Bridge error in Versal-Net CPM5NC are handled using Versal-Net CPM5N
> specific interrupt line & there is no support for legacy interrupts.

Applied to controller/xilinx-cpm, thank you!

	Krzysztof

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

* Re: [PATCH v5 1/3] PCI: xilinx-cpm: Fix IRQ domain leak in error path of probe.
  2025-03-04 15:46   ` Manivannan Sadhasivam
@ 2025-03-09 17:35     ` Krzysztof Wilczyński
  2025-03-10  5:08       ` Havalige, Thippeswamy
  0 siblings, 1 reply; 13+ messages in thread
From: Krzysztof Wilczyński @ 2025-03-09 17:35 UTC (permalink / raw)
  To: Manivannan Sadhasivam
  Cc: Thippeswamy Havalige, bhelgaas, lpieralisi, robh, krzk+dt,
	conor+dt, linux-pci, devicetree, linux-kernel, michal.simek,
	bharat.kumar.gogada

Hello,

[...]
> > The IRQ domain allocated for the PCIe controller is not freed if
> > resource_list_first_type returns NULL, leading to a resource leak.
> > 
> > This fix ensures properly cleaning up the allocated IRQ domain in the error
> > path.
> > 
> 
> Missing Fixes tag.

Done.

> > Signed-off-by: Thippeswamy Havalige <thippeswamy.havalige@amd.com>
> > ---
> >  drivers/pci/controller/pcie-xilinx-cpm.c | 4 +++-
> >  1 file changed, 3 insertions(+), 1 deletion(-)
> > 
> > diff --git a/drivers/pci/controller/pcie-xilinx-cpm.c b/drivers/pci/controller/pcie-xilinx-cpm.c
> > index 81e8bfae53d0..660b12fc4631 100644
> > --- a/drivers/pci/controller/pcie-xilinx-cpm.c
> > +++ b/drivers/pci/controller/pcie-xilinx-cpm.c
> > @@ -583,8 +583,10 @@ static int xilinx_cpm_pcie_probe(struct platform_device *pdev)
> >  		return err;
> >  
> >  	bus = resource_list_first_type(&bridge->windows, IORESOURCE_BUS);
> > -	if (!bus)
> > +	if (!bus) {
> > +		xilinx_cpm_free_irq_domains(port);
> 
> Why can't you use existing 'err_parse_dt' label? If the reason is the name, just
> change it to actual error case. Like, 'err_free_irq_domains'.

Done.

I took care of the review feedback and added missing "Fixes:" tag, and
changed the code to use an existing goto label.  Both changes are already
on the branch.

Thank you!

	Krzysztof

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

* RE: [PATCH v5 0/3] Add support for Versal Net CPM5N Root Port controller
  2025-03-09 17:30 ` [PATCH v5 0/3] Add support for Versal Net CPM5N " Krzysztof Wilczyński
@ 2025-03-10  5:07   ` Havalige, Thippeswamy
  0 siblings, 0 replies; 13+ messages in thread
From: Havalige, Thippeswamy @ 2025-03-10  5:07 UTC (permalink / raw)
  To: Krzysztof Wilczyński
  Cc: bhelgaas@google.com, lpieralisi@kernel.org,
	manivannan.sadhasivam@linaro.org, robh@kernel.org,
	krzk+dt@kernel.org, conor+dt@kernel.org,
	linux-pci@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org, Simek, Michal, Gogada, Bharat Kumar

[AMD Official Use Only - AMD Internal Distribution Only]

Thank you, Krzysztof for applying patches.

Regards,
Thippeswamy H

> -----Original Message-----
> From: Krzysztof Wilczyński <kw@linux.com>
> Sent: Sunday, March 9, 2025 11:01 PM
> To: Havalige, Thippeswamy <thippeswamy.havalige@amd.com>
> Cc: bhelgaas@google.com; lpieralisi@kernel.org;
> manivannan.sadhasivam@linaro.org; robh@kernel.org; krzk+dt@kernel.org;
> conor+dt@kernel.org; linux-pci@vger.kernel.org; devicetree@vger.kernel.org;
> linux-kernel@vger.kernel.org; Simek, Michal <michal.simek@amd.com>;
> Gogada, Bharat Kumar <bharat.kumar.gogada@amd.com>
> Subject: Re: [PATCH v5 0/3] Add support for Versal Net CPM5N Root Port
> controller
>
> Hello,
>
> > Add support for Versal Net CPM5NC Root Port controller 0.
> >
> > The Versal-Net ACAP devices include CCIX-PCIe Module (CPM). The
> > integrated block for CPM5NC along with the integrated bridge can
> > function as PCIe Root Port.
> >
> > Bridge error in Versal-Net CPM5NC are handled using Versal-Net CPM5N
> > specific interrupt line & there is no support for legacy interrupts.
>
> Applied to controller/xilinx-cpm, thank you!
>
>       Krzysztof

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

* RE: [PATCH v5 1/3] PCI: xilinx-cpm: Fix IRQ domain leak in error path of probe.
  2025-03-09 17:35     ` Krzysztof Wilczyński
@ 2025-03-10  5:08       ` Havalige, Thippeswamy
  0 siblings, 0 replies; 13+ messages in thread
From: Havalige, Thippeswamy @ 2025-03-10  5:08 UTC (permalink / raw)
  To: Krzysztof Wilczyński, Manivannan Sadhasivam
  Cc: bhelgaas@google.com, lpieralisi@kernel.org, robh@kernel.org,
	krzk+dt@kernel.org, conor+dt@kernel.org,
	linux-pci@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org, Simek, Michal, Gogada, Bharat Kumar

[AMD Official Use Only - AMD Internal Distribution Only]

> -----Original Message-----
> From: Krzysztof Wilczyński <kw@linux.com>
> Sent: Sunday, March 9, 2025 11:05 PM
> To: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
> Cc: Havalige, Thippeswamy <thippeswamy.havalige@amd.com>;
> bhelgaas@google.com; lpieralisi@kernel.org; robh@kernel.org;
> krzk+dt@kernel.org; conor+dt@kernel.org; linux-pci@vger.kernel.org;
> devicetree@vger.kernel.org; linux-kernel@vger.kernel.org; Simek, Michal
> <michal.simek@amd.com>; Gogada, Bharat Kumar
> <bharat.kumar.gogada@amd.com>
> Subject: Re: [PATCH v5 1/3] PCI: xilinx-cpm: Fix IRQ domain leak in error path of
> probe.
>
> Hello,
>
> [...]
> > > The IRQ domain allocated for the PCIe controller is not freed if
> > > resource_list_first_type returns NULL, leading to a resource leak.
> > >
> > > This fix ensures properly cleaning up the allocated IRQ domain in
> > > the error path.
> > >
> >
> > Missing Fixes tag.
>
> Done.
>
> > > Signed-off-by: Thippeswamy Havalige <thippeswamy.havalige@amd.com>
> > > ---
> > >  drivers/pci/controller/pcie-xilinx-cpm.c | 4 +++-
> > >  1 file changed, 3 insertions(+), 1 deletion(-)
> > >
> > > diff --git a/drivers/pci/controller/pcie-xilinx-cpm.c
> > > b/drivers/pci/controller/pcie-xilinx-cpm.c
> > > index 81e8bfae53d0..660b12fc4631 100644
> > > --- a/drivers/pci/controller/pcie-xilinx-cpm.c
> > > +++ b/drivers/pci/controller/pcie-xilinx-cpm.c
> > > @@ -583,8 +583,10 @@ static int xilinx_cpm_pcie_probe(struct
> platform_device *pdev)
> > >           return err;
> > >
> > >   bus = resource_list_first_type(&bridge->windows, IORESOURCE_BUS);
> > > - if (!bus)
> > > + if (!bus) {
> > > +         xilinx_cpm_free_irq_domains(port);
> >
> > Why can't you use existing 'err_parse_dt' label? If the reason is the
> > name, just change it to actual error case. Like, 'err_free_irq_domains'.
>
> Done.
>
> I took care of the review feedback and added missing "Fixes:" tag, and changed
> the code to use an existing goto label.  Both changes are already on the branch.
>
> Thank you!
Thank you, Krzysztof for making changes & applying patches.
>
>       Krzysztof

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

* Re: [PATCH v5 3/3] PCI: xilinx-cpm: Add support for Versal Net CPM5NC Root Port controller
  2025-02-24 15:50 ` [PATCH v5 3/3] PCI: xilinx-cpm: Add support for Versal Net CPM5NC Root Port controller Thippeswamy Havalige
@ 2025-03-10 17:07   ` Bjorn Helgaas
  2025-03-11 15:59     ` Bjorn Helgaas
  0 siblings, 1 reply; 13+ messages in thread
From: Bjorn Helgaas @ 2025-03-10 17:07 UTC (permalink / raw)
  To: Thippeswamy Havalige
  Cc: bhelgaas, lpieralisi, kw, manivannan.sadhasivam, robh, krzk+dt,
	conor+dt, linux-pci, devicetree, linux-kernel, michal.simek,
	bharat.kumar.gogada

On Mon, Feb 24, 2025 at 09:20:24PM +0530, Thippeswamy Havalige wrote:
> The Versal Net ACAP (Adaptive Compute Acceleration Platform) devices
> incorporate the Coherency and PCIe Gen5 Module, specifically the
> Next-Generation Compact Module (CPM5NC).
> 
> The integrated CPM5NC block, along with the built-in bridge, can function
> as a PCIe Root Port & supports the PCIe Gen5 protocol with data transfer
> rates of up to 32 GT/s, capable of supporting up to a x16 lane-width
> configuration.
> 
> Bridge errors are managed using a specific interrupt line designed for
> CPM5N. INTx interrupt support is not available.
> 
> Currently in this commit platform specific Bridge errors support is not
> added.

> @@ -478,6 +479,9 @@ static void xilinx_cpm_pcie_init_port(struct xilinx_cpm_pcie *port)
>  {
>  	const struct xilinx_cpm_variant *variant = port->variant;
>  
> +	if (variant->version != CPM5NC_HOST)
> +		return;

You're adding support for CPM5NC_HOST, but this changes the behavior
for all the NON-CPM5NC_HOST devices, which looks like a typo.

Should it be "variant->version == CPM5NC_HOST" instead?

>  	if (cpm_pcie_link_up(port))
>  		dev_info(port->dev, "PCIe Link is UP\n");
>  	else
> @@ -578,9 +582,13 @@ static int xilinx_cpm_pcie_probe(struct platform_device *pdev)
>  
>  	port->dev = dev;
>  
> -	err = xilinx_cpm_pcie_init_irq_domain(port);
> -	if (err)
> -		return err;
> +	port->variant = of_device_get_match_data(dev);
> +
> +	if (port->variant->version != CPM5NC_HOST) {
> +		err = xilinx_cpm_pcie_init_irq_domain(port);

  xilinx_cpm_pcie_init_port()
  {
    if (variant->version != CPM5NC_HOST)
      return;
    ...

  xilinx_cpm_pcie_probe()
  {
    ...
    if (port->variant->version != CPM5NC_HOST) {
      err = xilinx_cpm_pcie_init_irq_domain(port);
    ...
    xilinx_cpm_pcie_init_port();
    ...
    if (port->variant->version != CPM5NC_HOST) {
      err = xilinx_cpm_setup_irq(port);
    ...
  err_host_bridge:
    if (port->variant->version != CPM5NC_HOST)
      xilinx_cpm_free_interrupts(port);
    ...
  err_free_irq_domains:
    if (port->variant->version != CPM5NC_HOST)
      xilinx_cpm_free_irq_domains(port);

Right now one CPM5NC_HOST test is inside xilinx_cpm_pcie_init_port()
all the others are in xilinx_cpm_pcie_probe().

I think it would be nicer if the tests were inside
xilinx_cpm_pcie_init_irq_domain(), xilinx_cpm_setup_irq(),
xilinx_cpm_free_interrupts(), and xilinx_cpm_free_irq_domains() so
they're all done the same way and they're closer to the actual
differences instead of cluttering xilinx_cpm_pcie_probe().

Also, this makes it look like CPM5NC_HOST doesn't support any
interrupts at all.  No INTx, no MSI, no MSI-X.  Is that true?  If so,
what good is a host controller where interrupts don't work?

Bjorn

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

* Re: [PATCH v5 3/3] PCI: xilinx-cpm: Add support for Versal Net CPM5NC Root Port controller
  2025-03-10 17:07   ` Bjorn Helgaas
@ 2025-03-11 15:59     ` Bjorn Helgaas
  2025-03-11 16:21       ` Havalige, Thippeswamy
  0 siblings, 1 reply; 13+ messages in thread
From: Bjorn Helgaas @ 2025-03-11 15:59 UTC (permalink / raw)
  To: Thippeswamy Havalige
  Cc: bhelgaas, lpieralisi, kw, manivannan.sadhasivam, robh, krzk+dt,
	conor+dt, linux-pci, devicetree, linux-kernel, michal.simek,
	bharat.kumar.gogada

On Mon, Mar 10, 2025 at 12:07:17PM -0500, Bjorn Helgaas wrote:
> On Mon, Feb 24, 2025 at 09:20:24PM +0530, Thippeswamy Havalige wrote:
> > The Versal Net ACAP (Adaptive Compute Acceleration Platform) devices
> > incorporate the Coherency and PCIe Gen5 Module, specifically the
> > Next-Generation Compact Module (CPM5NC).
> > 
> > The integrated CPM5NC block, along with the built-in bridge, can function
> > as a PCIe Root Port & supports the PCIe Gen5 protocol with data transfer
> > rates of up to 32 GT/s, capable of supporting up to a x16 lane-width
> > configuration.
> > 
> > Bridge errors are managed using a specific interrupt line designed for
> > CPM5N. INTx interrupt support is not available.
> > 
> > Currently in this commit platform specific Bridge errors support is not
> > added.
> 
> > @@ -478,6 +479,9 @@ static void xilinx_cpm_pcie_init_port(struct xilinx_cpm_pcie *port)
> >  {
> >  	const struct xilinx_cpm_variant *variant = port->variant;
> >  
> > +	if (variant->version != CPM5NC_HOST)
> > +		return;
> 
> You're adding support for CPM5NC_HOST, but this changes the behavior
> for all the NON-CPM5NC_HOST devices, which looks like a typo.
> 
> Should it be "variant->version == CPM5NC_HOST" instead?

Thanks for your patch that fixes this part.

> Also, this makes it look like CPM5NC_HOST doesn't support any
> interrupts at all.  No INTx, no MSI, no MSI-X.  Is that true?  If so,
> what good is a host controller where interrupts don't work?

Does this controller support interrupts?

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

* RE: [PATCH v5 3/3] PCI: xilinx-cpm: Add support for Versal Net CPM5NC Root Port controller
  2025-03-11 15:59     ` Bjorn Helgaas
@ 2025-03-11 16:21       ` Havalige, Thippeswamy
  0 siblings, 0 replies; 13+ messages in thread
From: Havalige, Thippeswamy @ 2025-03-11 16:21 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: bhelgaas@google.com, lpieralisi@kernel.org, kw@linux.com,
	manivannan.sadhasivam@linaro.org, robh@kernel.org,
	krzk+dt@kernel.org, conor+dt@kernel.org,
	linux-pci@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org, Simek, Michal, Gogada, Bharat Kumar

[AMD Official Use Only - AMD Internal Distribution Only]

Hi Bjorn,

> -----Original Message-----
> From: Bjorn Helgaas <helgaas@kernel.org>
> Sent: Tuesday, March 11, 2025 9:30 PM
> To: Havalige, Thippeswamy <thippeswamy.havalige@amd.com>
> Cc: bhelgaas@google.com; lpieralisi@kernel.org; kw@linux.com;
> manivannan.sadhasivam@linaro.org; robh@kernel.org; krzk+dt@kernel.org;
> conor+dt@kernel.org; linux-pci@vger.kernel.org; devicetree@vger.kernel.org;
> linux-kernel@vger.kernel.org; Simek, Michal <michal.simek@amd.com>;
> Gogada, Bharat Kumar <bharat.kumar.gogada@amd.com>
> Subject: Re: [PATCH v5 3/3] PCI: xilinx-cpm: Add support for Versal Net CPM5NC
> Root Port controller
>
> On Mon, Mar 10, 2025 at 12:07:17PM -0500, Bjorn Helgaas wrote:
> > On Mon, Feb 24, 2025 at 09:20:24PM +0530, Thippeswamy Havalige wrote:
> > > The Versal Net ACAP (Adaptive Compute Acceleration Platform) devices
> > > incorporate the Coherency and PCIe Gen5 Module, specifically the
> > > Next-Generation Compact Module (CPM5NC).
> > >
> > > The integrated CPM5NC block, along with the built-in bridge, can function
> > > as a PCIe Root Port & supports the PCIe Gen5 protocol with data transfer
> > > rates of up to 32 GT/s, capable of supporting up to a x16 lane-width
> > > configuration.
> > >
> > > Bridge errors are managed using a specific interrupt line designed for
> > > CPM5N. INTx interrupt support is not available.
> > >
> > > Currently in this commit platform specific Bridge errors support is not
> > > added.
> >
> > > @@ -478,6 +479,9 @@ static void xilinx_cpm_pcie_init_port(struct
> xilinx_cpm_pcie *port)
> > >  {
> > >   const struct xilinx_cpm_variant *variant = port->variant;
> > >
> > > + if (variant->version != CPM5NC_HOST)
> > > +         return;
> >
> > You're adding support for CPM5NC_HOST, but this changes the behavior
> > for all the NON-CPM5NC_HOST devices, which looks like a typo.
> >
> > Should it be "variant->version == CPM5NC_HOST" instead?
>
> Thanks for your patch that fixes this part.
>
> > Also, this makes it look like CPM5NC_HOST doesn't support any
> > interrupts at all.  No INTx, no MSI, no MSI-X.  Is that true?  If so,
> > what good is a host controller where interrupts don't work?
>
> Does this controller support interrupts?

Yes, CPM5NC controller supports MSI & MSI-X via gic-its.

Regards,
Thippeswamy H

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

end of thread, other threads:[~2025-03-11 16:21 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-24 15:50 [PATCH v5 0/3] Add support for Versal Net CPM5N Root Port controller Thippeswamy Havalige
2025-02-24 15:50 ` [PATCH v5 1/3] PCI: xilinx-cpm: Fix IRQ domain leak in error path of probe Thippeswamy Havalige
2025-02-27  5:52   ` Havalige, Thippeswamy
2025-03-04 15:46   ` Manivannan Sadhasivam
2025-03-09 17:35     ` Krzysztof Wilczyński
2025-03-10  5:08       ` Havalige, Thippeswamy
2025-02-24 15:50 ` [PATCH v5 2/3] dt-bindings: PCI: xilinx-cpm: Add compatible string for CPM5NC Versal Net host Thippeswamy Havalige
2025-02-24 15:50 ` [PATCH v5 3/3] PCI: xilinx-cpm: Add support for Versal Net CPM5NC Root Port controller Thippeswamy Havalige
2025-03-10 17:07   ` Bjorn Helgaas
2025-03-11 15:59     ` Bjorn Helgaas
2025-03-11 16:21       ` Havalige, Thippeswamy
2025-03-09 17:30 ` [PATCH v5 0/3] Add support for Versal Net CPM5N " Krzysztof Wilczyński
2025-03-10  5:07   ` Havalige, Thippeswamy

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).