yeahuh / rpms / qemu-kvm

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