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

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