[Qemu-devel] [PATCH 13/15] s390-bios: Use control unit type to determine boot method

Jason J. Herne posted 15 patches 7 years ago
Maintainers: Thomas Huth <thuth@redhat.com>, Paolo Bonzini <pbonzini@redhat.com>, Cornelia Huck <cohuck@redhat.com>, David Hildenbrand <david@redhat.com>, Alex Williamson <alex.williamson@redhat.com>, Farhan Ali <alifm@linux.ibm.com>, Richard Henderson <rth@twiddle.net>, Christian Borntraeger <borntraeger@de.ibm.com>, Eric Farman <farman@linux.ibm.com>, Halil Pasic <pasic@linux.ibm.com>, Laurent Vivier <lvivier@redhat.com>
There is a newer version of this series
[Qemu-devel] [PATCH 13/15] s390-bios: Use control unit type to determine boot method
Posted by Jason J. Herne 7 years ago
The boot method is different depending on which device type we are
booting from. Let's examine the control unit type to determine if we're
a virtio device. We'll eventually add a case to check for a real dasd device
here as well.

Signed-off-by: Jason J. Herne <jjherne@linux.ibm.com>
---
 pc-bios/s390-ccw/main.c | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/pc-bios/s390-ccw/main.c b/pc-bios/s390-ccw/main.c
index fa90aa3..5ee02c3 100644
--- a/pc-bios/s390-ccw/main.c
+++ b/pc-bios/s390-ccw/main.c
@@ -200,13 +200,24 @@ static void virtio_setup(void)
 
 int main(void)
 {
+    uint16_t cutype;
+
     sclp_setup();
     css_setup();
     boot_setup();
     find_boot_device();
+    enable_subchannel(blk_schid);
 
-    virtio_setup();
-    zipl_load(); /* no return */
+    cutype = cu_type(blk_schid) ;
+    switch (cutype) {
+    case CU_TYPE_VIRTIO:
+        virtio_setup();
+        zipl_load(); /* no return */
+        break;
+    default:
+        print_int("Attempting to boot from unexpected device type", cutype);
+        panic("");
+    }
 
     panic("Failed to load OS from hard disk\n");
     return 0; /* make compiler happy */
-- 
2.7.4


Re: [Qemu-devel] [PATCH 13/15] s390-bios: Use control unit type to determine boot method
Posted by Cornelia Huck 7 years ago
On Tue, 29 Jan 2019 08:29:20 -0500
"Jason J. Herne" <jjherne@linux.ibm.com> wrote:

> The boot method is different depending on which device type we are
> booting from. Let's examine the control unit type to determine if we're
> a virtio device. We'll eventually add a case to check for a real dasd device
> here as well.
> 
> Signed-off-by: Jason J. Herne <jjherne@linux.ibm.com>
> ---
>  pc-bios/s390-ccw/main.c | 15 +++++++++++++--
>  1 file changed, 13 insertions(+), 2 deletions(-)
> 
> diff --git a/pc-bios/s390-ccw/main.c b/pc-bios/s390-ccw/main.c
> index fa90aa3..5ee02c3 100644
> --- a/pc-bios/s390-ccw/main.c
> +++ b/pc-bios/s390-ccw/main.c
> @@ -200,13 +200,24 @@ static void virtio_setup(void)
>  
>  int main(void)
>  {
> +    uint16_t cutype;
> +
>      sclp_setup();
>      css_setup();
>      boot_setup();
>      find_boot_device();
> +    enable_subchannel(blk_schid);

You even enable the subchannel here already -- no need to do that in
run_ccw again ;)

>  
> -    virtio_setup();
> -    zipl_load(); /* no return */
> +    cutype = cu_type(blk_schid) ;

extra ' '

> +    switch (cutype) {
> +    case CU_TYPE_VIRTIO:
> +        virtio_setup();
> +        zipl_load(); /* no return */
> +        break;
> +    default:
> +        print_int("Attempting to boot from unexpected device type", cutype);
> +        panic("");
> +    }
>  
>      panic("Failed to load OS from hard disk\n");
>      return 0; /* make compiler happy */