Received: from eggs.gnu.org ([209.51.188.92]:39209) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hEvG1-00030D-Mb for qemu-devel@nongnu.org; Fri, 12 Apr 2019 08:26:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hEvG0-0002jL-Nl for qemu-devel@nongnu.org; Fri, 12 Apr 2019 08:26:13 -0400 From: Thomas Huth Date: Fri, 12 Apr 2019 14:25:19 +0200 Message-Id: <20190412122523.24111-14-thuth@redhat.com> In-Reply-To: <20190412122523.24111-1-thuth@redhat.com> References: <20190412122523.24111-1-thuth@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PULL SUBSYSTEM s390-ccw-bios 13/17] s390-bios: Use control unit type to determine boot method List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: cohuck@redhat.com, qemu-s390x@nongnu.org Cc: qemu-devel@nongnu.org, jjherne@linux.ibm.com, borntraeger@de.ibm.com From: "Jason J. Herne" 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 dev= ice here as well. Since we have to call enable_subchannel() in main now, might as well remove that call from virtio.c : run_ccw(). This requires adding some additional enable_subchannel calls to not break calls to virtio_is_supported(). Signed-off-by: Jason J. Herne Reviewed-by: Cornelia Huck Reviewed-by: Thomas Huth Message-Id: <1554388475-18329-14-git-send-email-jjherne@linux.ibm.com> Signed-off-by: Thomas Huth --- pc-bios/s390-ccw/main.c | 16 ++++++++++++++-- pc-bios/s390-ccw/netmain.c | 1 + pc-bios/s390-ccw/virtio.c | 1 - 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/pc-bios/s390-ccw/main.c b/pc-bios/s390-ccw/main.c index d3a161c685..57a10138c6 100644 --- a/pc-bios/s390-ccw/main.c +++ b/pc-bios/s390-ccw/main.c @@ -76,6 +76,7 @@ static bool find_subch(int dev_no) /* Skip net devices since no IPLB is created and therefore no * network bootloader has been loaded */ + enable_subchannel(blk_schid); if (virtio_is_supported(blk_schid) && virtio_get_device_type() =3D=3D VIRTIO_ID_NET && dev_no < 0)= { continue; @@ -198,13 +199,24 @@ static void virtio_setup(void) =20 int main(void) { + uint16_t cutype; + sclp_setup(); css_setup(); boot_setup(); find_boot_device(); + enable_subchannel(blk_schid); =20 - virtio_setup(); - zipl_load(); /* no return */ + cutype =3D 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", cuty= pe); + panic(""); + } =20 panic("Failed to load OS from hard disk\n"); return 0; /* make compiler happy */ diff --git a/pc-bios/s390-ccw/netmain.c b/pc-bios/s390-ccw/netmain.c index 5189c0fc39..f3542cb2cf 100644 --- a/pc-bios/s390-ccw/netmain.c +++ b/pc-bios/s390-ccw/netmain.c @@ -476,6 +476,7 @@ static bool find_net_dev(Schib *schib, int dev_no) if (!schib->pmcw.dnv) { continue; } + enable_subchannel(net_schid); if (!virtio_is_supported(net_schid)) { continue; } diff --git a/pc-bios/s390-ccw/virtio.c b/pc-bios/s390-ccw/virtio.c index 35278eaee1..fb40ca9828 100644 --- a/pc-bios/s390-ccw/virtio.c +++ b/pc-bios/s390-ccw/virtio.c @@ -102,7 +102,6 @@ static int run_ccw(VDev *vdev, int cmd, void *ptr, in= t len, bool sli) ccw.flags |=3D CCW_FLAG_SLI; } =20 - enable_subchannel(vdev->schid); return do_cio(vdev->schid, vdev->senseid.cu_type, ptr2u32(&ccw), CCW= _FMT1); } =20 --=20 2.21.0