On 27/01/2026 17.15, [email protected] wrote:
From: Jared Rossi <[email protected]>

Store the device type (e.g. block) directly and an attribute of the VDev rather
than assume all devices can be identified by accessing CCW specific sense data.

Signed-off-by: Jared Rossi <[email protected]>
---
...
@@ -346,12 +346,17 @@ bool virtio_is_supported(SubChannelId schid)
                  true)) {
          return false;
      }
+
+    vdev.dev_type = vdev.senseid.cu_model;
+
      if (vdev.senseid.cu_type == 0x3832) {
-        switch (vdev.senseid.cu_model) {
+        switch (vdev.dev_type) {
          case VIRTIO_ID_BLOCK:
          case VIRTIO_ID_SCSI:
          case VIRTIO_ID_NET:
              return true;
+        default:
+            return false;
          }
      }
      return false;
It feels a bit weird to set up vdev.dev_type in a function called "virtio_is_supported" (I'd rather expect a function with that name to check only stuff, not to set values) ... but we're doing the same with vdev.schid there, too, so I guess it's ok for now. In the long run, we should maybe split up virtio_is_supported in two pieces, one function that does early setup, and one that is checking whether it's a supported virtio device.

Anyway, for now:
Reviewed-by: Thomas Huth <[email protected]>


Reply via email to