thebeanogamer / rpms / qemu-kvm

Forked from rpms/qemu-kvm 5 months ago
Clone

Blame SOURCES/kvm-pc-bios-s390-ccw-virtio-blkdev-Request-the-right-fea.patch

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