Skip to contentSkip to conversation

vdpa: mandate 1.0 device

PATCH In review Jason Wang 3 participants 3 messages Jun 4, 2021 – Jun 6, 2021 virtio core

lore
Share & tools
lore

Jason Wang

author
#0 lore raw

PATCH 1/1 vdpa: mandate 1.0 device

This patch mandates 1.0 for vDPA devices. The plan is never to support transitional devices for vDPA devices in the future.

The reasons are:

- To have the semantic of normative statement in the virtio spec and eliminate the burden of transitional device for both vDPA bus and vDPA parent
- Eliminate the efforts for dealing with endian conversion in the management tool
- Mandate vDPA vendor to ship modern device instead of transitional device which is easily broken and unsafe
- Transitional device never work since the first day of vDPA

---
 include/linux/vdpa.h | 6 ++++++
 1 file changed, 6 insertions(+)
include/linux/vdpa.h +6 -0
index f311d227aa1b..11dd05b805a7 100644
@@ -6,6 +6,7 @@
 #include <linux/device.h>
 #include <linux/interrupt.h>
 #include <linux/vhost_iotlb.h>
+#include <uapi/linux/virtio_config.h>
 
 /**
  * struct vdpa_calllback - vDPA callback definition.
@@ -328,6 +329,11 @@ static inline int vdpa_set_features(struct vdpa_device *vdev, u64 features)
 {
         const struct vdpa_config_ops *ops = vdev->config;
 
+        /* Mandating 1.0 to have semantics of normative statements in
+         * the spec. */
+        if (!(features & BIT_ULL(VIRTIO_F_VERSION_1)))
+		return -EINVAL;
+
 	vdev->features_valid = true;
         return ops->set_features(vdev, features);
 }
Signature · 1 line
2.25.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 14 lines · Jason Wang

This patch mandates 1.0 for vDPA devices. The plan is never to support transitional devices for vDPA devices in the future.

The reasons are:

- To have the semantic of normative statement in the virtio spec and eliminate the burden of transitional device for both vDPA bus and vDPA parent
- Eliminate the efforts for dealing with endian conversion in the management tool
- Mandate vDPA vendor to ship modern device instead of transitional device which is easily broken and unsafe
- Transitional device never work since the first day of vDPA

Quoted 4 lines

---
include/linux/vdpa.h | 6 ++++++

1 file changed, 6 insertions(+)
Reviewed-by on v1 1/1
#2 lore raw
In reply to Jason Wang
Quoted 5 lines · Jason Wang

This patch mandates 1.0 for vDPA devices. The plan is never to support transitional devices for vDPA devices in the future.

The reasons are:

Quoted 8 lines

- To have the semantic of normative statement in the virtio spec and eliminate the burden of transitional device for both vDPA bus and vDPA parent
- Eliminate the efforts for dealing with endian conversion in the management tool
- Mandate vDPA vendor to ship modern device instead of transitional device which is easily broken and unsafe
- Transitional device never work since the first day of vDPA

Transitional devices never worked...

Quoted 33 lines
---
 include/linux/vdpa.h | 6 ++++++
 1 file changed, 6 insertions(+)
include/linux/vdpa.h +6 -0
index f311d227aa1b..11dd05b805a7 100644
@@ -6,6 +6,7 @@
 #include <linux/device.h>
 #include <linux/interrupt.h>
 #include <linux/vhost_iotlb.h>
+#include <uapi/linux/virtio_config.h>
 
 /**
  * struct vdpa_calllback - vDPA callback definition.
@@ -328,6 +329,11 @@ static inline int vdpa_set_features(struct vdpa_device *vdev, u64 features)
 {
         const struct vdpa_config_ops *ops = vdev->config;
 
+        /* Mandating 1.0 to have semantics of normative statements in
+         * the spec. */
+        if (!(features & BIT_ULL(VIRTIO_F_VERSION_1)))
+		return -EINVAL;
+
 	vdev->features_valid = true;
         return ops->set_features(vdev, features);
 }
Signature · 1 line
2.25.1