From nobody Mon Oct 13 23:47:35 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=linux.ibm.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1552318900706448.38371334322267; Mon, 11 Mar 2019 08:41:40 -0700 (PDT) Received: from localhost ([127.0.0.1]:35438 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h3N3Z-0004mU-JM for importer@patchew.org; Mon, 11 Mar 2019 11:41:37 -0400 Received: from eggs.gnu.org ([209.51.188.92]:42602) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h3MwY-0006jc-Gz for qemu-devel@nongnu.org; Mon, 11 Mar 2019 11:34:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h3MkQ-0006y6-Bp for qemu-devel@nongnu.org; Mon, 11 Mar 2019 11:21:51 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:42982 helo=mx0a-001b2d01.pphosted.com) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1h3MkQ-0006xa-5o for qemu-devel@nongnu.org; Mon, 11 Mar 2019 11:21:50 -0400 Received: from pps.filterd (m0098414.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x2BFLnUI084261 for ; Mon, 11 Mar 2019 11:21:49 -0400 Received: from e12.ny.us.ibm.com (e12.ny.us.ibm.com [129.33.205.202]) by mx0b-001b2d01.pphosted.com with ESMTP id 2r5sv21a8p-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 11 Mar 2019 11:21:49 -0400 Received: from localhost by e12.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 11 Mar 2019 15:21:46 -0000 Received: from b01cxnp23034.gho.pok.ibm.com (9.57.198.29) by e12.ny.us.ibm.com (146.89.104.199) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Mon, 11 Mar 2019 15:21:42 -0000 Received: from b01ledav004.gho.pok.ibm.com (b01ledav004.gho.pok.ibm.com [9.57.199.109]) by b01cxnp23034.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x2BFLel120971746 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 11 Mar 2019 15:21:40 GMT Received: from b01ledav004.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 44D0A11206D; Mon, 11 Mar 2019 15:21:40 +0000 (GMT) Received: from b01ledav004.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 11781112065; Mon, 11 Mar 2019 15:21:40 +0000 (GMT) Received: from jason-laptop.endicott.ibm.com (unknown [9.60.75.251]) by b01ledav004.gho.pok.ibm.com (Postfix) with ESMTP; Mon, 11 Mar 2019 15:21:39 +0000 (GMT) From: "Jason J. Herne" To: qemu-devel@nongnu.org, qemu-s390x@nongnu.org, cohuck@redhat.com, thuth@redhat.com, pasic@linux.ibm.com, alifm@linux.ibm.com, borntraeger@de.ibm.com Date: Mon, 11 Mar 2019 11:21:23 -0400 X-Mailer: git-send-email 2.7.4 In-Reply-To: <1552317693-21979-1-git-send-email-jjherne@linux.ibm.com> References: <1552317693-21979-1-git-send-email-jjherne@linux.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 19031115-0060-0000-0000-0000031A5954 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00010739; HX=3.00000242; KW=3.00000007; PH=3.00000004; SC=3.00000281; SDB=6.01172861; UDB=6.00613172; IPR=6.00953516; MB=3.00025928; MTD=3.00000008; XFM=3.00000015; UTC=2019-03-11 15:21:44 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19031115-0061-0000-0000-0000489312BA Message-Id: <1552317693-21979-6-git-send-email-jjherne@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-03-11_12:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1903110110 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] X-Received-From: 148.163.158.5 Subject: [Qemu-devel] [PATCH v4 05/15] 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: , 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" 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 --- 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 7e3f65e..5b2b941 100644 --- a/pc-bios/s390-ccw/main.c +++ b/pc-bios/s390-ccw/main.c @@ -55,17 +55,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 @@ -77,7 +78,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; } } @@ -133,56 +134,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"); } } @@ -192,8 +198,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 58a48f3..9daf2cb 100644 --- a/tests/boot-serial-test.c +++ b/tests/boot-serial-test.c @@ -112,7 +112,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.7.4