2018-11-14 14:58:23

by Bharat Kumar Gogada

[permalink] [raw]
Subject: [PATCH v2 0/4] Add support to register platform service IRQ

Some platforms have dedicated IRQ lines for PCIe services like AER/PME etc.
The root complex on these platform will use these seperate IRQ lines to
report AER/PME etc., interrupts and will not generate MSI/MSI-X/INTx interrupts
for these services.
These patches will add new method for these kind of platforms to register the
platform IRQ number with respective PCIe services.

Bharat Kumar Gogada (4):
PCI: Add setup_platform_service_irq hook to struct pci_host_bridge
PCI: Add pci_check_platform_service_irqs
PCI/portdrv: Check platform supported service IRQ's
PCI: xilinx-nwl: Add method to setup_platform_service_irq hook

drivers/pci/controller/pcie-xilinx-nwl.c | 12 ++++++++++++
drivers/pci/pcie/portdrv_core.c | 8 ++++++++
include/linux/pci.h | 20 ++++++++++++++++++++
3 files changed, 40 insertions(+)

--
2.7.4



2018-11-14 14:57:25

by Bharat Kumar Gogada

[permalink] [raw]
Subject: [PATCH v2 4/4] PCI: xilinx-nwl: Add method to setup_platform_service_irq hook

Add nwl_setup_service_irqs hook to setup_platform_service_irq to
register platform provided IRQ number to kernel AER service.

Signed-off-by: Bharat Kumar Gogada <[email protected]>
---
drivers/pci/controller/pcie-xilinx-nwl.c | 12 ++++++++++++
1 file changed, 12 insertions(+)

diff --git a/drivers/pci/controller/pcie-xilinx-nwl.c b/drivers/pci/controller/pcie-xilinx-nwl.c
index 81538d7..d22125d 100644
--- a/drivers/pci/controller/pcie-xilinx-nwl.c
+++ b/drivers/pci/controller/pcie-xilinx-nwl.c
@@ -22,6 +22,7 @@
#include <linux/irqchip/chained_irq.h>

#include "../pci.h"
+#include "../pcie/portdrv.h"

/* Bridge core config registers */
#define BRCFG_PCIE_RX0 0x00000000
@@ -810,6 +811,16 @@ static int nwl_pcie_parse_dt(struct nwl_pcie *pcie,
return 0;
}

+static void nwl_setup_service_irqs(struct pci_host_bridge *bridge, int *irqs,
+ int plat_mask)
+{
+ struct nwl_pcie *pcie;
+
+ pcie = pci_host_bridge_priv(bridge);
+ if (plat_mask & PCIE_PORT_SERVICE_AER)
+ irqs[PCIE_PORT_SERVICE_AER_SHIFT] = pcie->irq_misc;
+}
+
static const struct of_device_id nwl_pcie_of_match[] = {
{ .compatible = "xlnx,nwl-pcie-2.11", },
{}
@@ -871,6 +882,7 @@ static int nwl_pcie_probe(struct platform_device *pdev)
bridge->ops = &nwl_pcie_ops;
bridge->map_irq = of_irq_parse_and_map_pci;
bridge->swizzle_irq = pci_common_swizzle;
+ bridge->setup_platform_service_irq = nwl_setup_service_irqs;

if (IS_ENABLED(CONFIG_PCI_MSI)) {
err = nwl_pcie_enable_msi(pcie);
--
2.7.4


2018-11-14 14:57:50

by Bharat Kumar Gogada

[permalink] [raw]
Subject: [PATCH v2 3/4] PCI/portdrv: Check platform supported service IRQ's

Platforms may have dedicated IRQ lines for PCIe services like
AER/PME etc., check for such IRQ lines.
Check if platform has any dedicated IRQ lines for PCIe
services.

Signed-off-by: Bharat Kumar Gogada <[email protected]>
---
drivers/pci/pcie/portdrv_core.c | 8 ++++++++
1 file changed, 8 insertions(+)

diff --git a/drivers/pci/pcie/portdrv_core.c b/drivers/pci/pcie/portdrv_core.c
index f458ac9..8e37beb 100644
--- a/drivers/pci/pcie/portdrv_core.c
+++ b/drivers/pci/pcie/portdrv_core.c
@@ -330,6 +330,14 @@ int pcie_port_device_register(struct pci_dev *dev)
goto error_disable;
}

+ /*
+ * Some platforms have dedicated interrupt line from root complex to
+ * interrupt controller for PCIe services like AER/PME etc., check
+ * if platform registered with any such IRQ.
+ */
+ if (pci_pcie_type(dev) == PCI_EXP_TYPE_ROOT_PORT)
+ pci_check_platform_service_irqs(dev, irqs, capabilities);
+
/* Allocate child services if any */
status = -ENODEV;
nr_service = 0;
--
2.7.4


2018-11-14 14:59:32

by Bharat Kumar Gogada

[permalink] [raw]
Subject: [PATCH v2 1/4] PCI: Add setup_platform_service_irq hook to struct pci_host_bridge

As per section 6.2.4.1.2, 6.2.6 in PCIe r4.0 error interrupts can
be delivered with paltform specific interrupt lines.
Add setup_platform_service_irq hook to struct pci_host_bridge.
Some platforms have dedicated interrupt line from root complex to
interrupt controller for PCIe services like AER.
This hook is to register platform IRQ's to PCIe port services.

Signed-off-by: Bharat Kumar Gogada <[email protected]>
---
include/linux/pci.h | 2 ++
1 file changed, 2 insertions(+)

diff --git a/include/linux/pci.h b/include/linux/pci.h
index 11c71c4..28e5e06b 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -481,6 +481,8 @@ struct pci_host_bridge {
u8 (*swizzle_irq)(struct pci_dev *, u8 *); /* Platform IRQ swizzler */
int (*map_irq)(const struct pci_dev *, u8, u8);
void (*release_fn)(struct pci_host_bridge *);
+ void (*setup_platform_service_irq)(struct pci_host_bridge *, int *,
+ int);
void *release_data;
struct msi_controller *msi;
unsigned int ignore_reset_delay:1; /* For entire hierarchy */
--
2.7.4


2018-11-14 14:59:45

by Bharat Kumar Gogada

[permalink] [raw]
Subject: [PATCH v2 2/4] PCI: Add pci_check_platform_service_irqs

Adding method pci_check_platform_service_irqs to check if platform
has registered method to proivde dedicated IRQ lines for PCIe services
like AER.

Signed-off-by: Bharat Kumar Gogada <[email protected]>
---
include/linux/pci.h | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)

diff --git a/include/linux/pci.h b/include/linux/pci.h
index 28e5e06b..4fd54c2 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -2307,6 +2307,24 @@ static inline bool pci_ari_enabled(struct pci_bus *bus)
}

/**
+ * pci_check_platform_service_irqs - check platform service irq's
+ * @pdev: PCI Express device to check
+ * @irqs: Array of irqs to populate
+ * @mask: Bitmask of capabilities
+ */
+static inline void pci_check_platform_service_irqs(struct pci_dev *dev,
+ int *irqs, int mask)
+{
+ struct pci_host_bridge *bridge;
+
+ if (pci_pcie_type(dev) == PCI_EXP_TYPE_ROOT_PORT) {
+ bridge = pci_find_host_bridge(dev->bus);
+ if (bridge && bridge->setup_platform_service_irq)
+ bridge->setup_platform_service_irq(bridge, irqs, mask);
+ }
+}
+
+/**
* pci_is_thunderbolt_attached - whether device is on a Thunderbolt daisy chain
* @pdev: PCI device to check
*
--
2.7.4


2018-12-06 15:49:23

by Bharat Kumar Gogada

[permalink] [raw]
Subject: RE: [PATCH v2 0/4] Add support to register platform service IRQ

Hi All,

Please let me know if anyone has any issue with this patch series.

Regards,
Bharat

> -----Original Message-----
> From: Bharat Kumar Gogada [mailto:[email protected]]
> Sent: Wednesday, November 14, 2018 8:18 PM
> To: [email protected]
> Cc: [email protected]; Ravikiran Gummaluri <[email protected]>;
> Bharat Kumar Gogada <[email protected]>
> Subject: [PATCH v2 0/4] Add support to register platform service IRQ
>
> Some platforms have dedicated IRQ lines for PCIe services like AER/PME etc.
> The root complex on these platform will use these seperate IRQ lines to
> report AER/PME etc., interrupts and will not generate MSI/MSI-X/INTx
> interrupts for these services.
> These patches will add new method for these kind of platforms to register
> the platform IRQ number with respective PCIe services.
>
> Bharat Kumar Gogada (4):
> PCI: Add setup_platform_service_irq hook to struct pci_host_bridge
> PCI: Add pci_check_platform_service_irqs
> PCI/portdrv: Check platform supported service IRQ's
> PCI: xilinx-nwl: Add method to setup_platform_service_irq hook
>
> drivers/pci/controller/pcie-xilinx-nwl.c | 12 ++++++++++++
> drivers/pci/pcie/portdrv_core.c | 8 ++++++++
> include/linux/pci.h | 20 ++++++++++++++++++++
> 3 files changed, 40 insertions(+)
>
> --
> 2.7.4