Skip to contentSkip to conversation

Adding support for versal CPM as Root Port driver.

PATCH Superseded Bharat Kumar Gogada 5 participants 9 messages Dec 20, 2019 – Feb 25, 2020

Subsystems (5)

v1 of 9 Superseded Latest is v9 →

lore
Share & tools
lore
#0 lore raw

cover Adding support for versal CPM as Root Port driver.

- Adding support for versal CPM as Root port.
- The Versal ACAP devices include CCIX-PCIe Module (CPM). The integrated block for CPM along with the integrated bridge can function as PCIe Root Port.
- Versal CPM uses GICv3 ITS feature for assigning MSI/MSI-X vectors and handling MSI/MSI-X interrupts.
- Bridge error and legacy interrupts in versal CPM are handled using versal CPM specific MISC interrupt line.

Bharat Kumar Gogada (2):
PCI: Versal CPM: Add device tree binding forversal CPM host controller
PCI: Versal CPM: Add support for Versal CPM Root Port driver

 .../devicetree/bindings/pci/xilinx-versal-cpm.txt  |  66 +++
 drivers/pci/controller/Kconfig                     |   8 +
 drivers/pci/controller/Makefile                    |   1 +
 drivers/pci/controller/pcie-xilinx-cpm.c           | 511 +++++++++++++++++++++
 4 files changed, 586 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/pci/xilinx-versal-cpm.txt
 create mode 100644 drivers/pci/controller/pcie-xilinx-cpm.c
Signature · 1 line
2.7.4
#1 lore raw

PATCH 1/2 PCI: Versal CPM: Add device tree binding forversal CPM host controller

Adding device tree binding documentation for versal CPM Root Port driver.

---
 .../devicetree/bindings/pci/xilinx-versal-cpm.txt  | 66 ++++++++++++++++++++++
 1 file changed, 66 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/pci/xilinx-versal-cpm.txt
Documentation/devicetree/bindings/pci/xilinx-versal-cpm.txt new file +66 -0
new file mode 100644
index 0000000..35f8556
@@ -0,0 +1,66 @@
+* Xilinx Versal CPM DMA Root Port Bridge DT description
+
+Required properties:
+- #address-cells: Address representation for root ports, set to <3>
+- #size-cells: Size representation for root ports, set to <2>
+- #interrupt-cells: specifies the number of cells needed to encode an
+	interrupt source. The value must be 1.
+- compatible: Should contain "xlnx,versal-cpm-host-1.00"
+- reg: Should contain configuration space (includes bridge registers) and
+	CPM system level control and status registers, and length
+- reg-names: Must include the following entries:
+	"cfg": configuration space region and bridge registers
+	"cpm_slcr": CPM system level control and status registers
+- interrupts: Should contain AXI PCIe interrupt
+- interrupt-map-mask,
+  interrupt-map: standard PCI properties to define the mapping of the
+	PCI interface to interrupt numbers.
+- ranges: ranges for the PCI memory regions (I/O space region is not
+	supported by hardware)
+	Please refer to the standard PCI bus binding document for a more
+	detailed explanation
+- msi-map: Maps a Requester ID to an MSI controller and associated MSI
+	sideband data
+- interrupt-names: Must include the following entries:
+	"misc": interrupt asserted when legacy or error interrupt is received
+
+Interrupt controller child node
++++++++++++++++++++++++++++++++
+Required properties:
+- interrupt-controller: identifies the node as an interrupt controller
+- #address-cells: specifies the number of cells needed to encode an
+	address. The value must be 0.
+- #interrupt-cells: specifies the number of cells needed to encode an
+	interrupt source. The value must be 1.
+
+
+Refer to the following binding document for more detailed description on
+the use of 'msi-map':
+	 Documentation/devicetree/bindings/pci/pci-msi.txt
+
+Example:
+	pci@fca10000 {
+		#address-cells = <3>;
+		#interrupt-cells = <1>;
+		#size-cells = <2>;
+		compatible = "xlnx,versal-cpm-host-1.00";
+		interrupt-map = <0 0 0 1 &pcie_intc_0 1>,
+				<0 0 0 2 &pcie_intc_0 2>,
+				<0 0 0 3 &pcie_intc_0 3>,
+				<0 0 0 4 &pcie_intc_0 4>;
+		interrupt-map-mask = <0 0 0 7>;
+		interrupt-parent = <&gic>;
+		interrupt-names = "misc";
+		interrupts = <0 72 4>;
+		ranges = <0x02000000 0x00000000 0xE0000000 0x0 0xE0000000 0x00000000 0x10000000>,
+			 <0x43000000 0x00000080 0x00000000 0x00000080 0x00000000 0x00000000 0x80000000>;
+		msi-map = <0x0 &its_gic 0x0 0x10000>;
+		reg = <0x6 0x00000000 0x0 0x1000000>,
+		      <0x0 0xFCA10000 0x0 0x1000>;
+		reg-names = "cfg", "cpm_slcr";
+		pcie_intc_0: pci-interrupt-controller {
+			#address-cells = <0>;
+			#interrupt-cells = <1>;
+			interrupt-controller ;
+		};
+	};
Signature · 1 line
2.7.4
#2 lore raw

Re: [PATCH 1/2] PCI: Versal CPM: Add device tree binding forversal CPM host controller

Quoted 54 lines · Bharat Kumar Gogada

Adding device tree binding documentation for versal CPM Root Port driver.

---
 .../devicetree/bindings/pci/xilinx-versal-cpm.txt  | 66 ++++++++++++++++++++++
 1 file changed, 66 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/pci/xilinx-versal-cpm.txt
Documentation/devicetree/bindings/pci/xilinx-versal-cpm.txt new file +40 -0
new file mode 100644
index 0000000..35f8556
@@ -0,0 +1,66 @@
+* Xilinx Versal CPM DMA Root Port Bridge DT description
+
+Required properties:
+- #address-cells: Address representation for root ports, set to <3>
+- #size-cells: Size representation for root ports, set to <2>
+- #interrupt-cells: specifies the number of cells needed to encode an
+	interrupt source. The value must be 1.
+- compatible: Should contain "xlnx,versal-cpm-host-1.00"
+- reg: Should contain configuration space (includes bridge registers) and
+	CPM system level control and status registers, and length
+- reg-names: Must include the following entries:
+	"cfg": configuration space region and bridge registers
+	"cpm_slcr": CPM system level control and status registers
+- interrupts: Should contain AXI PCIe interrupt
+- interrupt-map-mask,
+  interrupt-map: standard PCI properties to define the mapping of the
+	PCI interface to interrupt numbers.
+- ranges: ranges for the PCI memory regions (I/O space region is not
+	supported by hardware)
+	Please refer to the standard PCI bus binding document for a more
+	detailed explanation
+- msi-map: Maps a Requester ID to an MSI controller and associated MSI
+	sideband data
+- interrupt-names: Must include the following entries:
+	"misc": interrupt asserted when legacy or error interrupt is received
+
+Interrupt controller child node
++++++++++++++++++++++++++++++++
+Required properties:
+- interrupt-controller: identifies the node as an interrupt controller
+- #address-cells: specifies the number of cells needed to encode an
+	address. The value must be 0.
+- #interrupt-cells: specifies the number of cells needed to encode an
+	interrupt source. The value must be 1.
+
+
+Refer to the following binding document for more detailed description on
+the use of 'msi-map':
+	 Documentation/devicetree/bindings/pci/pci-msi.txt
+

Documentation/devicetree/bindings/pci/xilinx-versal-cpm.txt line 50

Quoted 10 lines
Documentation/devicetree/bindings/pci/xilinx-versal-cpm.txt new file +10 -0
+Example:
+	pci@fca10000 {
+		#address-cells = <3>;
+		#interrupt-cells = <1>;
+		#size-cells = <2>;
+		compatible = "xlnx,versal-cpm-host-1.00";
+		interrupt-map = <0 0 0 1 &pcie_intc_0 1>,
+				<0 0 0 2 &pcie_intc_0 2>,
+				<0 0 0 3 &pcie_intc_0 3>,
+				<0 0 0 4 &pcie_intc_0 4>;

This is wrong, interrupts map to pin 0,1,2,3 of pcie_intc.

That's what's forcing you to use the pci_irqd_intx_xlate() function and that's completely wrong.

I should find a way to write a common binding for all the host bridges interrupt-map since this comes up over and over again.

Please have a look at:

Documentation/devicetree/bindings/pci/faraday,ftpci100.txt

Quoted 19 lines
Documentation/devicetree/bindings/pci/xilinx-versal-cpm.txt new file +16 -0
+		interrupt-map-mask = <0 0 0 7>;
+		interrupt-parent = <&gic>;
+		interrupt-names = "misc";
+		interrupts = <0 72 4>;
+		ranges = <0x02000000 0x00000000 0xE0000000 0x0 0xE0000000 0x00000000 0x10000000>,
+			 <0x43000000 0x00000080 0x00000000 0x00000080 0x00000000 0x00000000 0x80000000>;
+		msi-map = <0x0 &its_gic 0x0 0x10000>;
+		reg = <0x6 0x00000000 0x0 0x1000000>,
+		      <0x0 0xFCA10000 0x0 0x1000>;
+		reg-names = "cfg", "cpm_slcr";
+		pcie_intc_0: pci-interrupt-controller {
+			#address-cells = <0>;
+			#interrupt-cells = <1>;
+			interrupt-controller ;
+		};
+	};
Signature · 1 line
2.7.4
#3 lore raw

RE: [PATCH 1/2] PCI: Versal CPM: Add device tree binding forversal CPM host controller

Quoted 78 lines · Bharat Kumar Gogada
Quoted 60 lines

Adding device tree binding documentation for versal CPM Root Port driver.

---
 .../devicetree/bindings/pci/xilinx-versal-cpm.txt  | 66
++++++++++++++++++++++
 1 file changed, 66 insertions(+)
 create mode 100644

Documentation/devicetree/bindings/pci/xilinx-versal-cpm.txt

diff --git a/Documentation/devicetree/bindings/pci/xilinx-versal-cpm.txt b/Documentation/devicetree/bindings/pci/xilinx-versal-cpm.txt new file mode 100644
index 0000000..35f8556

Documentation/devicetree/bindings/pci/xilinx-versal-cpm.txt new file +42 -0
@@ -0,0 +1,66 @@
+* Xilinx Versal CPM DMA Root Port Bridge DT description
+
+Required properties:
+- #address-cells: Address representation for root ports, set to <3>
+- #size-cells: Size representation for root ports, set to <2>
+- #interrupt-cells: specifies the number of cells needed to encode an
+	interrupt source. The value must be 1.
+- compatible: Should contain "xlnx,versal-cpm-host-1.00"
+- reg: Should contain configuration space (includes bridge registers) and
+	CPM system level control and status registers, and length
+- reg-names: Must include the following entries:
+	"cfg": configuration space region and bridge registers
+	"cpm_slcr": CPM system level control and status registers
+- interrupts: Should contain AXI PCIe interrupt
+- interrupt-map-mask,
+  interrupt-map: standard PCI properties to define the mapping of the
+	PCI interface to interrupt numbers.
+- ranges: ranges for the PCI memory regions (I/O space region is not
+	supported by hardware)
+	Please refer to the standard PCI bus binding document for a more
+	detailed explanation
+- msi-map: Maps a Requester ID to an MSI controller and associated MSI
+	sideband data
+- interrupt-names: Must include the following entries:
+	"misc": interrupt asserted when legacy or error interrupt is
+received
+
+Interrupt controller child node
++++++++++++++++++++++++++++++++
+Required properties:
+- interrupt-controller: identifies the node as an interrupt
+controller
+- #address-cells: specifies the number of cells needed to encode an
+	address. The value must be 0.
+- #interrupt-cells: specifies the number of cells needed to encode an
+	interrupt source. The value must be 1.
+
+
+Refer to the following binding document for more detailed description
+on the use of 'msi-map':
+	 Documentation/devicetree/bindings/pci/pci-msi.txt
+

Documentation/devicetree/bindings/pci/xilinx-versal-cpm.txt line 52

Quoted 10 lines
Documentation/devicetree/bindings/pci/xilinx-versal-cpm.txt new file +10 -0
+Example:
+	pci@fca10000 {
+		#address-cells = <3>;
+		#interrupt-cells = <1>;
+		#size-cells = <2>;
+		compatible = "xlnx,versal-cpm-host-1.00";
+		interrupt-map = <0 0 0 1 &pcie_intc_0 1>,
+				<0 0 0 2 &pcie_intc_0 2>,
+				<0 0 0 3 &pcie_intc_0 3>,
+				<0 0 0 4 &pcie_intc_0 4>;

This is wrong, interrupts map to pin 0,1,2,3 of pcie_intc.

That's what's forcing you to use the pci_irqd_intx_xlate() function and that's completely wrong.

Quoted 6 lines

I should find a way to write a common binding for all the host bridges interrupt- map since this comes up over and over again.

Please have a look at:

Documentation/devicetree/bindings/pci/faraday,ftpci100.txt

Thanks Lorenzo, will fix this in next patch.

Quoted 23 lines

Documentation/devicetree/bindings/pci/xilinx-versal-cpm.txt

Quoted 7 lines
Documentation/devicetree/bindings/pci/xilinx-versal-cpm.txt new file +5 -0
+		interrupt-map-mask = <0 0 0 7>;
+		interrupt-parent = <&gic>;
+		interrupt-names = "misc";
+		interrupts = <0 72 4>;
+		ranges = <0x02000000 0x00000000 0xE0000000 0x0

0xE0000000 0x00000000 0x10000000>,

Documentation/devicetree/bindings/pci/xilinx-versal-cpm.txt line 58

Quoted 1 line
Documentation/devicetree/bindings/pci/xilinx-versal-cpm.txt new file +1 -0
+			 <0x43000000 0x00000080 0x00000000 0x00000080

0x00000000 0x00000000 0x80000000>;

Quoted 13 lines
Documentation/devicetree/bindings/pci/xilinx-versal-cpm.txt new file +10 -1
+		msi-map = <0x0 &its_gic 0x0 0x10000>;
+		reg = <0x6 0x00000000 0x0 0x1000000>,
+		      <0x0 0xFCA10000 0x0 0x1000>;
+		reg-names = "cfg", "cpm_slcr";
+		pcie_intc_0: pci-interrupt-controller {
+			#address-cells = <0>;
+			#interrupt-cells = <1>;
+			interrupt-controller ;
+		};
+	};
--

2.7.4

#4 lore raw

PATCH 2/2 PCI: Versal CPM: Add support for Versal CPM Root Port driver

In reply to Bharat Kumar Gogada

- Adding support for versal CPM as Root Port.
- The Versal ACAP devices include CCIX-PCIe Module (CPM). The integrated block for CPM along with the integrated bridge can function as PCIe Root Port.
- Versal CPM uses GICv3 ITS feature for assigning MSI/MSI-X vectors and handling MSI/MSI-X interrupts.
- Bridge error and legacy interrupts in versal CPM are handled using versal CPM specific MISC interrupt line.

---
 drivers/pci/controller/Kconfig           |   8 +
 drivers/pci/controller/Makefile          |   1 +
 drivers/pci/controller/pcie-xilinx-cpm.c | 511 +++++++++++++++++++++++++++++++
 3 files changed, 520 insertions(+)
 create mode 100644 drivers/pci/controller/pcie-xilinx-cpm.c
drivers/pci/controller/Kconfig +8 -0
index c77069c..eca496d 100644
@@ -81,6 +81,14 @@ config PCIE_XILINX
 	  Say 'Y' here if you want kernel to support the Xilinx AXI PCIe
 	  Host Bridge driver.
 
+config PCIE_XILINX_CPM
+	bool "Xilinx Versal CPM host bridge support"
+	depends on ARCH_ZYNQMP || COMPILE_TEST
+	help
+	  Say 'Y' here if you want kernel to enable support the
+	  Xilinx Versal CPM host Bridge driver.The driver supports
+	  MSI/MSI-X interrupts using GICv3 ITS feature.
+
 config PCI_XGENE
 	bool "X-Gene PCIe controller"
 	depends on ARM64 || COMPILE_TEST
drivers/pci/controller/Makefile +1 -0
index 3d4f597..6c936e9 100644
@@ -12,6 +12,7 @@ obj-$(CONFIG_PCI_HOST_COMMON) += pci-host-common.o
 obj-$(CONFIG_PCI_HOST_GENERIC) += pci-host-generic.o
 obj-$(CONFIG_PCIE_XILINX) += pcie-xilinx.o
 obj-$(CONFIG_PCIE_XILINX_NWL) += pcie-xilinx-nwl.o
+obj-$(CONFIG_PCIE_XILINX_CPM) += pcie-xilinx-cpm.o
 obj-$(CONFIG_PCI_V3_SEMI) += pci-v3-semi.o
 obj-$(CONFIG_PCI_XGENE_MSI) += pci-xgene-msi.o
 obj-$(CONFIG_PCI_VERSATILE) += pci-versatile.o
drivers/pci/controller/pcie-xilinx-cpm.c new file +511 -0

511 lines not on this page · raw message

Signature · 1 line
2.7.4
#5 lore raw

Re: [PATCH 2/2] PCI: Versal CPM: Add support for Versal CPM Root Port driver

[+cc other drivers that use the broken "is link up" test in config access]

Quoted 8 lines · Bharat Kumar Gogada

- Adding support for versal CPM as Root Port.
- The Versal ACAP devices include CCIX-PCIe Module (CPM). The integrated block for CPM along with the integrated bridge can function as PCIe Root Port.
- Versal CPM uses GICv3 ITS feature for assigning MSI/MSI-X vectors and handling MSI/MSI-X interrupts.
- Bridge error and legacy interrupts in versal CPM are handled using versal CPM specific MISC interrupt line.

"Versal" appears to be a brand name and should be capitalized consistently.

Quoted 1 line

+#define INTX_NUM 4

Don't we have a generic PCI core definition for this?

Quoted 1 line

+static inline bool cpm_pcie_link_is_up(struct xilinx_cpm_pcie_port *port)

Please follow the example of other drivers and name this "cpm_pcie_link_up()".

Quoted 11 lines
drivers/pci/controller/pcie-xilinx-cpm.c new file +10 -0
+{
+	return (pcie_read(port, XILINX_CPM_PCIE_REG_PSCR) &
+		XILINX_CPM_PCIE_REG_PSCR_LNKUP) ? 1 : 0;
+}
 
+/**
+ * xilinx_cpm_pcie_valid_device - Check if a valid device is present on bus
+ * @bus: PCI Bus structure
+ * @devfn: device/function
+ *
+ * Return: 'true' on success and 'false' if invalid device is found

drivers/pci/controller/pcie-xilinx-cpm.c line 146

Quoted 10 lines
drivers/pci/controller/pcie-xilinx-cpm.c new file +10 -0
+ */
+static bool xilinx_cpm_pcie_valid_device(struct pci_bus *bus,
+					 unsigned int devfn)
+{
+	struct xilinx_cpm_pcie_port *port = bus->sysdata;
+
+	/* Check if link is up when trying to access downstream ports */
+	if (bus->number != port->root_busno)
+		if (!cpm_pcie_link_is_up(port))
+			return false;

This check for the link being up is racy and should be removed. The link may go down after the check and before the config access.

A config access to a device where the link is down is an error, but it's an error we expect to happen because of enumeration, surprise unplug, or electrical issue. It's impossible to avoid so we must be able to handle and recover from it.

I know there are other drivers that do this (dwc, altera, xilinix-nwl, xilinx), and I've pointed this out many times in the past. This needs to be fixed.

drivers/pci/controller/pcie-xilinx-cpm.c line 220

Quoted 12 lines
drivers/pci/controller/pcie-xilinx-cpm.c new file +11 -0
+
+	/* Only one device down on each root port */
+	if (bus->number == port->root_busno && devfn > 0)
+		return false;
+
+	return true;
+}
 
+static irqreturn_t xilinx_cpm_pcie_intr_handler(int irq, void *data)
+{
+	struct xilinx_cpm_pcie_port *port =
+				(struct xilinx_cpm_pcie_port *)data;
  struct device *dev = port->dev;

to reduce repetition of "port->dev" below.

Quoted 17 lines
drivers/pci/controller/pcie-xilinx-cpm.c new file +16 -0
+	u32 val, mask, status, bit;
+	unsigned long intr_val;
+
+	/* Read interrupt decode and mask registers */
+	val = pcie_read(port, XILINX_CPM_PCIE_REG_IDR);
+	mask = pcie_read(port, XILINX_CPM_PCIE_REG_IMR);
+
+	status = val & mask;
+	if (!status)
+		return IRQ_NONE;
+
+	if (status & XILINX_CPM_PCIE_INTR_LINK_DOWN)
+		dev_warn(port->dev, "Link Down\n");
+
+	if (status & XILINX_CPM_PCIE_INTR_HOT_RESET)
+		dev_info(port->dev, "Hot reset\n");
...
#6 lore raw

RE: [PATCH 2/2] PCI: Versal CPM: Add support for Versal CPM Root Port driver

Quoted 15 lines

Subject: Re: [PATCH 2/2] PCI: Versal CPM: Add support for Versal CPM Root Port driver

[+cc other drivers that use the broken "is link up" test in config access]

Quoted 8 lines · Bharat Kumar Gogada

- Adding support for versal CPM as Root Port.
- The Versal ACAP devices include CCIX-PCIe Module (CPM). The integrated block for CPM along with the integrated bridge can function as PCIe Root Port.
- Versal CPM uses GICv3 ITS feature for assigning MSI/MSI-X vectors and handling MSI/MSI-X interrupts.
- Bridge error and legacy interrupts in versal CPM are handled using versal CPM specific MISC interrupt line.

Quoted 5 lines

"Versal" appears to be a brand name and should be capitalized consistently.

Quoted 1 line

+#define INTX_NUM 4

Don't we have a generic PCI core definition for this?

Thanks Bjorn, will fix this with core definition.

Quoted 5 lines

Review

Quoted 3 lines
(quoted diff) +2 -0
+static inline bool cpm_pcie_link_is_up(struct xilinx_cpm_pcie_port
+*port)

Please follow the example of other drivers and name this "cpm_pcie_link_up()".

Agreed, will change the name.

Quoted 25 lines
Quoted 11 lines
drivers/pci/controller/pcie-xilinx-cpm.c new file +9 -0
+{
+	return (pcie_read(port, XILINX_CPM_PCIE_REG_PSCR) &
+		XILINX_CPM_PCIE_REG_PSCR_LNKUP) ? 1 : 0; }
 
+/**
+ * xilinx_cpm_pcie_valid_device - Check if a valid device is present
+on bus
+ * @bus: PCI Bus structure
+ * @devfn: device/function
+ *

drivers/pci/controller/pcie-xilinx-cpm.c line 146

Quoted 10 lines
drivers/pci/controller/pcie-xilinx-cpm.c new file +10 -0
+ * Return: 'true' on success and 'false' if invalid device is found
+*/ static bool xilinx_cpm_pcie_valid_device(struct pci_bus *bus,
+					 unsigned int devfn)
+{
+	struct xilinx_cpm_pcie_port *port = bus->sysdata;
+
+	/* Check if link is up when trying to access downstream ports */
+	if (bus->number != port->root_busno)
+		if (!cpm_pcie_link_is_up(port))
+			return false;

This check for the link being up is racy and should be removed. The link may go down after the check and before the config access.

Quoted 6 lines

A config access to a device where the link is down is an error, but it's an error we expect to happen because of enumeration, surprise unplug, or electrical issue. It's impossible to avoid so we must be able to handle and recover from it.

I know there are other drivers that do this (dwc, altera, xilinix-nwl, xilinx), and I've pointed this out many times in the past. This needs to be fixed.

Agreed, will fix this check.

Quoted 9 lines
Quoted 8 lines
drivers/pci/controller/pcie-xilinx-cpm.c new file +7 -0
+
+	/* Only one device down on each root port */
+	if (bus->number == port->root_busno && devfn > 0)
+		return false;
+
+	return true;
+}
Quoted 8 lines

drivers/pci/controller/pcie-xilinx-cpm.c line 220

Quoted 4 lines
drivers/pci/controller/pcie-xilinx-cpm.c new file +4 -0
+static irqreturn_t xilinx_cpm_pcie_intr_handler(int irq, void *data)
+{
+	struct xilinx_cpm_pcie_port *port =
+				(struct xilinx_cpm_pcie_port *)data;
  struct device *dev = port->dev;

to reduce repetition of "port->dev" below.

Agreed, will fix this.

Quoted 17 lines
Quoted 17 lines
drivers/pci/controller/pcie-xilinx-cpm.c new file +16 -0
+	u32 val, mask, status, bit;
+	unsigned long intr_val;
+
+	/* Read interrupt decode and mask registers */
+	val = pcie_read(port, XILINX_CPM_PCIE_REG_IDR);
+	mask = pcie_read(port, XILINX_CPM_PCIE_REG_IMR);
+
+	status = val & mask;
+	if (!status)
+		return IRQ_NONE;
+
+	if (status & XILINX_CPM_PCIE_INTR_LINK_DOWN)
+		dev_warn(port->dev, "Link Down\n");
+
+	if (status & XILINX_CPM_PCIE_INTR_HOT_RESET)
+		dev_info(port->dev, "Hot reset\n");
...
#7 lore raw

Re: [PATCH 2/2] PCI: Versal CPM: Add support for Versal CPM Root Port driver

In reply to Bharat Kumar Gogada

Hi Bharat,

Thank you for the patch! Perhaps something to improve:

url:    https://github.com/0day-ci/linux/commits/Bharat-Kumar-Gogada/Adding-support-for-versal-CPM-as-Root-Port-driver/20191223-193219
base:   https://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci.git next

If you fix the issue, kindly add following tag

New smatch warnings:
drivers/pci/controller/pcie-xilinx-cpm.c:330 xilinx_cpm_pcie_init_irq_domain() warn: passing zero to 'PTR_ERR'

Old smatch warnings:
drivers/pci/controller/pcie-xilinx-cpm.c:338 xilinx_cpm_pcie_init_irq_domain() warn: passing zero to 'PTR_ERR'

# https://github.com/0day-ci/linux/commit/f107713acb796e598f16a23b33af74fa382921b2
git remote add linux-review https://github.com/0day-ci/linux
git remote update linux-review
git checkout f107713acb796e598f16a23b33af74fa382921b2
vim +/PTR_ERR +330 drivers/pci/controller/pcie-xilinx-cpm.c

f107713acb796e Bharat Kumar Gogada 2019-12-20  320  static int xilinx_cpm_pcie_init_irq_domain(struct xilinx_cpm_pcie_port *port)
f107713acb796e Bharat Kumar Gogada 2019-12-20  321  {
f107713acb796e Bharat Kumar Gogada 2019-12-20  322  	struct device *dev = port->dev;
f107713acb796e Bharat Kumar Gogada 2019-12-20  323  	struct device_node *node = dev->of_node;
f107713acb796e Bharat Kumar Gogada 2019-12-20  324  	struct device_node *pcie_intc_node;
f107713acb796e Bharat Kumar Gogada 2019-12-20  325  
f107713acb796e Bharat Kumar Gogada 2019-12-20  326  	/* Setup INTx */
f107713acb796e Bharat Kumar Gogada 2019-12-20  327  	pcie_intc_node = of_get_next_child(node, NULL);
f107713acb796e Bharat Kumar Gogada 2019-12-20  328  	if (!pcie_intc_node) {
                                                            ^^^^^^^^^^^^^^^

f107713acb796e Bharat Kumar Gogada 2019-12-20 329 dev_err(dev, "No PCIe Intc node found\n");

f107713acb796e Bharat Kumar Gogada 2019-12-20 @330  		return PTR_ERR(pcie_intc_node);
                                                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

(This means success).

f107713acb796e Bharat Kumar Gogada 2019-12-20  331  	}
f107713acb796e Bharat Kumar Gogada 2019-12-20  332  
f107713acb796e Bharat Kumar Gogada 2019-12-20  333  	port->leg_domain = irq_domain_add_linear(pcie_intc_node, INTX_NUM,
f107713acb796e Bharat Kumar Gogada 2019-12-20  334  						 &intx_domain_ops,
f107713acb796e Bharat Kumar Gogada 2019-12-20  335  						 port);
f107713acb796e Bharat Kumar Gogada 2019-12-20  336  	if (!port->leg_domain) {
f107713acb796e Bharat Kumar Gogada 2019-12-20  337  		dev_err(dev, "Failed to get a INTx IRQ domain\n");
f107713acb796e Bharat Kumar Gogada 2019-12-20  338  		return PTR_ERR(port->leg_domain);
f107713acb796e Bharat Kumar Gogada 2019-12-20  339  	}
f107713acb796e Bharat Kumar Gogada 2019-12-20  340  
f107713acb796e Bharat Kumar Gogada 2019-12-20  341  	return 0;
f107713acb796e Bharat Kumar Gogada 2019-12-20  342  }

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org Intel Corporation

#8 lore raw

RE: [PATCH 2/2] PCI: Versal CPM: Add support for Versal CPM Root Port driver

Thanks Dan, will fix it and resend.

Quoted 82 lines

-----Original Message-----
From: Dan Carpenter <[email protected]>
Sent: Monday, January 6, 2020 12:20 AM
To: kbuild(a)lists.01.org; Bharat Kumar Gogada <[email protected]>
Cc: kbuild-all(a)lists.01.org; linux-pci(a)vger.kernel.org; linux- kernel(a)vger.kernel.org; bhelgaas(a)google.com; Ravikiran Gummaluri <[email protected]>; Bharat Kumar Gogada <[email protected]>
Subject: Re: [PATCH 2/2] PCI: Versal CPM: Add support for Versal CPM Root Port driver

Hi Bharat,

Thank you for the patch! Perhaps something to improve:

url: https://github.com/0day-ci/linux/commits/Bharat-Kumar-Gogada/Adding-
support-for-versal-CPM-as-Root-Port-driver/20191223-193219
base: https://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci.git next

If you fix the issue, kindly add following tag

New smatch warnings:
drivers/pci/controller/pcie-xilinx-cpm.c:330 xilinx_cpm_pcie_init_irq_domain()
warn: passing zero to 'PTR_ERR'

Old smatch warnings:
drivers/pci/controller/pcie-xilinx-cpm.c:338 xilinx_cpm_pcie_init_irq_domain()
warn: passing zero to 'PTR_ERR'

# https://github.com/0day-
ci/linux/commit/f107713acb796e598f16a23b33af74fa382921b2 git remote add linux-review https://github.com/0day-ci/linux
git remote update linux-review
git checkout f107713acb796e598f16a23b33af74fa382921b2 vim +/PTR_ERR +330 drivers/pci/controller/pcie-xilinx-cpm.c

f107713acb796e Bharat Kumar Gogada 2019-12-20 320 static int xilinx_cpm_pcie_init_irq_domain(struct xilinx_cpm_pcie_port *port)

f107713acb796e Bharat Kumar Gogada 2019-12-20  321  {
f107713acb796e Bharat Kumar Gogada 2019-12-20  322  	struct device *dev =

port->dev;
f107713acb796e Bharat Kumar Gogada 2019-12-20 323 struct device_node
*node = dev->of_node;
f107713acb796e Bharat Kumar Gogada 2019-12-20 324 struct device_node
*pcie_intc_node;

f107713acb796e Bharat Kumar Gogada 2019-12-20  325
f107713acb796e Bharat Kumar Gogada 2019-12-20  326  	/* Setup INTx */
f107713acb796e Bharat Kumar Gogada 2019-12-20  327  	pcie_intc_node =
of_get_next_child(node, NULL);
f107713acb796e Bharat Kumar Gogada 2019-12-20  328  	if (!pcie_intc_node) {
                                                            ^^^^^^^^^^^^^^^

f107713acb796e Bharat Kumar Gogada 2019-12-20 329 dev_err(dev,
"No PCIe Intc node found\n");
f107713acb796e Bharat Kumar Gogada 2019-12-20 @330 return

PTR_ERR(pcie_intc_node);
                                                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

(This means success).

f107713acb796e Bharat Kumar Gogada 2019-12-20  331  	}
f107713acb796e Bharat Kumar Gogada 2019-12-20  332
f107713acb796e Bharat Kumar Gogada 2019-12-20  333  	port->leg_domain =

irq_domain_add_linear(pcie_intc_node, INTX_NUM, f107713acb796e Bharat Kumar Gogada 2019-12-20 334
&intx_domain_ops,
f107713acb796e Bharat Kumar Gogada 2019-12-20 335

			 port);

f107713acb796e Bharat Kumar Gogada 2019-12-20 336 if (!port->leg_domain)
{
f107713acb796e Bharat Kumar Gogada 2019-12-20 337 dev_err(dev,
"Failed to get a INTx IRQ domain\n");
f107713acb796e Bharat Kumar Gogada 2019-12-20 338 return
PTR_ERR(port->leg_domain);

f107713acb796e Bharat Kumar Gogada 2019-12-20  339  	}
f107713acb796e Bharat Kumar Gogada 2019-12-20  340
f107713acb796e Bharat Kumar Gogada 2019-12-20  341  	return 0;
f107713acb796e Bharat Kumar Gogada 2019-12-20  342  }

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org Intel Corporation