|
|
8fced6 |
From 911dc631f9ab68c6acfd4b401fbcfaa3b58a4fb6 Mon Sep 17 00:00:00 2001
|
|
|
8fced6 |
From: Thomas Huth <thuth@redhat.com>
|
|
|
8fced6 |
Date: Fri, 9 Oct 2020 10:08:46 -0400
|
|
|
8fced6 |
Subject: [PATCH 10/14] pc-bios/s390-ccw: Scan through all devices if no boot
|
|
|
8fced6 |
device specified
|
|
|
8fced6 |
|
|
|
8fced6 |
RH-Author: Thomas Huth <thuth@redhat.com>
|
|
|
8fced6 |
Message-id: <20201009100849.264994-7-thuth@redhat.com>
|
|
|
8fced6 |
Patchwork-id: 98600
|
|
|
8fced6 |
O-Subject: [RHEL-8.4.0 qemu-kvm PATCH 6/9] pc-bios/s390-ccw: Scan through all devices if no boot device specified
|
|
|
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 no boot device has been specified (via "bootindex=..."), the s390-ccw
|
|
|
8fced6 |
bios scans through all devices to find a bootable device. But so far, it
|
|
|
8fced6 |
stops at the very first block device (including virtio-scsi controllers
|
|
|
8fced6 |
without attached devices) that it finds, no matter whether it is bootable
|
|
|
8fced6 |
or not. That leads to some weird situatation where it is e.g. possible
|
|
|
8fced6 |
to boot via:
|
|
|
8fced6 |
|
|
|
8fced6 |
qemu-system-s390x -hda /path/to/disk.qcow2
|
|
|
8fced6 |
|
|
|
8fced6 |
but not if there is e.g. a virtio-scsi controller specified before:
|
|
|
8fced6 |
|
|
|
8fced6 |
qemu-system-s390x -device virtio-scsi -hda /path/to/disk.qcow2
|
|
|
8fced6 |
|
|
|
8fced6 |
While using "bootindex=..." is clearly the preferred way of booting
|
|
|
8fced6 |
on s390x, we still can make the life for the users at least a little
|
|
|
8fced6 |
bit easier if we look at all available devices to find a bootable one.
|
|
|
8fced6 |
|
|
|
8fced6 |
Buglink: https://bugzilla.redhat.com/show_bug.cgi?id=1846975
|
|
|
8fced6 |
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
|
|
|
8fced6 |
Message-Id: <20200806105349.632-7-thuth@redhat.com>
|
|
|
8fced6 |
Signed-off-by: Thomas Huth <thuth@redhat.com>
|
|
|
8fced6 |
(cherry picked from commit 869d0e2f593dd37297c366203f006b9acd1b7b45)
|
|
|
8fced6 |
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
|
|
|
8fced6 |
---
|
|
|
8fced6 |
pc-bios/s390-ccw/main.c | 46 +++++++++++++++++++++++++++--------------
|
|
|
8fced6 |
1 file changed, 31 insertions(+), 15 deletions(-)
|
|
|
8fced6 |
|
|
|
8fced6 |
diff --git a/pc-bios/s390-ccw/main.c b/pc-bios/s390-ccw/main.c
|
|
|
8fced6 |
index 456733fbee..5c1c98341d 100644
|
|
|
8fced6 |
--- a/pc-bios/s390-ccw/main.c
|
|
|
8fced6 |
+++ b/pc-bios/s390-ccw/main.c
|
|
|
8fced6 |
@@ -191,20 +191,8 @@ static void boot_setup(void)
|
|
|
8fced6 |
static void find_boot_device(void)
|
|
|
8fced6 |
{
|
|
|
8fced6 |
VDev *vdev = virtio_get_device();
|
|
|
8fced6 |
- int ssid;
|
|
|
8fced6 |
bool found;
|
|
|
8fced6 |
|
|
|
8fced6 |
- if (!have_iplb) {
|
|
|
8fced6 |
- for (ssid = 0; ssid < 0x3; ssid++) {
|
|
|
8fced6 |
- blk_schid.ssid = ssid;
|
|
|
8fced6 |
- found = find_subch(-1);
|
|
|
8fced6 |
- if (found) {
|
|
|
8fced6 |
- return;
|
|
|
8fced6 |
- }
|
|
|
8fced6 |
- }
|
|
|
8fced6 |
- panic("Could not find a suitable boot device (none specified)\n");
|
|
|
8fced6 |
- }
|
|
|
8fced6 |
-
|
|
|
8fced6 |
switch (iplb.pbt) {
|
|
|
8fced6 |
case S390_IPL_TYPE_CCW:
|
|
|
8fced6 |
debug_print_int("device no. ", iplb.ccw.devno);
|
|
|
8fced6 |
@@ -270,14 +258,42 @@ static void ipl_boot_device(void)
|
|
|
8fced6 |
}
|
|
|
8fced6 |
}
|
|
|
8fced6 |
|
|
|
8fced6 |
+/*
|
|
|
8fced6 |
+ * No boot device has been specified, so we have to scan through the
|
|
|
8fced6 |
+ * channels to find one.
|
|
|
8fced6 |
+ */
|
|
|
8fced6 |
+static void probe_boot_device(void)
|
|
|
8fced6 |
+{
|
|
|
8fced6 |
+ int ssid, sch_no, ret;
|
|
|
8fced6 |
+
|
|
|
8fced6 |
+ for (ssid = 0; ssid < 0x3; ssid++) {
|
|
|
8fced6 |
+ blk_schid.ssid = ssid;
|
|
|
8fced6 |
+ for (sch_no = 0; sch_no < 0x10000; sch_no++) {
|
|
|
8fced6 |
+ ret = is_dev_possibly_bootable(-1, sch_no);
|
|
|
8fced6 |
+ if (ret < 0) {
|
|
|
8fced6 |
+ break;
|
|
|
8fced6 |
+ }
|
|
|
8fced6 |
+ if (ret == true) {
|
|
|
8fced6 |
+ ipl_boot_device(); /* Only returns if unsuccessful */
|
|
|
8fced6 |
+ }
|
|
|
8fced6 |
+ }
|
|
|
8fced6 |
+ }
|
|
|
8fced6 |
+
|
|
|
8fced6 |
+ sclp_print("Could not find a suitable boot device (none specified)\n");
|
|
|
8fced6 |
+}
|
|
|
8fced6 |
+
|
|
|
8fced6 |
int main(void)
|
|
|
8fced6 |
{
|
|
|
8fced6 |
sclp_setup();
|
|
|
8fced6 |
css_setup();
|
|
|
8fced6 |
boot_setup();
|
|
|
8fced6 |
- find_boot_device();
|
|
|
8fced6 |
- enable_subchannel(blk_schid);
|
|
|
8fced6 |
- ipl_boot_device();
|
|
|
8fced6 |
+ if (have_iplb) {
|
|
|
8fced6 |
+ find_boot_device();
|
|
|
8fced6 |
+ enable_subchannel(blk_schid);
|
|
|
8fced6 |
+ ipl_boot_device();
|
|
|
8fced6 |
+ } else {
|
|
|
8fced6 |
+ probe_boot_device();
|
|
|
8fced6 |
+ }
|
|
|
8fced6 |
|
|
|
8fced6 |
panic("Failed to load OS from hard disk\n");
|
|
|
8fced6 |
return 0; /* make compiler happy */
|
|
|
8fced6 |
--
|
|
|
8fced6 |
2.27.0
|
|
|
8fced6 |
|