From nobody Mon Nov 10 12:49:02 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1556199392; cv=none; d=zoho.com; s=zohoarc; b=Zw53TyI9SYa6nc7IQtAvZKb8JZItv4A+oZ6V4gzeE3NpZ4r7xAtdc9kYV4noOBC8e2pktn3ZNg5GXUwkwsWOTc+DVy51J5kPF2I6TFrkgHJ0Ky/DAW/b7GR+eq21Le2qbfVZU1iz2fdoHVWyiLykypVVGn4v4n94qvnaTFKmZGw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1556199392; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=89LWOyPx0kYcPE66Bfsog16oWHGG1ERp340/+TSjVDQ=; b=K1FQiaMVakIGnoCzqKZCJVyIlwFSW6DlqN/4XHMaRITaghHRhi8020nIElX+vNz1xv83VMavPaFJ4z3DBBKy/+AYJKgi1p5anzdxo4fRS/zYXR937fd48UKWkGWN2aOsLOPeODGEjfBAyGkbt6qcm9kWkCac0ztIBqX4R9fAaNU= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (209.51.188.17 [209.51.188.17]) by mx.zohomail.com with SMTPS id 1556199392727757.3834545887337; Thu, 25 Apr 2019 06:36:32 -0700 (PDT) Received: from localhost ([127.0.0.1]:57318 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hJeXw-0006Xo-3i for importer@patchew.org; Thu, 25 Apr 2019 09:36:16 -0400 Received: from eggs.gnu.org ([209.51.188.92]:58577) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hJeKB-0003U0-LP for qemu-devel@nongnu.org; Thu, 25 Apr 2019 09:22:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hJeKA-0003oU-Dp for qemu-devel@nongnu.org; Thu, 25 Apr 2019 09:22:03 -0400 Received: from mx1.redhat.com ([209.132.183.28]:3015) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hJeKA-0003nd-5r; Thu, 25 Apr 2019 09:22:02 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 6AA9A3158797; Thu, 25 Apr 2019 13:22:01 +0000 (UTC) Received: from localhost (dhcp-192-187.str.redhat.com [10.33.192.187]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D3AF11796F; Thu, 25 Apr 2019 13:22:00 +0000 (UTC) From: Cornelia Huck To: Peter Maydell Date: Thu, 25 Apr 2019 15:21:26 +0200 Message-Id: <20190425132134.2839-12-cohuck@redhat.com> In-Reply-To: <20190425132134.2839-1-cohuck@redhat.com> References: <20190425132134.2839-1-cohuck@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.41]); Thu, 25 Apr 2019 13:22:01 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 11/19] s390-bios: Factor finding boot device out of virtio code path X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Jason J. Herne" , qemu-s390x@nongnu.org, qemu-devel@nongnu.org, Thomas Huth Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: "Jason J. Herne" Make a new routine find_boot_device to locate the boot device for all cases, not just virtio. The error message for the case where no boot device has been specified and a suitable boot device cannot be auto detected was specific to virtio devices. We update this message to remove virtio specific wording. Signed-off-by: Jason J. Herne Reviewed-by: Farhan Ali Reviewed-by: Cornelia Huck Message-Id: <1554388475-18329-12-git-send-email-jjherne@linux.ibm.com> Signed-off-by: Thomas Huth --- pc-bios/s390-ccw/main.c | 85 ++++++++++++++++++++++------------------ tests/boot-serial-test.c | 2 +- 2 files changed, 47 insertions(+), 40 deletions(-) diff --git a/pc-bios/s390-ccw/main.c b/pc-bios/s390-ccw/main.c index d04ea8972a0c..d3a161c68546 100644 --- a/pc-bios/s390-ccw/main.c +++ b/pc-bios/s390-ccw/main.c @@ -58,17 +58,18 @@ unsigned int get_loadparm_index(void) * NOTE: The global variable blk_schid is updated to contain the subchannel * information. */ -static bool find_dev(Schib *schib, int dev_no) +static bool find_subch(int dev_no) { + Schib schib; int i, r; =20 for (i =3D 0; i < 0x10000; i++) { blk_schid.sch_no =3D i; - r =3D stsch_err(blk_schid, schib); + r =3D stsch_err(blk_schid, &schib); if ((r =3D=3D 3) || (r =3D=3D -EIO)) { break; } - if (!schib->pmcw.dnv) { + if (!schib.pmcw.dnv) { continue; } =20 @@ -80,7 +81,7 @@ static bool find_dev(Schib *schib, int dev_no) continue; } =20 - if ((dev_no < 0) || (schib->pmcw.dev =3D=3D dev_no)) { + if ((dev_no < 0) || (schib.pmcw.dev =3D=3D dev_no)) { return true; } } @@ -136,56 +137,61 @@ static void boot_setup(void) have_iplb =3D store_iplb(&iplb); } =20 -static void virtio_setup(void) +static void find_boot_device(void) { - Schib schib; - int ssid; - bool found =3D false; - uint16_t dev_no; VDev *vdev =3D virtio_get_device(); - QemuIplParameters *early_qipl =3D (QemuIplParameters *)QIPL_ADDRESS; - - memcpy(&qipl, early_qipl, sizeof(QemuIplParameters)); + int ssid; + bool found; =20 - if (have_iplb) { - switch (iplb.pbt) { - case S390_IPL_TYPE_CCW: - dev_no =3D iplb.ccw.devno; - debug_print_int("device no. ", dev_no); - blk_schid.ssid =3D iplb.ccw.ssid & 0x3; - debug_print_int("ssid ", blk_schid.ssid); - found =3D find_dev(&schib, dev_no); - break; - case S390_IPL_TYPE_QEMU_SCSI: - vdev->scsi_device_selected =3D true; - vdev->selected_scsi_device.channel =3D iplb.scsi.channel; - vdev->selected_scsi_device.target =3D iplb.scsi.target; - vdev->selected_scsi_device.lun =3D iplb.scsi.lun; - blk_schid.ssid =3D iplb.scsi.ssid & 0x3; - found =3D find_dev(&schib, iplb.scsi.devno); - break; - default: - panic("List-directed IPL not supported yet!\n"); - } - menu_setup(); - } else { + if (!have_iplb) { for (ssid =3D 0; ssid < 0x3; ssid++) { blk_schid.ssid =3D ssid; - found =3D find_dev(&schib, -1); + found =3D find_subch(-1); if (found) { - break; + return; } } + panic("Could not find a suitable boot device (none specified)\n"); + } + + switch (iplb.pbt) { + case S390_IPL_TYPE_CCW: + debug_print_int("device no. ", iplb.ccw.devno); + blk_schid.ssid =3D iplb.ccw.ssid & 0x3; + debug_print_int("ssid ", blk_schid.ssid); + found =3D find_subch(iplb.ccw.devno); + break; + case S390_IPL_TYPE_QEMU_SCSI: + vdev->scsi_device_selected =3D true; + vdev->selected_scsi_device.channel =3D iplb.scsi.channel; + vdev->selected_scsi_device.target =3D iplb.scsi.target; + vdev->selected_scsi_device.lun =3D iplb.scsi.lun; + blk_schid.ssid =3D iplb.scsi.ssid & 0x3; + found =3D find_subch(iplb.scsi.devno); + break; + default: + panic("List-directed IPL not supported yet!\n"); } =20 - IPL_assert(found, "No virtio device found"); + IPL_assert(found, "Boot device not found\n"); +} + +static void virtio_setup(void) +{ + VDev *vdev =3D virtio_get_device(); + QemuIplParameters *early_qipl =3D (QemuIplParameters *)QIPL_ADDRESS; + + memcpy(&qipl, early_qipl, sizeof(QemuIplParameters)); + + if (have_iplb) { + menu_setup(); + } =20 if (virtio_get_device_type() =3D=3D VIRTIO_ID_NET) { sclp_print("Network boot device detected\n"); vdev->netboot_start_addr =3D qipl.netboot_start_addr; } else { virtio_blk_setup_device(blk_schid); - IPL_assert(virtio_ipl_disk_is_valid(), "No valid IPL device detect= ed"); } } @@ -195,8 +201,9 @@ int main(void) sclp_setup(); css_setup(); boot_setup(); - virtio_setup(); + find_boot_device(); =20 + virtio_setup(); zipl_load(); /* no return */ =20 panic("Failed to load OS from hard disk\n"); diff --git a/tests/boot-serial-test.c b/tests/boot-serial-test.c index c591748aaf00..24852d4c7d0b 100644 --- a/tests/boot-serial-test.c +++ b/tests/boot-serial-test.c @@ -114,7 +114,7 @@ static testdef_t tests[] =3D { { "sparc", "SS-4", "", "MB86904" }, { "sparc", "SS-600MP", "", "TMS390Z55" }, { "sparc64", "sun4u", "", "UltraSPARC" }, - { "s390x", "s390-ccw-virtio", "", "virtio device" }, + { "s390x", "s390-ccw-virtio", "", "device" }, { "m68k", "mcf5208evb", "", "TT", sizeof(kernel_mcf5208), kernel_mcf52= 08 }, { "microblaze", "petalogix-s3adsp1800", "", "TT", sizeof(kernel_pls3adsp1800), kernel_pls3adsp1800 }, --=20 2.17.2