On 8/31/26 3:49 PM, [email protected] wrote:
From: Jared Rossi <[email protected]>

Read virtio-pci configuration and configure virt-queue for scsi devices.

Also add check for virtio setup failures when doing scsi setup and return
early if it fails instead of waiting for subsequent failure.

Signed-off-by: Jared Rossi <[email protected]>
---
  pc-bios/s390-ccw/main.c        |  3 ++-
  pc-bios/s390-ccw/virtio-pci.c  | 30 ++++++++++++++++++++++++++++++
  pc-bios/s390-ccw/virtio-scsi.c | 18 +++++++++++++++++-
  3 files changed, 49 insertions(+), 2 deletions(-)

diff --git a/pc-bios/s390-ccw/main.c b/pc-bios/s390-ccw/main.c
index 6ab2b8f75b..a2a24b024f 100644
--- a/pc-bios/s390-ccw/main.c
+++ b/pc-bios/s390-ccw/main.c
@@ -273,6 +273,7 @@ static bool find_boot_device(void)
          }
          break;
       case S390_IPL_TYPE_PCI:
+        vdev->scsi_device_selected = false;
          found = find_fid(iplb->pci.fid);
          break;
      default:
@@ -333,13 +334,13 @@ static void ipl_pci_device(void)
  {
      VDev *vdev = virtio_get_device();
      vdev->is_cdrom = false;
-    vdev->scsi_device_selected = false;
if (virtio_pci_setup_device()) {
          return;
      }
switch (vdev->dev_type) {
+    case VIRTIO_ID_SCSI:
      case VIRTIO_ID_BLOCK:
          if (virtio_setup() == 0) {
              zipl_load(); /* only return on error */
diff --git a/pc-bios/s390-ccw/virtio-pci.c b/pc-bios/s390-ccw/virtio-pci.c
index 231ab6e04d..277c3ea68d 100644
--- a/pc-bios/s390-ccw/virtio-pci.c
+++ b/pc-bios/s390-ccw/virtio-pci.c
@@ -52,6 +52,10 @@ void virtio_pci_id2type(VDev *vdev, uint16_t device_id)
      case 0x1001:
          vdev->dev_type = VIRTIO_ID_BLOCK;
          break;
+    case 0x1048:
+    case 0x1004:
+        vdev->dev_type = VIRTIO_ID_SCSI;
+        break;
      default:
          vdev->dev_type = 0;
      }

I normally dislike magic numbers, but the meaning here is clear enough, and the comment above the function is a good enough pointer to the source of the magic, in my opinion:

/* virtio spec v1.3 section 4.1.2.1 */
void virtio_pci_id2type(VDev *vdev, uint16_t device_id)

So lgtm :)

Reviewed-by: Jason J. Herne <[email protected]>


Reply via email to