yeahuh / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone

Blame SOURCES/kvm-pc-bios-s390-ccw-Allow-booting-in-case-the-first-vir.patch

f66865
From e46aaac6f1ad67753face896e827ad1da920b9e5 Mon Sep 17 00:00:00 2001
f66865
From: Thomas Huth <thuth@redhat.com>
f66865
Date: Fri, 9 Oct 2020 10:08:47 -0400
f66865
Subject: [PATCH 11/14] pc-bios/s390-ccw: Allow booting in case the first
f66865
 virtio-blk disk is bad
f66865
f66865
RH-Author: Thomas Huth <thuth@redhat.com>
f66865
Message-id: <20201009100849.264994-8-thuth@redhat.com>
f66865
Patchwork-id: 98601
f66865
O-Subject: [RHEL-8.4.0 qemu-kvm PATCH 7/9] pc-bios/s390-ccw: Allow booting in case the first virtio-blk disk is bad
f66865
Bugzilla: 1846975
f66865
RH-Acked-by: Jens Freimann <jfreimann@redhat.com>
f66865
RH-Acked-by: David Hildenbrand <david@redhat.com>
f66865
RH-Acked-by: Cornelia Huck <cohuck@redhat.com>
f66865
f66865
If you try to boot with two virtio-blk disks (without bootindex), and
f66865
only the second one is bootable, the s390-ccw bios currently stops at
f66865
the first disk and does not continue booting from the second one. This
f66865
is annoying - and all other major QEMU firmwares succeed to boot from
f66865
the second disk in this case, so we should do the same in the s390-ccw
f66865
bios, too.
f66865
f66865
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
f66865
Message-Id: <20200806105349.632-8-thuth@redhat.com>
f66865
Signed-off-by: Thomas Huth <thuth@redhat.com>
f66865
(cherry picked from commit 5dc739f343cd06ecb9b058294564ce7504856f3f)
f66865
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
f66865
---
f66865
 pc-bios/s390-ccw/bootmap.c | 34 +++++++++++++++++++++++-----------
f66865
 pc-bios/s390-ccw/main.c    |  2 +-
f66865
 2 files changed, 24 insertions(+), 12 deletions(-)
f66865
f66865
diff --git a/pc-bios/s390-ccw/bootmap.c b/pc-bios/s390-ccw/bootmap.c
f66865
index d13b7cbd15..e91ea719ff 100644
f66865
--- a/pc-bios/s390-ccw/bootmap.c
f66865
+++ b/pc-bios/s390-ccw/bootmap.c
f66865
@@ -289,11 +289,18 @@ static void ipl_eckd_cdl(void)
f66865
     read_block(1, ipl2, "Cannot read IPL2 record at block 1");
f66865
 
f66865
     mbr = &ipl2->mbr;
f66865
-    IPL_assert(magic_match(mbr, ZIPL_MAGIC), "No zIPL section in IPL2 record.");
f66865
-    IPL_assert(block_size_ok(mbr->blockptr.xeckd.bptr.size),
f66865
-               "Bad block size in zIPL section of IPL2 record.");
f66865
-    IPL_assert(mbr->dev_type == DEV_TYPE_ECKD,
f66865
-               "Non-ECKD device type in zIPL section of IPL2 record.");
f66865
+    if (!magic_match(mbr, ZIPL_MAGIC)) {
f66865
+        sclp_print("No zIPL section in IPL2 record.\n");
f66865
+        return;
f66865
+    }
f66865
+    if (!block_size_ok(mbr->blockptr.xeckd.bptr.size)) {
f66865
+        sclp_print("Bad block size in zIPL section of IPL2 record.\n");
f66865
+        return;
f66865
+    }
f66865
+    if (!mbr->dev_type == DEV_TYPE_ECKD) {
f66865
+        sclp_print("Non-ECKD device type in zIPL section of IPL2 record.\n");
f66865
+        return;
f66865
+    }
f66865
 
f66865
     /* save pointer to Boot Map Table */
f66865
     bmt_block_nr = eckd_block_num(&mbr->blockptr.xeckd.bptr.chs);
f66865
@@ -303,10 +310,14 @@ static void ipl_eckd_cdl(void)
f66865
 
f66865
     memset(sec, FREE_SPACE_FILLER, sizeof(sec));
f66865
     read_block(2, vlbl, "Cannot read Volume Label at block 2");
f66865
-    IPL_assert(magic_match(vlbl->key, VOL1_MAGIC),
f66865
-               "Invalid magic of volume label block");
f66865
-    IPL_assert(magic_match(vlbl->f.key, VOL1_MAGIC),
f66865
-               "Invalid magic of volser block");
f66865
+    if (!magic_match(vlbl->key, VOL1_MAGIC)) {
f66865
+        sclp_print("Invalid magic of volume label block.\n");
f66865
+        return;
f66865
+    }
f66865
+    if (!magic_match(vlbl->f.key, VOL1_MAGIC)) {
f66865
+        sclp_print("Invalid magic of volser block.\n");
f66865
+        return;
f66865
+    }
f66865
     print_volser(vlbl->f.volser);
f66865
 
f66865
     run_eckd_boot_script(bmt_block_nr, s1b_block_nr);
f66865
@@ -400,7 +411,8 @@ static void ipl_eckd(void)
f66865
     read_block(0, mbr, "Cannot read block 0 on DASD");
f66865
 
f66865
     if (magic_match(mbr->magic, IPL1_MAGIC)) {
f66865
-        ipl_eckd_cdl(); /* no return */
f66865
+        ipl_eckd_cdl();         /* only returns in case of error */
f66865
+        return;
f66865
     }
f66865
 
f66865
     /* LDL/CMS? */
f66865
@@ -827,5 +839,5 @@ void zipl_load(void)
f66865
         panic("\n! Unknown IPL device type !\n");
f66865
     }
f66865
 
f66865
-    panic("\n* this can never happen *\n");
f66865
+    sclp_print("zIPL load failed.\n");
f66865
 }
f66865
diff --git a/pc-bios/s390-ccw/main.c b/pc-bios/s390-ccw/main.c
f66865
index 5c1c98341d..b5c721c395 100644
f66865
--- a/pc-bios/s390-ccw/main.c
f66865
+++ b/pc-bios/s390-ccw/main.c
f66865
@@ -249,7 +249,7 @@ static void ipl_boot_device(void)
f66865
         break;
f66865
     case CU_TYPE_VIRTIO:
f66865
         if (virtio_setup() == 0) {
f66865
-            zipl_load(); /* no return */
f66865
+            zipl_load();             /* Only returns in case of errors */
f66865
         }
f66865
         break;
f66865
     default:
f66865
-- 
f66865
2.27.0
f66865