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