|
|
016a62 |
From e9b154b1297ac5aff8737dde61b6793fcd7c0a69 Mon Sep 17 00:00:00 2001
|
|
|
016a62 |
From: Thomas Huth <thuth@redhat.com>
|
|
|
016a62 |
Date: Mon, 14 Oct 2019 10:06:40 +0100
|
|
|
016a62 |
Subject: [PATCH 15/21] s390-bios: Factor finding boot device out of virtio
|
|
|
016a62 |
code path
|
|
|
016a62 |
|
|
|
016a62 |
RH-Author: Thomas Huth <thuth@redhat.com>
|
|
|
016a62 |
Message-id: <20191014100645.22862-13-thuth@redhat.com>
|
|
|
016a62 |
Patchwork-id: 91789
|
|
|
016a62 |
O-Subject: [RHEL-8.2.0 qemu-kvm PATCH v2 12/17] s390-bios: Factor finding boot device out of virtio code path
|
|
|
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 |
Make a new routine find_boot_device to locate the boot device for all
|
|
|
016a62 |
cases, not just virtio.
|
|
|
016a62 |
|
|
|
016a62 |
The error message for the case where no boot device has been specified
|
|
|
016a62 |
and a suitable boot device cannot be auto detected was specific to
|
|
|
016a62 |
virtio devices. We update this message to remove virtio specific wording.
|
|
|
016a62 |
|
|
|
016a62 |
Signed-off-by: Jason J. Herne <jjherne@linux.ibm.com>
|
|
|
016a62 |
Reviewed-by: Farhan Ali <alifm@linux.ibm.com>
|
|
|
016a62 |
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
|
|
|
016a62 |
Message-Id: <1554388475-18329-12-git-send-email-jjherne@linux.ibm.com>
|
|
|
016a62 |
Signed-off-by: Thomas Huth <thuth@redhat.com>
|
|
|
016a62 |
(cherry picked from commit 7b361db37b18a75860decc0a85e0194936401d66)
|
|
|
016a62 |
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
|
|
|
016a62 |
|
|
|
016a62 |
Conflicts:
|
|
|
016a62 |
tests/boot-serial-test.c
|
|
|
016a62 |
(we're missing commit 052888f043ba in downstream)
|
|
|
016a62 |
Signed-off-by: Thomas Huth <thuth@redhat.com>
|
|
|
016a62 |
|
|
|
016a62 |
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
|
|
|
016a62 |
---
|
|
|
016a62 |
pc-bios/s390-ccw/main.c | 85 ++++++++++++++++++++++++++----------------------
|
|
|
016a62 |
tests/boot-serial-test.c | 2 +-
|
|
|
016a62 |
2 files changed, 47 insertions(+), 40 deletions(-)
|
|
|
016a62 |
|
|
|
016a62 |
diff --git a/pc-bios/s390-ccw/main.c b/pc-bios/s390-ccw/main.c
|
|
|
016a62 |
index d04ea89..d3a161c 100644
|
|
|
016a62 |
--- a/pc-bios/s390-ccw/main.c
|
|
|
016a62 |
+++ b/pc-bios/s390-ccw/main.c
|
|
|
016a62 |
@@ -58,17 +58,18 @@ unsigned int get_loadparm_index(void)
|
|
|
016a62 |
* NOTE: The global variable blk_schid is updated to contain the subchannel
|
|
|
016a62 |
* information.
|
|
|
016a62 |
*/
|
|
|
016a62 |
-static bool find_dev(Schib *schib, int dev_no)
|
|
|
016a62 |
+static bool find_subch(int dev_no)
|
|
|
016a62 |
{
|
|
|
016a62 |
+ Schib schib;
|
|
|
016a62 |
int i, r;
|
|
|
016a62 |
|
|
|
016a62 |
for (i = 0; i < 0x10000; i++) {
|
|
|
016a62 |
blk_schid.sch_no = i;
|
|
|
016a62 |
- r = stsch_err(blk_schid, schib);
|
|
|
016a62 |
+ r = stsch_err(blk_schid, &schib);
|
|
|
016a62 |
if ((r == 3) || (r == -EIO)) {
|
|
|
016a62 |
break;
|
|
|
016a62 |
}
|
|
|
016a62 |
- if (!schib->pmcw.dnv) {
|
|
|
016a62 |
+ if (!schib.pmcw.dnv) {
|
|
|
016a62 |
continue;
|
|
|
016a62 |
}
|
|
|
016a62 |
|
|
|
016a62 |
@@ -80,7 +81,7 @@ static bool find_dev(Schib *schib, int dev_no)
|
|
|
016a62 |
continue;
|
|
|
016a62 |
}
|
|
|
016a62 |
|
|
|
016a62 |
- if ((dev_no < 0) || (schib->pmcw.dev == dev_no)) {
|
|
|
016a62 |
+ if ((dev_no < 0) || (schib.pmcw.dev == dev_no)) {
|
|
|
016a62 |
return true;
|
|
|
016a62 |
}
|
|
|
016a62 |
}
|
|
|
016a62 |
@@ -136,56 +137,61 @@ static void boot_setup(void)
|
|
|
016a62 |
have_iplb = store_iplb(&iplb);
|
|
|
016a62 |
}
|
|
|
016a62 |
|
|
|
016a62 |
-static void virtio_setup(void)
|
|
|
016a62 |
+static void find_boot_device(void)
|
|
|
016a62 |
{
|
|
|
016a62 |
- Schib schib;
|
|
|
016a62 |
- int ssid;
|
|
|
016a62 |
- bool found = false;
|
|
|
016a62 |
- uint16_t dev_no;
|
|
|
016a62 |
VDev *vdev = virtio_get_device();
|
|
|
016a62 |
- QemuIplParameters *early_qipl = (QemuIplParameters *)QIPL_ADDRESS;
|
|
|
016a62 |
-
|
|
|
016a62 |
- memcpy(&qipl, early_qipl, sizeof(QemuIplParameters));
|
|
|
016a62 |
+ int ssid;
|
|
|
016a62 |
+ bool found;
|
|
|
016a62 |
|
|
|
016a62 |
- if (have_iplb) {
|
|
|
016a62 |
- switch (iplb.pbt) {
|
|
|
016a62 |
- case S390_IPL_TYPE_CCW:
|
|
|
016a62 |
- dev_no = iplb.ccw.devno;
|
|
|
016a62 |
- debug_print_int("device no. ", dev_no);
|
|
|
016a62 |
- blk_schid.ssid = iplb.ccw.ssid & 0x3;
|
|
|
016a62 |
- debug_print_int("ssid ", blk_schid.ssid);
|
|
|
016a62 |
- found = find_dev(&schib, dev_no);
|
|
|
016a62 |
- break;
|
|
|
016a62 |
- case S390_IPL_TYPE_QEMU_SCSI:
|
|
|
016a62 |
- vdev->scsi_device_selected = true;
|
|
|
016a62 |
- vdev->selected_scsi_device.channel = iplb.scsi.channel;
|
|
|
016a62 |
- vdev->selected_scsi_device.target = iplb.scsi.target;
|
|
|
016a62 |
- vdev->selected_scsi_device.lun = iplb.scsi.lun;
|
|
|
016a62 |
- blk_schid.ssid = iplb.scsi.ssid & 0x3;
|
|
|
016a62 |
- found = find_dev(&schib, iplb.scsi.devno);
|
|
|
016a62 |
- break;
|
|
|
016a62 |
- default:
|
|
|
016a62 |
- panic("List-directed IPL not supported yet!\n");
|
|
|
016a62 |
- }
|
|
|
016a62 |
- menu_setup();
|
|
|
016a62 |
- } else {
|
|
|
016a62 |
+ if (!have_iplb) {
|
|
|
016a62 |
for (ssid = 0; ssid < 0x3; ssid++) {
|
|
|
016a62 |
blk_schid.ssid = ssid;
|
|
|
016a62 |
- found = find_dev(&schib, -1);
|
|
|
016a62 |
+ found = find_subch(-1);
|
|
|
016a62 |
if (found) {
|
|
|
016a62 |
- break;
|
|
|
016a62 |
+ return;
|
|
|
016a62 |
}
|
|
|
016a62 |
}
|
|
|
016a62 |
+ panic("Could not find a suitable boot device (none specified)\n");
|
|
|
016a62 |
+ }
|
|
|
016a62 |
+
|
|
|
016a62 |
+ switch (iplb.pbt) {
|
|
|
016a62 |
+ case S390_IPL_TYPE_CCW:
|
|
|
016a62 |
+ debug_print_int("device no. ", iplb.ccw.devno);
|
|
|
016a62 |
+ blk_schid.ssid = iplb.ccw.ssid & 0x3;
|
|
|
016a62 |
+ debug_print_int("ssid ", blk_schid.ssid);
|
|
|
016a62 |
+ found = find_subch(iplb.ccw.devno);
|
|
|
016a62 |
+ break;
|
|
|
016a62 |
+ case S390_IPL_TYPE_QEMU_SCSI:
|
|
|
016a62 |
+ vdev->scsi_device_selected = true;
|
|
|
016a62 |
+ vdev->selected_scsi_device.channel = iplb.scsi.channel;
|
|
|
016a62 |
+ vdev->selected_scsi_device.target = iplb.scsi.target;
|
|
|
016a62 |
+ vdev->selected_scsi_device.lun = iplb.scsi.lun;
|
|
|
016a62 |
+ blk_schid.ssid = iplb.scsi.ssid & 0x3;
|
|
|
016a62 |
+ found = find_subch(iplb.scsi.devno);
|
|
|
016a62 |
+ break;
|
|
|
016a62 |
+ default:
|
|
|
016a62 |
+ panic("List-directed IPL not supported yet!\n");
|
|
|
016a62 |
}
|
|
|
016a62 |
|
|
|
016a62 |
- IPL_assert(found, "No virtio device found");
|
|
|
016a62 |
+ IPL_assert(found, "Boot device not found\n");
|
|
|
016a62 |
+}
|
|
|
016a62 |
+
|
|
|
016a62 |
+static void virtio_setup(void)
|
|
|
016a62 |
+{
|
|
|
016a62 |
+ VDev *vdev = virtio_get_device();
|
|
|
016a62 |
+ QemuIplParameters *early_qipl = (QemuIplParameters *)QIPL_ADDRESS;
|
|
|
016a62 |
+
|
|
|
016a62 |
+ memcpy(&qipl, early_qipl, sizeof(QemuIplParameters));
|
|
|
016a62 |
+
|
|
|
016a62 |
+ if (have_iplb) {
|
|
|
016a62 |
+ menu_setup();
|
|
|
016a62 |
+ }
|
|
|
016a62 |
|
|
|
016a62 |
if (virtio_get_device_type() == VIRTIO_ID_NET) {
|
|
|
016a62 |
sclp_print("Network boot device detected\n");
|
|
|
016a62 |
vdev->netboot_start_addr = qipl.netboot_start_addr;
|
|
|
016a62 |
} else {
|
|
|
016a62 |
virtio_blk_setup_device(blk_schid);
|
|
|
016a62 |
-
|
|
|
016a62 |
IPL_assert(virtio_ipl_disk_is_valid(), "No valid IPL device detected");
|
|
|
016a62 |
}
|
|
|
016a62 |
}
|
|
|
016a62 |
@@ -195,8 +201,9 @@ int main(void)
|
|
|
016a62 |
sclp_setup();
|
|
|
016a62 |
css_setup();
|
|
|
016a62 |
boot_setup();
|
|
|
016a62 |
- virtio_setup();
|
|
|
016a62 |
+ find_boot_device();
|
|
|
016a62 |
|
|
|
016a62 |
+ virtio_setup();
|
|
|
016a62 |
zipl_load(); /* no return */
|
|
|
016a62 |
|
|
|
016a62 |
panic("Failed to load OS from hard disk\n");
|
|
|
016a62 |
diff --git a/tests/boot-serial-test.c b/tests/boot-serial-test.c
|
|
|
016a62 |
index dc682c1..fe52668 100644
|
|
|
016a62 |
--- a/tests/boot-serial-test.c
|
|
|
016a62 |
+++ b/tests/boot-serial-test.c
|
|
|
016a62 |
@@ -97,7 +97,7 @@ static testdef_t tests[] = {
|
|
|
016a62 |
{ "sparc", "SS-600MP", "", "TMS390Z55" },
|
|
|
016a62 |
{ "sparc64", "sun4u", "", "UltraSPARC" },
|
|
|
016a62 |
{ "s390x", "s390-ccw-virtio",
|
|
|
016a62 |
- "-nodefaults -device sclpconsole,chardev=serial0", "virtio device" },
|
|
|
016a62 |
+ "-nodefaults -device sclpconsole,chardev=serial0", "device" },
|
|
|
016a62 |
{ "m68k", "mcf5208evb", "", "TT", sizeof(kernel_mcf5208), kernel_mcf5208 },
|
|
|
016a62 |
{ "microblaze", "petalogix-s3adsp1800", "", "TT",
|
|
|
016a62 |
sizeof(kernel_pls3adsp1800), kernel_pls3adsp1800 },
|
|
|
016a62 |
--
|
|
|
016a62 |
1.8.3.1
|
|
|
016a62 |
|