pci: support for configurable PCI endpoint
Subsystems (26)
cover pci: support for configurable PCI endpoint
This patch series
*) adds PCI endpoint core layer
*) modifies designware/dra7xx driver to be configured in EP mode *) adds a PCI endpoint *test* function driver
Known Limitation:
*) Does not support multi-function devices
TODO:
*) access buffers in RC
*) raise MSI interrupts
*) Enable user space control for the RC side PCI driver *) Adapt all other users of designware to use the new design (only
dra7xx has been adapted)
HOW TO:
ON THE EP SIDE:
***************
/* EP function is configured using configfs */
# mount -t configfs none /sys/kernel/config
/* PCI EP core layer creates "pci_ep" entry in configfs */
# cd /sys/kernel/config/pci_ep/
/*
* This is the 1st step in creating an endpoint function. This
* creates the endpoint function device *instance*. The string
* before the .<num> suffix will identify the driver this
* EP function will bind to.
* Just pci_epf_test is also valid. The .<num> suffix is used
* if there are multiple PCI controllers and all of them wants
* to use the same function.
*/
# mkdir pci_epf_test.0
/*
* When the above command is given, the function device will
* also be bound to a function driver. To find the list of
* function drivers available in the system, use the following
* command. To create a new driver, the following can be referred
* drivers/pci/endpoint/functions/pci-epf-test.c
*/
# ls /sys/bus/pci-epf/drivers pci_epf_test
/* Now configure the endpoint function */
# cd pci_epf_test.0
/* These are the fields that can be configured */
# ls baseclass_code function revid vendorid cache_line_size interrupt_pin subclass_code deviceid peripheral subsys_id epc progif_code subsys_vendor_id
/* The function driver will populate these fields with default values */
# cat vendorid 0xffff
# cat interrupt_pin 0x0001
/* The user can configure any of these fields */
# echo 0x104c > vendorid
/*
* Next is binding this function driver to the controller driver. In
* order to find the possible controller drivers that this function
* driver can be bound to, the following sysfs entry can be used */
# ls /sys/class/pci_epc/ 51000000.pci
/* Now bind the function driver to the controller driver */
# echo "51000000.pcie" > epc [ 494.743487] dra7-pcie 51000000.pcie: no free inbound window [ 494.749367] pci_epf_test pci_epf_test.0: failed to set BAR4 [ 494.755238] dra7-pcie 51000000.pcie: no free inbound window [ 494.761451] pci_epf_test pci_epf_test.0: failed to set BAR5
/*
* the above error messages are due to non availability of free
* inbound windows. So the function drivers in dra7xx can use
* only 4 (BAR0..BAR3) BARs
*/
/****** PCI endpoint is configured ******/
ON THE HOST SIDE:
*****************
# modprobe pci_endpoint_test [ 8.197560] ****** Testing pci-endpoint-test Device ****** [ 9.056990] Reset: OKAY [ 9.059753] BAR1 OKAY [ 9.062419] BAR2 OKAY [ 9.069506] BAR3 OKAY [ 9.071880] BAR4 NOT OKAY [ 9.074618] BAR5 NOT OKAY [ 9.379257] Legacy IRQ: OKAY [ 9.382281] ****** End Test ******
/*
* Rightnow these tests gets executed as soon as the pci_endpoint_test
* module gets inserted. These will be modified so that user/user script
* can control this. Once the functionality for EP to access RC buffer
* is added, more tests can be added including throughput measurement tests. */
Kishon Vijay Abraham I (11):
pci: endpoint: add EP core layer to enable EP controller and EP
functions
pci: endpoint: introduce configfs entry for configuring EP functions
Documentation: PCI: guide to use PCI Endpoint Core Layer
pci: endpoint: functions: add an EP function to test PCI
pci: rename *host* directory to *controller*
pci: controller: split designware into *core* and *host*
pci: controller: designware: Add EP mode support
pci: controller: dra7xx: Add EP mode support
misc: add a new host side PCI endpoint test driver
ARM: dts: DRA7: Modify pcie1 dt node for EP mode
HACK: pci: controller: dra7xx: disable smart idle
Documentation/PCI/00-INDEX | 5 +
Documentation/PCI/pci-endpoint.txt | 199 ++++++++++
Documentation/PCI/pci-test.txt | 79 ++++
.../devicetree/bindings/pci/designware-pcie.txt | 26 +-
Documentation/devicetree/bindings/pci/ti-pci.txt | 30 +-
MAINTAINERS | 50 +--
arch/arm/boot/dts/dra7.dtsi | 43 +--
drivers/Makefile | 4 +
drivers/misc/Kconfig | 7 +
drivers/misc/Makefile | 1 +
drivers/misc/pci_endpoint_test.c | 291 +++++++++++++++
drivers/pci/Kconfig | 3 +-
drivers/pci/Makefile | 3 -
drivers/pci/{host => controller}/Kconfig | 109 +++++-
drivers/pci/{host => controller}/Makefile | 2 +
drivers/pci/{host => controller}/pci-aardvark.c | 0
drivers/pci/{host => controller}/pci-dra7xx.c | 340 +++++++++++++----
drivers/pci/{host => controller}/pci-exynos.c | 0
drivers/pci/{host => controller}/pci-host-common.c | 0
.../pci/{host => controller}/pci-host-generic.c | 0
drivers/pci/{host => controller}/pci-hyperv.c | 0
drivers/pci/{host => controller}/pci-imx6.c | 0
drivers/pci/{host => controller}/pci-keystone-dw.c | 0
drivers/pci/{host => controller}/pci-keystone.c | 0
drivers/pci/{host => controller}/pci-keystone.h | 0
drivers/pci/{host => controller}/pci-layerscape.c | 0
drivers/pci/{host => controller}/pci-mvebu.c | 0
drivers/pci/{host => controller}/pci-rcar-gen2.c | 0
drivers/pci/{host => controller}/pci-tegra.c | 0
.../pci/{host => controller}/pci-thunder-ecam.c | 0
drivers/pci/{host => controller}/pci-thunder-pem.c | 0
drivers/pci/{host => controller}/pci-versatile.c | 0
drivers/pci/{host => controller}/pci-xgene-msi.c | 0
drivers/pci/{host => controller}/pci-xgene.c | 0
drivers/pci/{host => controller}/pcie-altera-msi.c | 0
drivers/pci/{host => controller}/pcie-altera.c | 0
drivers/pci/{host => controller}/pcie-armada8k.c | 0
drivers/pci/{host => controller}/pcie-artpec6.c | 0
drivers/pci/controller/pcie-designware-ep.c | 228 ++++++++++++
.../pcie-designware-host.c} | 294 +++------------
.../{host => controller}/pcie-designware-plat.c | 0
drivers/pci/controller/pcie-designware.c | 233 ++++++++++++
drivers/pci/controller/pcie-designware.h | 238 ++++++++++++
drivers/pci/{host => controller}/pcie-hisi.c | 0
drivers/pci/{host => controller}/pcie-iproc-bcma.c | 0
drivers/pci/{host => controller}/pcie-iproc-msi.c | 0
.../pci/{host => controller}/pcie-iproc-platform.c | 0
drivers/pci/{host => controller}/pcie-iproc.c | 0
drivers/pci/{host => controller}/pcie-iproc.h | 0
drivers/pci/{host => controller}/pcie-qcom.c | 0
drivers/pci/{host => controller}/pcie-rcar.c | 0
drivers/pci/{host => controller}/pcie-spear13xx.c | 0
drivers/pci/{host => controller}/pcie-xilinx-nwl.c | 0
drivers/pci/{host => controller}/pcie-xilinx.c | 0
drivers/pci/endpoint/Kconfig | 25 ++
drivers/pci/endpoint/Makefile | 6 +
drivers/pci/endpoint/functions/Kconfig | 12 +
drivers/pci/endpoint/functions/Makefile | 5 +
drivers/pci/endpoint/functions/pci-epf-test.c | 272 ++++++++++++++
drivers/pci/endpoint/pci-ep-cfs.c | 275 ++++++++++++++
drivers/pci/endpoint/pci-epc-core.c | 389 ++++++++++++++++++++
drivers/pci/endpoint/pci-epf-core.c | 338 +++++++++++++++++
drivers/pci/host/pcie-designware.h | 89 -----
include/linux/mod_devicetable.h | 10 +
include/linux/pci-epc.h | 100 +++++
include/linux/pci-epf.h | 159 ++++++++
66 files changed, 3373 insertions(+), 492 deletions(-)
create mode 100644 Documentation/PCI/pci-endpoint.txt
create mode 100644 Documentation/PCI/pci-test.txt
create mode 100644 drivers/misc/pci_endpoint_test.c
rename drivers/pci/{host => controller}/Kconfig (79%)
rename drivers/pci/{host => controller}/Makefile (93%)
rename drivers/pci/{host => controller}/pci-aardvark.c (100%)
rename drivers/pci/{host => controller}/pci-dra7xx.c (62%)
rename drivers/pci/{host => controller}/pci-exynos.c (100%)
rename drivers/pci/{host => controller}/pci-host-common.c (100%)
rename drivers/pci/{host => controller}/pci-host-generic.c (100%)
rename drivers/pci/{host => controller}/pci-hyperv.c (100%)
rename drivers/pci/{host => controller}/pci-imx6.c (100%)
rename drivers/pci/{host => controller}/pci-keystone-dw.c (100%)
rename drivers/pci/{host => controller}/pci-keystone.c (100%)
rename drivers/pci/{host => controller}/pci-keystone.h (100%)
rename drivers/pci/{host => controller}/pci-layerscape.c (100%)
rename drivers/pci/{host => controller}/pci-mvebu.c (100%)
rename drivers/pci/{host => controller}/pci-rcar-gen2.c (100%)
rename drivers/pci/{host => controller}/pci-tegra.c (100%)
rename drivers/pci/{host => controller}/pci-thunder-ecam.c (100%)
rename drivers/pci/{host => controller}/pci-thunder-pem.c (100%)
rename drivers/pci/{host => controller}/pci-versatile.c (100%)
rename drivers/pci/{host => controller}/pci-xgene-msi.c (100%)
rename drivers/pci/{host => controller}/pci-xgene.c (100%)
rename drivers/pci/{host => controller}/pcie-altera-msi.c (100%)
rename drivers/pci/{host => controller}/pcie-altera.c (100%)
rename drivers/pci/{host => controller}/pcie-armada8k.c (100%)
rename drivers/pci/{host => controller}/pcie-artpec6.c (100%)
create mode 100644 drivers/pci/controller/pcie-designware-ep.c
rename drivers/pci/{host/pcie-designware.c => controller/pcie-designware-host.c} (64%)
rename drivers/pci/{host => controller}/pcie-designware-plat.c (100%)
create mode 100644 drivers/pci/controller/pcie-designware.c
create mode 100644 drivers/pci/controller/pcie-designware.h
rename drivers/pci/{host => controller}/pcie-hisi.c (100%)
rename drivers/pci/{host => controller}/pcie-iproc-bcma.c (100%)
rename drivers/pci/{host => controller}/pcie-iproc-msi.c (100%)
rename drivers/pci/{host => controller}/pcie-iproc-platform.c (100%)
rename drivers/pci/{host => controller}/pcie-iproc.c (100%)
rename drivers/pci/{host => controller}/pcie-iproc.h (100%)
rename drivers/pci/{host => controller}/pcie-qcom.c (100%)
rename drivers/pci/{host => controller}/pcie-rcar.c (100%)
rename drivers/pci/{host => controller}/pcie-spear13xx.c (100%)
rename drivers/pci/{host => controller}/pcie-xilinx-nwl.c (100%)
rename drivers/pci/{host => controller}/pcie-xilinx.c (100%)
create mode 100644 drivers/pci/endpoint/Kconfig
create mode 100644 drivers/pci/endpoint/Makefile
create mode 100644 drivers/pci/endpoint/functions/Kconfig
create mode 100644 drivers/pci/endpoint/functions/Makefile
create mode 100644 drivers/pci/endpoint/functions/pci-epf-test.c
create mode 100644 drivers/pci/endpoint/pci-ep-cfs.c
create mode 100644 drivers/pci/endpoint/pci-epc-core.c
create mode 100644 drivers/pci/endpoint/pci-epf-core.c
delete mode 100644 drivers/pci/host/pcie-designware.h
create mode 100644 include/linux/pci-epc.h
create mode 100644 include/linux/pci-epf.hSignature · 1 line
1.7.9.5
RFC PATCH 1/11 pci: endpoint: add EP core layer to enable EP controller and EP functions
Introduce a new EP core layer in order to support endpoint functions in linux kernel. This comprises of EPC library
(Endpoint Controller Library) and EPF library (Endpoint Function Library). EPC library implements functions that is specific to an endpoint controller and EPF library implements functions that is specific to an endpoint function.
--- drivers/Makefile | 1 + drivers/pci/Kconfig | 1 + drivers/pci/endpoint/Kconfig | 21 ++ drivers/pci/endpoint/Makefile | 5 + drivers/pci/endpoint/pci-epc-core.c | 389 +++++++++++++++++++++++++++++++++++ drivers/pci/endpoint/pci-epf-core.c | 338 ++++++++++++++++++++++++++++++ include/linux/mod_devicetable.h | 10 + include/linux/pci-epc.h | 100 +++++++++ include/linux/pci-epf.h | 159 ++++++++++++++ 9 files changed, 1024 insertions(+) create mode 100644 drivers/pci/endpoint/Kconfig create mode 100644 drivers/pci/endpoint/Makefile create mode 100644 drivers/pci/endpoint/pci-epc-core.c create mode 100644 drivers/pci/endpoint/pci-epf-core.c create mode 100644 include/linux/pci-epc.h create mode 100644 include/linux/pci-epf.h
drivers/Makefile +1 -0
@@ -14,6 +14,7 @@ obj-$(CONFIG_GENERIC_PHY) += phy/ obj-$(CONFIG_PINCTRL) += pinctrl/ obj-$(CONFIG_GPIOLIB) += gpio/ obj-y += pwm/ +obj-$(CONFIG_PCI_ENDPOINT) += pci/endpoint/ obj-$(CONFIG_PCI) += pci/ obj-$(CONFIG_PARISC) += parisc/ obj-$(CONFIG_RAPIDIO) += rapidio/
drivers/pci/Kconfig +1 -0
@@ -133,3 +133,4 @@ config PCI_HYPERV source "drivers/pci/hotplug/Kconfig" source "drivers/pci/host/Kconfig" +source "drivers/pci/endpoint/Kconfig"
drivers/pci/endpoint/Kconfig new file +21 -0
@@ -0,0 +1,21 @@ +# +# PCI Endpoint Support +# + +menu "PCI Endpoint" + +config PCI_ENDPOINT + tristate "PCI Endpoint Support" + help + Enable this configuration option to support configurable PCI + endpoint. This should be enabled if the platform has a PCI + controller that can operate in endpoint mode. + + Enabling this option will build the endpoint library, which + includes endpoint controller library and endpoint function + library. + + If in doubt, say "N" to disable Endpoint support. + +endmenu +
drivers/pci/endpoint/Makefile new file +5 -0
@@ -0,0 +1,5 @@ +# +# Makefile for PCI Endpoint Support +# + +obj-$(CONFIG_PCI_ENDPOINT) := pci-epc-core.o pci-epf-core.o
drivers/pci/endpoint/pci-epc-core.c new file +389 -0
389 lines not on this page · raw message
drivers/pci/endpoint/pci-epf-core.c new file +338 -0
338 lines not on this page · raw message
include/linux/mod_devicetable.h +10 -0
@@ -427,6 +427,16 @@ struct i2c_device_id {kernel_ulong_t driver_data;/* Data private to the driver */ }; +/* pci_epf */ + +#define PCI_EPF_NAME_SIZE 20 +#define PCI_EPF_MODULE_PREFIX "pci_epf:" + +struct pci_epf_device_id { +char name[PCI_EPF_NAME_SIZE ]; +kernel_ulong_t driver_data; +}; +/* spi */ #define SPI_NAME_SIZE 32
include/linux/pci-epc.h new file +100 -0
100 lines not on this page · raw message
include/linux/pci-epf.h new file +159 -0
159 lines not on this page · raw message
Signature · 1 line
1.7.9.5
RFC PATCH 2/11 pci: endpoint: introduce configfs entry for configuring EP functions
In reply to Kishon Vijay Abraham IIntroduce a new configfs entry to configure the EP function (like configuring the standard configuration header entries) and to bind the function with a controller.
--- drivers/pci/endpoint/Kconfig | 4 +- drivers/pci/endpoint/Makefile | 3 +- drivers/pci/endpoint/pci-ep-cfs.c | 275 +++++++++++++++++++++++++++++++++++++ 3 files changed, 280 insertions(+), 2 deletions(-) create mode 100644 drivers/pci/endpoint/pci-ep-cfs.c
drivers/pci/endpoint/Kconfig +3 -1
@@ -13,7 +13,9 @@ config PCI_ENDPOINT Enabling this option will build the endpoint library, which includes endpoint controller library and endpoint function - library. + library. This will also enable the configfs entry required to + configure the endpoint function and used to bind the + function with a endpoint controller. If in doubt, say "N" to disable Endpoint support.
drivers/pci/endpoint/Makefile +2 -1
@@ -2,4 +2,5 @@ # Makefile for PCI Endpoint Support # -obj-$(CONFIG_PCI_ENDPOINT) := pci-epc-core.o pci-epf-core.o +obj-$(CONFIG_PCI_ENDPOINT) := pci-epc-core.o pci-epf-core.o \ + pci-ep-cfs.o
drivers/pci/endpoint/pci-ep-cfs.c new file +275 -0
275 lines not on this page · raw message
Signature · 1 line
1.7.9.5
RFC PATCH 3/11 Documentation: PCI: guide to use PCI Endpoint Core Layer
In reply to Kishon Vijay Abraham IAdd Documentation to let users enable endpoint mode in the PCI controller and add new PCI endpoint function.
--- Documentation/PCI/00-INDEX | 2 + Documentation/PCI/pci-endpoint.txt | 199 ++++++++++++++++++++++++++++++++++++ 2 files changed, 201 insertions(+) create mode 100644 Documentation/PCI/pci-endpoint.txt
Documentation/PCI/00-INDEX +2 -0
@@ -12,3 +12,5 @@ pci.txt - info on the PCI subsystem for device driver authors pcieaer-howto.txt - the PCI Express Advanced Error Reporting Driver Guide HOWTO +pci-endpoint.txt + - guide to add endpoint controller driver and endpoint function driver.
Documentation/PCI/pci-endpoint.txt new file +199 -0
199 lines not on this page · raw message
Signature · 1 line
1.7.9.5
RFC PATCH 4/11 pci: endpoint: functions: add an EP function to test PCI
In reply to Kishon Vijay Abraham IThis adds a new endpoint function driver (to program the virtual test device) making use of the EP-core library. The complete usage of the test function is described in Documentation/PCI/pci-test.txt (included in this commit).
--- Documentation/PCI/00-INDEX | 3 + Documentation/PCI/pci-test.txt | 79 +++++++ drivers/pci/endpoint/Kconfig | 2 + drivers/pci/endpoint/Makefile | 2 +- drivers/pci/endpoint/functions/Kconfig | 12 ++ drivers/pci/endpoint/functions/Makefile | 5 + drivers/pci/endpoint/functions/pci-epf-test.c | 272 +++++++++++++++++++++++++ 7 files changed, 374 insertions(+), 1 deletion(-) create mode 100644 Documentation/PCI/pci-test.txt create mode 100644 drivers/pci/endpoint/functions/Kconfig create mode 100644 drivers/pci/endpoint/functions/Makefile create mode 100644 drivers/pci/endpoint/functions/pci-epf-test.c
Documentation/PCI/00-INDEX +3 -0
@@ -14,3 +14,6 @@ pcieaer-howto.txt - the PCI Express Advanced Error Reporting Driver Guide HOWTO pci-endpoint.txt - guide to add endpoint controller driver and endpoint function driver. +pci-test.txt + - description of the PCI EP function that can be used to test PCI + functionality
Documentation/PCI/pci-test.txt new file +79 -0
79 lines not on this page · raw message
drivers/pci/endpoint/Kconfig +2 -0
@@ -19,5 +19,7 @@ config PCI_ENDPOINT If in doubt, say "N" to disable Endpoint support. +source "drivers/pci/endpoint/functions/Kconfig" + endmenu
drivers/pci/endpoint/Makefile +1 -1
@@ -3,4 +3,4 @@ # obj-$(CONFIG_PCI_ENDPOINT) := pci-epc-core.o pci-epf-core.o \ - pci-ep-cfs.o + pci-ep-cfs.o functions/
drivers/pci/endpoint/functions/Kconfig new file +12 -0
@@ -0,0 +1,12 @@ +# +# PCI Endpoint Functions +# + +config PCI_EPF_TEST + tristate "PCI Endpoint Test driver" + depends on PCI_ENDPOINT + help + Enable this configuration option to enable the test driver + for PCI Endpoint. + + If in doubt, say "N" to disable Endpoint test driver.
drivers/pci/endpoint/functions/Makefile new file +5 -0
@@ -0,0 +1,5 @@ +# +# Makefile for PCI Endpoint Functions +# + +obj-$(CONFIG_PCI_EPF_TEST) := pci-epf-test.o
drivers/pci/endpoint/functions/pci-epf-test.c new file +272 -0
272 lines not on this page · raw message
Signature · 1 line
1.7.9.5
RFC PATCH 5/11 pci: rename *host* directory to *controller*
In reply to Kishon Vijay Abraham INo functional change. Renamed the *host* directory present inside drivers/pci to *controller*. Some of the controllers present in drivers/pci/host is capable of operating in endpoint mode. So having these drivers in *host* directory might not be appropriate. This is in preparation for adding endpoint mode support for some of controller drivers present here.
---
MAINTAINERS | 50 ++++++++++----------
drivers/Makefile | 3 ++
drivers/pci/Kconfig | 2 +-
drivers/pci/Makefile | 3 --
drivers/pci/{host => controller}/Kconfig | 35 +++++++++++++-
drivers/pci/{host => controller}/Makefile | 0
drivers/pci/{host => controller}/pci-aardvark.c | 0
drivers/pci/{host => controller}/pci-dra7xx.c | 0
drivers/pci/{host => controller}/pci-exynos.c | 0
drivers/pci/{host => controller}/pci-host-common.c | 0
.../pci/{host => controller}/pci-host-generic.c | 0
drivers/pci/{host => controller}/pci-hyperv.c | 0
drivers/pci/{host => controller}/pci-imx6.c | 0
drivers/pci/{host => controller}/pci-keystone-dw.c | 0
drivers/pci/{host => controller}/pci-keystone.c | 0
drivers/pci/{host => controller}/pci-keystone.h | 0
drivers/pci/{host => controller}/pci-layerscape.c | 0
drivers/pci/{host => controller}/pci-mvebu.c | 0
drivers/pci/{host => controller}/pci-rcar-gen2.c | 0
drivers/pci/{host => controller}/pci-tegra.c | 0
.../pci/{host => controller}/pci-thunder-ecam.c | 0
drivers/pci/{host => controller}/pci-thunder-pem.c | 0
drivers/pci/{host => controller}/pci-versatile.c | 0
drivers/pci/{host => controller}/pci-xgene-msi.c | 0
drivers/pci/{host => controller}/pci-xgene.c | 0
drivers/pci/{host => controller}/pcie-altera-msi.c | 0
drivers/pci/{host => controller}/pcie-altera.c | 0
drivers/pci/{host => controller}/pcie-armada8k.c | 0
drivers/pci/{host => controller}/pcie-artpec6.c | 0
.../{host => controller}/pcie-designware-plat.c | 0
drivers/pci/{host => controller}/pcie-designware.c | 0
drivers/pci/{host => controller}/pcie-designware.h | 0
drivers/pci/{host => controller}/pcie-hisi.c | 0
drivers/pci/{host => controller}/pcie-iproc-bcma.c | 0
drivers/pci/{host => controller}/pcie-iproc-msi.c | 0
.../pci/{host => controller}/pcie-iproc-platform.c | 0
drivers/pci/{host => controller}/pcie-iproc.c | 0
drivers/pci/{host => controller}/pcie-iproc.h | 0
drivers/pci/{host => controller}/pcie-qcom.c | 0
drivers/pci/{host => controller}/pcie-rcar.c | 0
drivers/pci/{host => controller}/pcie-spear13xx.c | 0
drivers/pci/{host => controller}/pcie-xilinx-nwl.c | 0
drivers/pci/{host => controller}/pcie-xilinx.c | 0
43 files changed, 62 insertions(+), 31 deletions(-)
rename drivers/pci/{host => controller}/Kconfig (93%)
rename drivers/pci/{host => controller}/Makefile (100%)
rename drivers/pci/{host => controller}/pci-aardvark.c (100%)
rename drivers/pci/{host => controller}/pci-dra7xx.c (100%)
rename drivers/pci/{host => controller}/pci-exynos.c (100%)
rename drivers/pci/{host => controller}/pci-host-common.c (100%)
rename drivers/pci/{host => controller}/pci-host-generic.c (100%)
rename drivers/pci/{host => controller}/pci-hyperv.c (100%)
rename drivers/pci/{host => controller}/pci-imx6.c (100%)
rename drivers/pci/{host => controller}/pci-keystone-dw.c (100%)
rename drivers/pci/{host => controller}/pci-keystone.c (100%)
rename drivers/pci/{host => controller}/pci-keystone.h (100%)
rename drivers/pci/{host => controller}/pci-layerscape.c (100%)
rename drivers/pci/{host => controller}/pci-mvebu.c (100%)
rename drivers/pci/{host => controller}/pci-rcar-gen2.c (100%)
rename drivers/pci/{host => controller}/pci-tegra.c (100%)
rename drivers/pci/{host => controller}/pci-thunder-ecam.c (100%)
rename drivers/pci/{host => controller}/pci-thunder-pem.c (100%)
rename drivers/pci/{host => controller}/pci-versatile.c (100%)
rename drivers/pci/{host => controller}/pci-xgene-msi.c (100%)
rename drivers/pci/{host => controller}/pci-xgene.c (100%)
rename drivers/pci/{host => controller}/pcie-altera-msi.c (100%)
rename drivers/pci/{host => controller}/pcie-altera.c (100%)
rename drivers/pci/{host => controller}/pcie-armada8k.c (100%)
rename drivers/pci/{host => controller}/pcie-artpec6.c (100%)
rename drivers/pci/{host => controller}/pcie-designware-plat.c (100%)
rename drivers/pci/{host => controller}/pcie-designware.c (100%)
rename drivers/pci/{host => controller}/pcie-designware.h (100%)
rename drivers/pci/{host => controller}/pcie-hisi.c (100%)
rename drivers/pci/{host => controller}/pcie-iproc-bcma.c (100%)
rename drivers/pci/{host => controller}/pcie-iproc-msi.c (100%)
rename drivers/pci/{host => controller}/pcie-iproc-platform.c (100%)
rename drivers/pci/{host => controller}/pcie-iproc.c (100%)
rename drivers/pci/{host => controller}/pcie-iproc.h (100%)
rename drivers/pci/{host => controller}/pcie-qcom.c (100%)
rename drivers/pci/{host => controller}/pcie-rcar.c (100%)
rename drivers/pci/{host => controller}/pcie-spear13xx.c (100%)
rename drivers/pci/{host => controller}/pcie-xilinx-nwl.c (100%)
rename drivers/pci/{host => controller}/pcie-xilinx.c (100%)MAINTAINERS +25 -25
@@ -5662,7 +5662,7 @@ F: arch/x86/kernel/cpu/mshyperv.c F: drivers/hid/hid-hyperv.c F: drivers/hv/ F: drivers/input/serio/hyperv-keyboard.c -F: drivers/pci/host/pci-hyperv.c +F: drivers/pci/controller/pci-hyperv.c F: drivers/net/hyperv/ F: drivers/scsi/storvsc_drv.c F: drivers/video/fbdev/hyperv_fb.c
@@ -8945,7 +8945,7 @@ 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 +F: drivers/pci/controller/pcie-altera.c PCI DRIVER FOR ARM VERSATILE PLATFORM M: Rob Herring <[email protected]>
@@ -8953,7 +8953,7 @@ L: linux-pci at vger.kernel.org L: linux-arm-kernel at lists.infradead.org S: Maintained F: Documentation/devicetree/bindings/pci/versatile.txt -F: drivers/pci/host/pci-versatile.c +F: drivers/pci/controller/pci-versatile.c PCI DRIVER FOR APPLIEDMICRO XGENE M: Tanmay Inamdar <[email protected]>
@@ -8961,7 +8961,7 @@ L: linux-pci at vger.kernel.org L: linux-arm-kernel at lists.infradead.org S: Maintained F: Documentation/devicetree/bindings/pci/xgene-pci.txt -F: drivers/pci/host/pci-xgene.c +F: drivers/pci/controller/pci-xgene.c PCI DRIVER FOR FREESCALE LAYERSCAPE M: Minghuan Lian <[email protected]>
@@ -8971,7 +8971,7 @@ L: linuxppc-dev at lists.ozlabs.org L: linux-pci at vger.kernel.org L: linux-arm-kernel at lists.infradead.org S: Maintained -F: drivers/pci/host/*layerscape* +F: drivers/pci/controller/*layerscape* PCI DRIVER FOR IMX6 M: Richard Zhu <[email protected]>
@@ -8979,14 +8979,14 @@ M: Lucas Stach <[email protected]> L: linux-pci at vger.kernel.org L: linux-arm-kernel at lists.infradead.org (moderated for non-subscribers) S: Maintained -F: drivers/pci/host/*imx6* +F: drivers/pci/controller/*imx6* PCI DRIVER FOR TI KEYSTONE M: Murali Karicheri <[email protected]> L: linux-pci at vger.kernel.org L: linux-arm-kernel at lists.infradead.org (moderated for non-subscribers) S: Maintained -F: drivers/pci/host/*keystone* +F: drivers/pci/controller/*keystone* PCI DRIVER FOR MVEBU (Marvell Armada 370 and Armada XP SOC support) M: Thomas Petazzoni <[email protected]>
@@ -8994,14 +8994,14 @@ M: Jason Cooper <[email protected]> L: linux-pci at vger.kernel.org L: linux-arm-kernel at lists.infradead.org (moderated for non-subscribers) S: Maintained -F: drivers/pci/host/*mvebu* +F: drivers/pci/controller/*mvebu* PCI DRIVER FOR AARDVARK (Marvell Armada 3700) M: Thomas Petazzoni <[email protected]> L: linux-pci at vger.kernel.org L: linux-arm-kernel at lists.infradead.org (moderated for non-subscribers) S: Maintained -F: drivers/pci/host/pci-aardvark.c +F: drivers/pci/controller/pci-aardvark.c PCI DRIVER FOR NVIDIA TEGRA M: Thierry Reding <[email protected]>
@@ -9009,7 +9009,7 @@ L: linux-tegra at vger.kernel.org L: linux-pci at vger.kernel.org S: Supported F: Documentation/devicetree/bindings/pci/nvidia,tegra20-pcie.txt -F: drivers/pci/host/pci-tegra.c +F: drivers/pci/controller/pci-tegra.c PCI DRIVER FOR TI DRA7XX M: Kishon Vijay Abraham I <[email protected]>
@@ -9017,14 +9017,14 @@ L: linux-omap at vger.kernel.org L: linux-pci at vger.kernel.org S: Supported F: Documentation/devicetree/bindings/pci/ti-pci.txt -F: drivers/pci/host/pci-dra7xx.c +F: drivers/pci/controller/pci-dra7xx.c PCI DRIVER FOR RENESAS R-CAR M: Simon Horman <[email protected]> L: linux-pci at vger.kernel.org L: linux-renesas-soc at vger.kernel.org S: Maintained -F: drivers/pci/host/*rcar* +F: drivers/pci/controller/*rcar* PCI DRIVER FOR SAMSUNG EXYNOS M: Jingoo Han <[email protected]>
@@ -9032,30 +9032,30 @@ L: linux-pci at vger.kernel.org L: linux-arm-kernel at lists.infradead.org (moderated for non-subscribers) L: linux-samsung-soc at vger.kernel.org (moderated for non-subscribers) S: Maintained -F: drivers/pci/host/pci-exynos.c +F: drivers/pci/controller/pci-exynos.c PCI DRIVER FOR SYNOPSIS DESIGNWARE M: Jingoo Han <[email protected]> M: Pratyush Anand <[email protected]> L: linux-pci at vger.kernel.org S: Maintained -F: drivers/pci/host/*designware* +F: drivers/pci/controller/*designware* PCI DRIVER FOR SYNOPSYS PROTOTYPING DEVICE M: Joao Pinto <[email protected]> L: linux-pci at vger.kernel.org S: Maintained F: Documentation/devicetree/bindings/pci/designware-pcie.txt -F: drivers/pci/host/pcie-designware-plat.c +F: drivers/pci/controller/pcie-designware-plat.c PCI DRIVER FOR GENERIC OF HOSTS M: Will Deacon <[email protected]> L: linux-pci at vger.kernel.org L: linux-arm-kernel at lists.infradead.org (moderated for non-subscribers) S: Maintained -F: Documentation/devicetree/bindings/pci/host-generic-pci.txt -F: drivers/pci/host/pci-host-common.c -F: drivers/pci/host/pci-host-generic.c +F: Documentation/devicetree/bindings/pci/controller-generic-pci.txt +F: drivers/pci/controller/pci-host-common.c +F: drivers/pci/controller/pci-host-generic.c PCI DRIVER FOR INTEL VOLUME MANAGEMENT DEVICE (VMD) M: Keith Busch <[email protected]>
@@ -9067,7 +9067,7 @@ PCIE DRIVER FOR ST SPEAR13XX M: Pratyush Anand <[email protected]> L: linux-pci at vger.kernel.org S: Maintained -F: drivers/pci/host/*spear* +F: drivers/pci/controller/*spear* PCI MSI DRIVER FOR ALTERA MSI IP M: Ley Foon Tan <[email protected]>
@@ -9075,7 +9075,7 @@ 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 +F: drivers/pci/controller/pcie-altera-msi.c PCI MSI DRIVER FOR APPLIEDMICRO XGENE M: Duc Dang <[email protected]>
@@ -9083,7 +9083,7 @@ L: linux-pci at vger.kernel.org L: linux-arm-kernel at lists.infradead.org S: Maintained F: Documentation/devicetree/bindings/pci/xgene-pci-msi.txt -F: drivers/pci/host/pci-xgene-msi.c +F: drivers/pci/controller/pci-xgene-msi.c PCIE DRIVER FOR AXIS ARTPEC M: Niklas Cassel <[email protected]>
@@ -9092,7 +9092,7 @@ L: linux-arm-kernel at axis.com L: linux-pci at vger.kernel.org S: Maintained F: Documentation/devicetree/bindings/pci/axis,artpec* -F: drivers/pci/host/*artpec* +F: drivers/pci/controller/*artpec* PCIE DRIVER FOR HISILICON M: Zhou Wang <[email protected]>
@@ -9100,14 +9100,14 @@ M: Gabriele Paoloni <[email protected]> L: linux-pci at vger.kernel.org S: Maintained F: Documentation/devicetree/bindings/pci/hisilicon-pcie.txt -F: drivers/pci/host/pcie-hisi.c +F: drivers/pci/controller/pcie-hisi.c PCIE DRIVER FOR QUALCOMM MSM M: Stanimir Varbanov <[email protected]> L: linux-pci at vger.kernel.org L: linux-arm-msm at vger.kernel.org S: Maintained -F: drivers/pci/host/*qcom* +F: drivers/pci/controller/*qcom* PCIE DRIVER FOR CAVIUM THUNDERX M: David Daney <[email protected]>
@@ -9115,7 +9115,7 @@ L: linux-pci at vger.kernel.org L: linux-arm-kernel at lists.infradead.org (moderated for non-subscribers) S: Supported F: Documentation/devicetree/bindings/pci/pci-thunder-* -F: drivers/pci/host/pci-thunder-* +F: drivers/pci/controller/pci-thunder-* PCMCIA SUBSYSTEM P: Linux PCMCIA Team
drivers/Makefile +3 -0
@@ -16,6 +16,9 @@ obj-$(CONFIG_GPIOLIB) += gpio/ obj-y += pwm/ obj-$(CONFIG_PCI_ENDPOINT) += pci/endpoint/ obj-$(CONFIG_PCI) += pci/ +# PCI controller drivers +obj-y += pci/controller/ + obj-$(CONFIG_PARISC) += parisc/ obj-$(CONFIG_RAPIDIO) += rapidio/ obj-y += video/
drivers/pci/Kconfig +1 -1
@@ -132,5 +132,5 @@ config PCI_HYPERV PCI devices from a PCI backend to support PCI driver domains. source "drivers/pci/hotplug/Kconfig" -source "drivers/pci/host/Kconfig" +source "drivers/pci/controller/Kconfig" source "drivers/pci/endpoint/Kconfig"
drivers/pci/Makefile +0 -3
@@ -65,6 +65,3 @@ obj-$(CONFIG_XEN_PCIDEV_FRONTEND) += xen-pcifront.o obj-$(CONFIG_OF) += of.o ccflags-$(CONFIG_PCI_DEBUG) := -DDEBUG - -# PCI host controller drivers -obj-y += host/
drivers/pci/controller/Kconfig renamed from drivers/pci/host/Kconfig +33 -2
@@ -1,10 +1,10 @@ -menu "PCI host controller drivers" - depends on PCI +menu "PCI controller drivers" config PCI_DRA7XX bool "TI DRA7xx PCIe controller" depends on OF && HAS_IOMEM && TI_PIPE3 depends on PCI_MSI_IRQ_DOMAIN + depends on PCI select PCIE_DW help Enables support for the PCIe controller in the DRA7xx SoC. There
@@ -16,12 +16,14 @@ config PCI_MVEBU depends on ARCH_MVEBU || ARCH_DOVE depends on ARM depends on OF + depends on PCI config PCI_AARDVARK bool "Aardvark PCIe controller" depends on ARCH_MVEBU && ARM64 depends on OF depends on PCI_MSI_IRQ_DOMAIN + depends on PCI help Add support for Aardvark 64bit PCIe Host Controller. This controller is part of the South Bridge of the Marvel Armada
@@ -31,6 +33,7 @@ config PCIE_XILINX_NWL bool "NWL PCIe Core" depends on ARCH_ZYNQMP depends on PCI_MSI_IRQ_DOMAIN + depends on PCI help Say 'Y' here if you want kernel support for Xilinx NWL PCIe controller. The controller can act as Root Port
@@ -40,6 +43,7 @@ config PCIE_XILINX_NWL config PCIE_DW_PLAT bool "Platform bus based DesignWare PCIe Controller" depends on PCI_MSI_IRQ_DOMAIN + depends on PCI select PCIE_DW ---help--- This selects the DesignWare PCIe controller support. Select this if
@@ -52,6 +56,7 @@ config PCIE_DW_PLAT config PCIE_DW bool depends on PCI_MSI_IRQ_DOMAIN + depends on PCI config PCI_EXYNOS bool "Samsung Exynos PCIe controller"
@@ -59,17 +64,20 @@ config PCI_EXYNOS depends on PCI_MSI_IRQ_DOMAIN select PCIEPORTBUS select PCIE_DW + depends on PCI config PCI_IMX6 bool "Freescale i.MX6 PCIe controller" depends on SOC_IMX6Q depends on PCI_MSI_IRQ_DOMAIN + depends on PCI select PCIEPORTBUS select PCIE_DW config PCI_TEGRA bool "NVIDIA Tegra PCIe controller" depends on ARCH_TEGRA && !ARM64 + depends on PCI help Say Y here if you want support for the PCIe host controller found on NVIDIA Tegra SoCs.
@@ -78,6 +86,7 @@ config PCI_RCAR_GEN2 bool "Renesas R-Car Gen2 Internal PCI controller" depends on ARM depends on ARCH_RENESAS || COMPILE_TEST + depends on PCI help Say Y here if you want internal PCI support on R-Car Gen2 SoC. There are 3 internal PCI controllers available with a single
@@ -87,16 +96,19 @@ config PCIE_RCAR bool "Renesas R-Car PCIe controller" depends on ARCH_RENESAS || (ARM && COMPILE_TEST) depends on PCI_MSI_IRQ_DOMAIN + depends on PCI help Say Y here if you want PCIe controller support on R-Car SoCs. config PCI_HOST_COMMON bool + depends on PCI select PCI_ECAM config PCI_HOST_GENERIC bool "Generic PCI host controller" depends on (ARM || ARM64) && OF + depends on PCI select PCI_HOST_COMMON select IRQ_DOMAIN help
@@ -107,6 +119,7 @@ config PCIE_SPEAR13XX bool "STMicroelectronics SPEAr PCIe controller" depends on ARCH_SPEAR13XX depends on PCI_MSI_IRQ_DOMAIN + depends on PCI select PCIEPORTBUS select PCIE_DW help
@@ -116,6 +129,7 @@ config PCI_KEYSTONE bool "TI Keystone PCIe controller" depends on ARCH_KEYSTONE depends on PCI_MSI_IRQ_DOMAIN + depends on PCI select PCIE_DW select PCIEPORTBUS help
@@ -127,6 +141,7 @@ config PCI_KEYSTONE config PCIE_XILINX bool "Xilinx AXI PCIe host bridge support" depends on ARCH_ZYNQ || MICROBLAZE + depends on PCI help Say 'Y' here if you want kernel to support the Xilinx AXI PCIe Host Bridge driver.
@@ -135,6 +150,7 @@ config PCI_XGENE bool "X-Gene PCIe controller" depends on ARCH_XGENE depends on OF + depends on PCI select PCIEPORTBUS help Say Y here if you want internal PCI support on APM X-Gene SoC.
@@ -145,6 +161,7 @@ config PCI_XGENE_MSI bool "X-Gene v1 PCIe MSI feature" depends on PCI_XGENE depends on PCI_MSI_IRQ_DOMAIN + depends on PCI default y help Say Y here if you want PCIe MSI support for the APM X-Gene v1 SoC.
@@ -154,6 +171,7 @@ config PCI_LAYERSCAPE bool "Freescale Layerscape PCIe controller" depends on OF && (ARM || ARCH_LAYERSCAPE) depends on PCI_MSI_IRQ_DOMAIN + depends on PCI select PCIE_DW select MFD_SYSCON help
@@ -162,9 +180,11 @@ config PCI_LAYERSCAPE config PCI_VERSATILE bool "ARM Versatile PB PCI controller" depends on ARCH_VERSATILE + depends on PCI config PCIE_IPROC tristate + depends on PCI help This enables the iProc PCIe core controller support for Broadcom's iProc family of SoCs. An appropriate bus interface driver needs
@@ -174,6 +194,7 @@ config PCIE_IPROC_PLATFORM tristate "Broadcom iProc PCIe platform bus driver" depends on ARCH_BCM_IPROC || (ARM && COMPILE_TEST) depends on OF + depends on PCI select PCIE_IPROC default ARCH_BCM_IPROC help
@@ -183,6 +204,7 @@ config PCIE_IPROC_PLATFORM config PCIE_IPROC_BCMA tristate "Broadcom iProc PCIe BCMA bus driver" depends on ARM && (ARCH_BCM_IPROC || COMPILE_TEST) + depends on PCI select PCIE_IPROC select BCMA select PCI_DOMAINS
@@ -195,6 +217,7 @@ config PCIE_IPROC_MSI bool "Broadcom iProc PCIe MSI support" depends on PCIE_IPROC_PLATFORM || PCIE_IPROC_BCMA depends on PCI_MSI_IRQ_DOMAIN + depends on PCI default ARCH_BCM_IPROC help Say Y here if you want to enable MSI support for Broadcom's iProc
@@ -204,6 +227,7 @@ config PCIE_ALTERA bool "Altera PCIe controller" depends on ARM || NIOS2 depends on OF_PCI + depends on PCI select PCI_DOMAINS help Say Y here if you want to enable PCIe controller support on Altera
@@ -213,6 +237,7 @@ config PCIE_ALTERA_MSI bool "Altera PCIe MSI feature" depends on PCIE_ALTERA depends on PCI_MSI_IRQ_DOMAIN + depends on PCI help Say Y here if you want PCIe MSI support for the Altera FPGA. This MSI driver supports Altera MSI to GIC controller IP.
@@ -221,6 +246,7 @@ config PCI_HISI depends on OF && ARM64 bool "HiSilicon Hip05 and Hip06 SoCs PCIe controllers" depends on PCI_MSI_IRQ_DOMAIN + depends on PCI select PCIEPORTBUS select PCIE_DW help
@@ -231,6 +257,7 @@ config PCIE_QCOM bool "Qualcomm PCIe controller" depends on ARCH_QCOM && OF depends on PCI_MSI_IRQ_DOMAIN + depends on PCI select PCIE_DW select PCIEPORTBUS help
@@ -241,6 +268,7 @@ config PCIE_QCOM config PCI_HOST_THUNDER_PEM bool "Cavium Thunder PCIe controller to off-chip devices" depends on OF && ARM64 + depends on PCI select PCI_HOST_COMMON help Say Y here if you want PCIe support for CN88XX Cavium Thunder SoCs.
@@ -248,6 +276,7 @@ config PCI_HOST_THUNDER_PEM config PCI_HOST_THUNDER_ECAM bool "Cavium Thunder ECAM controller to on-chip devices on pass-1.x silicon" depends on OF && ARM64 + depends on PCI select PCI_HOST_COMMON help Say Y here if you want ECAM support for CN88XX-Pass-1.x Cavium Thunder SoCs.
@@ -256,6 +285,7 @@ config PCIE_ARMADA_8K bool "Marvell Armada-8K PCIe controller" depends on ARCH_MVEBU depends on PCI_MSI_IRQ_DOMAIN + depends on PCI select PCIE_DW select PCIEPORTBUS help
@@ -268,6 +298,7 @@ config PCIE_ARTPEC6 bool "Axis ARTPEC-6 PCIe controller" depends on MACH_ARTPEC6 depends on PCI_MSI_IRQ_DOMAIN + depends on PCI select PCIE_DW select PCIEPORTBUS help
drivers/pci/controller/Makefile renamed from drivers/pci/host/Makefile +0 -0
drivers/pci/controller/pci-aardvark.c renamed from drivers/pci/host/pci-aardvark.c +0 -0
drivers/pci/controller/pci-dra7xx.c renamed from drivers/pci/host/pci-dra7xx.c +0 -0
drivers/pci/controller/pci-exynos.c renamed from drivers/pci/host/pci-exynos.c +0 -0
drivers/pci/controller/pci-host-common.c renamed from drivers/pci/host/pci-host-common.c +0 -0
drivers/pci/controller/pci-host-generic.c renamed from drivers/pci/host/pci-host-generic.c +0 -0
drivers/pci/controller/pci-hyperv.c renamed from drivers/pci/host/pci-hyperv.c +0 -0
drivers/pci/controller/pci-imx6.c renamed from drivers/pci/host/pci-imx6.c +0 -0
drivers/pci/controller/pci-keystone-dw.c renamed from drivers/pci/host/pci-keystone-dw.c +0 -0
drivers/pci/controller/pci-keystone.c renamed from drivers/pci/host/pci-keystone.c +0 -0
drivers/pci/controller/pci-keystone.h renamed from drivers/pci/host/pci-keystone.h +0 -0
drivers/pci/controller/pci-layerscape.c renamed from drivers/pci/host/pci-layerscape.c +0 -0
drivers/pci/controller/pci-mvebu.c renamed from drivers/pci/host/pci-mvebu.c +0 -0
drivers/pci/controller/pci-rcar-gen2.c renamed from drivers/pci/host/pci-rcar-gen2.c +0 -0
drivers/pci/controller/pci-tegra.c renamed from drivers/pci/host/pci-tegra.c +0 -0
drivers/pci/controller/pci-thunder-ecam.c renamed from drivers/pci/host/pci-thunder-ecam.c +0 -0
drivers/pci/controller/pci-thunder-pem.c renamed from drivers/pci/host/pci-thunder-pem.c +0 -0
drivers/pci/controller/pci-versatile.c renamed from drivers/pci/host/pci-versatile.c +0 -0
drivers/pci/controller/pci-xgene-msi.c renamed from drivers/pci/host/pci-xgene-msi.c +0 -0
drivers/pci/controller/pci-xgene.c renamed from drivers/pci/host/pci-xgene.c +0 -0
drivers/pci/controller/pcie-altera-msi.c renamed from drivers/pci/host/pcie-altera-msi.c +0 -0
drivers/pci/controller/pcie-altera.c renamed from drivers/pci/host/pcie-altera.c +0 -0
drivers/pci/controller/pcie-armada8k.c renamed from drivers/pci/host/pcie-armada8k.c +0 -0
drivers/pci/controller/pcie-artpec6.c renamed from drivers/pci/host/pcie-artpec6.c +0 -0
drivers/pci/controller/pcie-designware-plat.c renamed from drivers/pci/host/pcie-designware-plat.c +0 -0
drivers/pci/controller/pcie-designware.c renamed from drivers/pci/host/pcie-designware.c +0 -0
drivers/pci/controller/pcie-designware.h renamed from drivers/pci/host/pcie-designware.h +0 -0
drivers/pci/controller/pcie-hisi.c renamed from drivers/pci/host/pcie-hisi.c +0 -0
drivers/pci/controller/pcie-iproc-bcma.c renamed from drivers/pci/host/pcie-iproc-bcma.c +0 -0
drivers/pci/controller/pcie-iproc-msi.c renamed from drivers/pci/host/pcie-iproc-msi.c +0 -0
drivers/pci/controller/pcie-iproc-platform.c renamed from drivers/pci/host/pcie-iproc-platform.c +0 -0
drivers/pci/controller/pcie-iproc.c renamed from drivers/pci/host/pcie-iproc.c +0 -0
drivers/pci/controller/pcie-iproc.h renamed from drivers/pci/host/pcie-iproc.h +0 -0
drivers/pci/controller/pcie-qcom.c renamed from drivers/pci/host/pcie-qcom.c +0 -0
drivers/pci/controller/pcie-rcar.c renamed from drivers/pci/host/pcie-rcar.c +0 -0
drivers/pci/controller/pcie-spear13xx.c renamed from drivers/pci/host/pcie-spear13xx.c +0 -0
drivers/pci/controller/pcie-xilinx-nwl.c renamed from drivers/pci/host/pcie-xilinx-nwl.c +0 -0
drivers/pci/controller/pcie-xilinx.c renamed from drivers/pci/host/pcie-xilinx.c +0 -0
Signature · 1 line
1.7.9.5
RFC PATCH 6/11 pci: controller: split designware into *core* and *host*
In reply to Kishon Vijay Abraham INo functional change. Split the designware core driver into *core* driver and *host* only driver. This is in preparation to add endpoint support in designware. The *endpoint* driver will reuse the *core* driver.
This also modifies the dra7xx code to use the new architecture.
TODO: All other platforms using designware core should also be modified accordingly.
---
drivers/pci/controller/Kconfig | 48 +-
drivers/pci/controller/Makefile | 1 +
drivers/pci/controller/pci-dra7xx.c | 117 +++-
.../{pcie-designware.c => pcie-designware-host.c} | 294 ++------
drivers/pci/controller/pcie-designware.c | 741 ++------------------
drivers/pci/controller/pcie-designware.h | 158 ++++-
6 files changed, 367 insertions(+), 992 deletions(-)
copy drivers/pci/controller/{pcie-designware.c => pcie-designware-host.c} (64%)drivers/pci/controller/Kconfig +34 -14
@@ -3,13 +3,29 @@ menu "PCI controller drivers" config PCI_DRA7XX bool "TI DRA7xx PCIe controller" depends on OF && HAS_IOMEM && TI_PIPE3 + help + Enables support for the PCIe controller in the DRA7xx SoC. There + are two instances of PCIe controller in DRA7xx. This controller can + work either as EP or RC. In order to enable host specific features + PCI_DRA7XX_HOST must be selected. This reuses the Designware core. + +if PCI_DRA7XX + +choice + bool "PCIe Mode" + +config PCI_DRA7XX_HOST + bool "Host Only Mode" depends on PCI_MSI_IRQ_DOMAIN depends on PCI - select PCIE_DW + select PCIE_DW_HOST help - Enables support for the PCIe controller in the DRA7xx SoC. There - are two instances of PCIe controller in DRA7xx. This controller can - act both as EP and RC. This reuses the Designware core. + Enables support for the PCIe controller in the DRA7xx SoC to work in + host mode. + +endchoice + +endif config PCI_MVEBU bool "Marvell EBU PCIe controller"
@@ -44,7 +60,7 @@ config PCIE_DW_PLAT bool "Platform bus based DesignWare PCIe Controller" depends on PCI_MSI_IRQ_DOMAIN depends on PCI - select PCIE_DW + select PCIE_DW_HOST ---help--- This selects the DesignWare PCIe controller support. Select this if you have a PCIe controller on Platform bus.
@@ -55,16 +71,20 @@ config PCIE_DW_PLAT config PCIE_DW bool + +config PCIE_DW_HOST + bool depends on PCI_MSI_IRQ_DOMAIN depends on PCI + select PCIE_DW config PCI_EXYNOS bool "Samsung Exynos PCIe controller" depends on SOC_EXYNOS5440 depends on PCI_MSI_IRQ_DOMAIN select PCIEPORTBUS - select PCIE_DW depends on PCI + select PCIE_DW_HOST config PCI_IMX6 bool "Freescale i.MX6 PCIe controller"
@@ -72,7 +92,7 @@ config PCI_IMX6 depends on PCI_MSI_IRQ_DOMAIN depends on PCI select PCIEPORTBUS - select PCIE_DW + select PCIE_DW_HOST config PCI_TEGRA bool "NVIDIA Tegra PCIe controller"
@@ -121,7 +141,7 @@ config PCIE_SPEAR13XX depends on PCI_MSI_IRQ_DOMAIN depends on PCI select PCIEPORTBUS - select PCIE_DW + select PCIE_DW_HOST help Say Y here if you want PCIe support on SPEAr13XX SoCs.
@@ -130,7 +150,7 @@ config PCI_KEYSTONE depends on ARCH_KEYSTONE depends on PCI_MSI_IRQ_DOMAIN depends on PCI - select PCIE_DW + select PCIE_DW_HOST select PCIEPORTBUS help Say Y here if you want to enable PCI controller support on Keystone
@@ -172,7 +192,7 @@ config PCI_LAYERSCAPE depends on OF && (ARM || ARCH_LAYERSCAPE) depends on PCI_MSI_IRQ_DOMAIN depends on PCI - select PCIE_DW + select PCIE_DW_HOST select MFD_SYSCON help Say Y here if you want PCIe controller support on Layerscape SoCs.
@@ -248,7 +268,7 @@ config PCI_HISI depends on PCI_MSI_IRQ_DOMAIN depends on PCI select PCIEPORTBUS - select PCIE_DW + select PCIE_DW_HOST help Say Y here if you want PCIe controller support on HiSilicon Hip05 and Hip06 SoCs
@@ -258,7 +278,7 @@ config PCIE_QCOM depends on ARCH_QCOM && OF depends on PCI_MSI_IRQ_DOMAIN depends on PCI - select PCIE_DW + select PCIE_DW_HOST select PCIEPORTBUS help Say Y here to enable PCIe controller support on Qualcomm SoCs. The
@@ -286,7 +306,7 @@ config PCIE_ARMADA_8K depends on ARCH_MVEBU depends on PCI_MSI_IRQ_DOMAIN depends on PCI - select PCIE_DW + select PCIE_DW_HOST select PCIEPORTBUS help Say Y here if you want to enable PCIe controller support on
@@ -299,7 +319,7 @@ config PCIE_ARTPEC6 depends on MACH_ARTPEC6 depends on PCI_MSI_IRQ_DOMAIN depends on PCI - select PCIE_DW + select PCIE_DW_HOST select PCIEPORTBUS help Say Y here to enable PCIe controller support on Axis ARTPEC-6
drivers/pci/controller/Makefile +1 -0
@@ -1,4 +1,5 @@ obj-$(CONFIG_PCIE_DW) += pcie-designware.o +obj-$(CONFIG_PCIE_DW_HOST) += pcie-designware-host.o obj-$(CONFIG_PCIE_DW_PLAT) += pcie-designware-plat.o obj-$(CONFIG_PCI_DRA7XX) += pci-dra7xx.o obj-$(CONFIG_PCI_EXYNOS) += pci-exynos.o
drivers/pci/controller/pci-dra7xx.c +79 -38
251 lines not on this page · raw message
drivers/pci/controller/pcie-designware-host.c renamed from drivers/pci/controller/pcie-designware.c +54 -240
462 lines not on this page · raw message
drivers/pci/controller/pcie-designware.c +68 -673
831 lines not on this page · raw message
drivers/pci/controller/pcie-designware.h +131 -27
189 lines not on this page · raw message
Signature · 1 line
1.7.9.5
RFC PATCH 7/11 pci: controller: designware: Add EP mode support
In reply to Kishon Vijay Abraham IAdd endpoint mode support to designware driver. This uses the EP Core layer introduced recently to add endpoint mode support. *Any* function driver can now use this designware device to achieve the EP functionality.
--- .../devicetree/bindings/pci/designware-pcie.txt | 26 ++- drivers/pci/controller/Kconfig | 5 + drivers/pci/controller/Makefile | 1 + drivers/pci/controller/pcie-designware-ep.c | 228 ++++++++++++++++++++ drivers/pci/controller/pcie-designware.c | 30 +++ drivers/pci/controller/pcie-designware.h | 45 ++++ 6 files changed, 324 insertions(+), 11 deletions(-) create mode 100644 drivers/pci/controller/pcie-designware-ep.c
Documentation/devicetree/bindings/pci/designware-pcie.txt +15 -11
@@ -6,23 +6,27 @@ Required properties: - reg-names: Must be "config" for the PCIe configuration space. (The old way of getting the configuration address space from "ranges" is deprecated and should be avoided.) -- #address-cells: set to <3> -- #size-cells: set to <2> -- device_type: set to "pci" -- ranges: ranges for the PCI memory and I/O regions -- #interrupt-cells: set to <1> -- interrupt-map-mask and interrupt-map: standard PCI properties - to define the mapping of the PCIe interface to interrupt +- #address-cells (only for host mode): set to <3> +- #size-cells (only for host mode): set to <2> +- device_type (only for host mode): set to "pci" +- ranges (only for host mode): ranges for the PCI memory and I/O regions +- num-ib-windows (only for EP mode): number of inbound address translation + windows +- num-ob-windows (only for EP mode): number of outbound address translation + windows +- #interrupt-cells (only for host mode): set to <1> +- interrupt-map-mask and interrupt-map (only for host mode): standard PCI + properties to define the mapping of the PCIe interface to interrupt numbers. - num-lanes: number of lanes to use Optional properties: - num-lanes: number of lanes to use (this property should be specified unless the link is brought already up in BIOS) -- reset-gpio: gpio pin number of power good signal -- bus-range: PCI bus numbers covered (it is recommended for new devicetrees to - specify this property, to keep backwards compatibility a range of 0x00-0xff - is assumed if not present) +- reset-gpio (only for host mode): gpio pin number of power good signal +- bus-range (only for host mode): PCI bus numbers covered (it is recommended + for new devicetrees to specify this property, to keep backwards compatibility + a range of 0x00-0xff is assumed if not present) - clocks: Must contain an entry for each entry in clock-names. See ../clocks/clock-bindings.txt for details. - clock-names: Must include the following entries:
drivers/pci/controller/Kconfig +5 -0
@@ -78,6 +78,11 @@ config PCIE_DW_HOST depends on PCI select PCIE_DW +config PCIE_DW_EP + bool + depends on PCI_ENDPOINT + select PCIE_DW + config PCI_EXYNOS bool "Samsung Exynos PCIe controller" depends on SOC_EXYNOS5440
drivers/pci/controller/Makefile +1 -0
@@ -1,5 +1,6 @@ obj-$(CONFIG_PCIE_DW) += pcie-designware.o obj-$(CONFIG_PCIE_DW_HOST) += pcie-designware-host.o +obj-$(CONFIG_PCIE_DW_EP) += pcie-designware-ep.o obj-$(CONFIG_PCIE_DW_PLAT) += pcie-designware-plat.o obj-$(CONFIG_PCI_DRA7XX) += pci-dra7xx.o obj-$(CONFIG_PCI_EXYNOS) += pci-exynos.o
drivers/pci/controller/pcie-designware-ep.c new file +228 -0
228 lines not on this page · raw message
drivers/pci/controller/pcie-designware.c +30 -0
@@ -115,6 +115,36 @@ void dw_pcie_prog_outbound_atu(struct dw_pcie *pci, int index,dw_pcie_read_dbi (pci, base,PCIE_ATU_CR2 ,0x4 , &val); } +int dw_pcie_prog_inbound_atu (struct dw_pcie *pci,int index,int bar, +u64 cpu_addr,enum dw_pcie_as_type as_type) +{ +int type; +void __iomem *base = pci->dbi_base; + +dw_pcie_write_dbi (pci, base,PCIE_ATU_VIEWPORT ,0x4 , +PCIE_ATU_REGION_INBOUND | index); +dw_pcie_write_dbi (pci, base,PCIE_ATU_LOWER_TARGET ,0x4 , +lower_32_bits (cpu_addr)); +dw_pcie_write_dbi (pci, base,PCIE_ATU_UPPER_TARGET ,0x4 , +upper_32_bits (cpu_addr)); + +switch (as_type) { +case DW_PCIE_AS_MEM : + type =PCIE_ATU_TYPE_MEM ; +break ; +case DW_PCIE_AS_IO : + type =PCIE_ATU_TYPE_IO ; +break ; +default : +return -EINVAL ; + } + +dw_pcie_write_dbi (pci, base,PCIE_ATU_CR1 ,0x4 , type); +dw_pcie_write_dbi (pci, base,PCIE_ATU_CR2 ,0x4 ,PCIE_ATU_ENABLE | +PCIE_ATU_BAR_MODE_ENABLE | (bar <<8 )); +return 0 ; +} +int dw_pcie_wait_for_link (struct dw_pcie *pci) {int retries;
drivers/pci/controller/pcie-designware.h +45 -0
84 lines not on this page · raw message
Signature · 1 line
1.7.9.5
RFC PATCH 8/11 pci: controller: dra7xx: Add EP mode support
In reply to Kishon Vijay Abraham IThe PCIe controller integrated in dra7xx SoCs is capable of operating in endpoint mode. Add support for dra7xx SoCs to operate in endpoint mode.
--- Documentation/devicetree/bindings/pci/ti-pci.txt | 30 ++- drivers/pci/controller/Kconfig | 21 +++ drivers/pci/controller/pci-dra7xx.c | 211 +++++++++++++++++++--- 3 files changed, 225 insertions(+), 37 deletions(-)
Documentation/devicetree/bindings/pci/ti-pci.txt +23 -7
@@ -1,17 +1,22 @@ TI PCI Controllers PCIe Designware Controller - - compatible: Should be "ti,dra7-pcie"" - - reg : Two register ranges as listed in the reg-names property - - reg-names : The first entry must be "ti-conf" for the TI specific registers - The second entry must be "rc-dbics" for the designware pcie - registers - The third entry must be "config" for the PCIe configuration space + - compatible: Should be "ti,dra7-pcie" for RC + Should be "ti,dra7-pcie-ep" for EP - phys : list of PHY specifiers (used by generic PHY framework) - phy-names : must be "pcie-phy0", "pcie-phy1", "pcie-phyN".. based on the number of PHYs as specified in *phys* property. - ti,hwmods : Name of the hwmod associated to the pcie, "pcie<X>", where <X> is the instance number of the pcie from the HW spec. + - num-lanes as specified in ../designware-pcie.txt + +HOST MODE +========= + - reg : Two register ranges as listed in the reg-names property + - reg-names : The first entry must be "ti-conf" for the TI specific registers + The second entry must be "rc-dbics" for the designware pcie + registers + The third entry must be "config" for the PCIe configuration space - interrupts : Two interrupt entries must be specified. The first one is for main interrupt line and the second for MSI interrupt line. - #address-cells,
@@ -19,13 +24,24 @@ PCIe Designware Controller #interrupt-cells, device_type, ranges, - num-lanes, interrupt-map-mask, interrupt-map : as specified in ../designware-pcie.txt Optional Property: - gpios : Should be added if a gpio line is required to drive PERST# line +DEVICE MODE +=========== + - reg : Two register ranges as listed in the reg-names property + - reg-names : "ti-conf" for the TI specific registers + "ep_dbics" for the standard configuration registers as + they are locally accessed within the DIF CS space + "ep_dbics2" for the standard configuration registers as + they are locally accessed within the DIF CS2 space + - interrupts : one interrupt entries must be specified for main interrupt. + - num-ib-windows : number of inbound address translation windows + - num-ob-windows : number of outbound address translation windows + Example: axi { compatible = "simple-bus";
drivers/pci/controller/Kconfig +21 -0
@@ -23,6 +23,27 @@ config PCI_DRA7XX_HOST Enables support for the PCIe controller in the DRA7xx SoC to work in host mode. +config PCI_DRA7XX_EP + bool "Endpoint Only Mode" + depends on PCI_ENDPOINT + select PCIE_DW_EP + help + Enables support for the PCIe controller in the DRA7xx SoC to work in + endpoint mode. + +config PCI_DRA7XX_HOST_EP + bool "Both Host and Endpoint Mode" + depends on PCI_MSI_IRQ_DOMAIN + depends on PCI + depends on PCI_ENDPOINT + select PCIE_DW_HOST + select PCIE_DW_EP + help + Enables support for the PCIe controller in the DRA7xx SoC to work in + both endpoint mode and host mode. If the board has 2 PCIe ports and + one of them has to work in host mode and the other has to work in + EP mode then this option has to be enabled. + endchoice endif
drivers/pci/controller/pci-dra7xx.c +181 -30
314 lines not on this page · raw message
Signature · 1 line
1.7.9.5
RFC PATCH 9/11 misc: add a new host side PCI endpoint test driver
In reply to Kishon Vijay Abraham IAdd PCI endpoint test driver that can verify base address register and legacy interrupt. (TODO: buffer tests and MSI interrupt). The corresponding pci-epf-test function driver should be used on the EP side.
--- drivers/misc/Kconfig | 7 + drivers/misc/Makefile | 1 + drivers/misc/pci_endpoint_test.c | 291 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 299 insertions(+) create mode 100644 drivers/misc/pci_endpoint_test.c
drivers/misc/Kconfig +7 -0
@@ -794,6 +794,13 @@ config PANEL_BOOT_MESSAGE An empty message will only clear the display at driver init time. Any other printf()-formatted message is valid with newline and escape codes. +config PCI_ENDPOINT_TEST + depends on PCI + tristate "PCI Endpoint Test driver" + ---help--- + Enable this configuration option to enable the host side test driver + for PCI Endpoint. + source "drivers/misc/c2port/Kconfig" source "drivers/misc/eeprom/Kconfig" source "drivers/misc/cb710/Kconfig"
drivers/misc/Makefile +1 -0
@@ -56,6 +56,7 @@ obj-$(CONFIG_ECHO) += echo/ obj-$(CONFIG_VEXPRESS_SYSCFG) += vexpress-syscfg.o obj-$(CONFIG_CXL_BASE) += cxl/ obj-$(CONFIG_PANEL) += panel.o +obj-$(CONFIG_PCI_ENDPOINT_TEST) += pci_endpoint_test.o lkdtm-$(CONFIG_LKDTM) += lkdtm_core.o lkdtm-$(CONFIG_LKDTM) += lkdtm_bugs.o
drivers/misc/pci_endpoint_test.c new file +291 -0
291 lines not on this page · raw message
Signature · 1 line
1.7.9.5
RFC PATCH 10/11 ARM: dts: DRA7: Modify pcie1 dt node for EP mode
In reply to Kishon Vijay Abraham IModify pcie1 dt node in order for the controller to operate in endpoint mode. This is used only for testing EP mode.
--- arch/arm/boot/dts/dra7.dtsi | 43 +++++++++++-------------------------------- 1 file changed, 11 insertions(+), 32 deletions(-)
arch/arm/boot/dts/dra7.dtsi +11 -32
@@ -283,38 +283,17 @@ }; }; - axi at 0 { - compatible = "simple-bus"; - #size-cells = <1>; - #address-cells = <1>; - ranges = <0x51000000 0x51000000 0x3000 - 0x0 0x20000000 0x10000000>; - pcie1: pcie at 51000000 { - compatible = "ti,dra7-pcie"; - reg = <0x51000000 0x2000>, <0x51002000 0x14c>, <0x1000 0x2000>; - reg-names = "rc_dbics", "ti_conf", "config"; - interrupts = <0 232 0x4>, <0 233 0x4>; - #address-cells = <3>; - #size-cells = <2>; - device_type = "pci"; - ranges = <0x81000000 0 0 0x03000 0 0x00010000 - 0x82000000 0 0x20013000 0x13000 0 0xffed000>; - #interrupt-cells = <1>; - num-lanes = <1>; - ti,hwmods = "pcie1"; - phys = <&pcie1_phy>; - phy-names = "pcie-phy0"; - interrupt-map-mask = <0 0 0 7>; - interrupt-map = <0 0 0 1 &pcie1_intc 1>, - <0 0 0 2 &pcie1_intc 2>, - <0 0 0 3 &pcie1_intc 3>, - <0 0 0 4 &pcie1_intc 4>; - pcie1_intc: interrupt-controller { - interrupt-controller; - #address-cells = <0>; - #interrupt-cells = <1>; - }; - }; + pcie1: pcie at 51000000 { + compatible = "ti,dra7-pcie-ep"; + reg = <0x51000000 0x28>, <0x51002000 0x14c>, <0x51001000 0x28>; + reg-names = "ep_dbics", "ti_conf", "ep_dbics2"; + interrupts = <0 232 0x4>; + num-lanes = <1>; + num-ib-windows = <4>; + num-ob-windows = <16>; + ti,hwmods = "pcie1"; + phys = <&pcie1_phy>; + phy-names = "pcie-phy0"; }; axi at 1 {
Signature · 1 line
1.7.9.5
RFC PATCH 11/11 HACK: pci: controller: dra7xx: disable smart idle
In reply to Kishon Vijay Abraham ISmart idle prevents RC to access the memory space of this controller. Set the idle mode to smart idle wakeup. This should ideally be done in hwmod. Till it's figured out how to configure it in hwmod, mark this as HACK.
--- drivers/pci/controller/pci-dra7xx.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
drivers/pci/controller/pci-dra7xx.c +12 -0
@@ -30,6 +30,14 @@/* PCIe controller wrapper DRA7XX configuration registers */ +#define PCIECTRL_DRA7XX_CONF_SYSCONFIG 0x0010 +#define SIDLE_MASK 3 +#define SIDLE_SHIFT 2 +#define SIDLE_FORCE 0x0 +#define SIDLE_NO 0x1 +#define SIDLE_SMART 0x2 +#define SIDLE_SMART_WKUP 0x3 +#define PCIECTRL_DRA7XX_CONF_IRQSTATUS_MAIN 0x0024#define PCIECTRL_DRA7XX_CONF_IRQENABLE_SET_MAIN 0x0028#define ERR_SYS BIT(0)
@@ -606,6 +614,10 @@ static int __init dra7xx_pcie_probe(struct platform_device *pdev) goto err_gpio;break ;case DW_PCIE_EP_TYPE : + reg =dra7xx_pcie_readl (dra7xx,PCIECTRL_DRA7XX_CONF_SYSCONFIG ); + reg &= ~(SIDLE_MASK <<SIDLE_SHIFT ); + reg |=SIDLE_SMART_WKUP <<SIDLE_SHIFT ; +dra7xx_pcie_writel (dra7xx,PCIECTRL_DRA7XX_CONF_SYSCONFIG , reg);dra7xx_pcie_writel (dra7xx,PCIECTRL_TI_CONF_DEVICE_TYPE ,DEVICE_TYPE_EP ); ret =dra7xx_add_pcie_ep (dra7xx, pdev);
Signature · 1 line
1.7.9.5
Arnd Bergmann
maintainerQuoted 4 lines · CEST Kishon Vijay Abraham I
This patch series
*) adds PCI endpoint core layer
*) modifies designware/dra7xx driver to be configured in EP mode *) adds a PCI endpoint *test* function driver
Hi Kishon,
I think this is a great start, thanks for posting early with a clear list of limitations and TODO items.
I've added the drivers/ntb maintainers to Cc, given that there is a certain degree of overlap between your work and the existing code, I think they should be part of the discussion.
Quoted 2 lines
Known Limitation:
*) Does not support multi-function devices
If I understand it right, this was a problem for USB and adding it later made it somewhat inconsistent. Maybe we can at least try to come up with an idea of how multi-function devices could be handled even if we don't implement it until someone actually needs it.
Is your hardware able to make the PCIe endpoint look like a device with multiple PCI functions, or would one have to do this in software inside of a single PCI function if we ever need it?
Quoted 4 lines
TODO:
*) access buffers in RC
*) raise MSI interrupts
*) Enable user space control for the RC side PCI driver
The user space control would end up just being one of several gadget drivers, right? E.g. gadget drivers for standard hardware (8250 uart, ATA, NVMe, some ethernet) could be done as kernel drivers while a user space driver can be used for things that are more unusual and that don't need to interface to another part of the kernel?
Quoted 2 lines
*) Adapt all other users of designware to use the new design (only
dra7xx has been adapted)
I don't fully understand this part. Does every designware based driver need modifications, or are the changes to the generic parts of the designware driver enough to make it work for the simpler platforms?
Quoted 20 lines
HOW TO:
ON THE EP SIDE:
***************/* EP function is configured using configfs */
# mount -t configfs none /sys/kernel/config/* PCI EP core layer creates "
pci_ep" entry in configfs */# cd /sys/kernel/config/pci_ep//*
* This is the 1st step in creating an endpoint function. This
* creates the endpoint function device *instance*. The string
* before the .<num> suffix will identify the driver this
* EP function will bind to.
* Justpci_epf_testis also valid. The .<num> suffix is used
* if there are multiple PCI controllers and all of them wants
* to use the same function.
*/
Quoted 1 line
# mkdir pci_epf_test.0
I haven't used USB gadgets, but I assume this is modeled around the same interface. If there are notable differences, please mention what they are. Otherwise the general concept seems rather nice to me.
Quoted 4 lines
drivers/pci/{host => controller}/Kconfig | 109 +++++-
drivers/pci/{host => controller}/Makefile | 2 +
drivers/pci/{host => controller}/pci-aardvark.c | 0
drivers/pci/{host => controller}/pci-dra7xx.c | 340 +++++++++++++----Quoted 8 lines
drivers/pci/{host => controller}/pci-exynos.c | 0
drivers/pci/{host => controller}/pci-host-common.c | 0
.../pci/{host => controller}/pci-host-generic.c | 0
drivers/pci/{host => controller}/pci-hyperv.c | 0
drivers/pci/{host => controller}/pci-imx6.c | 0
drivers/pci/{host => controller}/pci-keystone-dw.c | 0
drivers/pci/{host => controller}/pci-keystone.c | 0
drivers/pci/{host => controller}/pci-keystone.h | 0Maybe it's better to wait before moving it around, this will make it harder for you to rebase the patch series while you are working on it and other people are working on the existing code.
I'd suggest dropping the rename patches for the moment and just work in drivers/pci/host.
Let's talk (high-level) about the DT binding. I see that the way you have done it here, one will need to have a different .dtb file for a machine depending on whether the PCIe is used in host or endpoint mode. The advantage of this way is that it's a much cleaner binding (PCIe host bindings are a mess, and adding more options to it will only make it worse), the downside is that you can't decide at runtime what you want to use it for. E.g. connecting two identical machines over PCIe requires deciding in the bootloader which one is the endpoint, or using DT overlays, which may be awkward for some users. Is this a realistic use case, or do you expect that all machines will only ever be used in one of the two ways?
Arnd
Hi Arnd,
Quoted 10 lines · Arnd Bergmann
Quoted 4 lines · CEST Kishon Vijay Abraham I
This patch series
*) adds PCI endpoint core layer
*) modifies designware/dra7xx driver to be configured in EP mode *) adds a PCI endpoint *test* function driverHi Kishon,
I think this is a great start, thanks for posting early with a clear list of limitations and TODO items.
Thank you :-)
Quoted 5 lines
I've added the
drivers/ntbmaintainers to Cc, given that there is a certain degree of overlap between your work and the existing code, I think they should be part of the discussion.
Quoted 8 lines
Quoted 2 lines
Known Limitation:
*) Does not support multi-function devicesIf I understand it right, this was a problem for USB and adding it later made it somewhat inconsistent. Maybe we can at least try to come up with an idea of how multi-function devices could be handled even if we don't implement it until someone actually needs it.
Actually IMO multi-function device in PCI should be much simpler than it is for USB. In the case of USB, all the functions in a multi-function device will share the same *usb configuration* . (USB device can have multiple configuration but only one can be enabled at a time). A multi-function USB device will still have a single vendor-id/product-id/class... So I think a separate library (composite.c) in USB makes sense.
But in the case of PCI, every function can be treated independently since all the functions have it's own 4KB configuration space. Each function can be configured independently. Each can have it's own vendor-id/product-id/class.. I'm not sure if we'll need a separate library for PCI like we have for USB.
Now the restriction for not allowing multi-function device is because of the following structure definition.
struct pci_epc {
..
struct pci_epf *epf;
..
};EPC has a single reference to EPF and it is used *only* to notify the function driver when the link is up. (If this can be changed to use notification mechanism, multi-function devices can be supported here)
One more place where this restriction arises is in designware driver
struct dw_pcie_ep {
..
u8 bar_to_atu[6];
..
};We use single ATU window to configure a BAR (in BAR). If there are multiple functions, then this should also be modified since each function has 6 BARs.
This can be fixed without much effort unless some other issue props up.
Quoted 5 lines
Is your hardware able to make the PCIe endpoint look like a device with multiple PCI functions, or would one have to do this in software inside of a single PCI function if we ever need it?
The hardware I have doesn't support multiple PCI functions (like having a separate configuration space for each function). It has a dedicated space for configuration space supporting only one function. [Section 24.9.7.3.2 PCIe_SS_EP_CFG_DBICS Register Description in [1]].
yeah, it has to be done in software (but that won't be multi-function device in PCI terms).
[1] -> http://www.ti.com/lit/ug/spruhz6g/spruhz6g.pdf
Quoted 6 lines
Quoted 5 lines
TODO:
*) access buffers in RC
*) raise MSI interrupts
*) Enable user space control for the RC side PCI driver
Quoted 6 lines
The user space control would end up just being one of several gadget drivers, right? E.g. gadget drivers for standard hardware (8250 uart, ATA, NVMe, some ethernet) could be done as kernel drivers while a user space driver can be used for things that are more unusual and that don't need to interface to another part of the kernel?
Actually I didn't mean that. It was more with respect to the host side PCI test driver (drivers/misc/pci_endpoint_test.c). Right now it validates BAR, irq itself. I wanted to change this so that the user controls which tests to run. (Like for USB gadget zero tests, testusb.c invokes ioctls to perform various tests). Similarly I want to have a userspace program invoke pci_endpoint_test to perform various PCI tests.
Quoted 8 lines
Quoted 3 lines
*) Adapt all other users of designware to use the new design (only
dra7xx has been adapted)I don't fully understand this part. Does every designware based driver need modifications, or are the changes to the generic parts of the designware driver enough to make it work for the simpler platforms?
I have changed the core designware driver structures (like previously the platform drivers will only use pcie_port, but now I introduced struct dw_pcie to support both host and endpoint). This will break (compilation failure) all the designware based drivers (except dra7xx). All these drivers should be adapted to the new change (even if they work only in host mode these has to be adapted).
Quoted 23 lines
Quoted 21 lines
HOW TO:
ON THE EP SIDE:
***************/* EP function is configured using configfs */
# mount -t configfs none /sys/kernel/config/* PCI EP core layer creates "
pci_ep" entry in configfs */# cd /sys/kernel/config/pci_ep//*
* This is the 1st step in creating an endpoint function. This
* creates the endpoint function device *instance*. The string
* before the .<num> suffix will identify the driver this
* EP function will bind to.
* Justpci_epf_testis also valid. The .<num> suffix is used
* if there are multiple PCI controllers and all of them wants
* to use the same function.
*/Quoted 1 line
# mkdir pci_epf_test.0
Quoted 3 lines
I haven't used USB gadgets, but I assume this is modeled around the same interface. If there are notable differences, please mention what they are. Otherwise the general concept seems rather nice to me.
Yeah, both USB gadget and PCI endpoint use configfs interface but the semantics are quite different.
Every directory in *usb_gadget* corresponds to a gadget device, and the gadget device has a functions sub-directory which has the USB functions. And these directories have fields or attributes specific to USB.
But in the case of PCI, every directory in *pci_ep* corresponds to a PCI function and it has fields or attributes specific to PCI function.
The main reason for using configfs for PCI endpoint is to give the users to control "which function has to be bound to which controller". The same concept is used for USB gadget as well but there it is "which gadget device has to be bound to which controller".
Quoted 14 lines
Quoted 13 lines
drivers/pci/{host => controller}/Kconfig | 109 +++++- drivers/pci/{host => controller}/Makefile | 2 + drivers/pci/{host => controller}/pci-aardvark.c | 0 drivers/pci/{host => controller}/pci-dra7xx.c | 340 +++++++++++++---- drivers/pci/{host => controller}/pci-exynos.c | 0 drivers/pci/{host => controller}/pci-host-common.c | 0 .../pci/{host => controller}/pci-host-generic.c | 0 drivers/pci/{host => controller}/pci-hyperv.c | 0 drivers/pci/{host => controller}/pci-imx6.c | 0 drivers/pci/{host => controller}/pci-keystone-dw.c | 0 drivers/pci/{host => controller}/pci-keystone.c | 0 drivers/pci/{host => controller}/pci-keystone.h | 0
Quoted 3 lines
Maybe it's better to wait before moving it around, this will make it harder for you to rebase the patch series while you are working on it and other people are working on the existing code.
These patches just do "mv drivers/pci/host drivers/pci/controller", so I guess irrespective of the changes in the existing driver it should just move. Anyways I have to check this.
Quoted 3 lines
I'd suggest dropping the rename patches for the moment and just work in
drivers/pci/host.
Okay.
Quoted 13 lines
Let's talk (high-level) about the DT binding. I see that the way you have done it here, one will need to have a different .dtb file for a machine depending on whether the PCIe is used in host or endpoint mode. The advantage of this way is that it's a much cleaner binding (PCIe host bindings are a mess, and adding more options to it will only make it worse), the downside is that you can't decide at runtime what you want to use it for. E.g. connecting two identical machines over PCIe requires deciding in the bootloader which one is the endpoint, or using DT overlays, which may be awkward for some users. Is this a realistic use case, or do you expect that all machines will only ever be used in one of the two ways?
It would definitely be nice to select the mode at runtime. Even for this patch series, I added a temporary dtsi patch to configure the pci controller in EP mode (which can't be merged since the same controller is also used to test RC).
Thanks
Kishon
Arnd Bergmann
maintainerQuoted 15 lines · CEST Kishon Vijay Abraham I
Quoted 5 lines · Arnd Bergmann
On Wednesday, September 14, 2016 10:41:56 AM CEST Kishon Vijay Abraham I wrote:
I've added thedrivers/ntbmaintainers to Cc, given that there is a certain degree of overlap between your work and the existing code, I think they should be part of the discussion.Quoted 8 lines
Quoted 2 lines
Known Limitation:
*) Does not support multi-function devicesIf I understand it right, this was a problem for USB and adding it later made it somewhat inconsistent. Maybe we can at least try to come up with an idea of how multi-function devices could be handled even if we don't implement it until someone actually needs it.
Quoted 6 lines
Actually IMO multi-function device in PCI should be much simpler than it is for USB. In the case of USB, all the functions in a multi-function device will share the same *usb configuration* . (USB device can have multiple configuration but only one can be enabled at a time). A multi-function USB device will still have a single vendor-id/product-id/class... So I think a separate library (
composite.c) in USB makes sense.
Ok, makes sense.
Quoted 4 lines
But in the case of PCI, every function can be treated independently since all the functions have it's own 4KB configuration space. Each function can be configured independently. Each can have it's own vendor-id/product-id/class.. I'm not sure if we'll need a separate library for PCI like we have for USB.
I think it depends on whether we want to add the software multi-function support you mention.
Quoted 21 lines
Now the restriction for not allowing multi-function device is because of the following structure definition.
struct pci_epc { .. struct pci_epf *epf; .. };EPC has a single reference to EPF and it is used *only* to notify the function driver when the link is up. (If this can be changed to use notification mechanism, multi-function devices can be supported here)
One more place where this restriction arises is in designware driver
struct dw_pcie_ep { .. u8 bar_to_atu[6]; .. };
Quoted 4 lines
We use single ATU window to configure a BAR (in BAR). If there are multiple functions, then this should also be modified since each function has 6 BARs.
This can be fixed without much effort unless some other issue props up.
Ok.
Quoted 11 lines
Quoted 5 lines
Is your hardware able to make the PCIe endpoint look like a device with multiple PCI functions, or would one have to do this in software inside of a single PCI function if we ever need it?
The hardware I have doesn't support multiple PCI functions (like having a separate configuration space for each function). It has a dedicated space for configuration space supporting only one function. [Section 24.9.7.3.2
PCIe_SS_EP_CFG_DBICSRegister Description in [1]].
Quoted 4 lines
yeah, it has to be done in software (but that won't be multi-function device in PCI terms).
Ok, so in theory there can be other hardware (and quite likely is) that supports multiple functions, and we can extend the framework to support them without major obstacles, but your hardware doesn't, so you kept it simple with one hardcoded function, right?
Seems completely reasonable to me.
Quoted 12 lines
Quoted 11 lines
Quoted 4 lines
TODO:
*) access buffers in RC
*) raise MSI interrupts
*) Enable user space control for the RC side PCI driverThe user space control would end up just being one of several gadget drivers, right? E.g. gadget drivers for standard hardware (8250 uart, ATA, NVMe, some ethernet) could be done as kernel drivers while a user space driver can be used for things that are more unusual and that don't need to interface to another part of the kernel?
Quoted 6 lines
Actually I didn't mean that. It was more with respect to the host side PCI test driver (
drivers/misc/pci_endpoint_test.c). Right now it validates BAR, irq itself. I wanted to change this so that the user controls which tests to run. (Like for USB gadget zero tests,testusb.cinvokes ioctls to perform various tests). Similarly I want to have a userspace program invokepci_endpoint_testto perform various PCI tests.
Ok, I see. So what I described above would be yet another function driver that can be implemented, but so far, you have not planned to do that because there was not need, right?
Quoted 9 lines
Quoted 8 lines
Quoted 3 lines
*) Adapt all other users of designware to use the new design (only
dra7xx has been adapted)I don't fully understand this part. Does every designware based driver need modifications, or are the changes to the generic parts of the designware driver enough to make it work for the simpler platforms?
Quoted 6 lines
I have changed the core designware driver structures (like previously the platform drivers will only use
pcie_port, but now I introduced structdw_pcieto support both host and endpoint). This will break (compilation failure) all the designware based drivers (except dra7xx). All these drivers should be adapted to the new change (even if they work only in host mode these has to be adapted).
Ah, so we have to do two separate modifications to each designware driver:
a) make it work with your patch (mandatory)
b) make it support endpoint mode (optional)
Quoted 29 lines
Quoted 22 lines
Quoted 20 lines
HOW TO:
ON THE EP SIDE:
***************/* EP function is configured using configfs */
# mount -t configfs none /sys/kernel/config/* PCI EP core layer creates "
pci_ep" entry in configfs */# cd /sys/kernel/config/pci_ep//*
* This is the 1st step in creating an endpoint function. This
* creates the endpoint function device *instance*. The string
* before the .<num> suffix will identify the driver this
* EP function will bind to.
* Justpci_epf_testis also valid. The .<num> suffix is used
* if there are multiple PCI controllers and all of them wants
* to use the same function.
*/Quoted 1 line
# mkdir pci_epf_test.0Quoted 3 lines
I haven't used USB gadgets, but I assume this is modeled around the same interface. If there are notable differences, please mention what they are. Otherwise the general concept seems rather nice to me.
Yeah, both USB gadget and PCI endpoint use configfs interface but the semantics are quite different.
Quoted 6 lines
Every directory in *usb_gadget* corresponds to a gadget device, and the gadget device has a functions sub-directory which has the USB functions. And these directories have fields or attributes specific to USB.
But in the case of PCI, every directory in *pci_ep* corresponds to a PCI function and it has fields or attributes specific to PCI function.
Ok, I see.
Quoted 4 lines
The main reason for using configfs for PCI endpoint is to give the users to control "which function has to be bound to which controller". The same concept is used for USB gadget as well but there it is "which gadget device has to be bound to which controller".
We should still find out whether it's important that you can have a single PCI function with a software multi-function support of some sort. We'd still be limited to six BARs in total, and would also need something to identify those sub-functions, so implementing that might get quite hairy.
Possibly this could be done at a higher level, e.g. by implementing a PCI-virtio multiplexer that can host multiple virtio based devices inside of a single PCI function. If we think that would be a good idea, we should make sure the configfs interface is extensible enough to handle that.
One use case I have in mind for this is to have a PCI function that can use virtio to provide rootfs (virtio-blk or 9pfs), network and console to the system that implements the PCI function (note that this is the opposite direction of what almost everyone else uses PCI devices for).
Quoted 13 lines
Quoted 4 lines
Let's talk (high-level) about the DT binding. I see that the way you have done it here, one will need to have a different .dtb file for a machine depending on whether the PCIe is used in host or endpoint mode. The advantage of this way is that it's a much
Quoted 8 lines
cleaner binding (PCIe host bindings are a mess, and adding more options to it will only make it worse), the downside is that you can't decide at runtime what you want to use it for. E.g. connecting two identical machines over PCIe requires deciding in the bootloader which one is the endpoint, or using DT overlays, which may be awkward for some users. Is this a realistic use case, or do you expect that all machines will only ever be used in one of the two ways?
Quoted 3 lines
It would definitely be nice to select the mode at runtime. Even for this patch series, I added a temporary dtsi patch to configure the pci controller in EP mode (which can't be merged since the same controller is also used to test RC).
I think it should be possible to have two bindings that define a distinct set of properties, and have one node that is marked as "compatible" with both of them in order to let the OS choose one or the other mode.
Arnd
Rob Herring
maintainerRe: [RFC PATCH 07/11] pci: controller: designware: Add EP mode support
In reply to Kishon Vijay Abraham IQuoted 32 lines · Kishon Vijay Abraham I
Add endpoint mode support to designware driver. This uses the EP Core layer introduced recently to add endpoint mode support. *Any* function driver can now use this designware device to achieve the EP functionality.
Signed-off-by Kishon Vijay Abraham I <[email protected]>--- .../devicetree/bindings/pci/designware-pcie.txt | 26 ++- drivers/pci/controller/Kconfig | 5 + drivers/pci/controller/Makefile | 1 + drivers/pci/controller/pcie-designware-ep.c | 228 ++++++++++++++++++++ drivers/pci/controller/pcie-designware.c | 30 +++ drivers/pci/controller/pcie-designware.h | 45 ++++ 6 files changed, 324 insertions(+), 11 deletions(-) create mode 100644 drivers/pci/controller/pcie-designware-ep.cDocumentation/devicetree/bindings/pci/designware-pcie.txt +1
-7@@ -6,23 +6,27 @@ Required properties: - reg-names: Must be "config" for the PCIe configuration space. (The old way of getting the configuration address space from "ranges" is deprecated and should be avoided.) -- #address-cells: set to <3> -- #size-cells: set to <2> -- device_type: set to "pci" -- ranges: ranges for the PCI memory and I/O regions -- #interrupt-cells: set to <1> -- interrupt-map-mask and interrupt-map: standard PCI properties - to define the mapping of the PCIe interface to interrupt +- #address-cells (only for host mode): set to <3>
Documentation/devicetree/bindings/pci/designware-pcie.txt Required properties: · line 19
Quoted 10 lines
Documentation/devicetree/bindings/pci/designware-pcie.txt +10
-0+- #size-cells (only for host mode): set to <2> +- device_type (only for host mode): set to "pci" +- ranges (only for host mode): ranges for the PCI memory and I/O regions +- num-ib-windows (only for EP mode): number of inbound address translation + windows +- num-ob-windows (only for EP mode): number of outbound address translation + windows +- #interrupt-cells (only for host mode): set to <1> +- interrupt-map-mask and interrupt-map (only for host mode): standard PCI + properties to define the mapping of the PCIe interface to interrupt
It may be clearer to just document EP mode in a separate section even if there's some duplication of properties. Other standard PCI binding properties probably also don't apply.
Rob
Rob Herring
maintainerRe: [RFC PATCH 08/11] pci: controller: dra7xx: Add EP mode support
In reply to Kishon Vijay Abraham IQuoted 45 lines · Kishon Vijay Abraham I
The PCIe controller integrated in dra7xx SoCs is capable of operating in endpoint mode. Add support for dra7xx SoCs to operate in endpoint mode.
Signed-off-by Kishon Vijay Abraham I <[email protected]>--- Documentation/devicetree/bindings/pci/ti-pci.txt | 30 ++- drivers/pci/controller/Kconfig | 21 +++ drivers/pci/controller/pci-dra7xx.c | 211 +++++++++++++++++++--- 3 files changed, 225 insertions(+), 37 deletions(-)Documentation/devicetree/bindings/pci/ti-pci.txt +11
-6@@ -1,17 +1,22 @@ TI PCI Controllers PCIe Designware Controller - - compatible: Should be "ti,dra7-pcie"" - - reg : Two register ranges as listed in the reg-names property - - reg-names : The first entry must be "ti-conf" for the TI specific registers - The second entry must be "rc-dbics" for the designware pcie - registers - The third entry must be "config" for the PCIe configuration space + - compatible: Should be "ti,dra7-pcie" for RC + Should be "ti,dra7-pcie-ep" for EP - phys : list of PHY specifiers (used by generic PHY framework) - phy-names : must be "pcie-phy0", "pcie-phy1", "pcie-phyN".. based on the number of PHYs as specified in *phys* property. - ti,hwmods : Name of the hwmod associated to the pcie, "pcie<X>", where <X> is the instance number of the pcie from the HW spec. + - num-lanes as specified in ../designware-pcie.txt + +HOST MODE +========= + - reg : Two register ranges as listed in the reg-names property + - reg-names : The first entry must be "ti-conf" for the TI specific registers + The second entry must be "rc-dbics" for the designware pcie + registers + The third entry must be "config" for the PCIe configuration space - interrupts : Two interrupt entries must be specified. The first one is for main interrupt line and the second for MSI interrupt line. - #address-cells,
Documentation/devicetree/bindings/pci/ti-pci.txt PCIe Designware Controller · line 31
Quoted 9 lines
Documentation/devicetree/bindings/pci/ti-pci.txt +0
-1@@ -19,13 +24,24 @@ PCIe Designware Controller #interrupt-cells, device_type, ranges, - num-lanes, interrupt-map-mask, interrupt-map : as specified in ../designware-pcie.txt Optional Property: - gpios : Should be added if a gpio line is required to drive PERST# line
Don't you need gpios as the input side of GPIO outputs in RC mode? Or for EP mode they are all handled by h/w?
Quoted 23 lines
Documentation/devicetree/bindings/pci/ti-pci.txt +12
-0+DEVICE MODE +=========== + - reg : Two register ranges as listed in the reg-names property + - reg-names : "ti-conf" for the TI specific registers + "ep_dbics" for the standard configuration registers as + they are locally accessed within the DIF CS space + "ep_dbics2" for the standard configuration registers as + they are locally accessed within the DIF CS2 space + - interrupts : one interrupt entries must be specified for main interrupt. + - num-ib-windows : number of inbound address translation windows + - num-ob-windows : number of outbound address translation windows + Example: axi { compatible = "simple-bus";drivers/pci/controller/Kconfig +0
-0@@ -23,6 +23,27 @@ config PCI_DRA7XX_HOST Enables support for the PCIe controller in the DRA7xx SoC to work in host mode.
drivers/pci/controller/Kconfig config PCI_DRA7XX_HOST · line 34
Quoted 10 lines
drivers/pci/controller/Kconfig +9
-0+config PCI_DRA7XX_EP + bool "Endpoint Only Mode" + depends on PCI_ENDPOINT + select PCIE_DW_EP + help + Enables support for the PCIe controller in the DRA7xx SoC to work in + endpoint mode. + +config PCI_DRA7XX_HOST_EP
I'd make these 2 options just RC and EP depending on PCI_DRA7XX_HOST with RC option being default yes.
Quoted 15 lines
drivers/pci/controller/Kconfig +12
-0+ bool "Both Host and Endpoint Mode" + depends on PCI_MSI_IRQ_DOMAIN + depends on PCI + depends on PCI_ENDPOINT + select PCIE_DW_HOST + select PCIE_DW_EP + help + Enables support for the PCIe controller in the DRA7xx SoC to work in + both endpoint mode and host mode. If the board has 2 PCIe ports and + one of them has to work in host mode and the other has to work in + EP mode then this option has to be enabled. + endchoice endif
Hi Arnd,
Quoted 75 lines · Arnd Bergmann
Quoted 15 lines · CEST Kishon Vijay Abraham I
Quoted 5 lines · Arnd Bergmann
On Wednesday, September 14, 2016 10:41:56 AM CEST Kishon Vijay Abraham I wrote:
I've added thedrivers/ntbmaintainers to Cc, given that there is a certain degree of overlap between your work and the existing code, I think they should be part of the discussion.Quoted 8 lines
Quoted 2 lines
Known Limitation:
*) Does not support multi-function devicesIf I understand it right, this was a problem for USB and adding it later made it somewhat inconsistent. Maybe we can at least try to come up with an idea of how multi-function devices could be handled even if we don't implement it until someone actually needs it.
Quoted 6 lines
Actually IMO multi-function device in PCI should be much simpler than it is for USB. In the case of USB, all the functions in a multi-function device will share the same *usb configuration* . (USB device can have multiple configuration but only one can be enabled at a time). A multi-function USB device will still have a single vendor-id/product-id/class... So I think a separate library (
composite.c) in USB makes sense.Ok, makes sense.
Quoted 4 lines
But in the case of PCI, every function can be treated independently since all the functions have it's own 4KB configuration space. Each function can be configured independently. Each can have it's own vendor-id/product-id/class.. I'm not sure if we'll need a separate library for PCI like we have for USB.
I think it depends on whether we want to add the software multi-function support you mention.
Quoted 21 lines
Now the restriction for not allowing multi-function device is because of the following structure definition.
struct pci_epc { .. struct pci_epf *epf; .. };EPC has a single reference to EPF and it is used *only* to notify the function driver when the link is up. (If this can be changed to use notification mechanism, multi-function devices can be supported here)
One more place where this restriction arises is in designware driver
struct dw_pcie_ep { .. u8 bar_to_atu[6]; .. };Quoted 4 lines
We use single ATU window to configure a BAR (in BAR). If there are multiple functions, then this should also be modified since each function has 6 BARs.
This can be fixed without much effort unless some other issue props up.
Ok.
Quoted 14 lines
Quoted 5 lines
Is your hardware able to make the PCIe endpoint look like a device with multiple PCI functions, or would one have to do this in software inside of a single PCI function if we ever need it?
The hardware I have doesn't support multiple PCI functions (like having a separate configuration space for each function). It has a dedicated space for configuration space supporting only one function. [Section 24.9.7.3.2
PCIe_SS_EP_CFG_DBICSRegister Description in [1]].yeah, it has to be done in software (but that won't be multi-function device in PCI terms).
Quoted 6 lines
Quoted 1 line
Ok, so in theory there can be other hardware (and quite likely is) that supports multiple functions, and we can extend the framework to support them without major obstacles, but your hardware doesn't, so you kept it simple with one hardcoded function, right?
right, PCIe can have upto 8 functions. So the issues with the current framework has to be fixed. I don't expect major obstacles with this as of now.
Quoted 22 lines
Seems completely reasonable to me.
Quoted 12 lines
Quoted 11 lines
Quoted 4 lines
TODO:
*) access buffers in RC
*) raise MSI interrupts
*) Enable user space control for the RC side PCI driverThe user space control would end up just being one of several gadget drivers, right? E.g. gadget drivers for standard hardware (8250 uart, ATA, NVMe, some ethernet) could be done as kernel drivers while a user space driver can be used for things that are more unusual and that don't need to interface to another part of the kernel?
Quoted 6 lines
Actually I didn't mean that. It was more with respect to the host side PCI test driver (
drivers/misc/pci_endpoint_test.c). Right now it validates BAR, irq itself. I wanted to change this so that the user controls which tests to run. (Like for USB gadget zero tests,testusb.cinvokes ioctls to perform various tests). Similarly I want to have a userspace program invokepci_endpoint_testto perform various PCI tests.
Quoted 3 lines
Ok, I see. So what I described above would be yet another function driver that can be implemented, but so far, you have not planned to do that because there was not need, right?
right. I felt pci_endpoint_test is the generic function that would be of interest to all the vendors. Any new function can be added by taking pci_endpoint_test as a reference.
The simple usecase I plan to work on after completing the framework is to have a camera sensor in one board and display in another board (the boards connected using PCIe) and the display showing the the camera capture.
Quoted 17 lines
Quoted 10 lines
Quoted 9 lines
Quoted 4 lines
*) Adapt all other users of designware to use the new design (only
dra7xx has been adapted)I don't fully understand this part. Does every designware based driver need modifications, or are the changes to the generic parts of the designware driver enough to make it work for the simpler platforms?
Quoted 6 lines
I have changed the core designware driver structures (like previously the platform drivers will only use
pcie_port, but now I introduced structdw_pcieto support both host and endpoint). This will break (compilation failure) all the designware based drivers (except dra7xx). All these drivers should be adapted to the new change (even if they work only in host mode these has to be adapted).
Quoted 4 lines
Ah, so we have to do two separate modifications to each designware driver:
a) make it work with your patch (mandatory)
b) make it support endpoint mode (optional)
yes.
Quoted 50 lines
Quoted 30 lines
Quoted 23 lines
Quoted 21 lines
HOW TO:
ON THE EP SIDE:
***************/* EP function is configured using configfs */
# mount -t configfs none /sys/kernel/config/* PCI EP core layer creates "
pci_ep" entry in configfs */# cd /sys/kernel/config/pci_ep//*
* This is the 1st step in creating an endpoint function. This
* creates the endpoint function device *instance*. The string
* before the .<num> suffix will identify the driver this
* EP function will bind to.
* Justpci_epf_testis also valid. The .<num> suffix is used
* if there are multiple PCI controllers and all of them wants
* to use the same function.
*/Quoted 1 line
# mkdir pci_epf_test.0Quoted 3 lines
I haven't used USB gadgets, but I assume this is modeled around the same interface. If there are notable differences, please mention what they are. Otherwise the general concept seems rather nice to me.
Yeah, both USB gadget and PCI endpoint use configfs interface but the semantics are quite different.
Quoted 6 lines
Every directory in *usb_gadget* corresponds to a gadget device, and the gadget device has a functions sub-directory which has the USB functions. And these directories have fields or attributes specific to USB.
But in the case of PCI, every directory in *pci_ep* corresponds to a PCI function and it has fields or attributes specific to PCI function.
Ok, I see.
Quoted 4 lines
The main reason for using configfs for PCI endpoint is to give the users to control "which function has to be bound to which controller". The same concept is used for USB gadget as well but there it is "which gadget device has to be bound to which controller".
We should still find out whether it's important that you can have a single PCI function with a software multi-function support of some sort. We'd still be limited to six BARs in total, and would also need something to identify those sub-functions, so implementing that might get quite hairy.
Quoted 5 lines
Possibly this could be done at a higher level, e.g. by implementing a PCI-virtio multiplexer that can host multiple virtio based devices inside of a single PCI function. If we think that would be a good idea, we should make sure the configfs interface is extensible enough to handle that.
Okay. So here the main function (actual PCI function) *can* perform the work of virtio muliplexer if the platform wants to support sub-functions or it can be a normal PCI function. right?
Quoted 6 lines
One use case I have in mind for this is to have a PCI function that can use virtio to provide rootfs (virtio-blk or 9pfs), network and console to the system that implements the PCI function (note that this is the opposite direction of what almost everyone else uses PCI devices for).
Do you mean the virtio should actually be in the host side? Even here the system that implements PCI function should have multiple functions right? (one for network, other for console etc..). So there should be a virtio multiplexer both in the host side and in the device side?
Quoted 14 lines
Quoted 14 lines
Quoted 13 lines
Let's talk (high-level) about the DT binding. I see that the way you have done it here, one will need to have a different .dtb file for a machine depending on whether the PCIe is used in host or endpoint mode. The advantage of this way is that it's a much cleaner binding (PCIe host bindings are a mess, and adding more options to it will only make it worse), the downside is that you can't decide at runtime what you want to use it for. E.g. connecting two identical machines over PCIe requires deciding in the bootloader which one is the endpoint, or using DT overlays, which may be awkward for some users. Is this a realistic use case, or do you expect that all machines will only ever be used in one of the two ways?
Quoted 8 lines
Quoted 3 lines
It would definitely be nice to select the mode at runtime. Even for this patch series, I added a temporary dtsi patch to configure the pci controller in EP mode (which can't be merged since the same controller is also used to test RC).
I think it should be possible to have two bindings that define a distinct set of properties, and have one node that is marked as "compatible" with both of them in order to let the OS choose one or the other mode.
hmm.. okay.
Thanks
Kishon
Re: [RFC PATCH 07/11] pci: controller: designware: Add EP mode support
In reply to Rob HerringHi,
Quoted 39 lines · Rob Herring
Quoted 38 lines · Kishon Vijay Abraham I
Add endpoint mode support to designware driver. This uses the EP Core layer introduced recently to add endpoint mode support. *Any* function driver can now use this designware device to achieve the EP functionality.
Signed-off-by Kishon Vijay Abraham I <[email protected]>--- .../devicetree/bindings/pci/designware-pcie.txt | 26 ++- drivers/pci/controller/Kconfig | 5 + drivers/pci/controller/Makefile | 1 + drivers/pci/controller/pcie-designware-ep.c | 228 ++++++++++++++++++++ drivers/pci/controller/pcie-designware.c | 30 +++ drivers/pci/controller/pcie-designware.h | 45 ++++ 6 files changed, 324 insertions(+), 11 deletions(-) create mode 100644 drivers/pci/controller/pcie-designware-ep.cDocumentation/devicetree/bindings/pci/designware-pcie.txt +7
-7@@ -6,23 +6,27 @@ Required properties: - reg-names: Must be "config" for the PCIe configuration space. (The old way of getting the configuration address space from "ranges" is deprecated and should be avoided.) -- #address-cells: set to <3> -- #size-cells: set to <2> -- device_type: set to "pci" -- ranges: ranges for the PCI memory and I/O regions -- #interrupt-cells: set to <1> -- interrupt-map-mask and interrupt-map: standard PCI properties - to define the mapping of the PCIe interface to interrupt +- #address-cells (only for host mode): set to <3> +- #size-cells (only for host mode): set to <2> +- device_type (only for host mode): set to "pci" +- ranges (only for host mode): ranges for the PCI memory and I/O regions +- num-ib-windows (only for EP mode): number of inbound address translation + windows +- num-ob-windows (only for EP mode): number of outbound address translation
Quoted 8 lines
Documentation/devicetree/bindings/pci/designware-pcie.txt Required properties: · line 19
Quoted 4 lines
Documentation/devicetree/bindings/pci/designware-pcie.txt +4
-0+ windows +- #interrupt-cells (only for host mode): set to <1> +- interrupt-map-mask and interrupt-map (only for host mode): standard PCI + properties to define the mapping of the PCIe interface to interruptIt may be clearer to just document EP mode in a separate section even if there's some duplication of properties. Other standard PCI binding properties probably also don't apply.
right, will change this accordingly.
Thanks
Kishon
Re: [RFC PATCH 08/11] pci: controller: dra7xx: Add EP mode support
In reply to Rob HerringHi,
Quoted 53 lines · Rob Herring
Quoted 52 lines · Kishon Vijay Abraham I
The PCIe controller integrated in dra7xx SoCs is capable of operating in endpoint mode. Add support for dra7xx SoCs to operate in endpoint mode.
Signed-off-by Kishon Vijay Abraham I <[email protected]>--- Documentation/devicetree/bindings/pci/ti-pci.txt | 30 ++- drivers/pci/controller/Kconfig | 21 +++ drivers/pci/controller/pci-dra7xx.c | 211 +++++++++++++++++++--- 3 files changed, 225 insertions(+), 37 deletions(-)Documentation/devicetree/bindings/pci/ti-pci.txt +11
-7@@ -1,17 +1,22 @@ TI PCI Controllers PCIe Designware Controller - - compatible: Should be "ti,dra7-pcie"" - - reg : Two register ranges as listed in the reg-names property - - reg-names : The first entry must be "ti-conf" for the TI specific registers - The second entry must be "rc-dbics" for the designware pcie - registers - The third entry must be "config" for the PCIe configuration space + - compatible: Should be "ti,dra7-pcie" for RC + Should be "ti,dra7-pcie-ep" for EP - phys : list of PHY specifiers (used by generic PHY framework) - phy-names : must be "pcie-phy0", "pcie-phy1", "pcie-phyN".. based on the number of PHYs as specified in *phys* property. - ti,hwmods : Name of the hwmod associated to the pcie, "pcie<X>", where <X> is the instance number of the pcie from the HW spec. + - num-lanes as specified in ../designware-pcie.txt + +HOST MODE +========= + - reg : Two register ranges as listed in the reg-names property + - reg-names : The first entry must be "ti-conf" for the TI specific registers + The second entry must be "rc-dbics" for the designware pcie + registers + The third entry must be "config" for the PCIe configuration space - interrupts : Two interrupt entries must be specified. The first one is for main interrupt line and the second for MSI interrupt line. - #address-cells,@@ -19,13 +24,24 @@ PCIe Designware Controller #interrupt-cells, device_type, ranges, - num-lanes, interrupt-map-mask, interrupt-map : as specified in ../designware-pcie.txt
Quoted 5 lines
Documentation/devicetree/bindings/pci/ti-pci.txt PCIe Designware Controller · line 31
Quoted 2 lines
Documentation/devicetree/bindings/pci/ti-pci.txt +0
-0Optional Property: - gpios : Should be added if a gpio line is required to drive PERST# lineDon't you need gpios as the input side of GPIO outputs in RC mode? Or for EP mode they are all handled by h/w?
I couldn't find any mention of the gpios being used in EP mode. I'll check this again.
Thanks
Kishon
Hi Arnd,
Quoted 137 lines · Kishon Vijay Abraham I
Hi Arnd,
Quoted 75 lines · Arnd Bergmann
Quoted 15 lines · CEST Kishon Vijay Abraham I
Quoted 5 lines · Arnd Bergmann
On Wednesday, September 14, 2016 10:41:56 AM CEST Kishon Vijay Abraham I wrote:
I've added thedrivers/ntbmaintainers to Cc, given that there is a certain degree of overlap between your work and the existing code, I think they should be part of the discussion.Quoted 8 lines
Quoted 2 lines
Known Limitation:
*) Does not support multi-function devicesIf I understand it right, this was a problem for USB and adding it later made it somewhat inconsistent. Maybe we can at least try to come up with an idea of how multi-function devices could be handled even if we don't implement it until someone actually needs it.
Quoted 6 lines
Actually IMO multi-function device in PCI should be much simpler than it is for USB. In the case of USB, all the functions in a multi-function device will share the same *usb configuration* . (USB device can have multiple configuration but only one can be enabled at a time). A multi-function USB device will still have a single vendor-id/product-id/class... So I think a separate library (
composite.c) in USB makes sense.Ok, makes sense.
Quoted 4 lines
But in the case of PCI, every function can be treated independently since all the functions have it's own 4KB configuration space. Each function can be configured independently. Each can have it's own vendor-id/product-id/class.. I'm not sure if we'll need a separate library for PCI like we have for USB.
I think it depends on whether we want to add the software multi-function support you mention.
Quoted 21 lines
Now the restriction for not allowing multi-function device is because of the following structure definition.
struct pci_epc { .. struct pci_epf *epf; .. };EPC has a single reference to EPF and it is used *only* to notify the function driver when the link is up. (If this can be changed to use notification mechanism, multi-function devices can be supported here)
One more place where this restriction arises is in designware driver
struct dw_pcie_ep { .. u8 bar_to_atu[6]; .. };Quoted 4 lines
We use single ATU window to configure a BAR (in BAR). If there are multiple functions, then this should also be modified since each function has 6 BARs.
This can be fixed without much effort unless some other issue props up.
Ok.
Quoted 14 lines
Quoted 5 lines
Is your hardware able to make the PCIe endpoint look like a device with multiple PCI functions, or would one have to do this in software inside of a single PCI function if we ever need it?
The hardware I have doesn't support multiple PCI functions (like having a separate configuration space for each function). It has a dedicated space for configuration space supporting only one function. [Section 24.9.7.3.2
PCIe_SS_EP_CFG_DBICSRegister Description in [1]].yeah, it has to be done in software (but that won't be multi-function device in PCI terms).
Quoted 6 lines
Quoted 1 line
Ok, so in theory there can be other hardware (and quite likely is) that supports multiple functions, and we can extend the framework to support them without major obstacles, but your hardware doesn't, so you kept it simple with one hardcoded function, right?
right, PCIe can have upto 8 functions. So the issues with the current framework has to be fixed. I don't expect major obstacles with this as of now.
Quoted 22 lines
Seems completely reasonable to me.
Quoted 12 lines
Quoted 11 lines
Quoted 4 lines
TODO:
*) access buffers in RC
*) raise MSI interrupts
*) Enable user space control for the RC side PCI driverThe user space control would end up just being one of several gadget drivers, right? E.g. gadget drivers for standard hardware (8250 uart, ATA, NVMe, some ethernet) could be done as kernel drivers while a user space driver can be used for things that are more unusual and that don't need to interface to another part of the kernel?
Quoted 6 lines
Actually I didn't mean that. It was more with respect to the host side PCI test driver (
drivers/misc/pci_endpoint_test.c). Right now it validates BAR, irq itself. I wanted to change this so that the user controls which tests to run. (Like for USB gadget zero tests,testusb.cinvokes ioctls to perform various tests). Similarly I want to have a userspace program invokepci_endpoint_testto perform various PCI tests.Quoted 3 lines
Ok, I see. So what I described above would be yet another function driver that can be implemented, but so far, you have not planned to do that because there was not need, right?
right. I felt
pci_endpoint_testis the generic function that would be of interest to all the vendors. Any new function can be added by takingpci_endpoint_testas a reference.The simple usecase I plan to work on after completing the framework is to have a camera sensor in one board and display in another board (the boards connected using PCIe) and the display showing the the camera capture.
Quoted 17 lines
Quoted 16 lines
Quoted 9 lines
Quoted 4 lines
*) Adapt all other users of designware to use the new design (only
dra7xx has been adapted)I don't fully understand this part. Does every designware based driver need modifications, or are the changes to the generic parts of the designware driver enough to make it work for the simpler platforms?
I have changed the core designware driver structures (like previously the platform drivers will only use
pcie_port, but now I introduced structdw_pcieto support both host and endpoint). This will break (compilation failure) all the designware based drivers (except dra7xx). All these drivers should be adapted to the new change (even if they work only in host mode these has to be adapted).
Quoted 55 lines
Quoted 4 lines
Ah, so we have to do two separate modifications to each designware driver:
a) make it work with your patch (mandatory)
b) make it support endpoint mode (optional)yes.
Quoted 49 lines
Quoted 30 lines
Quoted 23 lines
Quoted 21 lines
HOW TO:
ON THE EP SIDE:
***************/* EP function is configured using configfs */
# mount -t configfs none /sys/kernel/config/* PCI EP core layer creates "
pci_ep" entry in configfs */# cd /sys/kernel/config/pci_ep//*
* This is the 1st step in creating an endpoint function. This
* creates the endpoint function device *instance*. The string
* before the .<num> suffix will identify the driver this
* EP function will bind to.
* Justpci_epf_testis also valid. The .<num> suffix is used
* if there are multiple PCI controllers and all of them wants
* to use the same function.
*/Quoted 1 line
# mkdir pci_epf_test.0Quoted 3 lines
I haven't used USB gadgets, but I assume this is modeled around the same interface. If there are notable differences, please mention what they are. Otherwise the general concept seems rather nice to me.
Yeah, both USB gadget and PCI endpoint use configfs interface but the semantics are quite different.
Quoted 6 lines
Every directory in *usb_gadget* corresponds to a gadget device, and the gadget device has a functions sub-directory which has the USB functions. And these directories have fields or attributes specific to USB.
But in the case of PCI, every directory in *pci_ep* corresponds to a PCI function and it has fields or attributes specific to PCI function.
Ok, I see.
Quoted 4 lines
The main reason for using configfs for PCI endpoint is to give the users to control "which function has to be bound to which controller". The same concept is used for USB gadget as well but there it is "which gadget device has to be bound to which controller".
We should still find out whether it's important that you can have a single PCI function with a software multi-function support of some sort. We'd still be limited to six BARs in total, and would also need something to identify those sub-functions, so implementing that might get quite hairy.
Thought a bit on how to implement this and felt we should have the following entities:-
* Function (or main function)
* sub-Function
* device
Function: a single PCI function (as defined in the PCI specification with a separate configuration space). It will have control over the PCI header, manage BAR's and interrupts. It may or may not have sub-functions (sub-functions can be one or many).
Managing BAR's: The sub-functions will not have information
about BAR's. It will just request the number of address space it requires to the main *function*. The main function will allocate one BAR for each such request based on the BAR availability.
Managing interrupts:
FOR MSI: Say each main function is capable of supporting 32 MSI
interrupts. Each sub-function can request 'n' number of interrupts. (The sub-function will not be aware of the MSI number allocated to it). For each sub-function the interrupts will be numbered from '1..n'. The main function will map the sub-function interrupt to MSI interrupt number.
For legacy: No management is required, since one interrupt
line will be shared by all sub-functions. The host driver will check the interrupt status register.
Is there any thing else that has to be managed by the main Function?
Here the framework should be modified to add a new interface between the sub-function and main Function. A *simple* main Function should also be added to manage only the BARs and interrupts. For any special use case, new main Function has to be created.
The host side driver for this main function will be bound to it using the existing PCI host side mechanism. (using device id/vendor id/class code etc..).
sub-Function: Not defined in PCI specification. It will be *part* of the main function. There can be one or more sub-function within a main function. Each sub-function within a main function will be independent of each other. It will request the number of local address space required and the number of MSI interrupts from the main function.
Each sub-function should have a separate host side driver. But how do we bind the host side driver with the sub-function? Here the existing host side PCI framework won't work.
Some options for binding sub-function to it's host side driver:
Have a separate vendor-id/product id for each sub function. (But the *pci_dev* for the sub-function will not be created by host side PCI framework. The PCI framework shouldn't also have to do it because this is not standard).
The main *function* driver will scan the list of it's sub-functions (We can make the 1st BAR to be used by main *Function* and have these informations there.) and for each function it creates a new *pci_dev* allocating the memory resources. This way the sub-function host side driver can be created just like a regular PCI driver. I'm not sure if creating a pci_dev from a pci driver will have any adverse effects.
The other option is to define a new type of device (say pci_func_dev) and make the main *function* driver create these devices when it is getting probed. For binding, we can maybe just use a compatible string populated by the sub-function driver when it registers with the main function driver. Since this doesn't use an existing data structure, this should not be very difficult to implement.
With either options, lspci won't list any sub-functions.
device: one or more function (main function) will constitute a device. This shouldn't be too difficult to implement.
I think most of the complexity lies in the design of sub-function. Please let me know your thoughts and other ideas.
Thanks
Kishon
Quoted 7 lines · Kishon Vijay Abraham I
Quoted 4 lines
Ok, so in theory there can be other hardware (and quite likely is) that supports multiple functions, and we can extend the framework to support them without major obstacles, but your hardware doesn't, so you kept it simple with one hardcoded function, right?
right, PCIe can have upto 8 functions. So the issues with the current framework has to be fixed. I don't expect major obstacles with this as of now.
I wouldn't be too worried about. We have two kinds of functions in
PCIe: physical functions, or virtual functions using SR-IOV.
For the first one we pretty much just need the controller driver to report them separately as there is almost no interaction between functions.
SR-IOV support will be more interesting as the physical functions controls creation of the associated virtual functions. I'd like to defer that problem until we get hold of a software programmable controller that supports SR-IOV and has open documentation. (That beeing said, if someone has a pointer to such a beast send it my way!)
Quoted 12 lines
Quoted 11 lines
We should still find out whether it's important that you can have a single PCI function with a software multi-function support of some sort. We'd still be limited to six BARs in total, and would also need something to identify those sub-functions, so implementing that might get quite hairy.
Possibly this could be done at a higher level, e.g. by implementing a PCI-virtio multiplexer that can host multiple virtio based devices inside of a single PCI function. If we think that would be a good idea, we should make sure the configfs interface is extensible enough to handle that.
Quoted 3 lines
Okay. So here the main function (actual PCI function) *can* perform the work of virtio muliplexer if the platform wants to support sub-functions or it can be a normal PCI function. right?
I really don't think we should be worried about this multiplexer. It's not something real PCIe devices do (sane ones anyway, the rest is handled by ad-hoc multiplexers), and we should avoid creating our own magic periphals for it.
Quoted 10 lines
Quoted 5 lines
One use case I have in mind for this is to have a PCI function that can use virtio to provide rootfs (virtio-blk or 9pfs), network and console to the system that implements the PCI function (note that this is the opposite direction of what almost everyone else uses PCI devices for).
Do you mean the virtio should actually be in the host side? Even here the system that implements PCI function should have multiple functions right? (one for network, other for console etc..). So there should be a virtio multiplexer both in the host side and in the device side?
We already support virtio over phsysical PCIe buses to support intel MIC devices. Take a look at drivers/misc/mic/bus/vop_bus.c and drivers/misc/mic/vop (yes, what a horrible place for that code, not my fault)
Re: [RFC PATCH 01/11] pci: endpoint: add EP core layer to enable EP controller and EP functions
In reply to Kishon Vijay Abraham IQuoted 6 lines
drivers/pci/endpoint/pci-epc-core.c new file +6
-0+/** +* pci_epc_stop() - stop the PCI link +* @epc: the link of the EPC device that has to be stopped +* +* Invoke to stop the PCI link +*/
drivers/pci/endpoint/pci-epc-core.c line 123
Quoted 10 lines
drivers/pci/endpoint/pci-epc-core.c new file +10
-0+void pci_epc_stop (struct pci_epc *epc) +{ +if (IS_ERR (epc) || !epc->ops->stop) +return ; + +spin_lock_irq (&epc->irq_lock); + epc->ops->stop (epc); +spin_unlock_irq (&epc->irq_lock); +} +EXPORT_SYMBOL_GPL (pci_epc_stop);
Can you elaborate on the synchronization strategy here? It seems like irq_lock is generally taken irq save and just around method calls. Wou;dn't it be better to leave locking to the methods themselves?
include/linux/pci-epc.h line 64
Quoted 13 lines
include/linux/pci-epc.h new file +13
-0+/** +* struct pci_epc - represents the PCI EPC device +* @dev: PCI EPC device +* @ops: function pointers for performing endpoint operations +* @mutex: mutex to protect pci_epc ops +*/ +struct pci_epc { +struct device dev; +/* support only single function PCI device for now */ +struct pci_epf *epf; +const struct pci_epc_ops *ops; +spinlock_t irq_lock; +};
And this still documentes a mutex instead of the irq save spinlock, while we're at it..
include/linux/pci-epf.h line 108
Quoted 9 lines
include/linux/pci-epf.h new file +9
-0+/** +* struct pci_epf_bar - represents the BAR of EPF device +* @phys_addr: physical address that should be mapped to the BAR +* @size: the size of the address space present in BAR +*/ +struct pci_epf_bar { +dma_addr_t phys_addr; +size_t size; +};
Just curious: shouldn't this be a phys_addr_t instead of a dma_addr_t?
Otherwise this looks like a nice little framework to get started!
Re: [RFC PATCH 02/11] pci: endpoint: introduce configfs entry for configuring EP functions
In reply to Kishon Vijay Abraham IQuoted 5 lines · Kishon Vijay Abraham I
drivers/pci/endpoint/Kconfig +0
-0
drivers/pci/endpoint/Kconfig config PCI_ENDPOINT · line 20
Quoted 9 lines
drivers/pci/endpoint/Kconfig +3
-1@@ -13,7 +13,9 @@ config PCI_ENDPOINT Enabling this option will build the endpoint library, which includes endpoint controller library and endpoint function - library. + library. This will also enable the configfs entry required to + configure the endpoint function and used to bind the + function with a endpoint controller. If in doubt, say "N" to disable Endpoint support.
This needs to grow a
depends on CONFIGFS_FS
drivers/pci/endpoint/Kconfig config PCI_ENDPOINT
Quoted 2 lines
drivers/pci/endpoint/Kconfig +2
-0+/** + * pci-ep-cfs.c - configfs to configure the PCI endpoint
Please don't use the file name in the top of the file comment, it's only bound to get out of date..
drivers/pci/endpoint/Kconfig
Quoted 4 lines
drivers/pci/endpoint/Kconfig +4
-0+struct pci_epf_info { + struct config_item pci_epf; + struct pci_epf *epf; +};
Any reason not to simply embedd the config_item into the pci_epf structure?
Re: [RFC PATCH 05/11] pci: rename *host* directory to *controller*
In reply to Kishon Vijay Abraham IThis is a big and painful change. I'd suggest to either drop it for now or convince Bjorn to take it as a scripted renamed just after -rc1.