Skip to contentSkip to conversation

misc: Add Add Synopsys DesignWare xData IP driver

PATCH Superseded Gustavo Pimentel 2 participants 10 messages Mar 29, 2021

Subsystems (4)

v9 of 11 Superseded Latest is v11 →

lore
Share & tools
lore
#2 lore raw

PATCH v9 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 | 40 ++++++++++++++++++++++++++++
 1 file changed, 40 insertions(+)
 create mode 100644 Documentation/misc-devices/dw-xdata-pcie.rst
Documentation/misc-devices/dw-xdata-pcie.rst new file +40 -0
new file mode 100644
index 00000000..fd75c93
@@ -0,0 +1,40 @@
+.. SPDX-License-Identifier: GPL-2.0
+
+===========================================================================
+Driver for Synopsys DesignWare PCIe traffic generator (also known as xData)
+===========================================================================
+
+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.
+
+Request write TLPs traffic generation - Root Complex to Endpoint direction
+- Command:
+	echo 1 > /sys/class/misc/dw-xdata-pcie/write
+
+Get write TLPs traffic link throughput in MB/s
+- Command:
+        cat /sys/class/misc/dw-xdata-pcie/write
+- Output example:
+	204
+
+Request read TLPs traffic generation - Endpoint to Root Complex direction:
+- Command:
+	echo 1 > /sys/class/misc/dw-xdata-pcie/read
+
+Get read TLPs traffic link throughput in MB/s
+- Command:
+        cat /sys/class/misc/dw-xdata-pcie/read
+- Output example:
+	199
+
+Request to stop any current TLP transfer:
+- Command:
+	echo 1 > /sys/class/misc/dw-xdata-pcie/stop
Signature · 1 line
2.7.4
#0 lore raw

v9 cover misc: Add 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 into the driver patch #1

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]>

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 |  46 +++
 Documentation/misc-devices/dw-xdata-pcie.rst |  40 +++
 MAINTAINERS                                  |   7 +
 drivers/misc/Kconfig                         |  10 +
 drivers/misc/Makefile                        |   1 +
 drivers/misc/dw-xdata-pcie.c                 | 416 +++++++++++++++++++++++++++
 6 files changed, 520 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 v9 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 | 416 +++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 427 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 +416 -0

416 lines not on this page · raw message

Signature · 1 line
2.7.4
#3 lore raw

PATCH v9 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 v9 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 | 46 ++++++++++++++++++++++++++++
 1 file changed, 46 insertions(+)
 create mode 100644 Documentation/ABI/testing/sysfs-driver-xdata
Documentation/ABI/testing/sysfs-driver-xdata new file +46 -0
new file mode 100644
index 00000000..66af19a
@@ -0,0 +1,46 @@
+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.
+		Usage e.g.
+		 echo 1 > /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.
+		Usage e.g.
+		 echo 1 > /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.
+
+What:		/sys/class/misc/dw-xdata-pcie.<device>/stop
+Date:		April 2021
+KernelVersion:	5.13
+Contact:	Gustavo Pimentel <[email protected]>
+Description:	Allows the user to disable the PCIe traffic generator in all
+		directions.
+		Usage e.g.
+		 echo 1 > /sys/class/misc/dw-xdata-pcie.<device>/stop
+
+		The file is write only.
Signature · 1 line
2.7.4
#5 lore raw

Re: [PATCH v9 4/4] docs: ABI: Add sysfs documentation interface of dw-xdata-pcie driver

Quoted 15 lines · Gustavo Pimentel

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

---
 Documentation/ABI/testing/sysfs-driver-xdata | 46 ++++++++++++++++++++++++++++
 1 file changed, 46 insertions(+)
 create mode 100644 Documentation/ABI/testing/sysfs-driver-xdata
Documentation/ABI/testing/sysfs-driver-xdata new file +0 -0
new file mode 100644
index 00000000..66af19a

Documentation/ABI/testing/sysfs-driver-xdata line 9

Quoted 9 lines
Documentation/ABI/testing/sysfs-driver-xdata new file +9 -0
@@ -0,0 +1,46 @@
+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.
+		Usage e.g.
+		 echo 1 > /sys/class/misc/dw-xdata-pcie.<device>/write

Again, this does not match the code. Either fix the code (which I recommend), or change this and the other sysfs descriptions of writing values here.

thanks,

greg k-h

#6 lore raw

RE: [PATCH v9 4/4] docs: ABI: Add sysfs documentation interface of dw-xdata-pcie driver

Quoted 21 lines · Greg Kroah-Hartman
Quoted 20 lines · Gustavo Pimentel

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

---
 Documentation/ABI/testing/sysfs-driver-xdata | 46 ++++++++++++++++++++++++++++
 1 file changed, 46 insertions(+)
 create mode 100644 Documentation/ABI/testing/sysfs-driver-xdata
Documentation/ABI/testing/sysfs-driver-xdata new file +5 -0
new file mode 100644
index 00000000..66af19a
@@ -0,0 +1,46 @@
+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
Quoted 8 lines

Documentation/ABI/testing/sysfs-driver-xdata line 9

Quoted 4 lines
Documentation/ABI/testing/sysfs-driver-xdata new file +4 -0
+		will create write TLPs frames - from the Root Complex to the
+		Endpoint direction.
+		Usage e.g.
+		 echo 1 > /sys/class/misc/dw-xdata-pcie.<device>/write

Again, this does not match the code. Either fix the code (which I recommend), or change this and the other sysfs descriptions of writing values here.

I've commented about this previously, but I didn't get feedback on it, therefore I assumed that justification was okay.
I will change the code to accept only the "1" input on the *_store()

-Gustavo

Quoted 4 lines

thanks,

greg k-h

#7 lore raw

Re: [PATCH v9 4/4] docs: ABI: Add sysfs documentation interface of dw-xdata-pcie driver

Quoted 33 lines · Gustavo Pimentel
Quoted 21 lines · Greg Kroah-Hartman
Quoted 20 lines · Gustavo Pimentel

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

---
 Documentation/ABI/testing/sysfs-driver-xdata | 46 ++++++++++++++++++++++++++++
 1 file changed, 46 insertions(+)
 create mode 100644 Documentation/ABI/testing/sysfs-driver-xdata
Documentation/ABI/testing/sysfs-driver-xdata new file +5 -0
new file mode 100644
index 00000000..66af19a
@@ -0,0 +1,46 @@
+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
Quoted 8 lines

Documentation/ABI/testing/sysfs-driver-xdata line 9

Quoted 4 lines
Documentation/ABI/testing/sysfs-driver-xdata new file +4 -0
+		will create write TLPs frames - from the Root Complex to the
+		Endpoint direction.
+		Usage e.g.
+		 echo 1 > /sys/class/misc/dw-xdata-pcie.<device>/write

Again, this does not match the code. Either fix the code (which I recommend), or change this and the other sysfs descriptions of writing values here.

Quoted 3 lines

I've commented about this previously, but I didn't get feedback on it, therefore I assumed that justification was okay.
I will change the code to accept only the "1" input on the *_store()

Why not use the built-in function to parse "1/y/Y" that the kernel provides for this type of thing?

thanks,

greg k-h

#8 lore raw

RE: [PATCH v9 4/4] docs: ABI: Add sysfs documentation interface of dw-xdata-pcie driver

Quoted 34 lines · Greg Kroah-Hartman
Quoted 33 lines · Gustavo Pimentel
Quoted 29 lines · Greg Kroah-Hartman
Quoted 15 lines · Gustavo Pimentel

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

---
 Documentation/ABI/testing/sysfs-driver-xdata | 46 ++++++++++++++++++++++++++++
 1 file changed, 46 insertions(+)
 create mode 100644 Documentation/ABI/testing/sysfs-driver-xdata
Documentation/ABI/testing/sysfs-driver-xdata new file +0 -0
new file mode 100644
index 00000000..66af19a

Documentation/ABI/testing/sysfs-driver-xdata line 9

Quoted 9 lines
Documentation/ABI/testing/sysfs-driver-xdata new file +9 -0
@@ -0,0 +1,46 @@
+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.
+		Usage e.g.
+		 echo 1 > /sys/class/misc/dw-xdata-pcie.<device>/write

Again, this does not match the code. Either fix the code (which I recommend), or change this and the other sysfs descriptions of writing values here.

Quoted 6 lines
Quoted 3 lines

I've commented about this previously, but I didn't get feedback on it, therefore I assumed that justification was okay.
I will change the code to accept only the "1" input on the *_store()

Why not use the built-in function to parse "1/y/Y" that the kernel provides for this type of thing?

I found kstrtobool() just now. I'm adapting the code as we speak. After testing I will send the v10 as soon as possible.

-Gustavo

Quoted 4 lines

thanks,

greg k-h

#9 lore raw

Re: [PATCH v9 4/4] docs: ABI: Add sysfs documentation interface of dw-xdata-pcie driver

Quoted 41 lines · Gustavo Pimentel
Quoted 38 lines · Greg Kroah-Hartman
Quoted 36 lines · Gustavo Pimentel
Quoted 21 lines · Greg Kroah-Hartman
Quoted 20 lines · Gustavo Pimentel

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

---
 Documentation/ABI/testing/sysfs-driver-xdata | 46 ++++++++++++++++++++++++++++
 1 file changed, 46 insertions(+)
 create mode 100644 Documentation/ABI/testing/sysfs-driver-xdata
Documentation/ABI/testing/sysfs-driver-xdata new file +5 -0
new file mode 100644
index 00000000..66af19a
@@ -0,0 +1,46 @@
+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
Quoted 8 lines

Documentation/ABI/testing/sysfs-driver-xdata line 9

Quoted 4 lines
Documentation/ABI/testing/sysfs-driver-xdata new file +4 -0
+		will create write TLPs frames - from the Root Complex to the
+		Endpoint direction.
+		Usage e.g.
+		 echo 1 > /sys/class/misc/dw-xdata-pcie.<device>/write

Again, this does not match the code. Either fix the code (which I recommend), or change this and the other sysfs descriptions of writing values here.

I've commented about this previously, but I didn't get feedback on it, therefore I assumed that justification was okay.
I will change the code to accept only the "1" input on the *_store()

Quoted 5 lines
Quoted 2 lines

Why not use the built-in function to parse "1/y/Y" that the kernel provides for this type of thing?

I found kstrtobool() just now. I'm adapting the code as we speak. After testing I will send the v10 as soon as possible.

There is no rush, take your time.

greg k-h