Skip to contentSkip to conversation

Altera PCIe host controller driver with MSI support

PATCH Superseded Ley Foon Tan 2 participants 10 messages Oct 19, 2015

Subsystems (4)

v10 of 12 Superseded Latest is v12 →

lore
Share & tools
lore
#0 lore raw

v10 cover Altera PCIe host controller driver with MSI support

This is the 10th version of patch set to add support for Altera PCIe host controller with MSI feature on Altera FPGA device families. This patchset mainly resolve comments from Arnd to support loadable module and implement fixups within driver instead of calling *PCI_FIXUP* macro. Only PATCH 3/6 has changes, others unchanged.

This patchset is based on v4.3-rc6.

v9->v10 changes:
- altera-pcie: support loadable module
- altera-pcie: implement fixups within driver instead of calling *PCI_FIXUP* macro
- altera-pcie: remove altera_pcie_remove and add suppress_bind_attrs = true

History:
-------
[v1]: https://lkml.org/lkml/2015/7/28/395
[v2]: https://lkml.org/lkml/2015/7/31/267
[v3]: http://www.kernelhub.org/?msg=811940&p=2
[v4]: https://lkml.org/lkml/2015/8/17/141
[v5]: https://lkml.org/lkml/2015/8/25/238
[v6]: https://lkml.org/lkml/2015/9/1/177
[v7]: https://lkml.org/lkml/2015/9/20/193
[v8]: http://www.kernelhub.org/?msg=853553&p=2
[v9]: https://lkml.org/lkml/2015/10/13/998

Ley Foon Tan (6):
arm: add msi.h to Kbuild
pci: add Altera PCI vendor ID
pci:host: Add Altera PCIe host controller driver
pci: altera: Add Altera PCIe MSI driver
Documentation: dt-bindings: pci: altera pcie device tree binding
MAINTAINERS: Add Altera PCIe and MSI drivers maintainer

 .../devicetree/bindings/pci/altera-pcie-msi.txt    |  28 +
 .../devicetree/bindings/pci/altera-pcie.txt        |  49 ++
 MAINTAINERS                                        |  16 +
 arch/arm/include/asm/Kbuild                        |   1 +
 drivers/pci/host/Kconfig                           |  15 +
 drivers/pci/host/Makefile                          |   2 +
 drivers/pci/host/pcie-altera-msi.c                 | 313 +++++++++++
 drivers/pci/host/pcie-altera.c                     | 581 +++++++++++++++++++++
 include/linux/pci_ids.h                            |   2 +
 9 files changed, 1007 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/pci/altera-pcie-msi.txt
 create mode 100644 Documentation/devicetree/bindings/pci/altera-pcie.txt
 create mode 100644 drivers/pci/host/pcie-altera-msi.c
 create mode 100644 drivers/pci/host/pcie-altera.c
Signature · 1 line
1.8.2.1
#1 lore raw

PATCH v10 1/6 arm: add msi.h to Kbuild

Include asm-generic/msi.h to support CONFIG_GENERIC_MSI_IRQ_DOMAIN. This to fix compilation error:
"include/linux/msi.h:123:21: fatal error: asm/msi.h:
No such file or directory"

---
 arch/arm/include/asm/Kbuild | 1 +
 1 file changed, 1 insertion(+)
arch/arm/include/asm/Kbuild +1 -0
index be648eb..bd42530 100644
@@ -14,6 +14,7 @@ generic-y += local.h
 generic-y += local64.h
 generic-y += mm-arch-hooks.h
 generic-y += msgbuf.h
+generic-y += msi.h
 generic-y += param.h
 generic-y += parport.h
 generic-y += poll.h
Signature · 1 line
1.8.2.1
#2 lore raw

PATCH v10 2/6 pci: add Altera PCI vendor ID

In reply to Ley Foon Tan
---
 include/linux/pci_ids.h | 2 ++
 1 file changed, 2 insertions(+)
include/linux/pci_ids.h +2 -0
index d9ba49c..08e4462 100644
@@ -1550,6 +1550,8 @@
 #define PCI_DEVICE_ID_SERVERWORKS_CSB6LPC 0x0227
 #define PCI_DEVICE_ID_SERVERWORKS_HT1100LD 0x0408
 
+#define PCI_VENDOR_ID_ALTERA		0x1172
+
 #define PCI_VENDOR_ID_SBE		0x1176
 #define PCI_DEVICE_ID_SBE_WANXL100	0x0301
 #define PCI_DEVICE_ID_SBE_WANXL200	0x0302
Signature · 1 line
1.8.2.1
#3 lore raw

PATCH v10 3/6 pci:host: Add Altera PCIe host controller driver

In reply to Ley Foon Tan

This patch adds the Altera PCIe host controller driver.

---
 drivers/pci/host/Kconfig       |   7 +
 drivers/pci/host/Makefile      |   1 +
 drivers/pci/host/pcie-altera.c | 581 +++++++++++++++++++++++++++++++++++++++++
 3 files changed, 589 insertions(+)
 create mode 100644 drivers/pci/host/pcie-altera.c
drivers/pci/host/Kconfig +7 -0
index d5e58ba..a9f6db4 100644
@@ -145,4 +145,11 @@ config PCIE_IPROC_BCMA
 	  Say Y here if you want to use the Broadcom iProc PCIe controller
 	  through the BCMA bus interface
 
+config PCIE_ALTERA
+	tristate "Altera PCIe controller"
+	select PCI_DOMAINS
+	help
+	  Say Y here if you want to enable PCIe controller support on Altera
+	  FPGA.
+
 endmenu
drivers/pci/host/Makefile +1 -0
index 140d66f..6954f76 100644
@@ -17,3 +17,4 @@ obj-$(CONFIG_PCI_VERSATILE) += pci-versatile.o
 obj-$(CONFIG_PCIE_IPROC) += pcie-iproc.o
 obj-$(CONFIG_PCIE_IPROC_PLATFORM) += pcie-iproc-platform.o
 obj-$(CONFIG_PCIE_IPROC_BCMA) += pcie-iproc-bcma.o
+obj-$(CONFIG_PCIE_ALTERA) += pcie-altera.o
drivers/pci/host/pcie-altera.c new file +581 -0

581 lines not on this page · raw message

Signature · 1 line
1.8.2.1
#4 lore raw

[RFC PATCH] pci:host: altera_pcie_fixups() can be static

Signed-off-by: Fengguang Wu <[email protected]>
---
 pcie-altera.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pci/host/pcie-altera.c +1 -1
index b5e7bc2..45f03e3 100644
@@ -114,7 +114,7 @@ static void altera_pcie_fixup_res(struct pci_dev *dev)
 	}
 }
 
-void altera_pcie_fixups(struct pci_bus *bus)
+static void altera_pcie_fixups(struct pci_bus *bus)
 {
 	struct pci_dev *dev;
 
#5 lore raw

Re: [PATCH v10 3/6] pci:host: Add Altera PCIe host controller driver

In reply to Ley Foon Tan
url: https://github.com/0day-ci/linux/commits/Ley-Foon-Tan/arm-add-msi-h-to-Kbuild/20151019-162417 reproduce:

Hi Ley,

[auto build test WARNING on pci/next -- if it's inappropriate base, please suggest rules for selecting the more suitable base]

url: https://github.com/0day-ci/linux/commits/Ley-Foon-Tan/arm-add-msi-h-to-Kbuild/20151019-162417
reproduce:

        # apt-get install sparse
        make ARCH=x86_64 allmodconfig
        make C=1 CF=-D__CHECK_ENDIAN__

sparse warnings: (new ones prefixed by >>)

>> drivers/pci/host/pcie-altera.c:117:6: sparse: symbol 'altera_pcie_fixups' was not declared. Should it be static?
   drivers/pci/host/pcie-altera.c:496:53: sparse: incorrect type in argument 2 (incompatible argument 1 (different base types))
   drivers/pci/host/pcie-altera.c:496:53:    expected void ( *[usertype] handle )( ... )
   drivers/pci/host/pcie-altera.c:496:53:    got void ( static [toplevel] *<noident> )( ... )
   drivers/pci/host/pcie-altera.c: In function 'altera_pcie_parse_dt':
   drivers/pci/host/pcie-altera.c:496:46: warning: passing argument 2 of 'irq_set_chained_handler_and_data' from incompatible pointer type [-Wincompatible-pointer-types]
     irq_set_chained_handler_and_data(pcie->irq, altera_pcie_isr, pcie);
                                                 ^

In file included from arch/x86/include/asm/hardirq.h:5:0,
from include/linux/hardirq.h:8,
from include/linux/interrupt.h:12,
from drivers/pci/host/pcie-altera.c:17:
include/linux/irq.h:545:1: note: expected 'irq_flow_handler_t {aka void (*)(unsigned int, struct irq_desc *)}' but argument is of type 'void (*)(struct irq_desc *)'
irq_set_chained_handler_and_data(unsigned int irq, irq_flow_handler_t handle,
^

Please review and possibly fold the followup patch.

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation

#6 lore raw

Re: [PATCH v10 3/6] pci:host: Add Altera PCIe host controller driver

In reply to Ley Foon Tan
reproduce:

Hi Ley,

[auto build test ERROR on pci/next -- if it's inappropriate base, please suggest rules for selecting the more suitable base]

url:    https://github.com/0day-ci/linux/commits/Ley-Foon-Tan/arm-add-msi-h-to-Kbuild/20151019-162417
config: i386-allmodconfig (attached as .config)
reproduce:
        # save the attached .config to linux build tree
        make ARCH=i386 

All errors (new ones prefixed by >>):

>> ERROR: "pci_fixup_irqs" undefined!

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
-------------- next part --------------
A non-text attachment was scrubbed...
Name: .config.gz
Type: application/octet-stream
Size: 51506 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20151019/93b16dd8/attachment-0001.obj>

#7 lore raw

PATCH v10 4/6 pci: altera: Add Altera PCIe MSI driver

In reply to Ley Foon Tan

This patch adds Altera PCIe MSI driver. This soft IP supports configurable number of vectors, which is a dts parameter.

---
 drivers/pci/host/Kconfig           |   8 +
 drivers/pci/host/Makefile          |   1 +
 drivers/pci/host/pcie-altera-msi.c | 313 +++++++++++++++++++++++++++++++++++++
 3 files changed, 322 insertions(+)
 create mode 100644 drivers/pci/host/pcie-altera-msi.c
drivers/pci/host/Kconfig +8 -0
index a9f6db4..35eba16 100644
@@ -152,4 +152,12 @@ config PCIE_ALTERA
 	  Say Y here if you want to enable PCIe controller support on Altera
 	  FPGA.
 
+config PCIE_ALTERA_MSI
+	bool "Altera PCIe MSI feature"
+	depends on PCI_MSI
+	select PCI_MSI_IRQ_DOMAIN
+	help
+	  Say Y here if you want PCIe MSI support for the Altera FPGA.
+	  This MSI driver supports Altera MSI to GIC controller IP.
+
 endmenu
drivers/pci/host/Makefile +1 -0
index 6954f76..6c4913d 100644
@@ -18,3 +18,4 @@ obj-$(CONFIG_PCIE_IPROC) += pcie-iproc.o
 obj-$(CONFIG_PCIE_IPROC_PLATFORM) += pcie-iproc-platform.o
 obj-$(CONFIG_PCIE_IPROC_BCMA) += pcie-iproc-bcma.o
 obj-$(CONFIG_PCIE_ALTERA) += pcie-altera.o
+obj-$(CONFIG_PCIE_ALTERA_MSI) += pcie-altera-msi.o
drivers/pci/host/pcie-altera-msi.c new file +313 -0

313 lines not on this page · raw message

Signature · 1 line
1.8.2.1
#8 lore raw

PATCH v10 5/6 Documentation: dt-bindings: pci: altera pcie device tree binding

In reply to Ley Foon Tan

This patch adds the bindings for Altera PCIe host controller driver and Altera PCIe MSI driver.

---
 .../devicetree/bindings/pci/altera-pcie-msi.txt    | 28 +++++++++++++
 .../devicetree/bindings/pci/altera-pcie.txt        | 49 ++++++++++++++++++++++
 2 files changed, 77 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/pci/altera-pcie-msi.txt
 create mode 100644 Documentation/devicetree/bindings/pci/altera-pcie.txt
Documentation/devicetree/bindings/pci/altera-pcie-msi.txt new file +28 -0
new file mode 100644
index 0000000..09cd3bc
@@ -0,0 +1,28 @@
+* Altera PCIe MSI controller
+
+Required properties:
+- compatible:	should contain "altr,msi-1.0"
+- reg:		specifies the physical base address of the controller and
+		the length of the memory mapped region.
+- reg-names:	must include the following entries:
+		"csr": CSR registers
+		"vector_slave": vectors slave port region
+- interrupt-parent:	interrupt source phandle.
+- interrupts:	specifies the interrupt source of the parent interrupt
+		controller. The format of the interrupt specifier depends on the
+		parent interrupt controller.
+- num-vectors:	number of vectors, range 1 to 32.
+- msi-controller:	indicates that this is MSI controller node
+
+
+Example
+msi0: msi at 0xFF200000 {
+	compatible = "altr,msi-1.0";
+	reg = <0xFF200000 0x00000010
+		0xFF200010 0x00000080>;
+	reg-names = "csr", "vector_slave";
+	interrupt-parent = <&hps_0_arm_gic_0>;
+	interrupts = <0 42 4>;
+	msi-controller;
+	num-vectors = <32>;
+};
Documentation/devicetree/bindings/pci/altera-pcie.txt new file +49 -0

49 lines not on this page · raw message

Signature · 1 line
1.8.2.1
#9 lore raw

PATCH v10 6/6 MAINTAINERS: Add Altera PCIe and MSI drivers maintainer

In reply to Ley Foon Tan
---
 MAINTAINERS | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
MAINTAINERS +16 -0
index b8577ad9..96b9fac 100644
@@ -7958,6 +7958,14 @@ F:	include/linux/pci*
 F:	arch/x86/pci/
 F:	arch/x86/kernel/quirks.c
 
+PCI DRIVER FOR ALTERA PCIE IP
+M:	Ley Foon Tan <[email protected]>
+L:	rfi at lists.rocketboards.org (moderated for non-subscribers)
+L:	linux-pci at vger.kernel.org
+S:	Supported
+F:	Documentation/devicetree/bindings/pci/altera-pcie.txt
+F:	drivers/pci/host/pcie-altera.c
+
 PCI DRIVER FOR ARM VERSATILE PLATFORM
 M:	Rob Herring <[email protected]>
 L:	linux-pci at vger.kernel.org
@@ -8059,6 +8067,14 @@ L:	linux-pci at vger.kernel.org
 S:	Maintained
 F:	drivers/pci/host/*spear*
 
+PCI MSI DRIVER FOR ALTERA MSI IP
+M:	Ley Foon Tan <[email protected]>
+L:	rfi at lists.rocketboards.org (moderated for non-subscribers)
+L:	linux-pci at vger.kernel.org
+S:	Supported
+F:	Documentation/devicetree/bindings/pci/altera-pcie-msi.txt
+F:	drivers/pci/host/pcie-altera-msi.c
+
 PCI MSI DRIVER FOR APPLIEDMICRO XGENE
 M:	Duc Dang <[email protected]>
 L:	linux-pci at vger.kernel.org
Signature · 1 line
1.8.2.1