From nobody Sat May 18 04:30:08 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.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=1596713022; cv=none; d=zohomail.com; s=zohoarc; b=j/8B0DD8t5/ZvY5FWnCopax7rjruirlUkN7w2lzCZAzic5/38Vnr+8Ajzsan4pXsxeuyiPaQb+R4zl5hFEjHelH1IZr1TGiWhLbUjhrewGPW/FdD0UTWrvdqbHyOSFTG4TBrUhJ3VS38P9mS9sf6DyYuI+B2gsAuMrMeBiiy+84= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1596713022; h=Content-Type:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=h8EvJZ035WHxSXid+8QTy6DZMmKeb3NVgaxvccUMGDI=; b=nE65PS5OgvXUC+r1Qhi1f1jrVaqWNXrb2BzaH56Gk+5rNkXr9oEegfqNJryMnOFLQRJdrA0x9skla/MwNaW2Blxz01YUu94QyBhP3xt38303KnpdqGNrErkLR4j6KhR+MQnbDEkb4zPdw0B7KbnLeXOOpJW/BOjeJl5t1XyRqpA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.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 (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1596713022892643.7468319793554; Thu, 6 Aug 2020 04:23:42 -0700 (PDT) Received: from localhost ([::1]:55406 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k3dzp-0003ba-LV for importer@patchew.org; Thu, 06 Aug 2020 07:23:41 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42966) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k3dXI-0004TR-Lh for qemu-devel@nongnu.org; Thu, 06 Aug 2020 06:54:12 -0400 Received: from us-smtp-1.mimecast.com ([205.139.110.61]:60805 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1k3dXH-0000J7-29 for qemu-devel@nongnu.org; Thu, 06 Aug 2020 06:54:12 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-434-D84FcchVPb6dABKfuvEF1A-1; Thu, 06 Aug 2020 06:54:03 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id A3838100AA22; Thu, 6 Aug 2020 10:54:01 +0000 (UTC) Received: from thuth.com (ovpn-112-229.ams2.redhat.com [10.36.112.229]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0AE9D5F202; Thu, 6 Aug 2020 10:53:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1596711247; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:content-type:content-type:in-reply-to:in-reply-to: references:references; bh=h8EvJZ035WHxSXid+8QTy6DZMmKeb3NVgaxvccUMGDI=; b=Zj5CP2H2y/GWgNTaMnaZautxX5qxMms9HZXYkVWtEoYBk7UJ1vjNWju1xfmF8QedvRqjiQ cwuG7T9Zq6KcBbaEFJsjeRW1eRAV2Vgcx6BHEYQBMO0T7UKSsBKhsRWy/k2no2Z9YV5Tk2 P45E6J6JXm1g+eBJVV1+msI1IyL71Qs= X-MC-Unique: D84FcchVPb6dABKfuvEF1A-1 From: Thomas Huth To: qemu-s390x@nongnu.org, qemu-devel@nongnu.org Subject: [PATCH for-5.2 v2 1/9] pc-bios/s390-ccw/Makefile: Compile with -std=gnu99, -fwrapv and -fno-common Date: Thu, 6 Aug 2020 12:53:41 +0200 Message-Id: <20200806105349.632-2-thuth@redhat.com> In-Reply-To: <20200806105349.632-1-thuth@redhat.com> References: <20200806105349.632-1-thuth@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=thuth@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=205.139.110.61; envelope-from=thuth@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/08/06 00:07:42 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -40 X-Spam_score: -4.1 X-Spam_bar: ---- X-Spam_report: (-4.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Jason J . Herne" , Thomas Huth , Janosch Frank , qemu-block@nongnu.org, Cornelia Huck , Collin Walling , Christian Borntraeger , Claudio Imbrenda Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" The main QEMU code is compiled with -std=3Dgnu99, -fwrapv and -fno-common. We should use the same flags for the s390-ccw bios, too, to avoid that we get different behavior with different compiler versions that changed their default settings in the course of time (it happened at least with -std=3D... and -fno-common in the past already). While we're at it, also group the other flags here in a little bit nicer fashion: Move the two "-m" flags out of the "-f" area and specify them on a separate line. Reviewed-by: Claudio Imbrenda Acked-by: Cornelia Huck Acked-by: Janosch Frank Signed-off-by: Thomas Huth --- pc-bios/s390-ccw/Makefile | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pc-bios/s390-ccw/Makefile b/pc-bios/s390-ccw/Makefile index 50bc880272..9abb0ea4c0 100644 --- a/pc-bios/s390-ccw/Makefile +++ b/pc-bios/s390-ccw/Makefile @@ -13,10 +13,11 @@ OBJECTS =3D start.o main.o bootmap.o jump2ipl.o sclp.o = menu.o \ virtio.o virtio-scsi.o virtio-blkdev.o libc.o cio.o dasd-ipl.o =20 QEMU_CFLAGS :=3D $(filter -W%, $(QEMU_CFLAGS)) -QEMU_CFLAGS +=3D -ffreestanding -fno-delete-null-pointer-checks -msoft-flo= at -QEMU_CFLAGS +=3D -march=3Dz900 -fPIE -fno-strict-aliasing -QEMU_CFLAGS +=3D -fno-asynchronous-unwind-tables +QEMU_CFLAGS +=3D -ffreestanding -fno-delete-null-pointer-checks -fno-commo= n -fPIE +QEMU_CFLAGS +=3D -fwrapv -fno-strict-aliasing -fno-asynchronous-unwind-tab= les QEMU_CFLAGS +=3D $(call cc-option, $(QEMU_CFLAGS), -fno-stack-protector) +QEMU_CFLAGS +=3D -msoft-float -march=3Dz900 +QEMU_CFLAGS +=3D -std=3Dgnu99 LDFLAGS +=3D -Wl,-pie -nostdlib =20 build-all: s390-ccw.img s390-netboot.img --=20 2.18.1 From nobody Sat May 18 04:30:08 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.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=1596713105; cv=none; d=zohomail.com; s=zohoarc; b=Nl6TtPosgGRlciCyijTwbSmErTQmxhXmdRq9NoIJ6n7kyLDsHYCoADSIpSmZi1DNZ5ZKCOChGK66jU2LMvfsfYfpM+90w3iUqPRSc2kccX4ydqFij9pbngAQ66fXJeSltEqAGN0FITFTi3J6X4XpPwYgZmKlorAPAEhPAUu2/8w= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1596713105; h=Content-Type:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=7wZMtm3y0oJGsx1R3gI6uu6wtOLJEuzArm2CHIogM00=; b=CTk42lAdEOsx2sR1F4UBxP4maP6rfKorDm+JovMcrPErHB4KQDMksMo5xmLBA88OzBI1Tc9OmzrQyPT/dkgVIkDdbWXzhp9GvWG0oA1yzmrTvfc0XJ8VX99ThHlBs/UkLKWU19CGDoQEq06DpQCsA2HW3PQqWevynbCISqWuLw0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.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 (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 15967131058221012.7768790426525; Thu, 6 Aug 2020 04:25:05 -0700 (PDT) Received: from localhost ([::1]:35650 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k3e1A-0007OK-Ih for importer@patchew.org; Thu, 06 Aug 2020 07:25:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42970) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k3dXI-0004U0-S6 for qemu-devel@nongnu.org; Thu, 06 Aug 2020 06:54:12 -0400 Received: from us-smtp-1.mimecast.com ([207.211.31.81]:30529 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1k3dXH-0000JE-2N for qemu-devel@nongnu.org; Thu, 06 Aug 2020 06:54:12 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-505-JTqMnNGUM4iHom_GRxn03Q-1; Thu, 06 Aug 2020 06:54:07 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 8805F2D0; Thu, 6 Aug 2020 10:54:06 +0000 (UTC) Received: from thuth.com (ovpn-112-229.ams2.redhat.com [10.36.112.229]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3BDBC5F202; Thu, 6 Aug 2020 10:54:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1596711249; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:content-type:content-type:in-reply-to:in-reply-to: references:references; bh=7wZMtm3y0oJGsx1R3gI6uu6wtOLJEuzArm2CHIogM00=; b=M94fsK1PslnzkGjgGPOLwgmFDr5EAoxaWXiaSM/DS94pxsPxbDUbgtrrwd6AYXKfJCvBWn VXOoGK9cAMpTopstBhgKBsC6AMu+KBe6Jf4hlsGohvv0ZuRqb0E7ytxHEdbwFgXpnAzZ5g jqzyK8Zjdzkq9VNXwXjPU+QvrVWf4RA= X-MC-Unique: JTqMnNGUM4iHom_GRxn03Q-1 From: Thomas Huth To: qemu-s390x@nongnu.org, qemu-devel@nongnu.org Subject: [PATCH for-5.2 v2 2/9] pc-bios/s390-ccw: Move ipl-related code from main() into a separate function Date: Thu, 6 Aug 2020 12:53:42 +0200 Message-Id: <20200806105349.632-3-thuth@redhat.com> In-Reply-To: <20200806105349.632-1-thuth@redhat.com> References: <20200806105349.632-1-thuth@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=thuth@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=207.211.31.81; envelope-from=thuth@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/08/06 05:03:13 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Jason J . Herne" , Thomas Huth , Janosch Frank , qemu-block@nongnu.org, Cornelia Huck , Collin Walling , Christian Borntraeger , Claudio Imbrenda Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Let's move this part of the code into a separate function to be able to use it from multiple spots later. Reviewed-by: Claudio Imbrenda Reviewed-by: Cornelia Huck Reviewed-by: Janosch Frank Signed-off-by: Thomas Huth --- pc-bios/s390-ccw/main.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/pc-bios/s390-ccw/main.c b/pc-bios/s390-ccw/main.c index 146a50760b..9b64eb0c24 100644 --- a/pc-bios/s390-ccw/main.c +++ b/pc-bios/s390-ccw/main.c @@ -223,14 +223,8 @@ static void virtio_setup(void) } } =20 -int main(void) +static void ipl_boot_device(void) { - sclp_setup(); - css_setup(); - boot_setup(); - find_boot_device(); - enable_subchannel(blk_schid); - switch (cutype) { case CU_TYPE_DASD_3990: case CU_TYPE_DASD_2107: @@ -242,8 +236,18 @@ int main(void) break; default: print_int("Attempting to boot from unexpected device type", cutype= ); - panic(""); + panic("\nBoot failed.\n"); } +} + +int main(void) +{ + sclp_setup(); + css_setup(); + boot_setup(); + find_boot_device(); + enable_subchannel(blk_schid); + ipl_boot_device(); =20 panic("Failed to load OS from hard disk\n"); return 0; /* make compiler happy */ --=20 2.18.1 From nobody Sat May 18 04:30:08 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.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=1596713005; cv=none; d=zohomail.com; s=zohoarc; b=jgHDcvA0jMPV5TzqCZsgb+x7gCaxz5PQl4MroJad2+XsfJ+GcSqH2HXs7yHJ0DbwMTGD49RRsLOYL26CzCPd/KaMyM/8qNc7Ig3m4bhdDPHwXm4BlqpqxF8ZkpcUg99RRd8FZgDXtbo+GMsUQQhkgwf1HcJG3oFNgajt/JsToow= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1596713005; h=Content-Type:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=dVncLk4qU7TyxwUHWT5YIq1tr33qzJ32c21Bhbk3/aU=; b=IRnzmxjLo0A2XqEzqgroaGYnaak0vn++S+yxV4HJc0sO/NvR7GGdQLa+0wCuevbr6l1qE5PsIsfYBuBRyRCeRA9rbJL1c804JF3dcfyn0DcsrqLJ7sHFEo1RNRh9DJNqnOApdFT1n05pgFTzQ59gGEzrCLfb2cbU2Z4I+9JFpoI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.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 (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1596713005482504.0912456610664; Thu, 6 Aug 2020 04:23:25 -0700 (PDT) Received: from localhost ([::1]:53610 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k3dzY-0002pU-3E for importer@patchew.org; Thu, 06 Aug 2020 07:23:24 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43020) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k3dXM-0004cD-2r for qemu-devel@nongnu.org; Thu, 06 Aug 2020 06:54:16 -0400 Received: from us-smtp-1.mimecast.com ([207.211.31.81]:25466 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1k3dXK-0000Jq-De for qemu-devel@nongnu.org; Thu, 06 Aug 2020 06:54:15 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-127-sJdTF754NhiUpFKjnsXYzA-1; Thu, 06 Aug 2020 06:54:12 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 41B808017FB; Thu, 6 Aug 2020 10:54:10 +0000 (UTC) Received: from thuth.com (ovpn-112-229.ams2.redhat.com [10.36.112.229]) by smtp.corp.redhat.com (Postfix) with ESMTP id DCB985F202; Thu, 6 Aug 2020 10:54:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1596711253; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:content-type:content-type:in-reply-to:in-reply-to: references:references; bh=dVncLk4qU7TyxwUHWT5YIq1tr33qzJ32c21Bhbk3/aU=; b=AE58feWnJ7gIjFWmdjg11cn6pJXw84pdzw1UddUGC/FcA21kbr9grSr0XPT8O2g3ldqwWg LgjT2y8/c+4238cOdbYzRMfDsw4Eqj3VFdECiL/xs600dEKQF1ke9+FD3bArfvzz2lGXsv 6n2J8Ti93H6PWWpvUenzL7192rhHqoo= X-MC-Unique: sJdTF754NhiUpFKjnsXYzA-1 From: Thomas Huth To: qemu-s390x@nongnu.org, qemu-devel@nongnu.org Subject: [PATCH for-5.2 v2 3/9] pc-bios/s390-ccw: Introduce ENODEV define and remove guards of others Date: Thu, 6 Aug 2020 12:53:43 +0200 Message-Id: <20200806105349.632-4-thuth@redhat.com> In-Reply-To: <20200806105349.632-1-thuth@redhat.com> References: <20200806105349.632-1-thuth@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=thuth@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=207.211.31.81; envelope-from=thuth@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/08/06 05:03:13 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Jason J . Herne" , Thomas Huth , Janosch Frank , qemu-block@nongnu.org, Cornelia Huck , Collin Walling , Christian Borntraeger , Claudio Imbrenda Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Remove the "#ifndef E..." guards from the defines here - the header guard S390_CCW_H at the top of the file should avoid double definition, and if the error code is defined in a different file already, we're in trouble anyway, then it's better to see the error at compile time instead of hunting weird behavior during runtime later. Also define ENODEV - we will use this in a later patch. Signed-off-by: Thomas Huth Reviewed-by: Cornelia Huck Reviewed-by: Janosch Frank --- pc-bios/s390-ccw/s390-ccw.h | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/pc-bios/s390-ccw/s390-ccw.h b/pc-bios/s390-ccw/s390-ccw.h index 36b884cced..dbc4c64851 100644 --- a/pc-bios/s390-ccw/s390-ccw.h +++ b/pc-bios/s390-ccw/s390-ccw.h @@ -27,12 +27,10 @@ typedef unsigned long long __u64; #define false 0 #define PAGE_SIZE 4096 =20 -#ifndef EIO #define EIO 1 -#endif -#ifndef EBUSY #define EBUSY 2 -#endif +#define ENODEV 3 + #ifndef NULL #define NULL 0 #endif --=20 2.18.1 From nobody Sat May 18 04:30:08 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.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=1596713590; cv=none; d=zohomail.com; s=zohoarc; b=GO96hZDeyeYf53jQHzdXmWkPhTWNxWWJQgaAY3IKoUC5Ke8H3+N+LER09AL2N/85h9qBllqYE70A5t15puls1iLy6mDR+xFi2/R0jLHSKOpxPb+yekTAtKQazGgLZNKNbnRQepD5rNwkGqo6YjyhKHAyrPh6UCwceGOmVelgsfg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1596713590; h=Content-Type:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=1IQowK9NNlqpIMC+bc7iQ/baFlNISGVkiJLNBwOKRU0=; b=BZOl91iuUAgIXofvh6XFqnBJuZzECBrPS8Xwz+vruEnpposTpWByEA9yzHgeILN8B9McjkMmLAus96mXPYlFgq38kXvxWixAKVhQv2T0TzRV0GoB/jfhQlPesuRarkMJpR/Iq/FTfATpET9LstCTjOhIMEeXtcfcXwzE7UbnrTs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.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 (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1596713590826220.92445357215593; Thu, 6 Aug 2020 04:33:10 -0700 (PDT) Received: from localhost ([::1]:43288 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k3e8z-0005dK-KB for importer@patchew.org; Thu, 06 Aug 2020 07:33:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43078) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k3dXR-0004po-RR for qemu-devel@nongnu.org; Thu, 06 Aug 2020 06:54:21 -0400 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:28551 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1k3dXQ-0000KM-8N for qemu-devel@nongnu.org; Thu, 06 Aug 2020 06:54:21 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-250-S5m69_wZNQKd3qfH5mpn8w-1; Thu, 06 Aug 2020 06:54:15 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 808C3100AA21; Thu, 6 Aug 2020 10:54:14 +0000 (UTC) Received: from thuth.com (ovpn-112-229.ams2.redhat.com [10.36.112.229]) by smtp.corp.redhat.com (Postfix) with ESMTP id CE4515F202; Thu, 6 Aug 2020 10:54:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1596711259; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:content-type:content-type:in-reply-to:in-reply-to: references:references; bh=1IQowK9NNlqpIMC+bc7iQ/baFlNISGVkiJLNBwOKRU0=; b=PO4SlddcX8/IU9jsoY47XodbwamC7ZP8i4DFntODkbXqgOYQQn4PV57N/GdnNIsBvsLGIY OA0YDDKcVTj/+z8qa5hoBymoyxvCgk4yyqZEQ5r85t6EikHnXTsEBXhN+d1eJisrz2GuIM Dl8KynE0WNx5AvXso6dSA3vDTciRqow= X-MC-Unique: S5m69_wZNQKd3qfH5mpn8w-1 From: Thomas Huth To: qemu-s390x@nongnu.org, qemu-devel@nongnu.org Subject: [PATCH for-5.2 v2 4/9] pc-bios/s390-ccw: Move the inner logic of find_subch() to a separate function Date: Thu, 6 Aug 2020 12:53:44 +0200 Message-Id: <20200806105349.632-5-thuth@redhat.com> In-Reply-To: <20200806105349.632-1-thuth@redhat.com> References: <20200806105349.632-1-thuth@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=thuth@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=205.139.110.120; envelope-from=thuth@redhat.com; helo=us-smtp-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/08/06 00:24:10 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Jason J . Herne" , Thomas Huth , Janosch Frank , qemu-block@nongnu.org, Cornelia Huck , Collin Walling , Christian Borntraeger , Claudio Imbrenda Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Move the code to a separate function to be able to re-use it from a different spot later. Reviewed-by: Claudio Imbrenda Signed-off-by: Thomas Huth Reviewed-by: Cornelia Huck Reviewed-by: Janosch Frank --- pc-bios/s390-ccw/main.c | 99 ++++++++++++++++++++++++----------------- 1 file changed, 57 insertions(+), 42 deletions(-) diff --git a/pc-bios/s390-ccw/main.c b/pc-bios/s390-ccw/main.c index 9b64eb0c24..0d2aabbc58 100644 --- a/pc-bios/s390-ccw/main.c +++ b/pc-bios/s390-ccw/main.c @@ -51,6 +51,60 @@ unsigned int get_loadparm_index(void) return atoui(loadparm_str); } =20 +static int is_dev_possibly_bootable(int dev_no, int sch_no) +{ + bool is_virtio; + Schib schib; + int r; + + blk_schid.sch_no =3D sch_no; + r =3D stsch_err(blk_schid, &schib); + if (r =3D=3D 3 || r =3D=3D -EIO) { + return -ENODEV; + } + if (!schib.pmcw.dnv) { + return false; + } + + enable_subchannel(blk_schid); + cutype =3D cu_type(blk_schid); + + /* + * Note: we always have to run virtio_is_supported() here to make + * sure that the vdev.senseid data gets pre-initialized correctly + */ + is_virtio =3D virtio_is_supported(blk_schid); + + /* No specific devno given, just return whether the device is possibly= bootable */ + if (dev_no < 0) { + switch (cutype) { + case CU_TYPE_VIRTIO: + if (is_virtio) { + /* + * Skip net devices since no IPLB is created and therefore + * no network bootloader has been loaded + */ + if (virtio_get_device_type() !=3D VIRTIO_ID_NET) { + return true; + } + } + return false; + case CU_TYPE_DASD_3990: + case CU_TYPE_DASD_2107: + return true; + default: + return false; + } + } + + /* Caller asked for a specific devno */ + if (schib.pmcw.dev =3D=3D dev_no) { + return true; + } + + return false; +} + /* * Find the subchannel connected to the given device (dev_no) and fill in = the * subchannel information block (schib) with the connected subchannel's in= fo. @@ -62,53 +116,14 @@ unsigned int get_loadparm_index(void) */ static bool find_subch(int dev_no) { - Schib schib; int i, r; - bool is_virtio; =20 for (i =3D 0; i < 0x10000; i++) { - blk_schid.sch_no =3D i; - r =3D stsch_err(blk_schid, &schib); - if ((r =3D=3D 3) || (r =3D=3D -EIO)) { + r =3D is_dev_possibly_bootable(dev_no, i); + if (r < 0) { break; } - if (!schib.pmcw.dnv) { - continue; - } - - enable_subchannel(blk_schid); - cutype =3D cu_type(blk_schid); - - /* - * Note: we always have to run virtio_is_supported() here to make - * sure that the vdev.senseid data gets pre-initialized correctly - */ - is_virtio =3D virtio_is_supported(blk_schid); - - /* No specific devno given, just return 1st possibly bootable devi= ce */ - if (dev_no < 0) { - switch (cutype) { - case CU_TYPE_VIRTIO: - if (is_virtio) { - /* - * Skip net devices since no IPLB is created and there= fore - * no network bootloader has been loaded - */ - if (virtio_get_device_type() !=3D VIRTIO_ID_NET) { - return true; - } - } - continue; - case CU_TYPE_DASD_3990: - case CU_TYPE_DASD_2107: - return true; - default: - continue; - } - } - - /* Caller asked for a specific devno */ - if (schib.pmcw.dev =3D=3D dev_no) { + if (r =3D=3D true) { return true; } } --=20 2.18.1 From nobody Sat May 18 04:30:08 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.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=1596713237; cv=none; d=zohomail.com; s=zohoarc; b=nEYsb5sOhNr/JJzzbKNJ96PXZwUYPLxyq3+bj652IVyXLqgraMyZhzQCPzTRKIdEBR8GQK75RAfmIg+J4RQvrNKN/9PN8SKchskAt9AABv7KQ2MDgHYyeoRnrlMdj4YLp7FPWtrissB/TLZhSlJZSe+uI9DU9zGuZJUgI+OJMiE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1596713237; h=Content-Type:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=zDvbgsh1c1UhhMgGCZMoaNfRF3t0YyDsQ+n3Mn4hroc=; b=NZyDmHSEYVYCxk5r9UdCqLKrqahuImSseVJpDhC98vloUj8XA5Pt5g/WyDDF1tJfJbYsvndkApQ6MVxrB1XvzT8lGfPdinsB5KBspzzYiU02YPdNvlrzFFTeUCUFvuMH2ct6z35RB54gcqWkWsUzT+KdSS1LXthGj5C0fKfP8GE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.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 (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1596713237441605.3636185285491; Thu, 6 Aug 2020 04:27:17 -0700 (PDT) Received: from localhost ([::1]:47438 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k3e3I-0004CG-2W for importer@patchew.org; Thu, 06 Aug 2020 07:27:16 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43110) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k3dXU-0004x3-Rn for qemu-devel@nongnu.org; Thu, 06 Aug 2020 06:54:24 -0400 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:40491 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1k3dXS-0000Ln-Kp for qemu-devel@nongnu.org; Thu, 06 Aug 2020 06:54:24 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-200-H0ZdImZXNceZuD35C7LK0w-1; Thu, 06 Aug 2020 06:54:20 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id A2B261005504; Thu, 6 Aug 2020 10:54:18 +0000 (UTC) Received: from thuth.com (ovpn-112-229.ams2.redhat.com [10.36.112.229]) by smtp.corp.redhat.com (Postfix) with ESMTP id E3B955F202; Thu, 6 Aug 2020 10:54:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1596711261; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:content-type:content-type:in-reply-to:in-reply-to: references:references; bh=zDvbgsh1c1UhhMgGCZMoaNfRF3t0YyDsQ+n3Mn4hroc=; b=SUPAJ5Ok1J4ZjxMrjTwaaHe7hyrMtpwO5bPBei9UMX/tRNQ8X7NJI0wWhxATJ9cxTq64hx /+KvnsWrrjqmRAc/KRwJCKNv3UiF6msNXrNE68Ug6rZ5UBVQb0EY2VcvfdPYJ/1Ftytpqe YzwoUGrdiSzWdpSgMDz+H1bJqN7QF6g= X-MC-Unique: H0ZdImZXNceZuD35C7LK0w-1 From: Thomas Huth To: qemu-s390x@nongnu.org, qemu-devel@nongnu.org Subject: [PATCH for-5.2 v2 5/9] pc-bios/s390-ccw: Do not bail out early if not finding a SCSI disk Date: Thu, 6 Aug 2020 12:53:45 +0200 Message-Id: <20200806105349.632-6-thuth@redhat.com> In-Reply-To: <20200806105349.632-1-thuth@redhat.com> References: <20200806105349.632-1-thuth@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=thuth@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=205.139.110.120; envelope-from=thuth@redhat.com; helo=us-smtp-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/08/06 00:24:10 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Jason J . Herne" , Thomas Huth , Janosch Frank , qemu-block@nongnu.org, Cornelia Huck , Collin Walling , Christian Borntraeger , Claudio Imbrenda Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" In case the user did not specify a boot device, we want to continue looking for other devices if there are no valid SCSI disks on a virtio- scsi controller. As a first step, do not panic in this case and let the control flow carry the error to the upper functions instead. Signed-off-by: Thomas Huth Reviewed-by: Cornelia Huck --- pc-bios/s390-ccw/main.c | 14 ++++++++++---- pc-bios/s390-ccw/s390-ccw.h | 2 +- pc-bios/s390-ccw/virtio-blkdev.c | 7 +++++-- pc-bios/s390-ccw/virtio-scsi.c | 28 ++++++++++++++++++++-------- pc-bios/s390-ccw/virtio-scsi.h | 2 +- 5 files changed, 37 insertions(+), 16 deletions(-) diff --git a/pc-bios/s390-ccw/main.c b/pc-bios/s390-ccw/main.c index 0d2aabbc58..7bdd12ab2e 100644 --- a/pc-bios/s390-ccw/main.c +++ b/pc-bios/s390-ccw/main.c @@ -218,7 +218,7 @@ static void find_boot_device(void) IPL_assert(found, "Boot device not found\n"); } =20 -static void virtio_setup(void) +static int virtio_setup(void) { VDev *vdev =3D virtio_get_device(); QemuIplParameters *early_qipl =3D (QemuIplParameters *)QIPL_ADDRESS; @@ -233,9 +233,14 @@ static void virtio_setup(void) sclp_print("Network boot device detected\n"); vdev->netboot_start_addr =3D qipl.netboot_start_addr; } else { - virtio_blk_setup_device(blk_schid); + int ret =3D virtio_blk_setup_device(blk_schid); + if (ret) { + return ret; + } IPL_assert(virtio_ipl_disk_is_valid(), "No valid IPL device detect= ed"); } + + return 0; } =20 static void ipl_boot_device(void) @@ -246,8 +251,9 @@ static void ipl_boot_device(void) dasd_ipl(blk_schid, cutype); /* no return */ break; case CU_TYPE_VIRTIO: - virtio_setup(); - zipl_load(); /* no return */ + if (virtio_setup() =3D=3D 0) { + zipl_load(); /* no return */ + } break; default: print_int("Attempting to boot from unexpected device type", cutype= ); diff --git a/pc-bios/s390-ccw/s390-ccw.h b/pc-bios/s390-ccw/s390-ccw.h index dbc4c64851..9b86c120b4 100644 --- a/pc-bios/s390-ccw/s390-ccw.h +++ b/pc-bios/s390-ccw/s390-ccw.h @@ -69,7 +69,7 @@ int sclp_read(char *str, size_t count); unsigned long virtio_load_direct(ulong rec_list1, ulong rec_list2, ulong subchan_id, void *load_addr); bool virtio_is_supported(SubChannelId schid); -void virtio_blk_setup_device(SubChannelId schid); +int virtio_blk_setup_device(SubChannelId schid); int virtio_read(ulong sector, void *load_addr); =20 /* bootmap.c */ diff --git a/pc-bios/s390-ccw/virtio-blkdev.c b/pc-bios/s390-ccw/virtio-blk= dev.c index 11c56261ca..7d35050292 100644 --- a/pc-bios/s390-ccw/virtio-blkdev.c +++ b/pc-bios/s390-ccw/virtio-blkdev.c @@ -263,9 +263,10 @@ uint64_t virtio_get_blocks(void) return 0; } =20 -void virtio_blk_setup_device(SubChannelId schid) +int virtio_blk_setup_device(SubChannelId schid) { VDev *vdev =3D virtio_get_device(); + int ret =3D 0; =20 vdev->schid =3D schid; virtio_setup_ccw(vdev); @@ -288,9 +289,11 @@ void virtio_blk_setup_device(SubChannelId schid) "Config: CDB size mismatch"); =20 sclp_print("Using virtio-scsi.\n"); - virtio_scsi_setup(vdev); + ret =3D virtio_scsi_setup(vdev); break; default: panic("\n! No IPL device available !\n"); } + + return ret; } diff --git a/pc-bios/s390-ccw/virtio-scsi.c b/pc-bios/s390-ccw/virtio-scsi.c index eddfb8a7ad..2c8d0f3097 100644 --- a/pc-bios/s390-ccw/virtio-scsi.c +++ b/pc-bios/s390-ccw/virtio-scsi.c @@ -194,7 +194,12 @@ static bool scsi_read_capacity(VDev *vdev, =20 /* virtio-scsi routines */ =20 -static void virtio_scsi_locate_device(VDev *vdev) +/* + * Tries to locate a SCSI device and and adds the information for the found + * device to the vdev->scsi_device structure. + * Returns 0 if SCSI device could be located, or a error code < 0 otherwise + */ +static int virtio_scsi_locate_device(VDev *vdev) { const uint16_t channel =3D 0; /* again, it's what QEMU does */ uint16_t target; @@ -220,7 +225,7 @@ static void virtio_scsi_locate_device(VDev *vdev) IPL_check(sdev->channel =3D=3D 0, "non-zero channel requested"); IPL_check(sdev->target <=3D vdev->config.scsi.max_target, "target#= high"); IPL_check(sdev->lun <=3D vdev->config.scsi.max_lun, "LUN# high"); - return; + return 0; } =20 for (target =3D 0; target <=3D vdev->config.scsi.max_target; target++)= { @@ -247,18 +252,20 @@ static void virtio_scsi_locate_device(VDev *vdev) */ sdev->lun =3D r->lun[0].v16[0]; /* it's returned this way */ debug_print_int("Have to use LUN", sdev->lun); - return; /* we have to use this device */ + return 0; /* we have to use this device */ } for (i =3D 0; i < luns; i++) { if (r->lun[i].v64) { /* Look for non-zero LUN - we have where to choose from */ sdev->lun =3D r->lun[i].v16[0]; debug_print_int("Will use LUN", sdev->lun); - return; /* we have found a device */ + return 0; /* we have found a device */ } } } - panic("\n! Cannot locate virtio-scsi device !\n"); + + sclp_print("Warning: Could not locate a usable virtio-scsi device\n"); + return -ENODEV; } =20 int virtio_scsi_read_many(VDev *vdev, @@ -322,17 +329,20 @@ static void scsi_parse_capacity_report(void *data, } } =20 -void virtio_scsi_setup(VDev *vdev) +int virtio_scsi_setup(VDev *vdev) { int retry_test_unit_ready =3D 3; uint8_t data[256]; uint32_t data_size =3D sizeof(data); ScsiInquiryEvpdPages *evpd =3D &scsi_inquiry_evpd_pages_response; ScsiInquiryEvpdBl *evpd_bl =3D &scsi_inquiry_evpd_bl_response; - int i; + int i, ret; =20 vdev->scsi_device =3D &default_scsi_device; - virtio_scsi_locate_device(vdev); + ret =3D virtio_scsi_locate_device(vdev); + if (ret < 0) { + return ret; + } =20 /* We have to "ping" the device before it becomes readable */ while (!scsi_test_unit_ready(vdev)) { @@ -417,4 +427,6 @@ void virtio_scsi_setup(VDev *vdev) } scsi_parse_capacity_report(data, &vdev->scsi_last_block, (uint32_t *) &vdev->scsi_block_size); + + return 0; } diff --git a/pc-bios/s390-ccw/virtio-scsi.h b/pc-bios/s390-ccw/virtio-scsi.h index 4c4f4bbc31..4b14c2c2f9 100644 --- a/pc-bios/s390-ccw/virtio-scsi.h +++ b/pc-bios/s390-ccw/virtio-scsi.h @@ -67,7 +67,7 @@ static inline bool virtio_scsi_response_ok(const VirtioSc= siCmdResp *r) return r->response =3D=3D VIRTIO_SCSI_S_OK && r->status =3D=3D CDB= _STATUS_GOOD; } =20 -void virtio_scsi_setup(VDev *vdev); +int virtio_scsi_setup(VDev *vdev); int virtio_scsi_read_many(VDev *vdev, ulong sector, void *load_addr, int sec_num); =20 --=20 2.18.1 From nobody Sat May 18 04:30:08 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.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=1596713103; cv=none; d=zohomail.com; s=zohoarc; b=juqmyg//XIw603pfdX33vO9B+ZF2HX1oqu6B8O52PNHRMQvcvdTyPSxvLjPuE3ClGcDOxP741KQ0ogfTzqetxYgL/SLURcyD1JeG6seIftvIaW/O6VSHijNObwcCTfHhogtu4XAOf97rep6o+bR/vlcKC7nC2ZTqyMR6CBSQmfA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1596713103; h=Content-Type:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=bAZhh42ol/yyjGGnHpznrtYUmEZhMmtP36AnH46cN78=; b=Ykd+Tm95XVUN1RyQWO85EO/inaMjCCVgb7mGS3KBb0k6xVXNyRCR9Ef3MoiB6PijHKV9IHNvCVykyE0kZxo8D+Cel6wNrFay5BcvbxGqfmFI9A/BbdHitXfbezOAW9zyADs8TJgZbIoxMDk3NGVkJ1BglwWdW71qq35ORU1Qvk8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.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 (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1596713103069227.5421859459898; Thu, 6 Aug 2020 04:25:03 -0700 (PDT) Received: from localhost ([::1]:35374 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k3e17-0007HV-Lq for importer@patchew.org; Thu, 06 Aug 2020 07:25:01 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43146) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k3dXc-00055n-6T for qemu-devel@nongnu.org; Thu, 06 Aug 2020 06:54:32 -0400 Received: from us-smtp-1.mimecast.com ([205.139.110.61]:53900 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1k3dXa-0000MU-9M for qemu-devel@nongnu.org; Thu, 06 Aug 2020 06:54:31 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-310-ucGPa8TJOeqYo6WVJHAY5Q-1; Thu, 06 Aug 2020 06:54:24 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 35CFF8017FB; Thu, 6 Aug 2020 10:54:23 +0000 (UTC) Received: from thuth.com (ovpn-112-229.ams2.redhat.com [10.36.112.229]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3BE165F202; Thu, 6 Aug 2020 10:54:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1596711268; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:content-type:content-type:in-reply-to:in-reply-to: references:references; bh=bAZhh42ol/yyjGGnHpznrtYUmEZhMmtP36AnH46cN78=; b=RR39U2JhGTKLLm+UDViW8bWtHo9TJh8rMrBYcFKHkfkPazZchoUVanbkAkcBdyYvrFOLsC EIka2O/UQPLuGRhvXdVQddpR9/Bco7hGrdaT3zcE8Ulfc9zyD/s/1482ivSp90yuCbKx/D OBMMfuRXupmm9NFClJEcmX/b0fqJwZA= X-MC-Unique: ucGPa8TJOeqYo6WVJHAY5Q-1 From: Thomas Huth To: qemu-s390x@nongnu.org, qemu-devel@nongnu.org Subject: [PATCH for-5.2 v2 6/9] pc-bios/s390-ccw: Scan through all devices if no boot device specified Date: Thu, 6 Aug 2020 12:53:46 +0200 Message-Id: <20200806105349.632-7-thuth@redhat.com> In-Reply-To: <20200806105349.632-1-thuth@redhat.com> References: <20200806105349.632-1-thuth@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=thuth@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=205.139.110.61; envelope-from=thuth@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/08/06 00:07:42 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -40 X-Spam_score: -4.1 X-Spam_bar: ---- X-Spam_report: (-4.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Jason J . Herne" , Thomas Huth , Janosch Frank , qemu-block@nongnu.org, Cornelia Huck , Collin Walling , Christian Borntraeger , Claudio Imbrenda Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" If no boot device has been specified (via "bootindex=3D..."), the s390-ccw bios scans through all devices to find a bootable device. But so far, it stops at the very first block device (including virtio-scsi controllers without attached devices) that it finds, no matter whether it is bootable or not. That leads to some weird situatation where it is e.g. possible to boot via: qemu-system-s390x -hda /path/to/disk.qcow2 but not if there is e.g. a virtio-scsi controller specified before: qemu-system-s390x -device virtio-scsi -hda /path/to/disk.qcow2 While using "bootindex=3D..." is clearly the preferred way of booting on s390x, we still can make the life for the users at least a little bit easier if we look at all available devices to find a bootable one. Buglink: https://bugzilla.redhat.com/show_bug.cgi?id=3D1846975 Reviewed-by: Cornelia Huck Signed-off-by: Thomas Huth --- pc-bios/s390-ccw/main.c | 46 +++++++++++++++++++++++++++-------------- 1 file changed, 31 insertions(+), 15 deletions(-) diff --git a/pc-bios/s390-ccw/main.c b/pc-bios/s390-ccw/main.c index 7bdd12ab2e..9b581074a1 100644 --- a/pc-bios/s390-ccw/main.c +++ b/pc-bios/s390-ccw/main.c @@ -182,20 +182,8 @@ static void boot_setup(void) static void find_boot_device(void) { VDev *vdev =3D virtio_get_device(); - int ssid; bool found; =20 - if (!have_iplb) { - for (ssid =3D 0; ssid < 0x3; ssid++) { - blk_schid.ssid =3D ssid; - found =3D find_subch(-1); - if (found) { - 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); @@ -261,14 +249,42 @@ static void ipl_boot_device(void) } } =20 +/* + * No boot device has been specified, so we have to scan through the + * channels to find one. + */ +static void probe_boot_device(void) +{ + int ssid, sch_no, ret; + + for (ssid =3D 0; ssid < 0x3; ssid++) { + blk_schid.ssid =3D ssid; + for (sch_no =3D 0; sch_no < 0x10000; sch_no++) { + ret =3D is_dev_possibly_bootable(-1, sch_no); + if (ret < 0) { + break; + } + if (ret =3D=3D true) { + ipl_boot_device(); /* Only returns if unsuccessful */ + } + } + } + + sclp_print("Could not find a suitable boot device (none specified)\n"); +} + int main(void) { sclp_setup(); css_setup(); boot_setup(); - find_boot_device(); - enable_subchannel(blk_schid); - ipl_boot_device(); + if (have_iplb) { + find_boot_device(); + enable_subchannel(blk_schid); + ipl_boot_device(); + } else { + probe_boot_device(); + } =20 panic("Failed to load OS from hard disk\n"); return 0; /* make compiler happy */ --=20 2.18.1 From nobody Sat May 18 04:30:08 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.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=1596713319; cv=none; d=zohomail.com; s=zohoarc; b=BkzJGD5YTZI1K98hHWnS7rc2Y+ukHq6XKt+XRYFXggt1NdAOan1q8IAX/rGhU2MLS59hjh0jSJkiE/ZX8Tu4acsulNBHGuECTwXrZe8eSx+q7uxEUL/0yR47zQjt8Jn9pZkccx8G5BdJV5QycBObxWg67RGxHhpJ2CyTPCtc0CI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1596713319; h=Content-Type:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=4BmZ5R/B5KF+JC5CuMlI6vsCTV8fruRdJKUwCMQH7+E=; b=NPJzWQZaTS7zPUTgbLvzugrIoMOgRTSixdrWb0dAwd5ysloGFQB0OIv9hE0IlO8F9a5vNa0XfdI/dLPUtc9315Uv/poX1bfUelbiCufLdF1MDKaorOdicXvCCjkR+zZw+3qtPaRG9zYsXPDsvcVmfmHz+5uIZyRTRVTC+kO7JTI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.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 (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1596713319089618.4620083590513; Thu, 6 Aug 2020 04:28:39 -0700 (PDT) Received: from localhost ([::1]:55124 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k3e4b-0007H2-Pk for importer@patchew.org; Thu, 06 Aug 2020 07:28:37 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43192) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k3dXf-0005Cq-35 for qemu-devel@nongnu.org; Thu, 06 Aug 2020 06:54:35 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:35411 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1k3dXd-0000Mo-3O for qemu-devel@nongnu.org; Thu, 06 Aug 2020 06:54:34 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-441-XBrdwAbkP4CYIxmaq3YqZA-1; Thu, 06 Aug 2020 06:54:28 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 419F4100AA23; Thu, 6 Aug 2020 10:54:27 +0000 (UTC) Received: from thuth.com (ovpn-112-229.ams2.redhat.com [10.36.112.229]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9A8BA65C82; Thu, 6 Aug 2020 10:54:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1596711272; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:content-type:content-type:in-reply-to:in-reply-to: references:references; bh=4BmZ5R/B5KF+JC5CuMlI6vsCTV8fruRdJKUwCMQH7+E=; b=B+wfnzsCOSErMyryXzLfOc/Kqi4/G7uNdrjMOuTbkcKHOx0KgjZ7P3qJoJl7tPRfX5M9xD ooiXA1orsOzS8HDEhwQ9xLK4hgkgUqSGIZRBXk2pd2jJLMb1CykSDPZDsghPwhHBErKtzb gQ7sUeFcXm6piCxj5VxVnJfIfTnPF/0= X-MC-Unique: XBrdwAbkP4CYIxmaq3YqZA-1 From: Thomas Huth To: qemu-s390x@nongnu.org, qemu-devel@nongnu.org Subject: [PATCH for-5.2 v2 7/9] pc-bios/s390-ccw: Allow booting in case the first virtio-blk disk is bad Date: Thu, 6 Aug 2020 12:53:47 +0200 Message-Id: <20200806105349.632-8-thuth@redhat.com> In-Reply-To: <20200806105349.632-1-thuth@redhat.com> References: <20200806105349.632-1-thuth@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=thuth@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=207.211.31.120; envelope-from=thuth@redhat.com; helo=us-smtp-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/08/06 03:10:56 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Jason J . Herne" , Thomas Huth , Janosch Frank , qemu-block@nongnu.org, Cornelia Huck , Collin Walling , Christian Borntraeger , Claudio Imbrenda Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" If you try to boot with two virtio-blk disks (without bootindex), and only the second one is bootable, the s390-ccw bios currently stops at the first disk and does not continue booting from the second one. This is annoying - and all other major QEMU firmwares succeed to boot from the second disk in this case, so we should do the same in the s390-ccw bios, too. Reviewed-by: Cornelia Huck Signed-off-by: Thomas Huth --- pc-bios/s390-ccw/bootmap.c | 34 +++++++++++++++++++++++----------- pc-bios/s390-ccw/main.c | 2 +- 2 files changed, 24 insertions(+), 12 deletions(-) diff --git a/pc-bios/s390-ccw/bootmap.c b/pc-bios/s390-ccw/bootmap.c index 97205674e5..0ef6b851f3 100644 --- a/pc-bios/s390-ccw/bootmap.c +++ b/pc-bios/s390-ccw/bootmap.c @@ -289,11 +289,18 @@ static void ipl_eckd_cdl(void) read_block(1, ipl2, "Cannot read IPL2 record at block 1"); =20 mbr =3D &ipl2->mbr; - IPL_assert(magic_match(mbr, ZIPL_MAGIC), "No zIPL section in IPL2 reco= rd."); - IPL_assert(block_size_ok(mbr->blockptr.xeckd.bptr.size), - "Bad block size in zIPL section of IPL2 record."); - IPL_assert(mbr->dev_type =3D=3D DEV_TYPE_ECKD, - "Non-ECKD device type in zIPL section of IPL2 record."); + if (!magic_match(mbr, ZIPL_MAGIC)) { + sclp_print("No zIPL section in IPL2 record.\n"); + return; + } + if (!block_size_ok(mbr->blockptr.xeckd.bptr.size)) { + sclp_print("Bad block size in zIPL section of IPL2 record.\n"); + return; + } + if (!mbr->dev_type =3D=3D DEV_TYPE_ECKD) { + sclp_print("Non-ECKD device type in zIPL section of IPL2 record.\n= "); + return; + } =20 /* save pointer to Boot Map Table */ bmt_block_nr =3D eckd_block_num(&mbr->blockptr.xeckd.bptr.chs); @@ -303,10 +310,14 @@ static void ipl_eckd_cdl(void) =20 memset(sec, FREE_SPACE_FILLER, sizeof(sec)); read_block(2, vlbl, "Cannot read Volume Label at block 2"); - IPL_assert(magic_match(vlbl->key, VOL1_MAGIC), - "Invalid magic of volume label block"); - IPL_assert(magic_match(vlbl->f.key, VOL1_MAGIC), - "Invalid magic of volser block"); + if (!magic_match(vlbl->key, VOL1_MAGIC)) { + sclp_print("Invalid magic of volume label block.\n"); + return; + } + if (!magic_match(vlbl->f.key, VOL1_MAGIC)) { + sclp_print("Invalid magic of volser block.\n"); + return; + } print_volser(vlbl->f.volser); =20 run_eckd_boot_script(bmt_block_nr, s1b_block_nr); @@ -398,7 +409,8 @@ static void ipl_eckd(void) read_block(0, mbr, "Cannot read block 0 on DASD"); =20 if (magic_match(mbr->magic, IPL1_MAGIC)) { - ipl_eckd_cdl(); /* no return */ + ipl_eckd_cdl(); /* only returns in case of error */ + return; } =20 /* LDL/CMS? */ @@ -825,5 +837,5 @@ void zipl_load(void) panic("\n! Unknown IPL device type !\n"); } =20 - panic("\n* this can never happen *\n"); + sclp_print("zIPL load failed.\n"); } diff --git a/pc-bios/s390-ccw/main.c b/pc-bios/s390-ccw/main.c index 9b581074a1..fc17e6ab83 100644 --- a/pc-bios/s390-ccw/main.c +++ b/pc-bios/s390-ccw/main.c @@ -240,7 +240,7 @@ static void ipl_boot_device(void) break; case CU_TYPE_VIRTIO: if (virtio_setup() =3D=3D 0) { - zipl_load(); /* no return */ + zipl_load(); /* Only returns in case of errors */ } break; default: --=20 2.18.1 From nobody Sat May 18 04:30:08 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.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=1596713664; cv=none; d=zohomail.com; s=zohoarc; b=B8KDmbr6WjrjDTrHtaBSSB+4ffTXEB2jpTOYKxUgJv+qAFZNlZhNMwYciVg0Ur0PMchrAM6I+TD7xtUsICOrRlUMPVvreDYQKm/t9QrfpmQNhUS6Y30nwSYnC0bs7wQDUt1fjjotGEAY2j9K7PmD2e6cD+xZce0qB/1Imb2JdJc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1596713664; h=Content-Type:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=lBMEsa2/MuC75GyEUnZL3y0OXLD9QXzBZj5Oli/XDEY=; b=N4aMAakMM/1bm6tLxb8Di22iBWVvLecEPiRe8wPJu1zApjQbTTzQWDoYnc8o2cMEU2W8cAiauNdlPWEN7ZTH/IG1ZR/yvuguDCvRUWHzBKEaNT/YxgHrEls59MjOIpt/M2BeCpYo7hp4lYOKVzPFEn2eci+7wFxuGErYWq7MOVc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.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 (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1596713664674352.9525359607279; Thu, 6 Aug 2020 04:34:24 -0700 (PDT) Received: from localhost ([::1]:45660 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k3eAB-0006c7-EY for importer@patchew.org; Thu, 06 Aug 2020 07:34:23 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43208) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k3dXh-0005JH-6A for qemu-devel@nongnu.org; Thu, 06 Aug 2020 06:54:37 -0400 Received: from us-smtp-1.mimecast.com ([205.139.110.61]:56759 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1k3dXf-0000NN-G0 for qemu-devel@nongnu.org; Thu, 06 Aug 2020 06:54:36 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-452-CIZJv3iEP-egf0BblUs4AA-1; Thu, 06 Aug 2020 06:54:33 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 8ACE0100AA21; Thu, 6 Aug 2020 10:54:31 +0000 (UTC) Received: from thuth.com (ovpn-112-229.ams2.redhat.com [10.36.112.229]) by smtp.corp.redhat.com (Postfix) with ESMTP id D01C55F202; Thu, 6 Aug 2020 10:54:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1596711274; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:content-type:content-type:in-reply-to:in-reply-to: references:references; bh=lBMEsa2/MuC75GyEUnZL3y0OXLD9QXzBZj5Oli/XDEY=; b=dBrl+c/lTYofgO1eacDI+oQR7CRMO0dpkleVHM1+ilNrmrMYr0GHg4QPzT+NLBGnBbwxyu owWKU22ltAtM5eevqyxXjyNlgdZ8TEuwoDwoVoxef+SjjkWh0/rgCfMS7VRACVCthkZyRe 9Bvp15Sx8Xw9hTWYWHUg80gxi/tc3nc= X-MC-Unique: CIZJv3iEP-egf0BblUs4AA-1 From: Thomas Huth To: qemu-s390x@nongnu.org, qemu-devel@nongnu.org Subject: [PATCH for-5.2 v2 8/9] pc-bios/s390-ccw/main: Remove superfluous call to enable_subchannel() Date: Thu, 6 Aug 2020 12:53:48 +0200 Message-Id: <20200806105349.632-9-thuth@redhat.com> In-Reply-To: <20200806105349.632-1-thuth@redhat.com> References: <20200806105349.632-1-thuth@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=thuth@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=205.139.110.61; envelope-from=thuth@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/08/06 00:07:42 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -40 X-Spam_score: -4.1 X-Spam_bar: ---- X-Spam_report: (-4.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Jason J . Herne" , Thomas Huth , Janosch Frank , qemu-block@nongnu.org, Cornelia Huck , Collin Walling , Christian Borntraeger , Claudio Imbrenda Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" enable_subchannel() is already done during is_dev_possibly_bootable() (which is called from find_boot_device() -> find_subch()), so there is no need to do this again in the main() function. Signed-off-by: Thomas Huth Reviewed-by: Cornelia Huck --- pc-bios/s390-ccw/main.c | 1 - 1 file changed, 1 deletion(-) diff --git a/pc-bios/s390-ccw/main.c b/pc-bios/s390-ccw/main.c index fc17e6ab83..43c792cf95 100644 --- a/pc-bios/s390-ccw/main.c +++ b/pc-bios/s390-ccw/main.c @@ -280,7 +280,6 @@ int main(void) boot_setup(); if (have_iplb) { find_boot_device(); - enable_subchannel(blk_schid); ipl_boot_device(); } else { probe_boot_device(); --=20 2.18.1 From nobody Sat May 18 04:30:08 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.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=1596713216; cv=none; d=zohomail.com; s=zohoarc; b=N2mDSM1Ag9V0dcvOIY8GE9M/ng9NQnhpvthDihGgYBoIOiOHDji5Mb4bPjA6vHO6C6yTb335p7MD3GaV6n8hSeJXgUxC/jhdm5DQq62T13AxXXpZMT8NoA2sl97gZxexHQdbXME9XEPLuVnrnKg+ute1EBqy1AFpLpP+41io8ko= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1596713216; h=Content-Type:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=5qakGv2SRjWkcEgBZWP7EefV+cPuJFE+yK79HsvsXaI=; b=GWaRt7rR3mDx0DMDZJL0Z6rGC2wpHQsEdeQnv/MNPOEordVFLNrvEQCtdugzlP0WjtcM5CJsA8y88Gn0wIzxizhJF4LJ9Lq3IEfzOePHHe/1yTuXcvA7bxFtD3nliIyKeoxD6VIN29GQMdswJdGQmArffrvByOq6EPYuOdDv92I= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.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 (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1596713216337468.25061088929635; Thu, 6 Aug 2020 04:26:56 -0700 (PDT) Received: from localhost ([::1]:45258 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k3e2v-0003JU-Dc for importer@patchew.org; Thu, 06 Aug 2020 07:26:53 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43264) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k3dXo-0005Qs-2g for qemu-devel@nongnu.org; Thu, 06 Aug 2020 06:54:44 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:34336 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1k3dXj-0000Ns-6Y for qemu-devel@nongnu.org; Thu, 06 Aug 2020 06:54:43 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-17-PMISKduCMiWaWw81A95dgA-1; Thu, 06 Aug 2020 06:54:37 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 3BFEF800404; Thu, 6 Aug 2020 10:54:35 +0000 (UTC) Received: from thuth.com (ovpn-112-229.ams2.redhat.com [10.36.112.229]) by smtp.corp.redhat.com (Postfix) with ESMTP id 233685F202; Thu, 6 Aug 2020 10:54:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1596711278; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:content-type:content-type:in-reply-to:in-reply-to: references:references; bh=5qakGv2SRjWkcEgBZWP7EefV+cPuJFE+yK79HsvsXaI=; b=Un1COuSzxK+nUTr6PwOyN990sN+j6OJ6Ft50ouELbSKqnqKUuD0gbx3hRtt0KbVLpKk7UK pog6ctsHseoN8R9rAkWHGwKhoppXZLuFD8uVb5IrjlXWAaAOFYrykVhCxAJdWnvn0+jNsR UBklWxrHrbgiLdmnMMtTpRvZ/4IzqZY= X-MC-Unique: PMISKduCMiWaWw81A95dgA-1 From: Thomas Huth To: qemu-s390x@nongnu.org, qemu-devel@nongnu.org Subject: [PATCH for-5.2 v2 9/9] tests/qtest/cdrom: Add more s390x-related boot tests Date: Thu, 6 Aug 2020 12:53:49 +0200 Message-Id: <20200806105349.632-10-thuth@redhat.com> In-Reply-To: <20200806105349.632-1-thuth@redhat.com> References: <20200806105349.632-1-thuth@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=thuth@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=207.211.31.120; envelope-from=thuth@redhat.com; helo=us-smtp-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/08/06 03:10:56 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Jason J . Herne" , Thomas Huth , Janosch Frank , qemu-block@nongnu.org, Cornelia Huck , Collin Walling , Christian Borntraeger , Claudio Imbrenda Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Let's add two new tests: 1) Booting with "bootindex" is the architected default behavior on the s390x target, so we should have at least one test that is using the "bootindex" property. 2) The s390-ccw bios used to fail when other unbootable devices have been specified before the bootable device (without "bootindex"). Now that the s390-ccw bios is a little bit smarter here, we should test this scenario, too, to avoid regressions. Signed-off-by: Thomas Huth Acked-by: Janosch Frank Reviewed-by: Cornelia Huck --- tests/qtest/cdrom-test.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tests/qtest/cdrom-test.c b/tests/qtest/cdrom-test.c index 833a0508a1..13e22f57c1 100644 --- a/tests/qtest/cdrom-test.c +++ b/tests/qtest/cdrom-test.c @@ -163,6 +163,18 @@ static void add_s390x_tests(void) qtest_add_data_func("cdrom/boot/virtio-scsi", "-device virtio-scsi -device scsi-cd,drive=3Dcdr " "-blockdev file,node-name=3Dcdr,filename=3D", test= _cdboot); + qtest_add_data_func("cdrom/boot/with-bootindex", + "-device virtio-serial -device virtio-scsi " + "-device virtio-blk,drive=3Dd1 " + "-drive driver=3Dnull-co,read-zeroes=3Don,if=3Dnon= e,id=3Dd1 " + "-device virtio-blk,drive=3Dd2,bootindex=3D1 " + "-drive if=3Dnone,id=3Dd2,media=3Dcdrom,file=3D", = test_cdboot); + qtest_add_data_func("cdrom/boot/without-bootindex", + "-device virtio-scsi -device virtio-serial " + "-device x-terminal3270 -device virtio-blk,drive= =3Dd1 " + "-drive driver=3Dnull-co,read-zeroes=3Don,if=3Dnon= e,id=3Dd1 " + "-device virtio-blk,drive=3Dd2 " + "-drive if=3Dnone,id=3Dd2,media=3Dcdrom,file=3D", = test_cdboot); } =20 int main(int argc, char **argv) --=20 2.18.1