* [PATCH v4 00/12] PCI: qcom: Enumerate endpoints based on Link up event in 'global_irq' interrupt
@ 2024-08-28 15:46 Manivannan Sadhasivam via B4 Relay
2024-08-28 15:46 ` [PATCH v4 01/12] PCI: qcom-ep: Drop the redundant masking of global IRQ events Manivannan Sadhasivam via B4 Relay
` (13 more replies)
0 siblings, 14 replies; 17+ messages in thread
From: Manivannan Sadhasivam via B4 Relay @ 2024-08-28 15:46 UTC (permalink / raw)
To: Lorenzo Pieralisi, Krzysztof Wilczyński, Rob Herring,
Bjorn Helgaas, Krzysztof Kozlowski, Conor Dooley,
Kishon Vijay Abraham I, Bjorn Andersson, Konrad Dybcio
Cc: linux-pci, linux-arm-msm, linux-kernel, devicetree,
Manivannan Sadhasivam, Konrad Dybcio
Hi,
This series adds support to enumerate the PCIe endpoint devices using the Qcom
specific 'Link up' event in 'global' IRQ. Historically, Qcom PCIe RC controllers
lacked standard hotplug support. So when an endpoint is attached to the SoC,
users have to rescan the bus manually to enumerate the device. But this can be
avoided by rescanning the bus upon receiving 'Link up' event.
Qcom PCIe RC controllers are capable of generating the 'global' SPI interrupt
to the host CPUs. The device driver can use this interrupt to identify events
such as PCIe link specific events, safety events etc...
One such event is the PCIe Link up event generated when an endpoint is detected
on the bus and the Link is 'up'. This event can be used to enumerate the
endpoint devices.
So add support for capturing the PCIe Link up event using the 'global' interrupt
in the driver. Once the Link up event is received, the bus underneath the host
bridge is scanned to enumerate PCIe endpoint devices.
This series also has some cleanups to the Qcom PCIe EP controller driver for
interrupt handling.
NOTE: During v2 review, there was a discussion about removing the devices when
'Link Down' event is received. But this needs some more investigation, so I'm
planning to add it later.
Testing
=======
This series is tested on Qcom SM8450 based development board that has 2 SoCs
connected over PCIe.
Merging Strategy
================
I'm expecting the binding and PCI driver changes to go through PCI tree and DTS
patches through Qcom tree.
- Mani
Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
---
Changes in v4:
- Fixed the indendation issue reported by Kbot
- Merged the bindings patch adding global IRQ into one as suggested by Rob
- Collected review tag
- Link to v3: https://lore.kernel.org/r/20240731-pci-qcom-hotplug-v3-0-a1426afdee3b@linaro.org
Changes in v3:
- Removed the usage of 'simulating hotplug' and just used 'Link up' as we are
not fully emulating the hotplug support
- Fixed the build issue wtih CONFIG_PCI_DOMAINS_GENERIC
- Moved the 'global' IRQ entry to last in the binding and also mentioned the ABI
break and its necessity in patch description.
- Collected tags
- Rebased on top of v6.11-rc1
- Link to v2: https://lore.kernel.org/r/20240717-pci-qcom-hotplug-v2-0-71d304b817f8@linaro.org
Changes in v2:
- Added CONFIG_PCI_DOMAINS_GENERIC guard for domain_nr
- Switched to dev_WARN_ONCE() for unhandled interrupts
- Squashed the 'linux,pci-domain' bindings patches into one
- Link to v1: https://lore.kernel.org/r/20240715-pci-qcom-hotplug-v1-0-5f3765cc873a@linaro.org
---
Manivannan Sadhasivam (12):
PCI: qcom-ep: Drop the redundant masking of global IRQ events
PCI: qcom-ep: Reword the error message for receiving unknown global IRQ event
dt-bindings: PCI: pci-ep: Update Maintainers
dt-bindings: PCI: pci-ep: Document 'linux,pci-domain' property
PCI: endpoint: Assign PCI domain number for endpoint controllers
PCI: qcom-ep: Modify 'global_irq' and 'perst_irq' IRQ device names
ARM: dts: qcom: sdx55: Add 'linux,pci-domain' to PCIe EP controller node
ARM: dts: qcom: sdx65: Add 'linux,pci-domain' to PCIe EP controller node
arm64: dts: qcom: sa8775p: Add 'linux,pci-domain' to PCIe EP controller nodes
dt-bindings: PCI: qcom,pcie-sm8450: Add 'global' interrupt
PCI: qcom: Enumerate endpoints based on Link up event in 'global_irq' interrupt
arm64: dts: qcom: sm8450: Add 'global' interrupt to the PCIe RC node
Documentation/devicetree/bindings/pci/pci-ep.yaml | 14 +++++-
.../devicetree/bindings/pci/qcom,pcie-common.yaml | 4 +-
.../devicetree/bindings/pci/qcom,pcie-ep.yaml | 1 +
.../devicetree/bindings/pci/qcom,pcie-sm8450.yaml | 10 ++--
arch/arm/boot/dts/qcom/qcom-sdx55.dtsi | 1 +
arch/arm/boot/dts/qcom/qcom-sdx65.dtsi | 1 +
arch/arm64/boot/dts/qcom/sa8775p.dtsi | 2 +
arch/arm64/boot/dts/qcom/sm8450.dtsi | 12 +++--
drivers/pci/controller/dwc/pcie-qcom-ep.c | 21 +++++++--
drivers/pci/controller/dwc/pcie-qcom.c | 55 +++++++++++++++++++++-
drivers/pci/endpoint/pci-epc-core.c | 14 ++++++
include/linux/pci-epc.h | 2 +
12 files changed, 120 insertions(+), 17 deletions(-)
---
base-commit: 8400291e289ee6b2bf9779ff1c83a291501f017b
change-id: 20240715-pci-qcom-hotplug-bcde1c13d91f
Best regards,
--
Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH v4 01/12] PCI: qcom-ep: Drop the redundant masking of global IRQ events
2024-08-28 15:46 [PATCH v4 00/12] PCI: qcom: Enumerate endpoints based on Link up event in 'global_irq' interrupt Manivannan Sadhasivam via B4 Relay
@ 2024-08-28 15:46 ` Manivannan Sadhasivam via B4 Relay
2024-08-28 15:46 ` [PATCH v4 02/12] PCI: qcom-ep: Reword the error message for receiving unknown global IRQ event Manivannan Sadhasivam via B4 Relay
` (12 subsequent siblings)
13 siblings, 0 replies; 17+ messages in thread
From: Manivannan Sadhasivam via B4 Relay @ 2024-08-28 15:46 UTC (permalink / raw)
To: Lorenzo Pieralisi, Krzysztof Wilczyński, Rob Herring,
Bjorn Helgaas, Krzysztof Kozlowski, Conor Dooley,
Kishon Vijay Abraham I, Bjorn Andersson, Konrad Dybcio
Cc: linux-pci, linux-arm-msm, linux-kernel, devicetree,
Manivannan Sadhasivam, Konrad Dybcio
From: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Once the events are disabled in PARF_INT_ALL_MASK register, only the
enabled events will generate global IRQ. So there is no need to do the
masking again in the IRQ handler, drop it.
If there are any spurious IRQs getting generated, they will be reported
using the existing dev_err() in the handler.
Reviewed-by: Konrad Dybcio <konrad.dybcio@linaro.org>
Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
---
drivers/pci/controller/dwc/pcie-qcom-ep.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/drivers/pci/controller/dwc/pcie-qcom-ep.c b/drivers/pci/controller/dwc/pcie-qcom-ep.c
index 236229f66c80..972a90eba494 100644
--- a/drivers/pci/controller/dwc/pcie-qcom-ep.c
+++ b/drivers/pci/controller/dwc/pcie-qcom-ep.c
@@ -647,11 +647,9 @@ static irqreturn_t qcom_pcie_ep_global_irq_thread(int irq, void *data)
struct dw_pcie *pci = &pcie_ep->pci;
struct device *dev = pci->dev;
u32 status = readl_relaxed(pcie_ep->parf + PARF_INT_ALL_STATUS);
- u32 mask = readl_relaxed(pcie_ep->parf + PARF_INT_ALL_MASK);
u32 dstate, val;
writel_relaxed(status, pcie_ep->parf + PARF_INT_ALL_CLEAR);
- status &= mask;
if (FIELD_GET(PARF_INT_ALL_LINK_DOWN, status)) {
dev_dbg(dev, "Received Linkdown event\n");
--
2.25.1
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH v4 02/12] PCI: qcom-ep: Reword the error message for receiving unknown global IRQ event
2024-08-28 15:46 [PATCH v4 00/12] PCI: qcom: Enumerate endpoints based on Link up event in 'global_irq' interrupt Manivannan Sadhasivam via B4 Relay
2024-08-28 15:46 ` [PATCH v4 01/12] PCI: qcom-ep: Drop the redundant masking of global IRQ events Manivannan Sadhasivam via B4 Relay
@ 2024-08-28 15:46 ` Manivannan Sadhasivam via B4 Relay
2024-08-28 15:46 ` [PATCH v4 03/12] dt-bindings: PCI: pci-ep: Update Maintainers Manivannan Sadhasivam via B4 Relay
` (11 subsequent siblings)
13 siblings, 0 replies; 17+ messages in thread
From: Manivannan Sadhasivam via B4 Relay @ 2024-08-28 15:46 UTC (permalink / raw)
To: Lorenzo Pieralisi, Krzysztof Wilczyński, Rob Herring,
Bjorn Helgaas, Krzysztof Kozlowski, Conor Dooley,
Kishon Vijay Abraham I, Bjorn Andersson, Konrad Dybcio
Cc: linux-pci, linux-arm-msm, linux-kernel, devicetree,
Manivannan Sadhasivam, Konrad Dybcio
From: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Current error message just prints the contents of PARF_INT_ALL_STATUS
register as if like the IRQ event number. It could mislead the users.
Reword it to make it clear that the error message is actually showing the
interrupt status register to help debug spurious IRQ events.
While at it, let's also switch over to dev_WARN_ONCE() so that any IRQ
storm won't flood the kernel log buffer.
Reviewed-by: Konrad Dybcio <konrad.dybcio@linaro.org>
Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
---
drivers/pci/controller/dwc/pcie-qcom-ep.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/pci/controller/dwc/pcie-qcom-ep.c b/drivers/pci/controller/dwc/pcie-qcom-ep.c
index 972a90eba494..0bb0a056dd8f 100644
--- a/drivers/pci/controller/dwc/pcie-qcom-ep.c
+++ b/drivers/pci/controller/dwc/pcie-qcom-ep.c
@@ -679,7 +679,8 @@ static irqreturn_t qcom_pcie_ep_global_irq_thread(int irq, void *data)
dw_pcie_ep_linkup(&pci->ep);
pcie_ep->link_status = QCOM_PCIE_EP_LINK_UP;
} else {
- dev_err(dev, "Received unknown event: %d\n", status);
+ dev_WARN_ONCE(dev, 1, "Received unknown event. INT_STATUS: 0x%08x\n",
+ status);
}
return IRQ_HANDLED;
--
2.25.1
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH v4 03/12] dt-bindings: PCI: pci-ep: Update Maintainers
2024-08-28 15:46 [PATCH v4 00/12] PCI: qcom: Enumerate endpoints based on Link up event in 'global_irq' interrupt Manivannan Sadhasivam via B4 Relay
2024-08-28 15:46 ` [PATCH v4 01/12] PCI: qcom-ep: Drop the redundant masking of global IRQ events Manivannan Sadhasivam via B4 Relay
2024-08-28 15:46 ` [PATCH v4 02/12] PCI: qcom-ep: Reword the error message for receiving unknown global IRQ event Manivannan Sadhasivam via B4 Relay
@ 2024-08-28 15:46 ` Manivannan Sadhasivam via B4 Relay
2024-08-28 18:31 ` Frank Li
2024-08-28 15:46 ` [PATCH v4 04/12] dt-bindings: PCI: pci-ep: Document 'linux,pci-domain' property Manivannan Sadhasivam via B4 Relay
` (10 subsequent siblings)
13 siblings, 1 reply; 17+ messages in thread
From: Manivannan Sadhasivam via B4 Relay @ 2024-08-28 15:46 UTC (permalink / raw)
To: Lorenzo Pieralisi, Krzysztof Wilczyński, Rob Herring,
Bjorn Helgaas, Krzysztof Kozlowski, Conor Dooley,
Kishon Vijay Abraham I, Bjorn Andersson, Konrad Dybcio
Cc: linux-pci, linux-arm-msm, linux-kernel, devicetree,
Manivannan Sadhasivam
From: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Kishon's TI email ID is not active anymore, so use his korg ID. Also, since
I've been maintaining the PCI endpoint framework, I'm willing to maintain
the DT binding as well. So add myself as the Co-maintainer.
Acked-by: Rob Herring (Arm) <robh@kernel.org>
Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
---
Documentation/devicetree/bindings/pci/pci-ep.yaml | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/Documentation/devicetree/bindings/pci/pci-ep.yaml b/Documentation/devicetree/bindings/pci/pci-ep.yaml
index d1eef4825207..0b5456ee21eb 100644
--- a/Documentation/devicetree/bindings/pci/pci-ep.yaml
+++ b/Documentation/devicetree/bindings/pci/pci-ep.yaml
@@ -10,7 +10,8 @@ description: |
Common properties for PCI Endpoint Controller Nodes.
maintainers:
- - Kishon Vijay Abraham I <kishon@ti.com>
+ - Kishon Vijay Abraham I <kishon@kernel.org>
+ - Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
properties:
$nodename:
--
2.25.1
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH v4 04/12] dt-bindings: PCI: pci-ep: Document 'linux,pci-domain' property
2024-08-28 15:46 [PATCH v4 00/12] PCI: qcom: Enumerate endpoints based on Link up event in 'global_irq' interrupt Manivannan Sadhasivam via B4 Relay
` (2 preceding siblings ...)
2024-08-28 15:46 ` [PATCH v4 03/12] dt-bindings: PCI: pci-ep: Update Maintainers Manivannan Sadhasivam via B4 Relay
@ 2024-08-28 15:46 ` Manivannan Sadhasivam via B4 Relay
2024-08-28 15:46 ` [PATCH v4 05/12] PCI: endpoint: Assign PCI domain number for endpoint controllers Manivannan Sadhasivam via B4 Relay
` (9 subsequent siblings)
13 siblings, 0 replies; 17+ messages in thread
From: Manivannan Sadhasivam via B4 Relay @ 2024-08-28 15:46 UTC (permalink / raw)
To: Lorenzo Pieralisi, Krzysztof Wilczyński, Rob Herring,
Bjorn Helgaas, Krzysztof Kozlowski, Conor Dooley,
Kishon Vijay Abraham I, Bjorn Andersson, Konrad Dybcio
Cc: linux-pci, linux-arm-msm, linux-kernel, devicetree,
Manivannan Sadhasivam
From: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
'linux,pci-domain' property provides the PCI domain number for the PCI
endpoint controllers in a SoC. If this property is not present, then an
unstable (across boots) unique number will be assigned.
Devicetrees can specify the domain number based on the actual hardware
instance of the PCI endpoint controllers in the SoC.
Reviewed-by: Rob Herring (Arm) <robh@kernel.org>
Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
---
Documentation/devicetree/bindings/pci/pci-ep.yaml | 11 +++++++++++
Documentation/devicetree/bindings/pci/qcom,pcie-ep.yaml | 1 +
2 files changed, 12 insertions(+)
diff --git a/Documentation/devicetree/bindings/pci/pci-ep.yaml b/Documentation/devicetree/bindings/pci/pci-ep.yaml
index 0b5456ee21eb..f75000e3093d 100644
--- a/Documentation/devicetree/bindings/pci/pci-ep.yaml
+++ b/Documentation/devicetree/bindings/pci/pci-ep.yaml
@@ -42,6 +42,17 @@ properties:
default: 1
maximum: 16
+ linux,pci-domain:
+ description:
+ If present this property assigns a fixed PCI domain number to a PCI
+ Endpoint Controller, otherwise an unstable (across boots) unique number
+ will be assigned. It is required to either not set this property at all
+ or set it for all PCI endpoint controllers in the system, otherwise
+ potentially conflicting domain numbers may be assigned to endpoint
+ controllers. The domain number for each endpoint controller in the system
+ must be unique.
+ $ref: /schemas/types.yaml#/definitions/uint32
+
required:
- compatible
diff --git a/Documentation/devicetree/bindings/pci/qcom,pcie-ep.yaml b/Documentation/devicetree/bindings/pci/qcom,pcie-ep.yaml
index 46802f7d9482..1226ee5d08d1 100644
--- a/Documentation/devicetree/bindings/pci/qcom,pcie-ep.yaml
+++ b/Documentation/devicetree/bindings/pci/qcom,pcie-ep.yaml
@@ -280,4 +280,5 @@ examples:
phy-names = "pciephy";
max-link-speed = <3>;
num-lanes = <2>;
+ linux,pci-domain = <0>;
};
--
2.25.1
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH v4 05/12] PCI: endpoint: Assign PCI domain number for endpoint controllers
2024-08-28 15:46 [PATCH v4 00/12] PCI: qcom: Enumerate endpoints based on Link up event in 'global_irq' interrupt Manivannan Sadhasivam via B4 Relay
` (3 preceding siblings ...)
2024-08-28 15:46 ` [PATCH v4 04/12] dt-bindings: PCI: pci-ep: Document 'linux,pci-domain' property Manivannan Sadhasivam via B4 Relay
@ 2024-08-28 15:46 ` Manivannan Sadhasivam via B4 Relay
2024-08-28 18:30 ` Frank Li
2024-08-28 15:46 ` [PATCH v4 06/12] PCI: qcom-ep: Modify 'global_irq' and 'perst_irq' IRQ device names Manivannan Sadhasivam via B4 Relay
` (8 subsequent siblings)
13 siblings, 1 reply; 17+ messages in thread
From: Manivannan Sadhasivam via B4 Relay @ 2024-08-28 15:46 UTC (permalink / raw)
To: Lorenzo Pieralisi, Krzysztof Wilczyński, Rob Herring,
Bjorn Helgaas, Krzysztof Kozlowski, Conor Dooley,
Kishon Vijay Abraham I, Bjorn Andersson, Konrad Dybcio
Cc: linux-pci, linux-arm-msm, linux-kernel, devicetree,
Manivannan Sadhasivam
From: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Right now, PCI endpoint subsystem doesn't assign PCI domain number for the
PCI endpoint controllers. But this domain number could be useful to the EPC
drivers to uniquely identify each controller based on the hardware instance
when there are multiple ones present in an SoC (even multiple RC/EP).
So let's make use of the existing pci_bus_find_domain_nr() API to allocate
domain numbers based on either Devicetree (linux,pci-domain) property or
dynamic domain number allocation scheme.
It should be noted that the domain number allocated by this API will be
based on both RC and EP controllers in a SoC. If the 'linux,pci-domain' DT
property is present, then the domain number represents the actual hardware
instance of the PCI endpoint controller. If not, then the domain number
will be allocated based on the PCI EP/RC controller probe order.
If the architecture doesn't support CONFIG_PCI_DOMAINS_GENERIC (rare), then
currently a warning is thrown to indicate that the architecture specific
implementation is needed.
Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
---
drivers/pci/endpoint/pci-epc-core.c | 14 ++++++++++++++
include/linux/pci-epc.h | 2 ++
2 files changed, 16 insertions(+)
diff --git a/drivers/pci/endpoint/pci-epc-core.c b/drivers/pci/endpoint/pci-epc-core.c
index 84309dfe0c68..085a2de8b923 100644
--- a/drivers/pci/endpoint/pci-epc-core.c
+++ b/drivers/pci/endpoint/pci-epc-core.c
@@ -838,6 +838,10 @@ void pci_epc_destroy(struct pci_epc *epc)
{
pci_ep_cfs_remove_epc_group(epc->group);
device_unregister(&epc->dev);
+
+#ifdef CONFIG_PCI_DOMAINS_GENERIC
+ pci_bus_release_domain_nr(NULL, &epc->dev);
+#endif
}
EXPORT_SYMBOL_GPL(pci_epc_destroy);
@@ -900,6 +904,16 @@ __pci_epc_create(struct device *dev, const struct pci_epc_ops *ops,
epc->dev.release = pci_epc_release;
epc->ops = ops;
+#ifdef CONFIG_PCI_DOMAINS_GENERIC
+ epc->domain_nr = pci_bus_find_domain_nr(NULL, dev);
+#else
+ /*
+ * TODO: If the architecture doesn't support generic PCI
+ * domains, then a custom implementation has to be used.
+ */
+ WARN_ONCE(1, "This architecture doesn't support generic PCI domains\n");
+#endif
+
ret = dev_set_name(&epc->dev, "%s", dev_name(dev));
if (ret)
goto put_dev;
diff --git a/include/linux/pci-epc.h b/include/linux/pci-epc.h
index 85bdf2adb760..8e3dcac55dcd 100644
--- a/include/linux/pci-epc.h
+++ b/include/linux/pci-epc.h
@@ -128,6 +128,7 @@ struct pci_epc_mem {
* @group: configfs group representing the PCI EPC device
* @lock: mutex to protect pci_epc ops
* @function_num_map: bitmap to manage physical function number
+ * @domain_nr: PCI domain number of the endpoint controller
* @init_complete: flag to indicate whether the EPC initialization is complete
* or not
*/
@@ -145,6 +146,7 @@ struct pci_epc {
/* mutex to protect against concurrent access of EP controller */
struct mutex lock;
unsigned long function_num_map;
+ int domain_nr;
bool init_complete;
};
--
2.25.1
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH v4 06/12] PCI: qcom-ep: Modify 'global_irq' and 'perst_irq' IRQ device names
2024-08-28 15:46 [PATCH v4 00/12] PCI: qcom: Enumerate endpoints based on Link up event in 'global_irq' interrupt Manivannan Sadhasivam via B4 Relay
` (4 preceding siblings ...)
2024-08-28 15:46 ` [PATCH v4 05/12] PCI: endpoint: Assign PCI domain number for endpoint controllers Manivannan Sadhasivam via B4 Relay
@ 2024-08-28 15:46 ` Manivannan Sadhasivam via B4 Relay
2024-08-28 15:46 ` [PATCH v4 07/12] ARM: dts: qcom: sdx55: Add 'linux,pci-domain' to PCIe EP controller node Manivannan Sadhasivam via B4 Relay
` (7 subsequent siblings)
13 siblings, 0 replies; 17+ messages in thread
From: Manivannan Sadhasivam via B4 Relay @ 2024-08-28 15:46 UTC (permalink / raw)
To: Lorenzo Pieralisi, Krzysztof Wilczyński, Rob Herring,
Bjorn Helgaas, Krzysztof Kozlowski, Conor Dooley,
Kishon Vijay Abraham I, Bjorn Andersson, Konrad Dybcio
Cc: linux-pci, linux-arm-msm, linux-kernel, devicetree,
Manivannan Sadhasivam, Konrad Dybcio
From: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Currently, the IRQ device name for both of these IRQs doesn't have Qcom
specific prefix and PCIe domain number. This causes 2 issues:
1. Pollutes the global IRQ namespace since 'global' is a common name.
2. When more than one EP controller instance is present in the SoC, naming
conflict will occur.
Hence, add 'qcom_pcie_ep_' prefix and PCIe domain number suffix to the IRQ
names to uniquely identify the IRQs and also to fix the above mentioned
issues.
Reviewed-by: Konrad Dybcio <konrad.dybcio@linaro.org>
Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
---
drivers/pci/controller/dwc/pcie-qcom-ep.c | 16 ++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)
diff --git a/drivers/pci/controller/dwc/pcie-qcom-ep.c b/drivers/pci/controller/dwc/pcie-qcom-ep.c
index 0bb0a056dd8f..d0a27fa6fdc8 100644
--- a/drivers/pci/controller/dwc/pcie-qcom-ep.c
+++ b/drivers/pci/controller/dwc/pcie-qcom-ep.c
@@ -711,8 +711,15 @@ static irqreturn_t qcom_pcie_ep_perst_irq_thread(int irq, void *data)
static int qcom_pcie_ep_enable_irq_resources(struct platform_device *pdev,
struct qcom_pcie_ep *pcie_ep)
{
+ struct device *dev = pcie_ep->pci.dev;
+ char *name;
int ret;
+ name = devm_kasprintf(dev, GFP_KERNEL, "qcom_pcie_ep_global_irq%d",
+ pcie_ep->pci.ep.epc->domain_nr);
+ if (!name)
+ return -ENOMEM;
+
pcie_ep->global_irq = platform_get_irq_byname(pdev, "global");
if (pcie_ep->global_irq < 0)
return pcie_ep->global_irq;
@@ -720,18 +727,23 @@ static int qcom_pcie_ep_enable_irq_resources(struct platform_device *pdev,
ret = devm_request_threaded_irq(&pdev->dev, pcie_ep->global_irq, NULL,
qcom_pcie_ep_global_irq_thread,
IRQF_ONESHOT,
- "global_irq", pcie_ep);
+ name, pcie_ep);
if (ret) {
dev_err(&pdev->dev, "Failed to request Global IRQ\n");
return ret;
}
+ name = devm_kasprintf(dev, GFP_KERNEL, "qcom_pcie_ep_perst_irq%d",
+ pcie_ep->pci.ep.epc->domain_nr);
+ if (!name)
+ return -ENOMEM;
+
pcie_ep->perst_irq = gpiod_to_irq(pcie_ep->reset);
irq_set_status_flags(pcie_ep->perst_irq, IRQ_NOAUTOEN);
ret = devm_request_threaded_irq(&pdev->dev, pcie_ep->perst_irq, NULL,
qcom_pcie_ep_perst_irq_thread,
IRQF_TRIGGER_HIGH | IRQF_ONESHOT,
- "perst_irq", pcie_ep);
+ name, pcie_ep);
if (ret) {
dev_err(&pdev->dev, "Failed to request PERST IRQ\n");
disable_irq(pcie_ep->global_irq);
--
2.25.1
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH v4 07/12] ARM: dts: qcom: sdx55: Add 'linux,pci-domain' to PCIe EP controller node
2024-08-28 15:46 [PATCH v4 00/12] PCI: qcom: Enumerate endpoints based on Link up event in 'global_irq' interrupt Manivannan Sadhasivam via B4 Relay
` (5 preceding siblings ...)
2024-08-28 15:46 ` [PATCH v4 06/12] PCI: qcom-ep: Modify 'global_irq' and 'perst_irq' IRQ device names Manivannan Sadhasivam via B4 Relay
@ 2024-08-28 15:46 ` Manivannan Sadhasivam via B4 Relay
2024-08-28 15:46 ` [PATCH v4 08/12] ARM: dts: qcom: sdx65: " Manivannan Sadhasivam via B4 Relay
` (6 subsequent siblings)
13 siblings, 0 replies; 17+ messages in thread
From: Manivannan Sadhasivam via B4 Relay @ 2024-08-28 15:46 UTC (permalink / raw)
To: Lorenzo Pieralisi, Krzysztof Wilczyński, Rob Herring,
Bjorn Helgaas, Krzysztof Kozlowski, Conor Dooley,
Kishon Vijay Abraham I, Bjorn Andersson, Konrad Dybcio
Cc: linux-pci, linux-arm-msm, linux-kernel, devicetree,
Manivannan Sadhasivam, Konrad Dybcio
From: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
'linux,pci-domain' property provides the PCI domain number for the PCI
endpoint controllers in a SoC. If this property is not present, then an
unstable (across boots) unique number will be assigned.
Use this property to specify the domain number based on the actual hardware
instance of the PCI endpoint controllers in SDX55 SoC.
Reviewed-by: Konrad Dybcio <konrad.dybcio@linaro.org>
Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
---
arch/arm/boot/dts/qcom/qcom-sdx55.dtsi | 1 +
1 file changed, 1 insertion(+)
diff --git a/arch/arm/boot/dts/qcom/qcom-sdx55.dtsi b/arch/arm/boot/dts/qcom/qcom-sdx55.dtsi
index 68fa5859d263..d0f6120b665d 100644
--- a/arch/arm/boot/dts/qcom/qcom-sdx55.dtsi
+++ b/arch/arm/boot/dts/qcom/qcom-sdx55.dtsi
@@ -437,6 +437,7 @@ pcie_ep: pcie-ep@1c00000 {
phy-names = "pciephy";
max-link-speed = <3>;
num-lanes = <2>;
+ linux,pci-domain = <0>;
status = "disabled";
};
--
2.25.1
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH v4 08/12] ARM: dts: qcom: sdx65: Add 'linux,pci-domain' to PCIe EP controller node
2024-08-28 15:46 [PATCH v4 00/12] PCI: qcom: Enumerate endpoints based on Link up event in 'global_irq' interrupt Manivannan Sadhasivam via B4 Relay
` (6 preceding siblings ...)
2024-08-28 15:46 ` [PATCH v4 07/12] ARM: dts: qcom: sdx55: Add 'linux,pci-domain' to PCIe EP controller node Manivannan Sadhasivam via B4 Relay
@ 2024-08-28 15:46 ` Manivannan Sadhasivam via B4 Relay
2024-08-28 15:46 ` [PATCH v4 09/12] arm64: dts: qcom: sa8775p: Add 'linux,pci-domain' to PCIe EP controller nodes Manivannan Sadhasivam via B4 Relay
` (5 subsequent siblings)
13 siblings, 0 replies; 17+ messages in thread
From: Manivannan Sadhasivam via B4 Relay @ 2024-08-28 15:46 UTC (permalink / raw)
To: Lorenzo Pieralisi, Krzysztof Wilczyński, Rob Herring,
Bjorn Helgaas, Krzysztof Kozlowski, Conor Dooley,
Kishon Vijay Abraham I, Bjorn Andersson, Konrad Dybcio
Cc: linux-pci, linux-arm-msm, linux-kernel, devicetree,
Manivannan Sadhasivam, Konrad Dybcio
From: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
'linux,pci-domain' property provides the PCI domain number for the PCI
endpoint controllers in a SoC. If this property is not present, then an
unstable (across boots) unique number will be assigned.
Use this property to specify the domain number based on the actual hardware
instance of the PCI endpoint controllers in SDX65 SoC.
Reviewed-by: Konrad Dybcio <konrad.dybcio@linaro.org>
Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
---
arch/arm/boot/dts/qcom/qcom-sdx65.dtsi | 1 +
1 file changed, 1 insertion(+)
diff --git a/arch/arm/boot/dts/qcom/qcom-sdx65.dtsi b/arch/arm/boot/dts/qcom/qcom-sdx65.dtsi
index a949454212e9..fcfec4228670 100644
--- a/arch/arm/boot/dts/qcom/qcom-sdx65.dtsi
+++ b/arch/arm/boot/dts/qcom/qcom-sdx65.dtsi
@@ -345,6 +345,7 @@ pcie_ep: pcie-ep@1c00000 {
max-link-speed = <3>;
num-lanes = <2>;
+ linux,pci-domain = <0>;
status = "disabled";
};
--
2.25.1
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH v4 09/12] arm64: dts: qcom: sa8775p: Add 'linux,pci-domain' to PCIe EP controller nodes
2024-08-28 15:46 [PATCH v4 00/12] PCI: qcom: Enumerate endpoints based on Link up event in 'global_irq' interrupt Manivannan Sadhasivam via B4 Relay
` (7 preceding siblings ...)
2024-08-28 15:46 ` [PATCH v4 08/12] ARM: dts: qcom: sdx65: " Manivannan Sadhasivam via B4 Relay
@ 2024-08-28 15:46 ` Manivannan Sadhasivam via B4 Relay
2024-08-28 15:46 ` [PATCH v4 10/12] dt-bindings: PCI: qcom,pcie-sm8450: Add 'global' interrupt Manivannan Sadhasivam via B4 Relay
` (4 subsequent siblings)
13 siblings, 0 replies; 17+ messages in thread
From: Manivannan Sadhasivam via B4 Relay @ 2024-08-28 15:46 UTC (permalink / raw)
To: Lorenzo Pieralisi, Krzysztof Wilczyński, Rob Herring,
Bjorn Helgaas, Krzysztof Kozlowski, Conor Dooley,
Kishon Vijay Abraham I, Bjorn Andersson, Konrad Dybcio
Cc: linux-pci, linux-arm-msm, linux-kernel, devicetree,
Manivannan Sadhasivam, Konrad Dybcio
From: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
'linux,pci-domain' property provides the PCI domain number for the PCI
endpoint controllers in a SoC. If this property is not present, then an
unstable (across boots) unique number will be assigned.
Use this property to specify the domain number based on the actual hardware
instance of the PCI endpoint controllers in SA8775P SoC.
Reviewed-by: Konrad Dybcio <konrad.dybcio@linaro.org>
Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
---
arch/arm64/boot/dts/qcom/sa8775p.dtsi | 2 ++
1 file changed, 2 insertions(+)
diff --git a/arch/arm64/boot/dts/qcom/sa8775p.dtsi b/arch/arm64/boot/dts/qcom/sa8775p.dtsi
index 23f1b2e5e624..198b39abde97 100644
--- a/arch/arm64/boot/dts/qcom/sa8775p.dtsi
+++ b/arch/arm64/boot/dts/qcom/sa8775p.dtsi
@@ -4618,6 +4618,7 @@ pcie0_ep: pcie-ep@1c00000 {
phy-names = "pciephy";
max-link-speed = <3>; /* FIXME: Limiting the Gen speed due to stability issues */
num-lanes = <2>;
+ linux,pci-domain = <0>;
status = "disabled";
};
@@ -4775,6 +4776,7 @@ pcie1_ep: pcie-ep@1c10000 {
phy-names = "pciephy";
max-link-speed = <3>; /* FIXME: Limiting the Gen speed due to stability issues */
num-lanes = <4>;
+ linux,pci-domain = <1>;
status = "disabled";
};
--
2.25.1
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH v4 10/12] dt-bindings: PCI: qcom,pcie-sm8450: Add 'global' interrupt
2024-08-28 15:46 [PATCH v4 00/12] PCI: qcom: Enumerate endpoints based on Link up event in 'global_irq' interrupt Manivannan Sadhasivam via B4 Relay
` (8 preceding siblings ...)
2024-08-28 15:46 ` [PATCH v4 09/12] arm64: dts: qcom: sa8775p: Add 'linux,pci-domain' to PCIe EP controller nodes Manivannan Sadhasivam via B4 Relay
@ 2024-08-28 15:46 ` Manivannan Sadhasivam via B4 Relay
2024-08-28 15:46 ` [PATCH v4 11/12] PCI: qcom: Enumerate endpoints based on Link up event in 'global_irq' interrupt Manivannan Sadhasivam via B4 Relay
` (3 subsequent siblings)
13 siblings, 0 replies; 17+ messages in thread
From: Manivannan Sadhasivam via B4 Relay @ 2024-08-28 15:46 UTC (permalink / raw)
To: Lorenzo Pieralisi, Krzysztof Wilczyński, Rob Herring,
Bjorn Helgaas, Krzysztof Kozlowski, Conor Dooley,
Kishon Vijay Abraham I, Bjorn Andersson, Konrad Dybcio
Cc: linux-pci, linux-arm-msm, linux-kernel, devicetree,
Manivannan Sadhasivam
From: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Qcom PCIe RC controllers are capable of generating 'global' SPI interrupt
to the host CPU. This interrupt can be used by the device driver to
identify events such as PCIe link specific events, safety events, etc...
Hence, document it in the binding along with the existing MSI interrupts.
Though adding a new interrupt will break the ABI, it is required to
accurately describe the hardware.
Reviewed-by: Rob Herring (Arm) <robh@kernel.org>
Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
---
Documentation/devicetree/bindings/pci/qcom,pcie-common.yaml | 4 ++--
Documentation/devicetree/bindings/pci/qcom,pcie-sm8450.yaml | 10 ++++++----
2 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/Documentation/devicetree/bindings/pci/qcom,pcie-common.yaml b/Documentation/devicetree/bindings/pci/qcom,pcie-common.yaml
index 0a39bbfcb28b..704c0f58eea5 100644
--- a/Documentation/devicetree/bindings/pci/qcom,pcie-common.yaml
+++ b/Documentation/devicetree/bindings/pci/qcom,pcie-common.yaml
@@ -21,11 +21,11 @@ properties:
interrupts:
minItems: 1
- maxItems: 8
+ maxItems: 9
interrupt-names:
minItems: 1
- maxItems: 8
+ maxItems: 9
iommu-map:
minItems: 1
diff --git a/Documentation/devicetree/bindings/pci/qcom,pcie-sm8450.yaml b/Documentation/devicetree/bindings/pci/qcom,pcie-sm8450.yaml
index d8c0afaa4b19..46bd59eefadb 100644
--- a/Documentation/devicetree/bindings/pci/qcom,pcie-sm8450.yaml
+++ b/Documentation/devicetree/bindings/pci/qcom,pcie-sm8450.yaml
@@ -55,8 +55,8 @@ properties:
- const: aggre1 # Aggre NoC PCIe1 AXI clock
interrupts:
- minItems: 8
- maxItems: 8
+ minItems: 9
+ maxItems: 9
interrupt-names:
items:
@@ -68,6 +68,7 @@ properties:
- const: msi5
- const: msi6
- const: msi7
+ - const: global
operating-points-v2: true
opp-table:
@@ -149,9 +150,10 @@ examples:
<GIC_SPI 145 IRQ_TYPE_LEVEL_HIGH>,
<GIC_SPI 146 IRQ_TYPE_LEVEL_HIGH>,
<GIC_SPI 147 IRQ_TYPE_LEVEL_HIGH>,
- <GIC_SPI 148 IRQ_TYPE_LEVEL_HIGH>;
+ <GIC_SPI 148 IRQ_TYPE_LEVEL_HIGH>,
+ <GIC_SPI 140 IRQ_TYPE_LEVEL_HIGH>;
interrupt-names = "msi0", "msi1", "msi2", "msi3",
- "msi4", "msi5", "msi6", "msi7";
+ "msi4", "msi5", "msi6", "msi7", "global";
#interrupt-cells = <1>;
interrupt-map-mask = <0 0 0 0x7>;
interrupt-map = <0 0 0 1 &intc 0 0 0 149 IRQ_TYPE_LEVEL_HIGH>, /* int_a */
--
2.25.1
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH v4 11/12] PCI: qcom: Enumerate endpoints based on Link up event in 'global_irq' interrupt
2024-08-28 15:46 [PATCH v4 00/12] PCI: qcom: Enumerate endpoints based on Link up event in 'global_irq' interrupt Manivannan Sadhasivam via B4 Relay
` (9 preceding siblings ...)
2024-08-28 15:46 ` [PATCH v4 10/12] dt-bindings: PCI: qcom,pcie-sm8450: Add 'global' interrupt Manivannan Sadhasivam via B4 Relay
@ 2024-08-28 15:46 ` Manivannan Sadhasivam via B4 Relay
2024-08-28 15:46 ` [PATCH v4 12/12] arm64: dts: qcom: sm8450: Add 'global' interrupt to the PCIe RC node Manivannan Sadhasivam via B4 Relay
` (2 subsequent siblings)
13 siblings, 0 replies; 17+ messages in thread
From: Manivannan Sadhasivam via B4 Relay @ 2024-08-28 15:46 UTC (permalink / raw)
To: Lorenzo Pieralisi, Krzysztof Wilczyński, Rob Herring,
Bjorn Helgaas, Krzysztof Kozlowski, Conor Dooley,
Kishon Vijay Abraham I, Bjorn Andersson, Konrad Dybcio
Cc: linux-pci, linux-arm-msm, linux-kernel, devicetree,
Manivannan Sadhasivam, Konrad Dybcio
From: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Historically, Qcom PCIe RC controllers lacked standard hotplug support. So
when an endpoint is attached to the SoC, users have to rescan the bus
manually to enumerate the device. But this can be avoided by using the Link
up event exposed by the Qcom specific 'global_irq' interrupt.
Qcom PCIe RC controllers are capable of generating the 'global' SPI
interrupt to the host CPUs. The device driver can use this interrupt to
identify events such as PCIe link specific events, safety events etc...
One such event is the PCIe Link up event generated when an endpoint is
detected on the bus and the Link is 'up'. This event can be used to
enumerate the PCIe endpoint devices without user intervention.
So add support for capturing the PCIe Link up event using the 'global'
interrupt in the driver. Once the Link up event is received, the bus
underneath the host bridge is scanned to enumerate PCIe endpoint devices.
All of the Qcom SoCs have only one rootport per controller instance. So
only a single 'Link up' event is generated for the PCIe controller.
Reviewed-by: Konrad Dybcio <konrad.dybcio@linaro.org>
Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
---
drivers/pci/controller/dwc/pcie-qcom.c | 55 +++++++++++++++++++++++++++++++++-
1 file changed, 54 insertions(+), 1 deletion(-)
diff --git a/drivers/pci/controller/dwc/pcie-qcom.c b/drivers/pci/controller/dwc/pcie-qcom.c
index 0180edf3310e..a1d678fe7fa5 100644
--- a/drivers/pci/controller/dwc/pcie-qcom.c
+++ b/drivers/pci/controller/dwc/pcie-qcom.c
@@ -50,6 +50,9 @@
#define PARF_AXI_MSTR_WR_ADDR_HALT_V2 0x1a8
#define PARF_Q2A_FLUSH 0x1ac
#define PARF_LTSSM 0x1b0
+#define PARF_INT_ALL_STATUS 0x224
+#define PARF_INT_ALL_CLEAR 0x228
+#define PARF_INT_ALL_MASK 0x22c
#define PARF_SID_OFFSET 0x234
#define PARF_BDF_TRANSLATE_CFG 0x24c
#define PARF_SLV_ADDR_SPACE_SIZE 0x358
@@ -121,6 +124,9 @@
/* PARF_LTSSM register fields */
#define LTSSM_EN BIT(8)
+/* PARF_INT_ALL_{STATUS/CLEAR/MASK} register fields */
+#define PARF_INT_ALL_LINK_UP BIT(13)
+
/* PARF_NO_SNOOP_OVERIDE register fields */
#define WR_NO_SNOOP_OVERIDE_EN BIT(1)
#define RD_NO_SNOOP_OVERIDE_EN BIT(3)
@@ -1488,6 +1494,29 @@ static void qcom_pcie_init_debugfs(struct qcom_pcie *pcie)
qcom_pcie_link_transition_count);
}
+static irqreturn_t qcom_pcie_global_irq_thread(int irq, void *data)
+{
+ struct qcom_pcie *pcie = data;
+ struct dw_pcie_rp *pp = &pcie->pci->pp;
+ struct device *dev = pcie->pci->dev;
+ u32 status = readl_relaxed(pcie->parf + PARF_INT_ALL_STATUS);
+
+ writel_relaxed(status, pcie->parf + PARF_INT_ALL_CLEAR);
+
+ if (FIELD_GET(PARF_INT_ALL_LINK_UP, status)) {
+ dev_dbg(dev, "Received Link up event. Starting enumeration!\n");
+ /* Rescan the bus to enumerate endpoint devices */
+ pci_lock_rescan_remove();
+ pci_rescan_bus(pp->bridge->bus);
+ pci_unlock_rescan_remove();
+ } else {
+ dev_WARN_ONCE(dev, 1, "Received unknown event. INT_STATUS: 0x%08x\n",
+ status);
+ }
+
+ return IRQ_HANDLED;
+}
+
static int qcom_pcie_probe(struct platform_device *pdev)
{
const struct qcom_pcie_cfg *pcie_cfg;
@@ -1498,7 +1527,8 @@ static int qcom_pcie_probe(struct platform_device *pdev)
struct dw_pcie_rp *pp;
struct resource *res;
struct dw_pcie *pci;
- int ret;
+ int ret, irq;
+ char *name;
pcie_cfg = of_device_get_match_data(dev);
if (!pcie_cfg || !pcie_cfg->ops) {
@@ -1617,6 +1647,27 @@ static int qcom_pcie_probe(struct platform_device *pdev)
goto err_phy_exit;
}
+ name = devm_kasprintf(dev, GFP_KERNEL, "qcom_pcie_global_irq%d",
+ pci_domain_nr(pp->bridge->bus));
+ if (!name) {
+ ret = -ENOMEM;
+ goto err_host_deinit;
+ }
+
+ irq = platform_get_irq_byname_optional(pdev, "global");
+ if (irq > 0) {
+ ret = devm_request_threaded_irq(&pdev->dev, irq, NULL,
+ qcom_pcie_global_irq_thread,
+ IRQF_ONESHOT, name, pcie);
+ if (ret) {
+ dev_err_probe(&pdev->dev, ret,
+ "Failed to request Global IRQ\n");
+ goto err_host_deinit;
+ }
+
+ writel_relaxed(PARF_INT_ALL_LINK_UP, pcie->parf + PARF_INT_ALL_MASK);
+ }
+
qcom_pcie_icc_opp_update(pcie);
if (pcie->mhi)
@@ -1624,6 +1675,8 @@ static int qcom_pcie_probe(struct platform_device *pdev)
return 0;
+err_host_deinit:
+ dw_pcie_host_deinit(pp);
err_phy_exit:
phy_exit(pcie->phy);
err_pm_runtime_put:
--
2.25.1
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH v4 12/12] arm64: dts: qcom: sm8450: Add 'global' interrupt to the PCIe RC node
2024-08-28 15:46 [PATCH v4 00/12] PCI: qcom: Enumerate endpoints based on Link up event in 'global_irq' interrupt Manivannan Sadhasivam via B4 Relay
` (10 preceding siblings ...)
2024-08-28 15:46 ` [PATCH v4 11/12] PCI: qcom: Enumerate endpoints based on Link up event in 'global_irq' interrupt Manivannan Sadhasivam via B4 Relay
@ 2024-08-28 15:46 ` Manivannan Sadhasivam via B4 Relay
2024-09-01 17:47 ` [PATCH v4 00/12] PCI: qcom: Enumerate endpoints based on Link up event in 'global_irq' interrupt Krzysztof Wilczyński
2024-10-23 4:15 ` (subset) " Bjorn Andersson
13 siblings, 0 replies; 17+ messages in thread
From: Manivannan Sadhasivam via B4 Relay @ 2024-08-28 15:46 UTC (permalink / raw)
To: Lorenzo Pieralisi, Krzysztof Wilczyński, Rob Herring,
Bjorn Helgaas, Krzysztof Kozlowski, Conor Dooley,
Kishon Vijay Abraham I, Bjorn Andersson, Konrad Dybcio
Cc: linux-pci, linux-arm-msm, linux-kernel, devicetree,
Manivannan Sadhasivam
From: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Qcom PCIe RC controllers are capable of generating 'global' SPI interrupt
to the host CPUs. This interrupt can be used by the device driver to
identify events such as PCIe link specific events, safety events, etc...
Hence, add it to the PCIe RC node along with the existing MSI interrupts.
Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
---
arch/arm64/boot/dts/qcom/sm8450.dtsi | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/arch/arm64/boot/dts/qcom/sm8450.dtsi b/arch/arm64/boot/dts/qcom/sm8450.dtsi
index 9bafb3b350ff..564b071eb77c 100644
--- a/arch/arm64/boot/dts/qcom/sm8450.dtsi
+++ b/arch/arm64/boot/dts/qcom/sm8450.dtsi
@@ -1787,7 +1787,8 @@ pcie0: pcie@1c00000 {
<GIC_SPI 145 IRQ_TYPE_LEVEL_HIGH>,
<GIC_SPI 146 IRQ_TYPE_LEVEL_HIGH>,
<GIC_SPI 147 IRQ_TYPE_LEVEL_HIGH>,
- <GIC_SPI 148 IRQ_TYPE_LEVEL_HIGH>;
+ <GIC_SPI 148 IRQ_TYPE_LEVEL_HIGH>,
+ <GIC_SPI 140 IRQ_TYPE_LEVEL_HIGH>;
interrupt-names = "msi0",
"msi1",
"msi2",
@@ -1795,7 +1796,8 @@ pcie0: pcie@1c00000 {
"msi4",
"msi5",
"msi6",
- "msi7";
+ "msi7",
+ "global";
#interrupt-cells = <1>;
interrupt-map-mask = <0 0 0 0x7>;
interrupt-map = <0 0 0 1 &intc 0 0 0 149 IRQ_TYPE_LEVEL_HIGH>, /* int_a */
@@ -1949,7 +1951,8 @@ pcie1: pcie@1c08000 {
<GIC_SPI 313 IRQ_TYPE_LEVEL_HIGH>,
<GIC_SPI 314 IRQ_TYPE_LEVEL_HIGH>,
<GIC_SPI 374 IRQ_TYPE_LEVEL_HIGH>,
- <GIC_SPI 375 IRQ_TYPE_LEVEL_HIGH>;
+ <GIC_SPI 375 IRQ_TYPE_LEVEL_HIGH>,
+ <GIC_SPI 306 IRQ_TYPE_LEVEL_HIGH>;
interrupt-names = "msi0",
"msi1",
"msi2",
@@ -1957,7 +1960,8 @@ pcie1: pcie@1c08000 {
"msi4",
"msi5",
"msi6",
- "msi7";
+ "msi7",
+ "global";
#interrupt-cells = <1>;
interrupt-map-mask = <0 0 0 0x7>;
interrupt-map = <0 0 0 1 &intc 0 0 0 434 IRQ_TYPE_LEVEL_HIGH>, /* int_a */
--
2.25.1
^ permalink raw reply related [flat|nested] 17+ messages in thread
* Re: [PATCH v4 05/12] PCI: endpoint: Assign PCI domain number for endpoint controllers
2024-08-28 15:46 ` [PATCH v4 05/12] PCI: endpoint: Assign PCI domain number for endpoint controllers Manivannan Sadhasivam via B4 Relay
@ 2024-08-28 18:30 ` Frank Li
0 siblings, 0 replies; 17+ messages in thread
From: Frank Li @ 2024-08-28 18:30 UTC (permalink / raw)
To: Manivannan Sadhasivam
Cc: Lorenzo Pieralisi, Krzysztof Wilczyński, Rob Herring,
Bjorn Helgaas, Krzysztof Kozlowski, Conor Dooley,
Kishon Vijay Abraham I, Bjorn Andersson, Konrad Dybcio, linux-pci,
linux-arm-msm, linux-kernel, devicetree
On Wed, Aug 28, 2024 at 09:16:15PM +0530, Manivannan Sadhasivam wrote:
> Right now, PCI endpoint subsystem doesn't assign PCI domain number for the
> PCI endpoint controllers. But this domain number could be useful to the EPC
> drivers to uniquely identify each controller based on the hardware instance
> when there are multiple ones present in an SoC (even multiple RC/EP).
>
> So let's make use of the existing pci_bus_find_domain_nr() API to allocate
> domain numbers based on either Devicetree (linux,pci-domain) property or
> dynamic domain number allocation scheme.
>
> It should be noted that the domain number allocated by this API will be
> based on both RC and EP controllers in a SoC. If the 'linux,pci-domain' DT
> property is present, then the domain number represents the actual hardware
> instance of the PCI endpoint controller. If not, then the domain number
> will be allocated based on the PCI EP/RC controller probe order.
>
> If the architecture doesn't support CONFIG_PCI_DOMAINS_GENERIC (rare), then
> currently a warning is thrown to indicate that the architecture specific
> implementation is needed.
>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
> Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
> ---
> drivers/pci/endpoint/pci-epc-core.c | 14 ++++++++++++++
> include/linux/pci-epc.h | 2 ++
> 2 files changed, 16 insertions(+)
>
> diff --git a/drivers/pci/endpoint/pci-epc-core.c b/drivers/pci/endpoint/pci-epc-core.c
> index 84309dfe0c68..085a2de8b923 100644
> --- a/drivers/pci/endpoint/pci-epc-core.c
> +++ b/drivers/pci/endpoint/pci-epc-core.c
> @@ -838,6 +838,10 @@ void pci_epc_destroy(struct pci_epc *epc)
> {
> pci_ep_cfs_remove_epc_group(epc->group);
> device_unregister(&epc->dev);
> +
> +#ifdef CONFIG_PCI_DOMAINS_GENERIC
> + pci_bus_release_domain_nr(NULL, &epc->dev);
> +#endif
> }
> EXPORT_SYMBOL_GPL(pci_epc_destroy);
>
> @@ -900,6 +904,16 @@ __pci_epc_create(struct device *dev, const struct pci_epc_ops *ops,
> epc->dev.release = pci_epc_release;
> epc->ops = ops;
>
> +#ifdef CONFIG_PCI_DOMAINS_GENERIC
> + epc->domain_nr = pci_bus_find_domain_nr(NULL, dev);
> +#else
> + /*
> + * TODO: If the architecture doesn't support generic PCI
> + * domains, then a custom implementation has to be used.
> + */
> + WARN_ONCE(1, "This architecture doesn't support generic PCI domains\n");
> +#endif
> +
> ret = dev_set_name(&epc->dev, "%s", dev_name(dev));
> if (ret)
> goto put_dev;
> diff --git a/include/linux/pci-epc.h b/include/linux/pci-epc.h
> index 85bdf2adb760..8e3dcac55dcd 100644
> --- a/include/linux/pci-epc.h
> +++ b/include/linux/pci-epc.h
> @@ -128,6 +128,7 @@ struct pci_epc_mem {
> * @group: configfs group representing the PCI EPC device
> * @lock: mutex to protect pci_epc ops
> * @function_num_map: bitmap to manage physical function number
> + * @domain_nr: PCI domain number of the endpoint controller
> * @init_complete: flag to indicate whether the EPC initialization is complete
> * or not
> */
> @@ -145,6 +146,7 @@ struct pci_epc {
> /* mutex to protect against concurrent access of EP controller */
> struct mutex lock;
> unsigned long function_num_map;
> + int domain_nr;
> bool init_complete;
> };
>
>
> --
> 2.25.1
>
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH v4 03/12] dt-bindings: PCI: pci-ep: Update Maintainers
2024-08-28 15:46 ` [PATCH v4 03/12] dt-bindings: PCI: pci-ep: Update Maintainers Manivannan Sadhasivam via B4 Relay
@ 2024-08-28 18:31 ` Frank Li
0 siblings, 0 replies; 17+ messages in thread
From: Frank Li @ 2024-08-28 18:31 UTC (permalink / raw)
To: Manivannan Sadhasivam
Cc: Lorenzo Pieralisi, Krzysztof Wilczyński, Rob Herring,
Bjorn Helgaas, Krzysztof Kozlowski, Conor Dooley,
Kishon Vijay Abraham I, Bjorn Andersson, Konrad Dybcio, linux-pci,
linux-arm-msm, linux-kernel, devicetree
On Wed, Aug 28, 2024 at 09:16:13PM +0530, Manivannan Sadhasivam wrote:
> Kishon's TI email ID is not active anymore, so use his korg ID. Also, since
> I've been maintaining the PCI endpoint framework, I'm willing to maintain
> the DT binding as well. So add myself as the Co-maintainer.
>
> Acked-by: Rob Herring (Arm) <robh@kernel.org>
> Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
> ---
> Documentation/devicetree/bindings/pci/pci-ep.yaml | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/Documentation/devicetree/bindings/pci/pci-ep.yaml b/Documentation/devicetree/bindings/pci/pci-ep.yaml
> index d1eef4825207..0b5456ee21eb 100644
> --- a/Documentation/devicetree/bindings/pci/pci-ep.yaml
> +++ b/Documentation/devicetree/bindings/pci/pci-ep.yaml
> @@ -10,7 +10,8 @@ description: |
> Common properties for PCI Endpoint Controller Nodes.
>
> maintainers:
> - - Kishon Vijay Abraham I <kishon@ti.com>
> + - Kishon Vijay Abraham I <kishon@kernel.org>
> + - Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
>
> properties:
> $nodename:
>
> --
> 2.25.1
>
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH v4 00/12] PCI: qcom: Enumerate endpoints based on Link up event in 'global_irq' interrupt
2024-08-28 15:46 [PATCH v4 00/12] PCI: qcom: Enumerate endpoints based on Link up event in 'global_irq' interrupt Manivannan Sadhasivam via B4 Relay
` (11 preceding siblings ...)
2024-08-28 15:46 ` [PATCH v4 12/12] arm64: dts: qcom: sm8450: Add 'global' interrupt to the PCIe RC node Manivannan Sadhasivam via B4 Relay
@ 2024-09-01 17:47 ` Krzysztof Wilczyński
2024-10-23 4:15 ` (subset) " Bjorn Andersson
13 siblings, 0 replies; 17+ messages in thread
From: Krzysztof Wilczyński @ 2024-09-01 17:47 UTC (permalink / raw)
To: manivannan.sadhasivam
Cc: Lorenzo Pieralisi, Rob Herring, Bjorn Helgaas,
Krzysztof Kozlowski, Conor Dooley, Kishon Vijay Abraham I,
Bjorn Andersson, Konrad Dybcio, linux-pci, linux-arm-msm,
linux-kernel, devicetree, Konrad Dybcio
Hello,
> This series adds support to enumerate the PCIe endpoint devices using the Qcom
> specific 'Link up' event in 'global' IRQ. Historically, Qcom PCIe RC controllers
> lacked standard hotplug support. So when an endpoint is attached to the SoC,
> users have to rescan the bus manually to enumerate the device. But this can be
> avoided by rescanning the bus upon receiving 'Link up' event.
>
> Qcom PCIe RC controllers are capable of generating the 'global' SPI interrupt
> to the host CPUs. The device driver can use this interrupt to identify events
> such as PCIe link specific events, safety events etc...
>
> One such event is the PCIe Link up event generated when an endpoint is detected
> on the bus and the Link is 'up'. This event can be used to enumerate the
> endpoint devices.
>
> So add support for capturing the PCIe Link up event using the 'global' interrupt
> in the driver. Once the Link up event is received, the bus underneath the host
> bridge is scanned to enumerate PCIe endpoint devices.
>
> This series also has some cleanups to the Qcom PCIe EP controller driver for
> interrupt handling.
>
> NOTE: During v2 review, there was a discussion about removing the devices when
> 'Link Down' event is received. But this needs some more investigation, so I'm
> planning to add it later.
>
> Testing
> =======
>
> This series is tested on Qcom SM8450 based development board that has 2 SoCs
> connected over PCIe.
>
> Merging Strategy
> ================
>
> I'm expecting the binding and PCI driver changes to go through PCI tree and DTS
> patches through Qcom tree.
Applied to controller/qcom, thank you!
[01/08] PCI: qcom-ep: Drop the redundant masking of global IRQ events
https://git.kernel.org/pci/pci/c/3858e8a5ea71
[02/08] PCI: qcom-ep: Reword the error message for receiving unknown global IRQ event
https://git.kernel.org/pci/pci/c/95bebcbd657c
[03/08] dt-bindings: PCI: pci-ep: Update Maintainers
https://git.kernel.org/pci/pci/c/99244b999dec
[04/08] dt-bindings: PCI: pci-ep: Document 'linux,pci-domain' property
https://git.kernel.org/pci/pci/c/ada94d00620a
[05/08] PCI: endpoint: Assign PCI domain number for endpoint controllers
https://git.kernel.org/pci/pci/c/0328947c5032
[06/08] PCI: qcom-ep: Modify 'global_irq' and 'perst_irq' IRQ device names
https://git.kernel.org/pci/pci/c/bba1251edf85
[07/08] dt-bindings: PCI: qcom,pcie-sm8450: Add 'global' interrupt
https://git.kernel.org/pci/pci/c/6efd853303a5
[08/08] PCI: qcom: Enumerate endpoints based on Link up event in 'global_irq' interrupt
https://git.kernel.org/pci/pci/c/4581403f6792
Krzysztof
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: (subset) [PATCH v4 00/12] PCI: qcom: Enumerate endpoints based on Link up event in 'global_irq' interrupt
2024-08-28 15:46 [PATCH v4 00/12] PCI: qcom: Enumerate endpoints based on Link up event in 'global_irq' interrupt Manivannan Sadhasivam via B4 Relay
` (12 preceding siblings ...)
2024-09-01 17:47 ` [PATCH v4 00/12] PCI: qcom: Enumerate endpoints based on Link up event in 'global_irq' interrupt Krzysztof Wilczyński
@ 2024-10-23 4:15 ` Bjorn Andersson
13 siblings, 0 replies; 17+ messages in thread
From: Bjorn Andersson @ 2024-10-23 4:15 UTC (permalink / raw)
To: Lorenzo Pieralisi, Krzysztof Wilczyński, Rob Herring,
Bjorn Helgaas, Krzysztof Kozlowski, Conor Dooley,
Kishon Vijay Abraham I, Konrad Dybcio, Manivannan Sadhasivam
Cc: linux-pci, linux-arm-msm, linux-kernel, devicetree
On Wed, 28 Aug 2024 21:16:10 +0530, Manivannan Sadhasivam wrote:
> This series adds support to enumerate the PCIe endpoint devices using the Qcom
> specific 'Link up' event in 'global' IRQ. Historically, Qcom PCIe RC controllers
> lacked standard hotplug support. So when an endpoint is attached to the SoC,
> users have to rescan the bus manually to enumerate the device. But this can be
> avoided by rescanning the bus upon receiving 'Link up' event.
>
> Qcom PCIe RC controllers are capable of generating the 'global' SPI interrupt
> to the host CPUs. The device driver can use this interrupt to identify events
> such as PCIe link specific events, safety events etc...
>
> [...]
Applied, thanks!
[09/12] arm64: dts: qcom: sa8775p: Add 'linux,pci-domain' to PCIe EP controller nodes
commit: 9e8f38da6e240a71b860c4a895ea583f63964c45
[12/12] arm64: dts: qcom: sm8450: Add 'global' interrupt to the PCIe RC node
commit: 7dc36be39c96f00d0d7c577cc91ff6b108b1d444
Best regards,
--
Bjorn Andersson <andersson@kernel.org>
^ permalink raw reply [flat|nested] 17+ messages in thread
end of thread, other threads:[~2024-10-23 4:16 UTC | newest]
Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-28 15:46 [PATCH v4 00/12] PCI: qcom: Enumerate endpoints based on Link up event in 'global_irq' interrupt Manivannan Sadhasivam via B4 Relay
2024-08-28 15:46 ` [PATCH v4 01/12] PCI: qcom-ep: Drop the redundant masking of global IRQ events Manivannan Sadhasivam via B4 Relay
2024-08-28 15:46 ` [PATCH v4 02/12] PCI: qcom-ep: Reword the error message for receiving unknown global IRQ event Manivannan Sadhasivam via B4 Relay
2024-08-28 15:46 ` [PATCH v4 03/12] dt-bindings: PCI: pci-ep: Update Maintainers Manivannan Sadhasivam via B4 Relay
2024-08-28 18:31 ` Frank Li
2024-08-28 15:46 ` [PATCH v4 04/12] dt-bindings: PCI: pci-ep: Document 'linux,pci-domain' property Manivannan Sadhasivam via B4 Relay
2024-08-28 15:46 ` [PATCH v4 05/12] PCI: endpoint: Assign PCI domain number for endpoint controllers Manivannan Sadhasivam via B4 Relay
2024-08-28 18:30 ` Frank Li
2024-08-28 15:46 ` [PATCH v4 06/12] PCI: qcom-ep: Modify 'global_irq' and 'perst_irq' IRQ device names Manivannan Sadhasivam via B4 Relay
2024-08-28 15:46 ` [PATCH v4 07/12] ARM: dts: qcom: sdx55: Add 'linux,pci-domain' to PCIe EP controller node Manivannan Sadhasivam via B4 Relay
2024-08-28 15:46 ` [PATCH v4 08/12] ARM: dts: qcom: sdx65: " Manivannan Sadhasivam via B4 Relay
2024-08-28 15:46 ` [PATCH v4 09/12] arm64: dts: qcom: sa8775p: Add 'linux,pci-domain' to PCIe EP controller nodes Manivannan Sadhasivam via B4 Relay
2024-08-28 15:46 ` [PATCH v4 10/12] dt-bindings: PCI: qcom,pcie-sm8450: Add 'global' interrupt Manivannan Sadhasivam via B4 Relay
2024-08-28 15:46 ` [PATCH v4 11/12] PCI: qcom: Enumerate endpoints based on Link up event in 'global_irq' interrupt Manivannan Sadhasivam via B4 Relay
2024-08-28 15:46 ` [PATCH v4 12/12] arm64: dts: qcom: sm8450: Add 'global' interrupt to the PCIe RC node Manivannan Sadhasivam via B4 Relay
2024-09-01 17:47 ` [PATCH v4 00/12] PCI: qcom: Enumerate endpoints based on Link up event in 'global_irq' interrupt Krzysztof Wilczyński
2024-10-23 4:15 ` (subset) " Bjorn Andersson
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).