yeahuh / rpms / qemu-kvm

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