Skip to contentSkip to conversation

misc: Add Synopsys DesignWare xData IP driver

PATCH In review Gustavo Pimentel 2 participants 6 messages Apr 6, 2021

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

v11 cover misc: Add Synopsys DesignWare xData IP driver

This patch series adds a new driver called xData-pcie for the Synopsys DesignWare PCIe prototype.

The driver configures and enables the Synopsys DesignWare PCIe traffic generator IP inside of prototype Endpoint which will generate upstream and downstream PCIe traffic. This allows to quickly test the PCIe link throughput speed and check is the prototype solution has some limitation or not.

Changes:
V2: Rework driver according to Greg Kroah-Hartman' feedback
- Replace module parameter by sysfs use.
- Replace bit fields structure with macros and masks use.
- Removed SET() and GET() macros by the writel() and readl().
- Removed some noisy info messages.
V3: Fixed issues detected while running on 64 bits platforms
Rebased patches on top of v5.11-rc1 version
V4: Rework driver according to Greg Kroah-Hartman' feedback
- Add the ABI doc related to the sysfs implemented on this driver
V5: Rework driver accordingly to Leon Romanovsky' feedback
- Removed "default n" on Kconfig
Rework driver accordingly to Krzysztof Wilczyński' feedback
- Added some explanatory comments for some steps
- Added some bit defines instead of magic numbers
V6: Rework driver according to Greg Kroah-Hartman' feedback
- Squashed patches #2 and #3
- Removed units (MB/s) on the sys file
- Reduced mutex scope on the functions called by sysfs
Rework driver accordingly to Krzysztof Wilczyński' feedback
- Fix typo "DesignWare"
V7: Rework driver according to Greg Kroah-Hartman' feedback
- Created a sub device (misc device) that will be associated with the PCI driver
- sysfs group is now associated with the misc drivers instead of the PCI driver
V8: Rework driver according to Greg Kroah-Hartman' feedback
- Added more detail to the version changes on the cover letter
- Squashed patches #1 and #2
- Removed struct device from the dw_xdata_pcie structure
- Replaced the pci_*() use by dev_*()
- Added free call for the misc driver name allocation
- Added reference counting
- Removed snps_edda_data structure and their usage
Rebased patches on top of v5.12-rc4 version
V9: Squashed temporary development patch #5 into the driver patch #1
V10: Reworked the write_store() and read_store() to validate the input using kstrtobool()
Removed stop_store()
Update ABI documentation accordingly
V11: Fixed the documentation based on the warnings detected by Stephen Rothwell

Cc Derek Kiernan <[email protected]>
Cc Dragan Cvetic <[email protected]>
Cc Arnd Bergmann <[email protected]>
Cc Andrew Morton <[email protected]>
Cc Greg Kroah-Hartman <[email protected]>
Cc Jonathan Corbet <[email protected]>
Cc Bjorn Helgaas <[email protected]>
Cc Krzysztof Wilczyński <[email protected]>
Cc Stephen Rothwell <[email protected]>

Gustavo Pimentel (4):
misc: Add Synopsys DesignWare xData IP driver
Documentation: misc-devices: Add Documentation for dw-xdata-pcie
driver
MAINTAINERS: Add Synopsys xData IP driver maintainer
docs: ABI: Add sysfs documentation interface of dw-xdata-pcie driver

 Documentation/ABI/testing/sysfs-driver-xdata |  49 ++++
 Documentation/misc-devices/dw-xdata-pcie.rst |  64 ++++
 Documentation/misc-devices/index.rst         |   1 +
 MAINTAINERS                                  |   7 +
 drivers/misc/Kconfig                         |  10 +
 drivers/misc/Makefile                        |   1 +
 drivers/misc/dw-xdata-pcie.c                 | 420 +++++++++++++++++++++++++++
 7 files changed, 552 insertions(+)
 create mode 100644 Documentation/ABI/testing/sysfs-driver-xdata
 create mode 100644 Documentation/misc-devices/dw-xdata-pcie.rst
 create mode 100644 drivers/misc/dw-xdata-pcie.c
Signature · 1 line
2.7.4
#1 lore raw

PATCH v11 1/4 misc: Add Synopsys DesignWare xData IP driver

Add Synopsys DesignWare xData IP driver. This driver enables/disables the PCI traffic generator module pertain to the Synopsys DesignWare prototype.

---
 drivers/misc/Kconfig         |  10 ++
 drivers/misc/Makefile        |   1 +
 drivers/misc/dw-xdata-pcie.c | 420 +++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 431 insertions(+)
 create mode 100644 drivers/misc/dw-xdata-pcie.c
drivers/misc/Kconfig +10 -0
index f532c59..e6af9ff 100644
@@ -402,6 +402,16 @@ config SRAM
 config SRAM_EXEC
 	bool
 
+config DW_XDATA_PCIE
+	depends on PCI
+	tristate "Synopsys DesignWare xData PCIe driver"
+	help
+	  This driver allows controlling Synopsys DesignWare PCIe traffic
+	  generator IP also known as xData, present in Synopsys DesignWare
+	  PCIe Endpoint prototype.
+
+	  If unsure, say N.
+
 config PCI_ENDPOINT_TEST
 	depends on PCI
 	select CRC32
drivers/misc/Makefile +1 -0
index 99b6f15..5411996 100644
@@ -47,6 +47,7 @@ obj-$(CONFIG_SRAM_EXEC)		+= sram-exec.o
 obj-$(CONFIG_GENWQE)		+= genwqe/
 obj-$(CONFIG_ECHO)		+= echo/
 obj-$(CONFIG_CXL_BASE)		+= cxl/
+obj-$(CONFIG_DW_XDATA_PCIE)	+= dw-xdata-pcie.o
 obj-$(CONFIG_PCI_ENDPOINT_TEST)	+= pci_endpoint_test.o
 obj-$(CONFIG_OCXL)		+= ocxl/
 obj-$(CONFIG_BCM_VK)		+= bcm-vk/
drivers/misc/dw-xdata-pcie.c new file +420 -0

420 lines not on this page · raw message

Signature · 1 line
2.7.4
#2 lore raw

PATCH v11 2/4 Documentation: misc-devices: Add Documentation for dw-xdata-pcie driver

In reply to Gustavo Pimentel

Add Documentation for dw-xdata-pcie driver.

---
 Documentation/misc-devices/dw-xdata-pcie.rst | 64 ++++++++++++++++++++++++++++
 Documentation/misc-devices/index.rst         |  1 +
 2 files changed, 65 insertions(+)
 create mode 100644 Documentation/misc-devices/dw-xdata-pcie.rst
Documentation/misc-devices/dw-xdata-pcie.rst new file +64 -0
new file mode 100644
index 00000000..a956e1a
@@ -0,0 +1,64 @@
+.. SPDX-License-Identifier: GPL-2.0
+
+===========================================================================
+Driver for Synopsys DesignWare PCIe traffic generator (also known as xData)
+===========================================================================
+
+Supported chips:
+Synopsys DesignWare PCIe prototype solution
+
+Data sheet:
+Not freely available
+
+Author:
+Gustavo Pimentel <[email protected]>
+
+Description
+-----------
+
+This driver should be used as a host-side (Root Complex) driver and Synopsys
+DesignWare prototype that includes this IP.
+
+The dw-xdata-pcie driver can be used to enable/disable PCIe traffic
+generator in either direction (mutual exclusion) besides allowing the
+PCIe link performance analysis.
+
+The interaction with this driver is done through the module parameter and
+can be changed in runtime. The driver outputs the requested command state
+information to ``/var/log/kern.log`` or dmesg.
+
+Example
+-------
+
+Write TLPs traffic generation - Root Complex to Endpoint direction
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Generate traffic::
+
+        # echo 1 > /sys/class/misc/dw-xdata-pcie.0/write
+
+Get link throughput in MB/s::
+
+        # cat /sys/class/misc/dw-xdata-pcie.0/write
+	204
+
+Stop traffic in any direction::
+
+        # echo 0 > /sys/class/misc/dw-xdata-pcie.0/write
+
+Read TLPs traffic generation - Endpoint to Root Complex direction
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Generate traffic::
+
+        # echo 1 > /sys/class/misc/dw-xdata-pcie.0/read
+
+Get link throughput in MB/s::
+
+        # cat /sys/class/misc/dw-xdata-pcie.0/read
+	199
+
+Stop traffic in any direction::
+
+        # echo 0 > /sys/class/misc/dw-xdata-pcie.0/read
+
Documentation/misc-devices/index.rst +1 -0
index 64420b331..30ac58f 100644
@@ -19,6 +19,7 @@ fit into other categories.
    bh1770glc
    eeprom
    c2port
+   dw-xdata-pcie
    ibmvmc
    ics932s401
    isl29003
Signature · 1 line
2.7.4
#3 lore raw

PATCH v11 3/4 MAINTAINERS: Add Synopsys xData IP driver maintainer

In reply to Gustavo Pimentel

Add Synopsys xData IP driver maintainer.

This driver aims to support Synopsys xData IP and is normally distributed along with Synopsys PCIe EndPoint IP as a PCIe traffic generator (depends of the use and licensing agreement).

---
 MAINTAINERS | 7 +++++++
 1 file changed, 7 insertions(+)
MAINTAINERS +7 -0
index 9e87692..36387b3 100644
@@ -5099,6 +5099,13 @@ S:	Maintained
 F:	drivers/dma/dw-edma/
 F:	include/linux/dma/edma.h
 
+DESIGNWARE XDATA IP DRIVER
+M:	Gustavo Pimentel <[email protected]>
+L:	[email protected]
+S:	Maintained
+F:	Documentation/misc-devices/dw-xdata-pcie.rst
+F:	drivers/misc/dw-xdata-pcie.c
+
 DESIGNWARE USB2 DRD IP DRIVER
 M:	Minas Harutyunyan <[email protected]>
 L:	[email protected]
Signature · 1 line
2.7.4
#4 lore raw

PATCH v11 4/4 docs: ABI: Add sysfs documentation interface of dw-xdata-pcie driver

In reply to Gustavo Pimentel

This patch describes the sysfs interface implemented on the dw-xdata-pcie driver.

---
 Documentation/ABI/testing/sysfs-driver-xdata | 49 ++++++++++++++++++++++++++++
 1 file changed, 49 insertions(+)
 create mode 100644 Documentation/ABI/testing/sysfs-driver-xdata
Documentation/ABI/testing/sysfs-driver-xdata new file +49 -0
new file mode 100644
index 00000000..f574e8e
@@ -0,0 +1,49 @@
+What:		/sys/class/misc/drivers/dw-xdata-pcie.<device>/write
+Date:		April 2021
+KernelVersion:	5.13
+Contact:	Gustavo Pimentel <[email protected]>
+Description:	Allows the user to enable the PCIe traffic generator which
+		will create write TLPs frames - from the Root Complex to the
+		Endpoint direction or to disable the PCIe traffic generator
+		in all directions.
+
+		Write y/1/on to enable, n/0/off to disable
+
+		Usage e.g.
+		 echo 1 > /sys/class/misc/dw-xdata-pcie.<device>/write
+		or
+		 echo 0 > /sys/class/misc/dw-xdata-pcie.<device>/write
+
+		The user can read the current PCIe link throughput generated
+		through this generator in MB/s.
+
+		Usage e.g.
+		 cat /sys/class/misc/dw-xdata-pcie.<device>/write
+		 204
+
+		The file is read and write.
+
+What:		/sys/class/misc/dw-xdata-pcie.<device>/read
+Date:		April 2021
+KernelVersion:	5.13
+Contact:	Gustavo Pimentel <[email protected]>
+Description:	Allows the user to enable the PCIe traffic generator which
+		will create read TLPs frames - from the Endpoint to the Root
+		Complex direction or to disable the PCIe traffic generator
+                in all directions.
+
+		Write y/1/on to enable, n/0/off to disable
+
+		Usage e.g.
+		 echo 1 > /sys/class/misc/dw-xdata-pcie.<device>/read
+		or
+		 echo 0 > /sys/class/misc/dw-xdata-pcie.<device>/read
+
+		The user can read the current PCIe link throughput generated
+		through this generator in MB/s.
+
+		Usage e.g.
+		 cat /sys/class/misc/dw-xdata-pcie.<device>/read
+		 199
+
+		The file is read and write.
Signature · 1 line
2.7.4
#5 lore raw
In reply to Gustavo Pimentel
Quoted 39 lines · Gustavo Pimentel

This patch series adds a new driver called xData-pcie for the Synopsys DesignWare PCIe prototype.

The driver configures and enables the Synopsys DesignWare PCIe traffic generator IP inside of prototype Endpoint which will generate upstream and downstream PCIe traffic. This allows to quickly test the PCIe link throughput speed and check is the prototype solution has some limitation or not.

Changes:
V2: Rework driver according to Greg Kroah-Hartman' feedback
- Replace module parameter by sysfs use.
- Replace bit fields structure with macros and masks use.
- Removed SET() and GET() macros by the writel() and readl().
- Removed some noisy info messages.
V3: Fixed issues detected while running on 64 bits platforms
Rebased patches on top of v5.11-rc1 version
V4: Rework driver according to Greg Kroah-Hartman' feedback
- Add the ABI doc related to the sysfs implemented on this driver
V5: Rework driver accordingly to Leon Romanovsky' feedback
- Removed "default n" on Kconfig
Rework driver accordingly to Krzysztof Wilczyński' feedback
- Added some explanatory comments for some steps
- Added some bit defines instead of magic numbers
V6: Rework driver according to Greg Kroah-Hartman' feedback
- Squashed patches #2 and #3
- Removed units (MB/s) on the sys file
- Reduced mutex scope on the functions called by sysfs
Rework driver accordingly to Krzysztof Wilczyński' feedback
- Fix typo "DesignWare"
V7: Rework driver according to Greg Kroah-Hartman' feedback
- Created a sub device (misc device) that will be associated with the PCI driver
- sysfs group is now associated with the misc drivers instead of the PCI driver
V8: Rework driver according to Greg Kroah-Hartman' feedback
- Added more detail to the version changes on the cover letter
- Squashed patches #1 and #2
- Removed struct device from the dw_xdata_pcie structure
- Replaced the pci_*() use by dev_*()
- Added free call for the misc driver name allocation

Quoted 8 lines

- Added reference counting
- Removed snps_edda_data structure and their usage
Rebased patches on top of v5.12-rc4 version
V9: Squashed temporary development patch #5 into the driver patch #1
V10: Reworked the write_store() and read_store() to validate the input using kstrtobool()
Removed stop_store()
Update ABI documentation accordingly
V11: Fixed the documentation based on the warnings detected by Stephen Rothwell

As mentioned on the other thread, I can't take these as I took your v10 into my public tree. Please send fixes on top of that.

thanks,

greg k-h