Blame SOURCES/kvm-s390-bios-Use-control-unit-type-to-determine-boot-me.patch

016a62
From 4b0f36b50e79fe6d345c85f60f12508c17c44f1d Mon Sep 17 00:00:00 2001
016a62
From: Thomas Huth <thuth@redhat.com>
016a62
Date: Mon, 14 Oct 2019 10:06:42 +0100
016a62
Subject: [PATCH 17/21] s390-bios: Use control unit type to determine boot
016a62
 method
016a62
016a62
RH-Author: Thomas Huth <thuth@redhat.com>
016a62
Message-id: <20191014100645.22862-15-thuth@redhat.com>
016a62
Patchwork-id: 91785
016a62
O-Subject: [RHEL-8.2.0 qemu-kvm PATCH v2 14/17] s390-bios: Use control unit type to determine boot method
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
The boot method is different depending on which device type we are
016a62
booting from. Let's examine the control unit type to determine if we're
016a62
a virtio device. We'll eventually add a case to check for a real dasd device
016a62
here as well.
016a62
016a62
Since we have to call enable_subchannel() in main now, might as well
016a62
remove that call from virtio.c : run_ccw(). This requires adding some
016a62
additional enable_subchannel calls to not break calls to
016a62
virtio_is_supported().
016a62
016a62
Signed-off-by: Jason J. Herne <jjherne@linux.ibm.com>
016a62
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
016a62
Reviewed-by: Thomas Huth <thuth@redhat.com>
016a62
Message-Id: <1554388475-18329-14-git-send-email-jjherne@linux.ibm.com>
016a62
Signed-off-by: Thomas Huth <thuth@redhat.com>
016a62
(cherry picked from commit 3668cb7ce864ee9351d5d20a1ec6b427cd0b3be4)
016a62
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
016a62
---
016a62
 pc-bios/s390-ccw/main.c    | 16 ++++++++++++++--
016a62
 pc-bios/s390-ccw/netmain.c |  1 +
016a62
 pc-bios/s390-ccw/virtio.c  |  1 -
016a62
 3 files changed, 15 insertions(+), 3 deletions(-)
016a62
016a62
diff --git a/pc-bios/s390-ccw/main.c b/pc-bios/s390-ccw/main.c
016a62
index d3a161c..57a1013 100644
016a62
--- a/pc-bios/s390-ccw/main.c
016a62
+++ b/pc-bios/s390-ccw/main.c
016a62
@@ -76,6 +76,7 @@ static bool find_subch(int dev_no)
016a62
         /* Skip net devices since no IPLB is created and therefore no
016a62
          * network bootloader has been loaded
016a62
          */
016a62
+        enable_subchannel(blk_schid);
016a62
         if (virtio_is_supported(blk_schid) &&
016a62
             virtio_get_device_type() == VIRTIO_ID_NET && dev_no < 0) {
016a62
             continue;
016a62
@@ -198,13 +199,24 @@ static void virtio_setup(void)
016a62
 
016a62
 int main(void)
016a62
 {
016a62
+    uint16_t cutype;
016a62
+
016a62
     sclp_setup();
016a62
     css_setup();
016a62
     boot_setup();
016a62
     find_boot_device();
016a62
+    enable_subchannel(blk_schid);
016a62
 
016a62
-    virtio_setup();
016a62
-    zipl_load(); /* no return */
016a62
+    cutype = cu_type(blk_schid);
016a62
+    switch (cutype) {
016a62
+    case CU_TYPE_VIRTIO:
016a62
+        virtio_setup();
016a62
+        zipl_load(); /* no return */
016a62
+        break;
016a62
+    default:
016a62
+        print_int("Attempting to boot from unexpected device type", cutype);
016a62
+        panic("");
016a62
+    }
016a62
 
016a62
     panic("Failed to load OS from hard disk\n");
016a62
     return 0; /* make compiler happy */
016a62
diff --git a/pc-bios/s390-ccw/netmain.c b/pc-bios/s390-ccw/netmain.c
016a62
index 4e1b8cf..69cf59d 100644
016a62
--- a/pc-bios/s390-ccw/netmain.c
016a62
+++ b/pc-bios/s390-ccw/netmain.c
016a62
@@ -304,6 +304,7 @@ static bool find_net_dev(Schib *schib, int dev_no)
016a62
         if (!schib->pmcw.dnv) {
016a62
             continue;
016a62
         }
016a62
+        enable_subchannel(net_schid);
016a62
         if (!virtio_is_supported(net_schid)) {
016a62
             continue;
016a62
         }
016a62
diff --git a/pc-bios/s390-ccw/virtio.c b/pc-bios/s390-ccw/virtio.c
016a62
index 35278eae..fb40ca9 100644
016a62
--- a/pc-bios/s390-ccw/virtio.c
016a62
+++ b/pc-bios/s390-ccw/virtio.c
016a62
@@ -102,7 +102,6 @@ static int run_ccw(VDev *vdev, int cmd, void *ptr, int len, bool sli)
016a62
         ccw.flags |= CCW_FLAG_SLI;
016a62
     }
016a62
 
016a62
-    enable_subchannel(vdev->schid);
016a62
     return do_cio(vdev->schid, vdev->senseid.cu_type, ptr2u32(&ccw), CCW_FMT1);
016a62
 }
016a62
 
016a62
-- 
016a62
1.8.3.1
016a62