Skip to content

Commit dcd19de

Browse files
dhdangbjorn-helgaas
authored andcommitted
PCI: xgene: Add APM X-Gene v1 PCIe MSI/MSIX termination driver
APM X-Gene v1 SoC supports its own implementation of MSI, which is not compliant to GIC V2M specification for MSI Termination. There is a single MSI block in X-Gene v1 SOC which serves all 5 PCIe ports. This MSI block supports 2048 MSI termination ports coalesced into 16 physical HW IRQ lines and shared across all 5 PCIe ports. As there are only 16 HW IRQs to serve 2048 MSI vectors, to support set_affinity correctly for each MSI vectors, the 16 HW IRQs are statically allocated to 8 X-Gene v1 cores (2 HW IRQs for each cores). To steer MSI interrupt to target CPU, MSI vector is moved around these HW IRQs lines. With this approach, the total MSI vectors this driver supports is reduced to 256. [bhelgaas: squash doc, driver, maintainer update] Signed-off-by: Duc Dang <[email protected]> Signed-off-by: Tanmay Inamdar <[email protected]> Signed-off-by: Bjorn Helgaas <[email protected]> Reviewed-by: Marc Zyngier <[email protected]>
1 parent 5ebe6af commit dcd19de

File tree

6 files changed

+703
-0
lines changed

6 files changed

+703
-0
lines changed
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
* AppliedMicro X-Gene v1 PCIe MSI controller
2+
3+
Required properties:
4+
5+
- compatible: should be "apm,xgene1-msi" to identify
6+
X-Gene v1 PCIe MSI controller block.
7+
- msi-controller: indicates that this is X-Gene v1 PCIe MSI controller node
8+
- reg: physical base address (0x79000000) and length (0x900000) for controller
9+
registers. These registers include the MSI termination address and data
10+
registers as well as the MSI interrupt status registers.
11+
- reg-names: not required
12+
- interrupts: A list of 16 interrupt outputs of the controller, starting from
13+
interrupt number 0x10 to 0x1f.
14+
- interrupt-names: not required
15+
16+
Each PCIe node needs to have property msi-parent that points to msi controller node
17+
18+
Examples:
19+
20+
SoC DTSI:
21+
22+
+ MSI node:
23+
msi@79000000 {
24+
compatible = "apm,xgene1-msi";
25+
msi-controller;
26+
reg = <0x00 0x79000000 0x0 0x900000>;
27+
interrupts = <0x0 0x10 0x4>
28+
<0x0 0x11 0x4>
29+
<0x0 0x12 0x4>
30+
<0x0 0x13 0x4>
31+
<0x0 0x14 0x4>
32+
<0x0 0x15 0x4>
33+
<0x0 0x16 0x4>
34+
<0x0 0x17 0x4>
35+
<0x0 0x18 0x4>
36+
<0x0 0x19 0x4>
37+
<0x0 0x1a 0x4>
38+
<0x0 0x1b 0x4>
39+
<0x0 0x1c 0x4>
40+
<0x0 0x1d 0x4>
41+
<0x0 0x1e 0x4>
42+
<0x0 0x1f 0x4>;
43+
};
44+
45+
+ PCIe controller node with msi-parent property pointing to MSI node:
46+
pcie0: pcie@1f2b0000 {
47+
status = "disabled";
48+
device_type = "pci";
49+
compatible = "apm,xgene-storm-pcie", "apm,xgene-pcie";
50+
#interrupt-cells = <1>;
51+
#size-cells = <2>;
52+
#address-cells = <3>;
53+
reg = < 0x00 0x1f2b0000 0x0 0x00010000 /* Controller registers */
54+
0xe0 0xd0000000 0x0 0x00040000>; /* PCI config space */
55+
reg-names = "csr", "cfg";
56+
ranges = <0x01000000 0x00 0x00000000 0xe0 0x10000000 0x00 0x00010000 /* io */
57+
0x02000000 0x00 0x80000000 0xe1 0x80000000 0x00 0x80000000>; /* mem */
58+
dma-ranges = <0x42000000 0x80 0x00000000 0x80 0x00000000 0x00 0x80000000
59+
0x42000000 0x00 0x00000000 0x00 0x00000000 0x80 0x00000000>;
60+
interrupt-map-mask = <0x0 0x0 0x0 0x7>;
61+
interrupt-map = <0x0 0x0 0x0 0x1 &gic 0x0 0xc2 0x1
62+
0x0 0x0 0x0 0x2 &gic 0x0 0xc3 0x1
63+
0x0 0x0 0x0 0x3 &gic 0x0 0xc4 0x1
64+
0x0 0x0 0x0 0x4 &gic 0x0 0xc5 0x1>;
65+
dma-coherent;
66+
clocks = <&pcie0clk 0>;
67+
msi-parent= <&msi>;
68+
};

MAINTAINERS

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7564,6 +7564,14 @@ L: [email protected]
75647564
S: Orphan
75657565
F: drivers/pci/host/*spear*
75667566

7567+
PCI MSI DRIVER FOR APPLIEDMICRO XGENE
7568+
M: Duc Dang <[email protected]>
7569+
7570+
7571+
S: Maintained
7572+
F: Documentation/devicetree/bindings/pci/xgene-pci-msi.txt
7573+
F: drivers/pci/host/pci-xgene-msi.c
7574+
75677575
PCMCIA SUBSYSTEM
75687576
P: Linux PCMCIA Team
75697577

drivers/pci/host/Kconfig

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,11 +89,20 @@ config PCI_XGENE
8989
depends on ARCH_XGENE
9090
depends on OF
9191
select PCIEPORTBUS
92+
select PCI_MSI_IRQ_DOMAIN if PCI_MSI
9293
help
9394
Say Y here if you want internal PCI support on APM X-Gene SoC.
9495
There are 5 internal PCIe ports available. Each port is GEN3 capable
9596
and have varied lanes from x1 to x8.
9697

98+
config PCI_XGENE_MSI
99+
bool "X-Gene v1 PCIe MSI feature"
100+
depends on PCI_XGENE && PCI_MSI
101+
default y
102+
help
103+
Say Y here if you want PCIe MSI support for the APM X-Gene v1 SoC.
104+
This MSI driver supports 5 PCIe ports on the APM X-Gene v1 SoC.
105+
97106
config PCI_LAYERSCAPE
98107
bool "Freescale Layerscape PCIe controller"
99108
depends on OF && ARM

drivers/pci/host/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ obj-$(CONFIG_PCIE_SPEAR13XX) += pcie-spear13xx.o
1111
obj-$(CONFIG_PCI_KEYSTONE) += pci-keystone-dw.o pci-keystone.o
1212
obj-$(CONFIG_PCIE_XILINX) += pcie-xilinx.o
1313
obj-$(CONFIG_PCI_XGENE) += pci-xgene.o
14+
obj-$(CONFIG_PCI_XGENE_MSI) += pci-xgene-msi.o
1415
obj-$(CONFIG_PCI_LAYERSCAPE) += pci-layerscape.o
1516
obj-$(CONFIG_PCI_VERSATILE) += pci-versatile.o
1617
obj-$(CONFIG_PCIE_IPROC) += pcie-iproc.o

0 commit comments

Comments
 (0)