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

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