yeahuh / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone

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

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