1be5c7
From 042e966a70789bd3ed450fa4f57016129a34672e Mon Sep 17 00:00:00 2001
1be5c7
From: Thomas Huth <thuth@redhat.com>
1be5c7
Date: Fri, 8 Jul 2022 12:29:50 +0200
1be5c7
Subject: [PATCH 37/37] pc-bios/s390-ccw/virtio-blkdev: Request the right
1be5c7
 feature bits
1be5c7
1be5c7
RH-Author: Thomas Huth <thuth@redhat.com>
1be5c7
RH-MergeRequest: 198: pc-bios/s390-ccw: Fix boot from disks with 4k sectors that do not have the typical DASD geometry
1be5c7
RH-Commit: [9/9] f04835423d648b04f2187ef9890f2d1689e2b57e
1be5c7
RH-Bugzilla: 2098076
1be5c7
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
1be5c7
RH-Acked-by: David Hildenbrand <david@redhat.com>
1be5c7
RH-Acked-by: Cornelia Huck <cohuck@redhat.com>
1be5c7
1be5c7
Bugzilla: http://bugzilla.redhat.com/2098076
1be5c7
1be5c7
commit 9125a314cca4a1838b09305a87d8efb98f80ab67
1be5c7
Author: Thomas Huth <thuth@redhat.com>
1be5c7
Date:   Mon Jul 4 13:19:01 2022 +0200
1be5c7
1be5c7
    pc-bios/s390-ccw/virtio-blkdev: Request the right feature bits
1be5c7
1be5c7
    The virtio-blk code uses the block size and geometry fields in the
1be5c7
    config area. According to the virtio-spec, these have to be negotiated
1be5c7
    with the right feature bits during initialization, otherwise they
1be5c7
    might not be available. QEMU is so far very forgiving and always
1be5c7
    provides them, but we should not rely on this behavior, so let's
1be5c7
    better request them properly via the VIRTIO_BLK_F_GEOMETRY and
1be5c7
    VIRTIO_BLK_F_BLK_SIZE feature bits.
1be5c7
1be5c7
    Message-Id: <20220704111903.62400-11-thuth@redhat.com>
1be5c7
    Signed-off-by: Thomas Huth <thuth@redhat.com>
1be5c7
1be5c7
Signed-off-by: Thomas Huth <thuth@redhat.com>
1be5c7
---
1be5c7
 pc-bios/s390-ccw/virtio-blkdev.c | 4 ++++
1be5c7
 1 file changed, 4 insertions(+)
1be5c7
1be5c7
diff --git a/pc-bios/s390-ccw/virtio-blkdev.c b/pc-bios/s390-ccw/virtio-blkdev.c
1be5c7
index c175b66a47..8271c47296 100644
1be5c7
--- a/pc-bios/s390-ccw/virtio-blkdev.c
1be5c7
+++ b/pc-bios/s390-ccw/virtio-blkdev.c
1be5c7
@@ -13,6 +13,9 @@
1be5c7
 #include "virtio.h"
1be5c7
 #include "virtio-scsi.h"
1be5c7
 
1be5c7
+#define VIRTIO_BLK_F_GEOMETRY   (1 << 4)
1be5c7
+#define VIRTIO_BLK_F_BLK_SIZE   (1 << 6)
1be5c7
+
1be5c7
 static int virtio_blk_read_many(VDev *vdev, ulong sector, void *load_addr,
1be5c7
                                 int sec_num)
1be5c7
 {
1be5c7
@@ -223,6 +226,7 @@ int virtio_blk_setup_device(SubChannelId schid)
1be5c7
 {
1be5c7
     VDev *vdev = virtio_get_device();
1be5c7
 
1be5c7
+    vdev->guest_features[0] = VIRTIO_BLK_F_GEOMETRY | VIRTIO_BLK_F_BLK_SIZE;
1be5c7
     vdev->schid = schid;
1be5c7
     virtio_setup_ccw(vdev);
1be5c7
 
1be5c7
-- 
1be5c7
2.35.3
1be5c7