Blame SOURCES/kvm-pc-bios-s390-ccw-virtio-Read-device-config-after-fea.patch

586cba
From 20f8724d0837acbe642c8c7698a4b256f34c1209 Mon Sep 17 00:00:00 2001
586cba
From: Thomas Huth <thuth@redhat.com>
586cba
Date: Fri, 8 Jul 2022 20:49:01 +0200
586cba
Subject: [PATCH 11/17] pc-bios/s390-ccw/virtio: Read device config after
586cba
 feature negotiation
586cba
586cba
RH-Author: Thomas Huth <thuth@redhat.com>
586cba
RH-MergeRequest: 106: pc-bios/s390-ccw: Fix boot from disks with 4k sectors that do not have the typical DASD geometry
586cba
RH-Commit: [6/10] 54d21e430b2dfba9e0a0823d6bb8ec7e7f8ff2ff (thuth/qemu-kvm-cs9)
586cba
RH-Bugzilla: 2098077
586cba
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
586cba
RH-Acked-by: David Hildenbrand <david@redhat.com>
586cba
RH-Acked-by: Cornelia Huck <cohuck@redhat.com>
586cba
586cba
Bugzilla: http://bugzilla.redhat.com/2098077
586cba
586cba
commit aa5c69ce99411c4886bcd051f288afc02b6d968d
586cba
Author: Thomas Huth <thuth@redhat.com>
586cba
Date:   Mon Jul 4 13:18:58 2022 +0200
586cba
586cba
    pc-bios/s390-ccw/virtio: Read device config after feature negotiation
586cba
586cba
    Feature negotiation should be done first, since some fields in the
586cba
    config area can depend on the negotiated features and thus should
586cba
    rather be read afterwards.
586cba
586cba
    While we're at it, also adjust the error message here a little bit
586cba
    (the code is nowadays used for non-block virtio devices, too).
586cba
586cba
    Message-Id: <20220704111903.62400-8-thuth@redhat.com>
586cba
    Reviewed-by: Eric Farman <farman@linux.ibm.com>
586cba
    Reviewed-by: Cornelia Huck <cohuck@redhat.com>
586cba
    Signed-off-by: Thomas Huth <thuth@redhat.com>
586cba
586cba
Signed-off-by: Thomas Huth <thuth@redhat.com>
586cba
---
586cba
 pc-bios/s390-ccw/virtio.c | 7 +++----
586cba
 1 file changed, 3 insertions(+), 4 deletions(-)
586cba
586cba
diff --git a/pc-bios/s390-ccw/virtio.c b/pc-bios/s390-ccw/virtio.c
586cba
index 4e85a2eb82..d8c2b52710 100644
586cba
--- a/pc-bios/s390-ccw/virtio.c
586cba
+++ b/pc-bios/s390-ccw/virtio.c
586cba
@@ -262,10 +262,6 @@ void virtio_setup_ccw(VDev *vdev)
586cba
     rc = run_ccw(vdev, CCW_CMD_WRITE_STATUS, &status, sizeof(status), false);
586cba
     IPL_assert(rc == 0, "Could not write DRIVER status to host");
586cba
 
586cba
-    IPL_assert(
586cba
-        run_ccw(vdev, CCW_CMD_READ_CONF, &vdev->config, cfg_size, false) == 0,
586cba
-       "Could not get block device configuration");
586cba
-
586cba
     /* Feature negotiation */
586cba
     for (i = 0; i < ARRAY_SIZE(vdev->guest_features); i++) {
586cba
         feats.features = 0;
586cba
@@ -278,6 +274,9 @@ void virtio_setup_ccw(VDev *vdev)
586cba
         IPL_assert(rc == 0, "Could not set features bits");
586cba
     }
586cba
 
586cba
+    rc = run_ccw(vdev, CCW_CMD_READ_CONF, &vdev->config, cfg_size, false);
586cba
+    IPL_assert(rc == 0, "Could not get virtio device configuration");
586cba
+
586cba
     for (i = 0; i < vdev->nr_vqs; i++) {
586cba
         VqInfo info = {
586cba
             .queue = (unsigned long long) ring_area + (i * VIRTIO_RING_SIZE),
586cba
-- 
586cba
2.31.1
586cba