All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/6] s390x: Fix intermittent errors with IPL from PCI devices on s390x
@ 2026-06-30 14:19 jrossi
  2026-06-30 14:19 ` [PATCH v2 1/6] pc-bios/s390-ccw: Refactor byte swapping jrossi
                   ` (7 more replies)
  0 siblings, 8 replies; 15+ messages in thread
From: jrossi @ 2026-06-30 14:19 UTC (permalink / raw)
  To: qemu-devel, qemu-s390x, cohuck, mjrosato
  Cc: jrossi, zycai, jdaley, jjherne, farman, nrb

From: Jared Rossi <jrossi@linux.ibm.com>

When booting from a PCI device on s390x there may be intermittent failures
caused by mismatched byte swaps.  Refactor the byte swapping to ensure that
it is properly synchronized.

Correct how the queue notification offset is calculated so that it may be
used for multi-queue configurations in the future.

Handle some switch cases that were not caught for PCI devices.

Changes v1 -> v2:
    - Split addition of missing break into its own patch
    - Add PCI case to generic is_viritio_supported() wapper
    - Switch the order of patches formerly 3 and 4
    - Use virtio_is_supported() instead of checking cutype when writing IPLB
        location to cover both CCW and PCI virtio devices

Jared Rossi (3):
  pc-bios/s390-ccw/virtio.c: Fix missing break for PCI notifications
  pc-bios/s390-ccw: Verify virtio support when booting from virtio PCI
    device on s390x
  pc-bios/s390-ccw: write IPLB location for non-net virtio devices

Zhuoying Cai (3):
  pc-bios/s390-ccw: Refactor byte swapping
  pc-bios/s390-ccw: Add per-queue notification offset for multi-queue
    virtio configurations
  s390x: Enable boot menu for virtio pci device

 hw/s390x/ipl.c                |  1 +
 pc-bios/s390-ccw/main.c       |  5 ++-
 pc-bios/s390-ccw/virtio-pci.c | 57 ++++++++++++++++++++++++++---------
 pc-bios/s390-ccw/virtio-pci.h |  5 ++-
 pc-bios/s390-ccw/virtio.c     | 29 ++++++++++--------
 pc-bios/s390-ccw/virtio.h     |  2 ++
 6 files changed, 69 insertions(+), 30 deletions(-)

-- 
2.54.0



^ permalink raw reply	[flat|nested] 15+ messages in thread

* [PATCH v2 1/6] pc-bios/s390-ccw: Refactor byte swapping
  2026-06-30 14:19 [PATCH v2 0/6] s390x: Fix intermittent errors with IPL from PCI devices on s390x jrossi
@ 2026-06-30 14:19 ` jrossi
  2026-06-30 14:19 ` [PATCH v2 2/6] pc-bios/s390-ccw/virtio.c: Fix missing break for PCI notifications jrossi
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 15+ messages in thread
From: jrossi @ 2026-06-30 14:19 UTC (permalink / raw)
  To: qemu-devel, qemu-s390x, cohuck, mjrosato
  Cc: jrossi, zycai, jdaley, jjherne, farman, nrb

From: Zhuoying Cai <zycai@linux.ibm.com>

Introduce local variables to cache the byte-swapped values eliminating
some redundant byte swap operations.  Additionally, do byte swap when
polling to avoid a special case where endianness is preserved.

Reviewed-by: Eric Farman <farman@linux.ibm.com>
Signed-off-by: Zhuoying Cai <zycai@linux.ibm.com>
Signed-off-by: Jared Rossi <jrossi@linux.ibm.com>
---
 pc-bios/s390-ccw/virtio.c | 24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/pc-bios/s390-ccw/virtio.c b/pc-bios/s390-ccw/virtio.c
index 390b55c7b9..a448dc96e2 100644
--- a/pc-bios/s390-ccw/virtio.c
+++ b/pc-bios/s390-ccw/virtio.c
@@ -153,14 +153,14 @@ static void vr_bswap_descriptor(VRingDesc *desc)
 
 void vring_send_buf(VRing *vr, void *p, int len, int flags)
 {
-    if (!be_ipl()) {
-        vr->avail->idx = bswap16(vr->avail->idx);
-    }
+    uint16_t avail_idx;
+
+    avail_idx = be_ipl() ? vr->avail->idx : bswap16(vr->avail->idx);
 
     /* For follow-up chains we need to keep the first entry point */
     if (!(flags & VRING_HIDDEN_IS_CHAIN)) {
-        vr->avail->ring[vr->avail->idx % vr->num] = be_ipl() ? vr->next_idx :
-                                                               bswap16(vr->next_idx);
+        vr->avail->ring[avail_idx % vr->num] = be_ipl() ? vr->next_idx :
+                                                          bswap16(vr->next_idx);
     }
 
     vr->desc[vr->next_idx].addr = (unsigned long)p;
@@ -177,23 +177,23 @@ void vring_send_buf(VRing *vr, void *p, int len, int flags)
 
     /* Chains only have a single ID */
     if (!(flags & VRING_DESC_F_NEXT)) {
-        vr->avail->idx++;
-    }
-
-    if (!be_ipl()) {
-        vr->avail->idx = bswap16(vr->avail->idx);
+        avail_idx++;
+        vr->avail->idx = be_ipl() ? avail_idx : bswap16(avail_idx);
     }
 }
 
 int vr_poll(VRing *vr)
 {
-    if (vr->used->idx == vr->used_idx) {
+    uint16_t used_idx;
+
+    used_idx = be_ipl() ? vr->used->idx : bswap16(vr->used->idx);
+    if (used_idx == vr->used_idx) {
         vring_notify(vr);
         yield();
         return 0;
     }
 
-    vr->used_idx = vr->used->idx; /* Endianness is preserved */
+    vr->used_idx = used_idx;
     vr->next_idx = 0;
     vr->desc[0].len = 0;
     vr->desc[0].flags = 0;
-- 
2.54.0



^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH v2 2/6] pc-bios/s390-ccw/virtio.c: Fix missing break for PCI notifications
  2026-06-30 14:19 [PATCH v2 0/6] s390x: Fix intermittent errors with IPL from PCI devices on s390x jrossi
  2026-06-30 14:19 ` [PATCH v2 1/6] pc-bios/s390-ccw: Refactor byte swapping jrossi
@ 2026-06-30 14:19 ` jrossi
  2026-07-02  1:44   ` Eric Farman
  2026-07-02  2:12   ` Matthew Rosato
  2026-06-30 14:19 ` [PATCH v2 3/6] pc-bios/s390-ccw: Add per-queue notification offset for multi-queue virtio configurations jrossi
                   ` (5 subsequent siblings)
  7 siblings, 2 replies; 15+ messages in thread
From: jrossi @ 2026-06-30 14:19 UTC (permalink / raw)
  To: qemu-devel, qemu-s390x, cohuck, mjrosato
  Cc: jrossi, zycai, jdaley, jjherne, farman, nrb

From: Jared Rossi <jrossi@linux.ibm.com>

Add a break after calling the PCI specific notification function instead of
falling through to the default case.

Signed-off-by: Jared Rossi <jrossi@linux.ibm.com>
---
 pc-bios/s390-ccw/virtio.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/pc-bios/s390-ccw/virtio.c b/pc-bios/s390-ccw/virtio.c
index a448dc96e2..7883871033 100644
--- a/pc-bios/s390-ccw/virtio.c
+++ b/pc-bios/s390-ccw/virtio.c
@@ -115,6 +115,7 @@ bool vring_notify(VRing *vr)
         break;
     case S390_IPL_TYPE_PCI:
         vr->cookie = virtio_pci_notify(vr->id);
+        break;
     default:
         return 1;
     }
-- 
2.54.0



^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH v2 3/6] pc-bios/s390-ccw: Add per-queue notification offset for multi-queue virtio configurations
  2026-06-30 14:19 [PATCH v2 0/6] s390x: Fix intermittent errors with IPL from PCI devices on s390x jrossi
  2026-06-30 14:19 ` [PATCH v2 1/6] pc-bios/s390-ccw: Refactor byte swapping jrossi
  2026-06-30 14:19 ` [PATCH v2 2/6] pc-bios/s390-ccw/virtio.c: Fix missing break for PCI notifications jrossi
@ 2026-06-30 14:19 ` jrossi
  2026-07-02  1:49   ` Eric Farman
  2026-06-30 14:19 ` [PATCH v2 4/6] pc-bios/s390-ccw: Verify virtio support when booting from virtio PCI device on s390x jrossi
                   ` (4 subsequent siblings)
  7 siblings, 1 reply; 15+ messages in thread
From: jrossi @ 2026-06-30 14:19 UTC (permalink / raw)
  To: qemu-devel, qemu-s390x, cohuck, mjrosato
  Cc: jrossi, zycai, jdaley, jjherne, farman, nrb

From: Zhuoying Cai <zycai@linux.ibm.com>

The initial support for virtio-blk-pci IPL devices used a single virt-queue, but
other device types require multiple queues, and for PCI device types this also
requires a per-queue notification offset.

Add a PCI notify field to the VRing struct so that each queue has a unique
notify offset as defined in the virtio spec.

Signed-off-by: Zhuoying Cai <zycai@linux.ibm.com>
Signed-off-by: Jared Rossi <jrossi@linux.ibm.com>
---
 pc-bios/s390-ccw/virtio-pci.c | 38 +++++++++++++++++++++--------------
 pc-bios/s390-ccw/virtio-pci.h |  2 +-
 pc-bios/s390-ccw/virtio.c     |  2 +-
 pc-bios/s390-ccw/virtio.h     |  1 +
 4 files changed, 26 insertions(+), 17 deletions(-)

diff --git a/pc-bios/s390-ccw/virtio-pci.c b/pc-bios/s390-ccw/virtio-pci.c
index 53bdb52e76..2c83ec4f13 100644
--- a/pc-bios/s390-ccw/virtio-pci.c
+++ b/pc-bios/s390-ccw/virtio-pci.c
@@ -21,7 +21,6 @@ VirtioPciCap c_cap; /* Common capabilities  */
 VirtioPciCap d_cap; /* Device capabilities  */
 VirtioPciCap n_cap; /* Notify capabilities  */
 uint32_t notify_mult;
-uint16_t q_notify_offset;
 
 static int virtio_pci_set_status(uint8_t status)
 {
@@ -74,10 +73,10 @@ int virtio_pci_reset(VDev *vdev)
     return 0;
 }
 
-long virtio_pci_notify(int vq_id)
+long virtio_pci_notify(VRing *vr)
 {
-    uint32_t offset = n_cap.off + notify_mult * q_notify_offset;
-    return vpci_bswap16_write(offset, n_cap.bar, (uint16_t) vq_id);
+    uint32_t offset = n_cap.off + notify_mult * vr->pci_notify;
+    return vpci_bswap16_write(offset, n_cap.bar, (uint16_t) vr->id);
 }
 
 /*
@@ -301,8 +300,7 @@ static int virtio_pci_read_pci_cap_config(void)
     }
 
     rc = vpci_read_bswap32(pos + VPCI_N_CAP_MULT, PCI_CFGBAR, &notify_mult);
-    if (rc || vpci_read_bswap16(c_cap.off + VPCI_C_OFFSET_Q_NOFF, c_cap.bar,
-                                &q_notify_offset)) {
+    if (rc) {
         puts("Failed to read notification queue configuration");
         return -EIO;
     }
@@ -332,7 +330,6 @@ int virtio_pci_setup(VDev *vdev)
     VRing *vr;
     int rc;
     uint8_t status;
-    uint16_t vq_size;
     int i = 0;
 
     vdev->guessed_disk_nature = VIRTIO_GDN_NONE;
@@ -380,28 +377,39 @@ int virtio_pci_setup(VDev *vdev)
         return -EIO;
     }
 
-    if (vpci_read_bswap16(VPCI_C_OFFSET_Q_SIZE, c_cap.bar, &vq_size)) {
-        puts("Failed to read virt-queue configuration");
-        return -EIO;
-    }
-
     /* Configure virt-queues for pci */
     for (i = 0; i < vdev->nr_vqs; i++) {
+        uint16_t vq_size;
+        uint16_t vq_notify;
         VqInfo info = {
             .queue = (unsigned long long) virtio_get_ring_area(i),
             .align = KVM_S390_VIRTIO_RING_ALIGN,
             .index = i,
-            .num = vq_size,
+            .num = 0,
         };
 
         vr = &vdev->vrings[i];
-        vring_init(vr, &info);
 
-        if (vpci_set_selected_vq(vr->id)) {
+        if (vpci_set_selected_vq(i)) {
             puts("Failed to set selected virt-queue");
             return -EIO;
         }
 
+        if (vpci_read_bswap16(c_cap.off + VPCI_C_OFFSET_Q_SIZE, c_cap.bar, &vq_size)) {
+            printf("Failed to read virt-queue %d size\n", i);
+            return -EIO;
+        }
+
+        info.num = vq_size;
+
+        if (vpci_read_bswap16(c_cap.off + VPCI_C_OFFSET_Q_NOFF, c_cap.bar, &vq_notify)) {
+            printf("Failed to read virt-queue %d notify offset\n", i);
+            return -EIO;
+        }
+
+        vr->pci_notify = vq_notify;
+        vring_init(vr, &info);
+
         rc = set_pci_vq_addr(VPCI_C_OFFSET_Q_DESCLO, vr->desc);
         rc |= set_pci_vq_addr(VPCI_C_OFFSET_Q_AVAILLO, vr->avail);
         rc |= set_pci_vq_addr(VPCI_C_OFFSET_Q_USEDLO, vr->used);
diff --git a/pc-bios/s390-ccw/virtio-pci.h b/pc-bios/s390-ccw/virtio-pci.h
index 90d07cb9a7..2494df1619 100644
--- a/pc-bios/s390-ccw/virtio-pci.h
+++ b/pc-bios/s390-ccw/virtio-pci.h
@@ -64,7 +64,7 @@ typedef struct VirtioPciCap  VirtioPciCap;
 
 void virtio_pci_id2type(VDev *vdev, uint16_t device_id);
 int virtio_pci_reset(VDev *vdev);
-long virtio_pci_notify(int vq_id);
+long virtio_pci_notify(VRing *vr);
 int virtio_pci_setup(VDev *vdev);
 int virtio_pci_setup_device(void);
 
diff --git a/pc-bios/s390-ccw/virtio.c b/pc-bios/s390-ccw/virtio.c
index 7883871033..df04479aa6 100644
--- a/pc-bios/s390-ccw/virtio.c
+++ b/pc-bios/s390-ccw/virtio.c
@@ -114,7 +114,7 @@ bool vring_notify(VRing *vr)
         vr->cookie = virtio_ccw_notify(vdev.schid, vr->id, vr->cookie);
         break;
     case S390_IPL_TYPE_PCI:
-        vr->cookie = virtio_pci_notify(vr->id);
+        vr->cookie = virtio_pci_notify(vr);
         break;
     default:
         return 1;
diff --git a/pc-bios/s390-ccw/virtio.h b/pc-bios/s390-ccw/virtio.h
index d32a4830ca..75ae5bdbc2 100644
--- a/pc-bios/s390-ccw/virtio.h
+++ b/pc-bios/s390-ccw/virtio.h
@@ -107,6 +107,7 @@ struct VRing {
     VRingUsed *used;
     long cookie;
     int id;
+    uint16_t pci_notify;
 };
 typedef struct VRing VRing;
 
-- 
2.54.0



^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH v2 4/6] pc-bios/s390-ccw: Verify virtio support when booting from virtio PCI device on s390x
  2026-06-30 14:19 [PATCH v2 0/6] s390x: Fix intermittent errors with IPL from PCI devices on s390x jrossi
                   ` (2 preceding siblings ...)
  2026-06-30 14:19 ` [PATCH v2 3/6] pc-bios/s390-ccw: Add per-queue notification offset for multi-queue virtio configurations jrossi
@ 2026-06-30 14:19 ` jrossi
  2026-07-02  2:03   ` Eric Farman
  2026-06-30 14:19 ` [PATCH v2 5/6] pc-bios/s390-ccw: write IPLB location for non-net virtio devices jrossi
                   ` (3 subsequent siblings)
  7 siblings, 1 reply; 15+ messages in thread
From: jrossi @ 2026-06-30 14:19 UTC (permalink / raw)
  To: qemu-devel, qemu-s390x, cohuck, mjrosato
  Cc: jrossi, zycai, jdaley, jjherne, farman, nrb

From: Jared Rossi <jrossi@linux.ibm.com>

The virtio specification requires that each PCI device has a vendor ID of
0x1af4.  Verify this value before continuing with boot process.

Signed-off-by: Jared Rossi <jrossi@linux.ibm.com>
---
 pc-bios/s390-ccw/main.c       |  1 +
 pc-bios/s390-ccw/virtio-pci.c | 19 +++++++++++++++++++
 pc-bios/s390-ccw/virtio-pci.h |  3 +++
 pc-bios/s390-ccw/virtio.c     |  2 ++
 pc-bios/s390-ccw/virtio.h     |  1 +
 5 files changed, 26 insertions(+)

diff --git a/pc-bios/s390-ccw/main.c b/pc-bios/s390-ccw/main.c
index 26287cfd81..fb47d29bb1 100644
--- a/pc-bios/s390-ccw/main.c
+++ b/pc-bios/s390-ccw/main.c
@@ -163,6 +163,7 @@ static bool find_fid(uint32_t fid)
     }
 
     vdev->pci_fh = entry.fh;
+    vdev->vendor_id = entry.vendor_id;
     virtio_pci_id2type(vdev, entry.device_id);
 
     return vdev->dev_type != 0;
diff --git a/pc-bios/s390-ccw/virtio-pci.c b/pc-bios/s390-ccw/virtio-pci.c
index 2c83ec4f13..f501252c81 100644
--- a/pc-bios/s390-ccw/virtio-pci.c
+++ b/pc-bios/s390-ccw/virtio-pci.c
@@ -325,6 +325,20 @@ static int enable_pci_bus_master(void)
     return 0;
 }
 
+bool virtio_pci_is_supported(VDev *vdev)
+{
+    if (vdev->vendor_id == PCI_VENDOR_VIRTIO) {
+        switch (vdev->dev_type) {
+        case VIRTIO_ID_BLOCK:
+            return true;
+        default:
+            return false;
+        }
+    }
+
+    return false;
+}
+
 int virtio_pci_setup(VDev *vdev)
 {
     VRing *vr;
@@ -335,6 +349,11 @@ int virtio_pci_setup(VDev *vdev)
     vdev->guessed_disk_nature = VIRTIO_GDN_NONE;
     vdev->cmd_vr_idx = 0;
 
+    if (!virtio_pci_is_supported(vdev)) {
+        puts("Virtio PCI unsupported for this device ID");
+        return -ENODEV;
+    }
+
     if (virtio_pci_read_pci_cap_config()) {
         puts("Invalid virtio PCI capabilities");
         return -EIO;
diff --git a/pc-bios/s390-ccw/virtio-pci.h b/pc-bios/s390-ccw/virtio-pci.h
index 2494df1619..33b683bd92 100644
--- a/pc-bios/s390-ccw/virtio-pci.h
+++ b/pc-bios/s390-ccw/virtio-pci.h
@@ -56,6 +56,8 @@
 
 #define VIRTIO_F_VERSION_1          1   /* Feature bit 32 */
 
+#define PCI_VENDOR_VIRTIO           0x1af4
+
 struct VirtioPciCap {
     uint8_t bar;     /* Which PCIAS it's in */
     uint32_t off;    /* Offset within bar */
@@ -65,6 +67,7 @@ typedef struct VirtioPciCap  VirtioPciCap;
 void virtio_pci_id2type(VDev *vdev, uint16_t device_id);
 int virtio_pci_reset(VDev *vdev);
 long virtio_pci_notify(VRing *vr);
+bool virtio_pci_is_supported(VDev *vdev);
 int virtio_pci_setup(VDev *vdev);
 int virtio_pci_setup_device(void);
 
diff --git a/pc-bios/s390-ccw/virtio.c b/pc-bios/s390-ccw/virtio.c
index df04479aa6..a0d249db24 100644
--- a/pc-bios/s390-ccw/virtio.c
+++ b/pc-bios/s390-ccw/virtio.c
@@ -247,6 +247,8 @@ bool virtio_is_supported(VDev *vdev)
     case S390_IPL_TYPE_QEMU_SCSI:
     case S390_IPL_TYPE_CCW:
         return virtio_ccw_is_supported(vdev);
+    case S390_IPL_TYPE_PCI:
+        return virtio_pci_is_supported(vdev);
     default:
         return false;
     }
diff --git a/pc-bios/s390-ccw/virtio.h b/pc-bios/s390-ccw/virtio.h
index 75ae5bdbc2..aa307025e0 100644
--- a/pc-bios/s390-ccw/virtio.h
+++ b/pc-bios/s390-ccw/virtio.h
@@ -259,6 +259,7 @@ struct VDev {
     bool scsi_device_selected;
     ScsiDevice selected_scsi_device;
     uint32_t pci_fh;
+    uint16_t vendor_id;
     uint32_t max_transfer;
     uint32_t guest_features[2];
 };
-- 
2.54.0



^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH v2 5/6] pc-bios/s390-ccw: write IPLB location for non-net virtio devices
  2026-06-30 14:19 [PATCH v2 0/6] s390x: Fix intermittent errors with IPL from PCI devices on s390x jrossi
                   ` (3 preceding siblings ...)
  2026-06-30 14:19 ` [PATCH v2 4/6] pc-bios/s390-ccw: Verify virtio support when booting from virtio PCI device on s390x jrossi
@ 2026-06-30 14:19 ` jrossi
  2026-07-02  2:04   ` Eric Farman
  2026-06-30 14:19 ` [PATCH v2 6/6] s390x: Enable boot menu for virtio pci device jrossi
                   ` (2 subsequent siblings)
  7 siblings, 1 reply; 15+ messages in thread
From: jrossi @ 2026-06-30 14:19 UTC (permalink / raw)
  To: qemu-devel, qemu-s390x, cohuck, mjrosato
  Cc: jrossi, zycai, jdaley, jjherne, farman, nrb

From: Jared Rossi <jrossi@linux.ibm.com>

When IPL type is PCI, cutype is unknown, so the IPLB location does not
get written to lowcore.  Instead of checking cutype, check if the device
is virtio generically, which covers both CCW and PCI variants.  Net devices
are excluded.

Signed-off-by: Jared Rossi <jrossi@linux.ibm.com>
---
 pc-bios/s390-ccw/main.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/pc-bios/s390-ccw/main.c b/pc-bios/s390-ccw/main.c
index fb47d29bb1..9c147ac5fa 100644
--- a/pc-bios/s390-ccw/main.c
+++ b/pc-bios/s390-ccw/main.c
@@ -52,7 +52,8 @@ void write_subsystem_identification(void)
 
 void write_iplb_location(void)
 {
-    if (cutype == CU_TYPE_VIRTIO && virtio_get_device_type() != VIRTIO_ID_NET) {
+    if (virtio_is_supported(virtio_get_device()) &&
+        virtio_get_device_type() != VIRTIO_ID_NET) {
         lowcore->ptr_iplb = ptr2u32(&iplb);
     }
 }
-- 
2.54.0



^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH v2 6/6] s390x: Enable boot menu for virtio pci device
  2026-06-30 14:19 [PATCH v2 0/6] s390x: Fix intermittent errors with IPL from PCI devices on s390x jrossi
                   ` (4 preceding siblings ...)
  2026-06-30 14:19 ` [PATCH v2 5/6] pc-bios/s390-ccw: write IPLB location for non-net virtio devices jrossi
@ 2026-06-30 14:19 ` jrossi
  2026-07-02  2:08   ` Matthew Rosato
  2026-07-02  2:12 ` [PATCH v2 0/6] s390x: Fix intermittent errors with IPL from PCI devices on s390x Matthew Rosato
  2026-07-07 11:59 ` Cornelia Huck
  7 siblings, 1 reply; 15+ messages in thread
From: jrossi @ 2026-06-30 14:19 UTC (permalink / raw)
  To: qemu-devel, qemu-s390x, cohuck, mjrosato
  Cc: jrossi, zycai, jdaley, jjherne, farman, nrb

From: Zhuoying Cai <zycai@linux.ibm.com>

Add S390_IPL_TYPE_PCI to the boot menu handling logic to enable
interactive boot menu support for virtio PCI devices on s390x.

Reviewed-by: Eric Farman <farman@linux.ibm.com>
Signed-off-by: Zhuoying Cai <zycai@linux.ibm.com>
Signed-off-by: Jared Rossi <jrossi@linux.ibm.com>
---
 hw/s390x/ipl.c          | 1 +
 pc-bios/s390-ccw/main.c | 1 +
 2 files changed, 2 insertions(+)

diff --git a/hw/s390x/ipl.c b/hw/s390x/ipl.c
index 4cca21c621..d5fdc3ea0f 100644
--- a/hw/s390x/ipl.c
+++ b/hw/s390x/ipl.c
@@ -315,6 +315,7 @@ static void s390_ipl_set_boot_menu(S390IPLState *ipl)
             return;
         }
         break;
+    case S390_IPL_TYPE_PCI:
     case S390_IPL_TYPE_QEMU_SCSI:
         break;
     default:
diff --git a/pc-bios/s390-ccw/main.c b/pc-bios/s390-ccw/main.c
index 9c147ac5fa..8bc6e8eaa3 100644
--- a/pc-bios/s390-ccw/main.c
+++ b/pc-bios/s390-ccw/main.c
@@ -185,6 +185,7 @@ static void menu_setup(VDev *vdev)
 
     switch (vdev->ipl_type) {
     case S390_IPL_TYPE_CCW:
+    case S390_IPL_TYPE_PCI:
     case S390_IPL_TYPE_QEMU_SCSI:
         menu_set_parms(qipl.qipl_flags & BOOT_MENU_FLAG_MASK,
                        qipl.boot_menu_timeout);
-- 
2.54.0



^ permalink raw reply related	[flat|nested] 15+ messages in thread

* Re: [PATCH v2 2/6] pc-bios/s390-ccw/virtio.c: Fix missing break for PCI notifications
  2026-06-30 14:19 ` [PATCH v2 2/6] pc-bios/s390-ccw/virtio.c: Fix missing break for PCI notifications jrossi
@ 2026-07-02  1:44   ` Eric Farman
  2026-07-02  2:12   ` Matthew Rosato
  1 sibling, 0 replies; 15+ messages in thread
From: Eric Farman @ 2026-07-02  1:44 UTC (permalink / raw)
  To: jrossi, qemu-devel, qemu-s390x, cohuck, mjrosato
  Cc: zycai, jdaley, jjherne, nrb

On Tue, 2026-06-30 at 10:19 -0400, jrossi@linux.ibm.com wrote:
> From: Jared Rossi <jrossi@linux.ibm.com>
> 
> Add a break after calling the PCI specific notification function instead of
> falling through to the default case.
> 

Fixes: d72fb5e6b2 ("pc-bios/s390-ccw: Add support for virtio-blk-pci IPL")

> Signed-off-by: Jared Rossi <jrossi@linux.ibm.com>
> ---
>  pc-bios/s390-ccw/virtio.c | 1 +
>  1 file changed, 1 insertion(+)
> 

Reviewed-by: Eric Farman <farman@linux.ibm.com>


^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH v2 3/6] pc-bios/s390-ccw: Add per-queue notification offset for multi-queue virtio configurations
  2026-06-30 14:19 ` [PATCH v2 3/6] pc-bios/s390-ccw: Add per-queue notification offset for multi-queue virtio configurations jrossi
@ 2026-07-02  1:49   ` Eric Farman
  0 siblings, 0 replies; 15+ messages in thread
From: Eric Farman @ 2026-07-02  1:49 UTC (permalink / raw)
  To: jrossi, qemu-devel, qemu-s390x, cohuck, mjrosato
  Cc: zycai, jdaley, jjherne, nrb

On Tue, 2026-06-30 at 10:19 -0400, jrossi@linux.ibm.com wrote:
> From: Zhuoying Cai <zycai@linux.ibm.com>
> 
> The initial support for virtio-blk-pci IPL devices used a single virt-queue, but
> other device types require multiple queues, and for PCI device types this also
> requires a per-queue notification offset.
> 
> Add a PCI notify field to the VRing struct so that each queue has a unique
> notify offset as defined in the virtio spec.
> 
> Signed-off-by: Zhuoying Cai <zycai@linux.ibm.com>
> Signed-off-by: Jared Rossi <jrossi@linux.ibm.com>
> ---
>  pc-bios/s390-ccw/virtio-pci.c | 38 +++++++++++++++++++++--------------
>  pc-bios/s390-ccw/virtio-pci.h |  2 +-
>  pc-bios/s390-ccw/virtio.c     |  2 +-
>  pc-bios/s390-ccw/virtio.h     |  1 +
>  4 files changed, 26 insertions(+), 17 deletions(-)

Thank you for pulling out the bugfix from this patch. This still looks good.

Reviewed-by: Eric Farman <farman@linux.ibm.com>


^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH v2 4/6] pc-bios/s390-ccw: Verify virtio support when booting from virtio PCI device on s390x
  2026-06-30 14:19 ` [PATCH v2 4/6] pc-bios/s390-ccw: Verify virtio support when booting from virtio PCI device on s390x jrossi
@ 2026-07-02  2:03   ` Eric Farman
  0 siblings, 0 replies; 15+ messages in thread
From: Eric Farman @ 2026-07-02  2:03 UTC (permalink / raw)
  To: jrossi, qemu-devel, qemu-s390x, cohuck, mjrosato
  Cc: zycai, jdaley, jjherne, nrb

On Tue, 2026-06-30 at 10:19 -0400, jrossi@linux.ibm.com wrote:
> From: Jared Rossi <jrossi@linux.ibm.com>
> 
> The virtio specification requires that each PCI device has a vendor ID of
> 0x1af4.  Verify this value before continuing with boot process.
> 
> Signed-off-by: Jared Rossi <jrossi@linux.ibm.com>
> ---
>  pc-bios/s390-ccw/main.c       |  1 +
>  pc-bios/s390-ccw/virtio-pci.c | 19 +++++++++++++++++++
>  pc-bios/s390-ccw/virtio-pci.h |  3 +++
>  pc-bios/s390-ccw/virtio.c     |  2 ++
>  pc-bios/s390-ccw/virtio.h     |  1 +
>  5 files changed, 26 insertions(+)

Looks nice.

Reviewed-by: Eric Farman <farman@linux.ibm.com>


^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH v2 5/6] pc-bios/s390-ccw: write IPLB location for non-net virtio devices
  2026-06-30 14:19 ` [PATCH v2 5/6] pc-bios/s390-ccw: write IPLB location for non-net virtio devices jrossi
@ 2026-07-02  2:04   ` Eric Farman
  0 siblings, 0 replies; 15+ messages in thread
From: Eric Farman @ 2026-07-02  2:04 UTC (permalink / raw)
  To: jrossi, qemu-devel, qemu-s390x, cohuck, mjrosato
  Cc: zycai, jdaley, jjherne, nrb

On Tue, 2026-06-30 at 10:19 -0400, jrossi@linux.ibm.com wrote:
> From: Jared Rossi <jrossi@linux.ibm.com>
> 
> When IPL type is PCI, cutype is unknown, so the IPLB location does not
> get written to lowcore.  Instead of checking cutype, check if the device
> is virtio generically, which covers both CCW and PCI variants.  Net devices
> are excluded.
> 
> Signed-off-by: Jared Rossi <jrossi@linux.ibm.com>
> ---
>  pc-bios/s390-ccw/main.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)

Reviewed-by: Eric Farman <farman@linux.ibm.com>


^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH v2 6/6] s390x: Enable boot menu for virtio pci device
  2026-06-30 14:19 ` [PATCH v2 6/6] s390x: Enable boot menu for virtio pci device jrossi
@ 2026-07-02  2:08   ` Matthew Rosato
  0 siblings, 0 replies; 15+ messages in thread
From: Matthew Rosato @ 2026-07-02  2:08 UTC (permalink / raw)
  To: jrossi, qemu-devel, qemu-s390x, cohuck
  Cc: zycai, jdaley, jjherne, farman, nrb

On 6/30/26 10:19 AM, jrossi@linux.ibm.com wrote:
> From: Zhuoying Cai <zycai@linux.ibm.com>
> 
> Add S390_IPL_TYPE_PCI to the boot menu handling logic to enable
> interactive boot menu support for virtio PCI devices on s390x.

Thanks, that message was bugging me!

Reviewed-by: Matthew Rosato <mjrosato@linux.ibm.com>




^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH v2 2/6] pc-bios/s390-ccw/virtio.c: Fix missing break for PCI notifications
  2026-06-30 14:19 ` [PATCH v2 2/6] pc-bios/s390-ccw/virtio.c: Fix missing break for PCI notifications jrossi
  2026-07-02  1:44   ` Eric Farman
@ 2026-07-02  2:12   ` Matthew Rosato
  1 sibling, 0 replies; 15+ messages in thread
From: Matthew Rosato @ 2026-07-02  2:12 UTC (permalink / raw)
  To: jrossi, qemu-devel, qemu-s390x, cohuck
  Cc: zycai, jdaley, jjherne, farman, nrb

On 6/30/26 10:19 AM, jrossi@linux.ibm.com wrote:
> From: Jared Rossi <jrossi@linux.ibm.com>
> 
> Add a break after calling the PCI specific notification function instead of
> falling through to the default case.
> 
> Signed-off-by: Jared Rossi <jrossi@linux.ibm.com>

With fixes tag as pointed out by Eric:

Reviewed-by: Matthew Rosato <mjrosato@linux.ibm.com>




^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH v2 0/6] s390x: Fix intermittent errors with IPL from PCI devices on s390x
  2026-06-30 14:19 [PATCH v2 0/6] s390x: Fix intermittent errors with IPL from PCI devices on s390x jrossi
                   ` (5 preceding siblings ...)
  2026-06-30 14:19 ` [PATCH v2 6/6] s390x: Enable boot menu for virtio pci device jrossi
@ 2026-07-02  2:12 ` Matthew Rosato
  2026-07-07 11:59 ` Cornelia Huck
  7 siblings, 0 replies; 15+ messages in thread
From: Matthew Rosato @ 2026-07-02  2:12 UTC (permalink / raw)
  To: jrossi, qemu-devel, qemu-s390x, cohuck
  Cc: zycai, jdaley, jjherne, farman, nrb

On 6/30/26 10:19 AM, jrossi@linux.ibm.com wrote:
> From: Jared Rossi <jrossi@linux.ibm.com>
> 
> When booting from a PCI device on s390x there may be intermittent failures
> caused by mismatched byte swaps.  Refactor the byte swapping to ensure that
> it is properly synchronized.
> 
> Correct how the queue notification offset is calculated so that it may be
> used for multi-queue configurations in the future.
> 
> Handle some switch cases that were not caught for PCI devices.

For the series:

Tested-by: Matthew Rosato <mjrosato@linux.ibm.com>

Worth nothing that, with this series applied (and after generating a new 
s390-ccw.img) I am no longer able to reproduce the error reported in:

https://gitlab.com/qemu-project/qemu/-/work_items/3350

Thanks,
Matt


^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH v2 0/6] s390x: Fix intermittent errors with IPL from PCI devices on s390x
  2026-06-30 14:19 [PATCH v2 0/6] s390x: Fix intermittent errors with IPL from PCI devices on s390x jrossi
                   ` (6 preceding siblings ...)
  2026-07-02  2:12 ` [PATCH v2 0/6] s390x: Fix intermittent errors with IPL from PCI devices on s390x Matthew Rosato
@ 2026-07-07 11:59 ` Cornelia Huck
  7 siblings, 0 replies; 15+ messages in thread
From: Cornelia Huck @ 2026-07-07 11:59 UTC (permalink / raw)
  To: jrossi, qemu-devel, qemu-s390x, mjrosato
  Cc: jrossi, zycai, jdaley, jjherne, farman, nrb

On Tue, Jun 30 2026, jrossi@linux.ibm.com wrote:

> From: Jared Rossi <jrossi@linux.ibm.com>
>
> When booting from a PCI device on s390x there may be intermittent failures
> caused by mismatched byte swaps.  Refactor the byte swapping to ensure that
> it is properly synchronized.
>
> Correct how the queue notification offset is calculated so that it may be
> used for multi-queue configurations in the future.
>
> Handle some switch cases that were not caught for PCI devices.
>
> Changes v1 -> v2:
>     - Split addition of missing break into its own patch
>     - Add PCI case to generic is_viritio_supported() wapper
>     - Switch the order of patches formerly 3 and 4
>     - Use virtio_is_supported() instead of checking cutype when writing IPLB
>         location to cover both CCW and PCI virtio devices
>
> Jared Rossi (3):
>   pc-bios/s390-ccw/virtio.c: Fix missing break for PCI notifications
>   pc-bios/s390-ccw: Verify virtio support when booting from virtio PCI
>     device on s390x
>   pc-bios/s390-ccw: write IPLB location for non-net virtio devices
>
> Zhuoying Cai (3):
>   pc-bios/s390-ccw: Refactor byte swapping
>   pc-bios/s390-ccw: Add per-queue notification offset for multi-queue
>     virtio configurations
>   s390x: Enable boot menu for virtio pci device
>
>  hw/s390x/ipl.c                |  1 +
>  pc-bios/s390-ccw/main.c       |  5 ++-
>  pc-bios/s390-ccw/virtio-pci.c | 57 ++++++++++++++++++++++++++---------
>  pc-bios/s390-ccw/virtio-pci.h |  5 ++-
>  pc-bios/s390-ccw/virtio.c     | 29 ++++++++++--------
>  pc-bios/s390-ccw/virtio.h     |  2 ++
>  6 files changed, 69 insertions(+), 30 deletions(-)
>

Thanks, applied.



^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2026-07-07 11:59 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-30 14:19 [PATCH v2 0/6] s390x: Fix intermittent errors with IPL from PCI devices on s390x jrossi
2026-06-30 14:19 ` [PATCH v2 1/6] pc-bios/s390-ccw: Refactor byte swapping jrossi
2026-06-30 14:19 ` [PATCH v2 2/6] pc-bios/s390-ccw/virtio.c: Fix missing break for PCI notifications jrossi
2026-07-02  1:44   ` Eric Farman
2026-07-02  2:12   ` Matthew Rosato
2026-06-30 14:19 ` [PATCH v2 3/6] pc-bios/s390-ccw: Add per-queue notification offset for multi-queue virtio configurations jrossi
2026-07-02  1:49   ` Eric Farman
2026-06-30 14:19 ` [PATCH v2 4/6] pc-bios/s390-ccw: Verify virtio support when booting from virtio PCI device on s390x jrossi
2026-07-02  2:03   ` Eric Farman
2026-06-30 14:19 ` [PATCH v2 5/6] pc-bios/s390-ccw: write IPLB location for non-net virtio devices jrossi
2026-07-02  2:04   ` Eric Farman
2026-06-30 14:19 ` [PATCH v2 6/6] s390x: Enable boot menu for virtio pci device jrossi
2026-07-02  2:08   ` Matthew Rosato
2026-07-02  2:12 ` [PATCH v2 0/6] s390x: Fix intermittent errors with IPL from PCI devices on s390x Matthew Rosato
2026-07-07 11:59 ` Cornelia Huck

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.