Skip to contentSkip to conversation

virtio: vdpa: new SolidNET DPU driver.

PATCH Superseded Alvaro Karsz 1 participant 2 messages Dec 13, 2022

Subsystems (3)

v5 of 9 Superseded Latest is v9 →

lore
Share & tools
lore

Alvaro Karsz

author reviewer
#0 lore raw

PATCH v5 3/3 virtio: vdpa: new SolidNET DPU driver.

This commit includes:
1) The driver to manage the controlplane over vDPA bus.
2) A HW monitor device to read health values from the DPU.

--
v2:
- Auto detect the BAR used for communication.
- When waiting for the DPU to write a config, wait for 5secs before giving up on the device.
- Return EOPNOTSUPP error code in vDPA set_vq_state callback if the vq state is not the same as the initial one.
- Implement a vDPA reset callback.
- Wait for an ACK when sending a message to the DPU.
- Add endianness comments on 64bit read/write functions.
- Remove the get_iova_range and free vDPA callbacks.
- Usage of managed device functions to ioremap a region.
- Call pci_set_drvdata and pci_set_master before vdpa_register_device.
- Create DMA isolation between the vDPA devices by using the chip SR-IOV feature.
Every vDPA device gets a PCIe VF with its own DMA device.

v3:
- Validate vDPA config length while receiving the DPU's config, not while trying to write the vDPA config to the DPU.
- Request IRQs when vDPA status is set to VIRTIO_CONFIG_S_DRIVER_OK.
- Remove snet_reset_dev() from the PCI remove function for a VF.
v4:
- Get SolidRun vendor ID from pci_ids
v5:
- Remove "select HWMON" from Kconfig.
Usage of "depends on HWMON || HWMON=n" instead and usage of IS_ENABLED(CONFIG_HWMON) when calling to snet hwmon functions. snet_hwmon.c is compiled only if CONFIG_HWMON is defined.
- Remove the #include <linux/hwmon-sysfs.h> from snet_hwmon.c.
- Remove the unnecessary (long) casting from snet_hwmon_read_reg.
- Remove the "_hwmon" ending from the hwmon name.
- Usage of IS_ERR macro to check if devm_hwmon_device_register_with_info failed.
- Replace schedule() with usleep_range() in the "hot loop" in psnet_detect_bar.
- Remove the logging of memory allocation failures.
- Add parenthesis to arguments in SNET_* macros.
- Prefer sizeof(*variable) instead of sizeof(struct x) when allocating memory.

---
 MAINTAINERS                        |    4 +
 drivers/vdpa/Kconfig               |   10 +
 drivers/vdpa/Makefile              |    1 +
 drivers/vdpa/solidrun/Makefile     |    6 +
 drivers/vdpa/solidrun/snet_hwmon.c |  188 +++++
 drivers/vdpa/solidrun/snet_main.c  | 1111 ++++++++++++++++++++++++++++
 drivers/vdpa/solidrun/snet_vdpa.h  |  196 +++++
 7 files changed, 1516 insertions(+)
 create mode 100644 drivers/vdpa/solidrun/Makefile
 create mode 100644 drivers/vdpa/solidrun/snet_hwmon.c
 create mode 100644 drivers/vdpa/solidrun/snet_main.c
 create mode 100644 drivers/vdpa/solidrun/snet_vdpa.h
MAINTAINERS +4 -0
index 046ff06ff97..ae425b3bed4 100644
@@ -21725,6 +21725,10 @@ IFCVF VIRTIO DATA PATH ACCELERATOR
 R:	Zhu Lingshan <[email protected]>
 F:	drivers/vdpa/ifcvf/
 
+SNET DPU VIRTIO DATA PATH ACCELERATOR
+R:	Alvaro Karsz <[email protected]>
+F:	drivers/vdpa/solidrun/
+
 VIRTIO BALLOON
 M:	"Michael S. Tsirkin" <[email protected]>
 M:	David Hildenbrand <[email protected]>
drivers/vdpa/Kconfig +10 -0
index 50f45d03761..79625c7cc46 100644
@@ -86,4 +86,14 @@ config ALIBABA_ENI_VDPA
 	  VDPA driver for Alibaba ENI (Elastic Network Interface) which is built upon
 	  virtio 0.9.5 specification.
 
+ config SNET_VDPA
+	tristate "SolidRun's vDPA driver for SolidNET"
+	depends on PCI_MSI && PCI_IOV && (HWMON || HWMON=n)
+	help
+	  vDPA driver for SolidNET DPU.
+	  With this driver, the VirtIO dataplane can be
+	  offloaded to a SolidNET DPU.
+	  This driver includes a HW monitor device that
+	  reads health values from the DPU.
+
 endif # VDPA
drivers/vdpa/Makefile +1 -0
index 15665563a7f..59396ff2a31 100644
@@ -6,3 +6,4 @@ obj-$(CONFIG_IFCVF)    += ifcvf/
 obj-$(CONFIG_MLX5_VDPA) += mlx5/
 obj-$(CONFIG_VP_VDPA)    += virtio_pci/
 obj-$(CONFIG_ALIBABA_ENI_VDPA) += alibaba/
+obj-$(CONFIG_SNET_VDPA) += solidrun/
drivers/vdpa/solidrun/Makefile new file +6 -0
new file mode 100644
index 00000000000..c0aa3415bf7
@@ -0,0 +1,6 @@
+# SPDX-License-Identifier: GPL-2.0
+obj-$(CONFIG_SNET_VDPA) += snet_vdpa.o
+snet_vdpa-$(CONFIG_SNET_VDPA) += snet_main.o
+ifdef CONFIG_HWMON
+snet_vdpa-$(CONFIG_SNET_VDPA) += snet_hwmon.o
+endif
drivers/vdpa/solidrun/snet_hwmon.c new file +188 -0

188 lines not on this page · raw message

drivers/vdpa/solidrun/snet_main.c new file +1111 -0

1,111 lines not on this page · raw message

drivers/vdpa/solidrun/snet_vdpa.h new file +196 -0

196 lines not on this page · raw message

Signature · 1 line
2.32.0
author reviewer
#1 lore raw
Quoted 1 line

+ SNET_WRN(pdev, "Can't start HWMON, CONFIG_HWMON is not enabled\n");

I'm really sorry, but SNET_WRN should be SNET_WARN. I will fix it

Alvaro