yeahuh / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone
902636
From 53053ea2e6c757e5d044655c8b61c485e0aad4ed Mon Sep 17 00:00:00 2001
902636
From: Thomas Huth <thuth@redhat.com>
902636
Date: Fri, 29 May 2020 05:53:59 -0400
902636
Subject: [PATCH 17/42] s390/ipl: sync back loadparm
902636
MIME-Version: 1.0
902636
Content-Type: text/plain; charset=UTF-8
902636
Content-Transfer-Encoding: 8bit
902636
902636
RH-Author: Thomas Huth <thuth@redhat.com>
902636
Message-id: <20200529055420.16855-18-thuth@redhat.com>
902636
Patchwork-id: 97039
902636
O-Subject: [RHEL-8.3.0 qemu-kvm PATCH v2 17/38] s390/ipl: sync back loadparm
902636
Bugzilla: 1828317
902636
RH-Acked-by: Claudio Imbrenda <cimbrend@redhat.com>
902636
RH-Acked-by: Philippe Mathieu-Daudé <philmd@redhat.com>
902636
RH-Acked-by: Cornelia Huck <cohuck@redhat.com>
902636
RH-Acked-by: David Hildenbrand <david@redhat.com>
902636
902636
From: Halil Pasic <pasic@linux.ibm.com>
902636
902636
We expose loadparm as a r/w machine property, but if loadparm is set by
902636
the guest via DIAG 308, we don't update the property. Having a
902636
disconnect between the guest view and the QEMU property is not nice in
902636
itself, but things get even worse for SCSI, where under certain
902636
circumstances (see 789b5a401b "s390: Ensure IPL from SCSI works as
902636
expected" for details) we call s390_gen_initial_iplb() on resets
902636
effectively overwriting the guest/user supplied loadparm with the stale
902636
value.
902636
902636
Signed-off-by: Halil Pasic <pasic@linux.ibm.com>
902636
Fixes: 7104bae9de ("hw/s390x: provide loadparm property for the machine")
902636
Reported-by: Marc Hartmayer <mhartmay@linux.ibm.com>
902636
Reviewed-by: Janosch Frank <frankja@linux.ibm.com>
902636
Reviewed-by: Viktor Mihajlovski <mihajlov@linux.ibm.com>
902636
Tested-by: Marc Hartmayer <mhartmay@linux.ibm.com>
902636
Reviewed-by: David Hildenbrand <david@redhat.com>
902636
Message-Id: <20200309133223.100491-1-pasic@linux.ibm.com>
902636
[borntraeger@de.ibm.com: use reverse xmas tree]
902636
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
902636
(cherry picked from commit 0a01e082a428b921e48b5314881b1f23a7b0fe50)
902636
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
902636
---
902636
 hw/s390x/ipl.c | 25 +++++++++++++++++++++++++
902636
 1 file changed, 25 insertions(+)
902636
902636
diff --git a/hw/s390x/ipl.c b/hw/s390x/ipl.c
902636
index 0b7548a549..f25339c503 100644
902636
--- a/hw/s390x/ipl.c
902636
+++ b/hw/s390x/ipl.c
902636
@@ -529,6 +529,30 @@ static bool is_virtio_scsi_device(IplParameterBlock *iplb)
902636
     return is_virtio_ccw_device_of_type(iplb, VIRTIO_ID_SCSI);
902636
 }
902636
 
902636
+static void update_machine_ipl_properties(IplParameterBlock *iplb)
902636
+{
902636
+    Object *machine = qdev_get_machine();
902636
+    Error *err = NULL;
902636
+
902636
+    /* Sync loadparm */
902636
+    if (iplb->flags & DIAG308_FLAGS_LP_VALID) {
902636
+        uint8_t *ebcdic_loadparm = iplb->loadparm;
902636
+        char ascii_loadparm[8];
902636
+        int i;
902636
+
902636
+        for (i = 0; i < 8 && ebcdic_loadparm[i]; i++) {
902636
+            ascii_loadparm[i] = ebcdic2ascii[(uint8_t) ebcdic_loadparm[i]];
902636
+        }
902636
+        ascii_loadparm[i] = 0;
902636
+        object_property_set_str(machine, ascii_loadparm, "loadparm", &err;;
902636
+    } else {
902636
+        object_property_set_str(machine, "", "loadparm", &err;;
902636
+    }
902636
+    if (err) {
902636
+        warn_report_err(err);
902636
+    }
902636
+}
902636
+
902636
 void s390_ipl_update_diag308(IplParameterBlock *iplb)
902636
 {
902636
     S390IPLState *ipl = get_ipl_device();
902636
@@ -536,6 +560,7 @@ void s390_ipl_update_diag308(IplParameterBlock *iplb)
902636
     ipl->iplb = *iplb;
902636
     ipl->iplb_valid = true;
902636
     ipl->netboot = is_virtio_net_device(iplb);
902636
+    update_machine_ipl_properties(iplb);
902636
 }
902636
 
902636
 IplParameterBlock *s390_ipl_get_iplb(void)
902636
-- 
902636
2.27.0
902636