diff mbox series

[v3,13/16] s390-bios: Use control unit type to determine boot method

Message ID 1551466776-29123-14-git-send-email-jjherne@linux.ibm.com (mailing list archive)
State New, archived
Headers show
Series s390: vfio-ccw dasd ipl support | expand

Commit Message

Jason J. Herne March 1, 2019, 6:59 p.m. UTC
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.

Since we have to call enable_subchannel() in main now, might as well
remove that call from virtio.c : run_ccw().

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

Comments

Cornelia Huck March 5, 2019, 12:27 p.m. UTC | #1
On Fri,  1 Mar 2019 13:59:33 -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.
> 
> Since we have to call enable_subchannel() in main now, might as well
> remove that call from virtio.c : run_ccw().

Any reason you cannot add the enable_subchannel() in the previous
patch? Then you never need to introduce it in run_ccw() :)

> 
> 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 0670c14..ed79b7a 100644
> --- a/pc-bios/s390-ccw/main.c
> +++ b/pc-bios/s390-ccw/main.c
> @@ -198,13 +198,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 */
Jason J. Herne March 7, 2019, 4:27 p.m. UTC | #2
On 3/5/19 7:27 AM, Cornelia Huck wrote:
> On Fri,  1 Mar 2019 13:59:33 -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.
>>
>> Since we have to call enable_subchannel() in main now, might as well
>> remove that call from virtio.c : run_ccw().
> 
> Any reason you cannot add the enable_subchannel() in the previous
> patch? Then you never need to introduce it in run_ccw() :)
> 

Just for clarity, the enablement of the subchannel has always been done in run_ccw. I 
merely encapsulated the logic into a function in patch #7. I do end up removing it here in 
#13, but this will actually break the netboot case I pointed out in my previous reply.
I agree that we can remove the call to enable_subchannel here if we add it to 
find_net_dev() but it is not a matter of never having introduced it in the first place.
diff mbox series

Patch

diff --git a/pc-bios/s390-ccw/main.c b/pc-bios/s390-ccw/main.c
index 0670c14..ed79b7a 100644
--- a/pc-bios/s390-ccw/main.c
+++ b/pc-bios/s390-ccw/main.c
@@ -198,13 +198,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 */