在 2022/12/19 16:35, Alvaro Karsz 写道:
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.
Signed-off-by: Alvaro Karsz <alvaro.karsz@xxxxxxxxxxxxx>
--
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.
v6:
- SNET_WRN -> SNET_WARN.
---
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
diff --git a/MAINTAINERS b/MAINTAINERS
index a608f19da3a..7f4d9dcb760 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -21955,6 +21955,10 @@ IFCVF VIRTIO DATA PATH ACCELERATOR
R: Zhu Lingshan <lingshan.zhu@xxxxxxxxx>
F: drivers/vdpa/ifcvf/
+SNET DPU VIRTIO DATA PATH ACCELERATOR
+R: Alvaro Karsz <alvaro.karsz@xxxxxxxxxxxxx>
+F: drivers/vdpa/solidrun/
+
VIRTIO BALLOON
M: "Michael S. Tsirkin" <mst@xxxxxxxxxx>
M: David Hildenbrand <david@xxxxxxxxxx>
diff --git a/drivers/vdpa/Kconfig b/drivers/vdpa/Kconfig
index 50f45d03761..79625c7cc46 100644
--- a/drivers/vdpa/Kconfig
+++ b/drivers/vdpa/Kconfig
@@ -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)
So I think we actually don't need to depend on HWMON here?
hwmon.c is only complied when HWMON is enabled and we use IS_ENABLED to
exclude the hwmon specific does.
Other looks good to me.
Thanks