Blame SOURCES/kvm-s390-bios-decouple-common-boot-logic-from-virtio.patch

Pablo Greco e6a3ae
From 59ef4d9a3358627fbd7001028903cd89e061a216 Mon Sep 17 00:00:00 2001
Pablo Greco e6a3ae
From: Thomas Huth <thuth@redhat.com>
Pablo Greco e6a3ae
Date: Mon, 14 Oct 2019 10:06:32 +0100
Pablo Greco e6a3ae
Subject: [PATCH 07/21] s390-bios: decouple common boot logic from virtio
Pablo Greco e6a3ae
Pablo Greco e6a3ae
RH-Author: Thomas Huth <thuth@redhat.com>
Pablo Greco e6a3ae
Message-id: <20191014100645.22862-5-thuth@redhat.com>
Pablo Greco e6a3ae
Patchwork-id: 91778
Pablo Greco e6a3ae
O-Subject: [RHEL-8.2.0 qemu-kvm PATCH v2 04/17] s390-bios: decouple common boot logic from virtio
Pablo Greco e6a3ae
Bugzilla: 1664376
Pablo Greco e6a3ae
RH-Acked-by: Cornelia Huck <cohuck@redhat.com>
Pablo Greco e6a3ae
RH-Acked-by: David Hildenbrand <david@redhat.com>
Pablo Greco e6a3ae
RH-Acked-by: Jens Freimann <jfreimann@redhat.com>
Pablo Greco e6a3ae
Pablo Greco e6a3ae
From: "Jason J. Herne" <jjherne@linux.ibm.com>
Pablo Greco e6a3ae
Pablo Greco e6a3ae
Create a boot_setup function to handle getting boot information from
Pablo Greco e6a3ae
the machine/hypervisor. This decouples common boot logic from the
Pablo Greco e6a3ae
virtio code path and allows us to make use of it for the real dasd boot
Pablo Greco e6a3ae
scenario.
Pablo Greco e6a3ae
Pablo Greco e6a3ae
Signed-off-by: Jason J. Herne <jjherne@linux.ibm.com>
Pablo Greco e6a3ae
Acked-by: Halil Pasic <pasic@linux.vnet.ibm.com>
Pablo Greco e6a3ae
Reviewed-by: Collin Walling 
Pablo Greco e6a3ae
Reviewed-by: Thomas Huth <thuth@redhat.com>
Pablo Greco e6a3ae
Reviewed-by: Farhan Ali <alifm@linux.ibm.com>
Pablo Greco e6a3ae
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
Pablo Greco e6a3ae
Message-Id: <1554388475-18329-4-git-send-email-jjherne@linux.ibm.com>
Pablo Greco e6a3ae
Signed-off-by: Thomas Huth <thuth@redhat.com>
Pablo Greco e6a3ae
(cherry picked from commit a5f6e0975b1f1b79f446c8323e62fd0534408da6)
Pablo Greco e6a3ae
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
Pablo Greco e6a3ae
---
Pablo Greco e6a3ae
 pc-bios/s390-ccw/main.c | 28 ++++++++++++++++++++--------
Pablo Greco e6a3ae
 1 file changed, 20 insertions(+), 8 deletions(-)
Pablo Greco e6a3ae
Pablo Greco e6a3ae
diff --git a/pc-bios/s390-ccw/main.c b/pc-bios/s390-ccw/main.c
Pablo Greco e6a3ae
index e82fe2c..67df421 100644
Pablo Greco e6a3ae
--- a/pc-bios/s390-ccw/main.c
Pablo Greco e6a3ae
+++ b/pc-bios/s390-ccw/main.c
Pablo Greco e6a3ae
@@ -14,16 +14,17 @@
Pablo Greco e6a3ae
 
Pablo Greco e6a3ae
 char stack[PAGE_SIZE * 8] __attribute__((__aligned__(PAGE_SIZE)));
Pablo Greco e6a3ae
 static SubChannelId blk_schid = { .one = 1 };
Pablo Greco e6a3ae
-IplParameterBlock iplb __attribute__((__aligned__(PAGE_SIZE)));
Pablo Greco e6a3ae
 static char loadparm_str[LOADPARM_LEN + 1] = { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
Pablo Greco e6a3ae
 QemuIplParameters qipl;
Pablo Greco e6a3ae
+IplParameterBlock iplb __attribute__((__aligned__(PAGE_SIZE)));
Pablo Greco e6a3ae
+static bool have_iplb;
Pablo Greco e6a3ae
 
Pablo Greco e6a3ae
 #define LOADPARM_PROMPT "PROMPT  "
Pablo Greco e6a3ae
 #define LOADPARM_EMPTY  "        "
Pablo Greco e6a3ae
 #define BOOT_MENU_FLAG_MASK (QIPL_FLAG_BM_OPTS_CMD | QIPL_FLAG_BM_OPTS_ZIPL)
Pablo Greco e6a3ae
 
Pablo Greco e6a3ae
 /*
Pablo Greco e6a3ae
- * Priniciples of Operations (SA22-7832-09) chapter 17 requires that
Pablo Greco e6a3ae
+ * Principles of Operations (SA22-7832-09) chapter 17 requires that
Pablo Greco e6a3ae
  * a subsystem-identification is at 184-187 and bytes 188-191 are zero
Pablo Greco e6a3ae
  * after list-directed-IPL and ccw-IPL.
Pablo Greco e6a3ae
  */
Pablo Greco e6a3ae
@@ -111,23 +112,33 @@ static void css_setup(void)
Pablo Greco e6a3ae
     enable_mss_facility();
Pablo Greco e6a3ae
 }
Pablo Greco e6a3ae
 
Pablo Greco e6a3ae
+/*
Pablo Greco e6a3ae
+ * Collect various pieces of information from the hypervisor/hardware that
Pablo Greco e6a3ae
+ * we'll use to determine exactly how we'll boot.
Pablo Greco e6a3ae
+ */
Pablo Greco e6a3ae
+static void boot_setup(void)
Pablo Greco e6a3ae
+{
Pablo Greco e6a3ae
+    char lpmsg[] = "LOADPARM=[________]\n";
Pablo Greco e6a3ae
+
Pablo Greco e6a3ae
+    sclp_get_loadparm_ascii(loadparm_str);
Pablo Greco e6a3ae
+    memcpy(lpmsg + 10, loadparm_str, 8);
Pablo Greco e6a3ae
+    sclp_print(lpmsg);
Pablo Greco e6a3ae
+
Pablo Greco e6a3ae
+    have_iplb = store_iplb(&iplb);
Pablo Greco e6a3ae
+}
Pablo Greco e6a3ae
+
Pablo Greco e6a3ae
 static void virtio_setup(void)
Pablo Greco e6a3ae
 {
Pablo Greco e6a3ae
     Schib schib;
Pablo Greco e6a3ae
     int ssid;
Pablo Greco e6a3ae
     bool found = false;
Pablo Greco e6a3ae
     uint16_t dev_no;
Pablo Greco e6a3ae
-    char ldp[] = "LOADPARM=[________]\n";
Pablo Greco e6a3ae
     VDev *vdev = virtio_get_device();
Pablo Greco e6a3ae
     QemuIplParameters *early_qipl = (QemuIplParameters *)QIPL_ADDRESS;
Pablo Greco e6a3ae
 
Pablo Greco e6a3ae
-    sclp_get_loadparm_ascii(loadparm_str);
Pablo Greco e6a3ae
-    memcpy(ldp + 10, loadparm_str, LOADPARM_LEN);
Pablo Greco e6a3ae
-    sclp_print(ldp);
Pablo Greco e6a3ae
-
Pablo Greco e6a3ae
     memcpy(&qipl, early_qipl, sizeof(QemuIplParameters));
Pablo Greco e6a3ae
 
Pablo Greco e6a3ae
-    if (store_iplb(&iplb)) {
Pablo Greco e6a3ae
+    if (have_iplb) {
Pablo Greco e6a3ae
         switch (iplb.pbt) {
Pablo Greco e6a3ae
         case S390_IPL_TYPE_CCW:
Pablo Greco e6a3ae
             dev_no = iplb.ccw.devno;
Pablo Greco e6a3ae
@@ -174,6 +185,7 @@ int main(void)
Pablo Greco e6a3ae
 {
Pablo Greco e6a3ae
     sclp_setup();
Pablo Greco e6a3ae
     css_setup();
Pablo Greco e6a3ae
+    boot_setup();
Pablo Greco e6a3ae
     virtio_setup();
Pablo Greco e6a3ae
 
Pablo Greco e6a3ae
     zipl_load(); /* no return */
Pablo Greco e6a3ae
-- 
Pablo Greco e6a3ae
1.8.3.1
Pablo Greco e6a3ae