All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/1] s390/ipl: sync back loadparm
@ 2020-02-24 15:02 Halil Pasic
  2020-02-25  9:39 ` David Hildenbrand
  0 siblings, 1 reply; 10+ messages in thread
From: Halil Pasic @ 2020-02-24 15:02 UTC (permalink / raw)
  To: Thomas Huth, Cornelia Huck, qemu-s390x, qemu-devel
  Cc: Janosch Frank, David Hildenbrand, Halil Pasic,
	Christian Borntraeger, Marc Hartmayer, Viktor Mihajlovski,
	Richard Henderson

We expose loadparm as a r/w machine property, but if loadparm is set by
the guest via DIAG 308, we don't update the property. Having a
disconnect between the guest view and the QEMU property is not nice in
itself, but things get even worse for SCSI, where under certain
circumstances (see 789b5a401b "s390: Ensure IPL from SCSI works as
expected" for details) we call s390_gen_initial_iplb() on resets
effectively overwriting the guest/user supplied loadparm with the stale
value.

Signed-off-by: Halil Pasic <pasic@linux.ibm.com>
Fixes: 7104bae9de "hw/s390x: provide loadparm property for the machine"
Reported-by: Marc Hartmayer <mhartmay@linux.ibm.com>
Reviewed-by: Janosch Frank <frankja@linux.ibm.com>
Reviewed-by: Viktor Mihajlovski <mihajlov@linux.ibm.com>
Tested-by: Marc Hartmayer <mhartmay@linux.ibm.com>
---
 hw/s390x/ipl.c | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/hw/s390x/ipl.c b/hw/s390x/ipl.c
index 7773499d7f..97a279c1a5 100644
--- a/hw/s390x/ipl.c
+++ b/hw/s390x/ipl.c
@@ -538,6 +538,26 @@ static bool is_virtio_scsi_device(IplParameterBlock *iplb)
     return is_virtio_ccw_device_of_type(iplb, VIRTIO_ID_SCSI);
 }
 
+static void update_machine_ipl_properties(IplParameterBlock *iplb)
+{
+    Object *mo = qdev_get_machine();
+
+    /* Sync loadparm */
+    if (iplb->flags & DIAG308_FLAGS_LP_VALID) {
+        char ascii_loadparm[8];
+        uint8_t *ebcdic_loadparm = iplb->loadparm;
+        int i;
+
+        for (i = 0; i < 8 && ebcdic_loadparm[i]; i++) {
+            ascii_loadparm[i] = ebcdic2ascii[(uint8_t) ebcdic_loadparm[i]];
+        }
+        ascii_loadparm[i] = 0;
+        object_property_set_str(mo, ascii_loadparm, "loadparm", NULL);
+    } else {
+        object_property_set_str(mo, "", "loadparm", NULL);
+    }
+}
+
 void s390_ipl_update_diag308(IplParameterBlock *iplb)
 {
     S390IPLState *ipl = get_ipl_device();
@@ -545,6 +565,7 @@ void s390_ipl_update_diag308(IplParameterBlock *iplb)
     ipl->iplb = *iplb;
     ipl->iplb_valid = true;
     ipl->netboot = is_virtio_net_device(iplb);
+    update_machine_ipl_properties(iplb);
 }
 
 IplParameterBlock *s390_ipl_get_iplb(void)

base-commit: c1e667d2598b9b3ce62b8e89ed22dd38dfe9f57f
-- 
2.17.1



^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2020-03-06 13:58 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-24 15:02 [PATCH 1/1] s390/ipl: sync back loadparm Halil Pasic
2020-02-25  9:39 ` David Hildenbrand
2020-02-25 11:56   ` Halil Pasic
2020-02-25 14:35     ` Viktor Mihajlovski
2020-02-25 14:47       ` Cornelia Huck
2020-03-05 12:44       ` Christian Borntraeger
2020-03-05 14:11         ` Halil Pasic
2020-03-05 14:25           ` Christian Borntraeger
2020-03-05 16:21             ` Christian Borntraeger
2020-03-06 13:57               ` Halil Pasic

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.