From nobody Fri Mar 29 02:13:11 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=1595961638; cv=none; d=zohomail.com; s=zohoarc; b=HTLWvXO7GwJvLNLOwhmPHttR/0W3N6TA/zCQydFZYsQE1Tf4axnbMcbXVtDh/Q4LAqrNjYAj+Y4Zc8JZ8md5+ZFw90Y4urPQdCPuOStVwaV6hCdNreP6EtYEEFqQmha7QP7dY3D3S45dG/MuZOT9HCw2NxGQcWgWWwS8HNW4/14= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1595961638; 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=OOAth+yTKBkPo6wkpKNriKVNskluGMqRi9nkamVdc7Q=; b=h4BGflZKHLeS+7J0lDKRRJGF/0Sm+xFv3vQnHW6absKqj2DDC0hAQXLVS/K3NKGunG2KkEEhfzqp5m1sKstvWXyaUDChKnruBBdPDvYW+1VvDoE4lw9ojh0pNJO9edDYbfHaQy+nD1ipm+vBhp1/VwJt1gZyGHgGufxpKJ2thKQ= 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 1595961638643244.4628059267444; Tue, 28 Jul 2020 11:40:38 -0700 (PDT) Received: from localhost ([::1]:39118 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k0UWj-0003J8-3l for importer@patchew.org; Tue, 28 Jul 2020 14:40:37 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45550) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k0UU6-0007dW-Aj for qemu-devel@nongnu.org; Tue, 28 Jul 2020 14:37:54 -0400 Received: from us-smtp-1.mimecast.com ([207.211.31.81]:35620 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 1k0UU4-0005KR-SQ for qemu-devel@nongnu.org; Tue, 28 Jul 2020 14:37:54 -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-343-Ru6A5vsKNMOblaFRX8MWyg-1; Tue, 28 Jul 2020 14:37:48 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id A6A94800685; Tue, 28 Jul 2020 18:37:46 +0000 (UTC) Received: from thuth.com (ovpn-112-56.ams2.redhat.com [10.36.112.56]) by smtp.corp.redhat.com (Postfix) with ESMTP id E9A4B60BF4; Tue, 28 Jul 2020 18:37:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1595961472; 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=OOAth+yTKBkPo6wkpKNriKVNskluGMqRi9nkamVdc7Q=; b=U2t6PbnGU4ODqgdp3L5ne4g55Qy+YXkXTn9PxyiAHLA4pxlcXTn1nbR18jXzAlKNiCLnGL qJIVSlM1xgnLpjeqFs2A63M+ZOmmMOh02SG5m5gqSg3Vd5x3BSrZuvLBJq1iydPl0EAKYq qYv/wmaC0oO8Ifzv64wicwQA63GdFSU= X-MC-Unique: Ru6A5vsKNMOblaFRX8MWyg-1 From: Thomas Huth To: qemu-s390x@nongnu.org, qemu-devel@nongnu.org Subject: [PATCH for-5.2 1/6] pc-bios/s390-ccw/Makefile: Compile with -std=gnu99, -fwrapv and -fno-common Date: Tue, 28 Jul 2020 20:37:29 +0200 Message-Id: <20200728183734.7838-2-thuth@redhat.com> In-Reply-To: <20200728183734.7838-1-thuth@redhat.com> References: <20200728183734.7838-1-thuth@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 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/07/28 10:31:13 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: 2 X-Spam_score: 0.2 X-Spam_bar: / X-Spam_report: (0.2 / 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_SBL_CSS=3.335, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no 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 , 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. Signed-off-by: Thomas Huth Acked-by: Cornelia Huck Acked-by: Janosch Frank Reviewed-by: Claudio Imbrenda --- 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 Fri Mar 29 02:13:11 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=1595961560; cv=none; d=zohomail.com; s=zohoarc; b=XEOYMrcmkTFGjUZgRIwEyO1qge+CjQw6tccCiXSLrjl1y6xTXb6aVf60Gg8c+XeOUEAIGflr2V5aVXjELrj0RE3p0xzwzle2tSXJoA1lL2vPhCK6gTjLgt5dLU2nHRQCFxmR+DlX78DpPMFz8OAVS48zmLF7btEvvFjSgGMMDw4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1595961560; 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=Hfp3QM9SgYQE0pQgUg/eToLLU9Zi7JYBr6vL1JgNcdI=; b=HhZH+qePXlQsimO8M2xcriVl0u1uhi5BTmhPirFpacuS+oBe+U+nFsaUF4V97hWqtXHCNqoakbyIHRkGRfodulAyO4dp8jiz19Opcko9KfKJPiY2LaMbW8k/dWuhHG1irx7gihjjjRPtgGVuVRdp3Ax0XDhkqqvTDvba9RUrFPI= 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 1595961560268239.79362904350876; Tue, 28 Jul 2020 11:39:20 -0700 (PDT) Received: from localhost ([::1]:33232 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k0UVT-0000t4-1N for importer@patchew.org; Tue, 28 Jul 2020 14:39:19 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45608) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k0UUE-0007n7-8F for qemu-devel@nongnu.org; Tue, 28 Jul 2020 14:38:02 -0400 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:59000 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 1k0UUC-0005Mq-Mu for qemu-devel@nongnu.org; Tue, 28 Jul 2020 14:38:01 -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-236-AWZM8PtnN4SP-KN18QMYCw-1; Tue, 28 Jul 2020 14:37:57 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 961F480046C; Tue, 28 Jul 2020 18:37:56 +0000 (UTC) Received: from thuth.com (ovpn-112-56.ams2.redhat.com [10.36.112.56]) by smtp.corp.redhat.com (Postfix) with ESMTP id 05D2360BF4; Tue, 28 Jul 2020 18:37:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1595961479; 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=Hfp3QM9SgYQE0pQgUg/eToLLU9Zi7JYBr6vL1JgNcdI=; b=cPgZWFeLQ8r3kwso4iDeAISBgjZ4QNt660d4KAFN+EWLbZ/I6xqbjkoQfX1mraI2QNncY+ GtVuDugBhnrgW6EXzIcrw7SPcYckcuBslTxZy2JZwk6PdqVJereS5/DKa+a7njCpbdm/6i 2uSiuVHHbLSBgvtv2hH3tbiT4u1+ffU= X-MC-Unique: AWZM8PtnN4SP-KN18QMYCw-1 From: Thomas Huth To: qemu-s390x@nongnu.org, qemu-devel@nongnu.org Subject: [PATCH for-5.2 2/6] pc-bios/s390-ccw: Move ipl-related code from main() into a separate function Date: Tue, 28 Jul 2020 20:37:30 +0200 Message-Id: <20200728183734.7838-3-thuth@redhat.com> In-Reply-To: <20200728183734.7838-1-thuth@redhat.com> References: <20200728183734.7838-1-thuth@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 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/07/28 10:31:20 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 , 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. Signed-off-by: Thomas Huth Reviewed-by: Claudio Imbrenda Reviewed-by: Cornelia Huck Reviewed-by: Janosch Frank --- 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 Fri Mar 29 02:13:11 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=1595961570; cv=none; d=zohomail.com; s=zohoarc; b=CyFStFa2VbVdNS0IiYW8dZSqig/8ZjU4BmGaTAmsel5dsphOCDreNgRDt+tl/wtdkvrU22V0urGXZteLdYQF4D/Z/8irZAe74uIkAiaDb8/HDRWPCNCk87RfUqiG1AGeJ2VJ/YtXPiIO5J25WnXRS1J+etOx8qx1Ay87d2c23gk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1595961570; 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=zrEIrVvtKcJBx3a3UhBSl61oVCnyNTvsVQLA8e8lV3w=; b=B8h06+KYhzk0xdyMgJN1NV2HCNYhNaPofxhHkhDk8Oe/8w4xQbUwLtgYYJZOs9CEUx6bT6r9TK2k5/veyoeL8VxynxQRdWgchj9iUROpua4Bnc2EVB1gmgAUJ1Ver7tNYfaFhn8pjA3N7tpKaqg+M4XZPA/KOpkZg6rgDbqawtk= 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 1595961570370634.8911975020599; Tue, 28 Jul 2020 11:39:30 -0700 (PDT) Received: from localhost ([::1]:34268 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k0UVd-0001KY-02 for importer@patchew.org; Tue, 28 Jul 2020 14:39:29 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45698) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k0UUN-00082j-22 for qemu-devel@nongnu.org; Tue, 28 Jul 2020 14:38:11 -0400 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:43715 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 1k0UUL-0005Om-GS for qemu-devel@nongnu.org; Tue, 28 Jul 2020 14:38:10 -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-400-FBGxgYUNOFuC7zS6lNnkNg-1; Tue, 28 Jul 2020 14:38:04 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 9EA291005504; Tue, 28 Jul 2020 18:38:02 +0000 (UTC) Received: from thuth.com (ovpn-112-56.ams2.redhat.com [10.36.112.56]) by smtp.corp.redhat.com (Postfix) with ESMTP id E8ADE60BF4; Tue, 28 Jul 2020 18:37:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1595961488; 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=zrEIrVvtKcJBx3a3UhBSl61oVCnyNTvsVQLA8e8lV3w=; b=WwXxJhDS4RSPYSkfnPQVoStr/qeGrviTGB4cQ6o+ZJtRVAYmD/v/Oj9MBKWjzqACiACNov qSBbIsbgmpccCTkLhMCP8RlU6wsLLl2e1KQHlxk88gbcfftsYDB8HblUhZ/EXJLVjfIGiE 9805lo/5+KzfTiwndwPViu40Jq/YPa0= X-MC-Unique: FBGxgYUNOFuC7zS6lNnkNg-1 From: Thomas Huth To: qemu-s390x@nongnu.org, qemu-devel@nongnu.org Subject: [PATCH for-5.2 3/6] pc-bios/s390-ccw: Move the inner logic of find_subch() to a separate function Date: Tue, 28 Jul 2020 20:37:31 +0200 Message-Id: <20200728183734.7838-4-thuth@redhat.com> In-Reply-To: <20200728183734.7838-1-thuth@redhat.com> References: <20200728183734.7838-1-thuth@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 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/07/28 10:31:20 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, 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 , 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. Signed-off-by: Thomas Huth Reviewed-by: Claudio Imbrenda --- 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..9477313188 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 check_sch_no(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 -EIO; + } + 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 1st possibly bootable device */ + 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 check_sch_no(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 Fri Mar 29 02:13:11 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=1595961572; cv=none; d=zohomail.com; s=zohoarc; b=gJhLMZeUn6pUqyExqweujLR2aESkpDlaK5WUWMhLVOdAnELhxAwDidAJijA8NGuzQGs6uhW0C2eXvgNbjjmZhZee1BF8tzb6ptpRqeLGlGkhTQ2SkOFLvuOl6K3G1EmSSpQRdyfMKF58T6az8Hz5EyIoa6kOwLdaQpyaMD7ENow= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1595961572; 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=PIjgQprHAqpNCLLgAtY/PnKTEo/f57Qig0gWhSWt1Rw=; b=cuqESM10qCK7ebXMwOdm4YReUlCCIjVYKfOc9H7A+Ep/goGWZUH7Edw2s3SBD/doFO07xxv3A3sIL4AXvt6xIB4fpkQHCtcwdVCpVl76daIcYKpUTSxYHoI1LH6p+DEOUYdby+BjRAOPObOky0xqFMPjrN93tSLd5B6F2VG08MQ= 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 1595961572421796.6633868862883; Tue, 28 Jul 2020 11:39:32 -0700 (PDT) Received: from localhost ([::1]:34524 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k0UVf-0001Qo-3b for importer@patchew.org; Tue, 28 Jul 2020 14:39:31 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45754) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k0UUT-0008CO-RU for qemu-devel@nongnu.org; Tue, 28 Jul 2020 14:38:18 -0400 Received: from us-smtp-1.mimecast.com ([205.139.110.61]:29609 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 1k0UUS-0005QN-82 for qemu-devel@nongnu.org; Tue, 28 Jul 2020 14:38:17 -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-292-kQQW2OCBPh-K7RN-mT7bHQ-1; Tue, 28 Jul 2020 14:38:13 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 439DE18C63CE; Tue, 28 Jul 2020 18:38:12 +0000 (UTC) Received: from thuth.com (ovpn-112-56.ams2.redhat.com [10.36.112.56]) by smtp.corp.redhat.com (Postfix) with ESMTP id 08F8560C87; Tue, 28 Jul 2020 18:38:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1595961495; 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=PIjgQprHAqpNCLLgAtY/PnKTEo/f57Qig0gWhSWt1Rw=; b=Ib3NCIUJs9zwWfYXEze9nQrnCnnMWAq9yvR1CAcpAo88xkvLYEUcGPm8AOFCmgybHJqG9D dHEpUFofizkwJHH3pU8Fa6SDfXTb1JyTJ6WgyWRfVn9KbrZOUZhsvGM3O/10buM10rolAE 4uT1W9gTH2dMuig40Vsxj6Ga5+xK+P4= X-MC-Unique: kQQW2OCBPh-K7RN-mT7bHQ-1 From: Thomas Huth To: qemu-s390x@nongnu.org, qemu-devel@nongnu.org Subject: [PATCH for-5.2 4/6] pc-bios/s390-ccw: Do not bail out early if not finding a SCSI disk Date: Tue, 28 Jul 2020 20:37:32 +0200 Message-Id: <20200728183734.7838-5-thuth@redhat.com> In-Reply-To: <20200728183734.7838-1-thuth@redhat.com> References: <20200728183734.7838-1-thuth@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 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/07/28 11:04:16 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: 2 X-Spam_score: 0.2 X-Spam_bar: / X-Spam_report: (0.2 / 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_SBL_CSS=3.335, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no 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 , 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 --- pc-bios/s390-ccw/main.c | 13 +++++++++---- pc-bios/s390-ccw/s390-ccw.h | 2 +- pc-bios/s390-ccw/virtio-blkdev.c | 7 ++++--- pc-bios/s390-ccw/virtio-scsi.c | 25 ++++++++++++++++++------- pc-bios/s390-ccw/virtio-scsi.h | 2 +- 5 files changed, 33 insertions(+), 16 deletions(-) diff --git a/pc-bios/s390-ccw/main.c b/pc-bios/s390-ccw/main.c index 9477313188..3cd01cd80f 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 bool virtio_setup(void) { VDev *vdev =3D virtio_get_device(); QemuIplParameters *early_qipl =3D (QemuIplParameters *)QIPL_ADDRESS; @@ -233,9 +233,13 @@ 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); + if (!virtio_blk_setup_device(blk_schid)) { + return false; + } IPL_assert(virtio_ipl_disk_is_valid(), "No valid IPL device detect= ed"); } + + return true; } =20 static void ipl_boot_device(void) @@ -246,8 +250,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()) { + 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 36b884cced..a46d15431e 100644 --- a/pc-bios/s390-ccw/s390-ccw.h +++ b/pc-bios/s390-ccw/s390-ccw.h @@ -71,7 +71,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); +bool 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..0746627b1e 100644 --- a/pc-bios/s390-ccw/virtio-blkdev.c +++ b/pc-bios/s390-ccw/virtio-blkdev.c @@ -263,7 +263,7 @@ uint64_t virtio_get_blocks(void) return 0; } =20 -void virtio_blk_setup_device(SubChannelId schid) +bool virtio_blk_setup_device(SubChannelId schid) { VDev *vdev =3D virtio_get_device(); =20 @@ -288,9 +288,10 @@ void virtio_blk_setup_device(SubChannelId schid) "Config: CDB size mismatch"); =20 sclp_print("Using virtio-scsi.\n"); - virtio_scsi_setup(vdev); - break; + return virtio_scsi_setup(vdev); default: panic("\n! No IPL device available !\n"); } + + return true; } diff --git a/pc-bios/s390-ccw/virtio-scsi.c b/pc-bios/s390-ccw/virtio-scsi.c index eddfb8a7ad..4d05b02ed0 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 adds that information to the + * vdev->scsi_device structure. + * Returns true if SCSI device could be located, false otherwise + */ +static bool 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 true; } =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 true; /* 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 true; /* 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 false; } =20 int virtio_scsi_read_many(VDev *vdev, @@ -322,7 +329,7 @@ static void scsi_parse_capacity_report(void *data, } } =20 -void virtio_scsi_setup(VDev *vdev) +bool virtio_scsi_setup(VDev *vdev) { int retry_test_unit_ready =3D 3; uint8_t data[256]; @@ -332,7 +339,9 @@ void virtio_scsi_setup(VDev *vdev) int i; =20 vdev->scsi_device =3D &default_scsi_device; - virtio_scsi_locate_device(vdev); + if (!virtio_scsi_locate_device(vdev)) { + return false; + } =20 /* We have to "ping" the device before it becomes readable */ while (!scsi_test_unit_ready(vdev)) { @@ -417,4 +426,6 @@ void virtio_scsi_setup(VDev *vdev) } scsi_parse_capacity_report(data, &vdev->scsi_last_block, (uint32_t *) &vdev->scsi_block_size); + + return true; } diff --git a/pc-bios/s390-ccw/virtio-scsi.h b/pc-bios/s390-ccw/virtio-scsi.h index 4c4f4bbc31..2e405d0436 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); +bool 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 Fri Mar 29 02:13:11 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=1595961696; cv=none; d=zohomail.com; s=zohoarc; b=QhPXwLk16h5iIhz5VKRYZQ3NtK8L13WRVMQNxpEN+76E8ihwW7DID0hQNs7WfvDu4uFNe4HuwHPcB5dGUZZ5roswSTuYO4yu/TA2vgfNsYrquFm3MfzzelcxShont9UgfIvizs8zjcHFd+bqPClXm8ZB40wi1DI3Y9EweaLXdXM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1595961696; 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=QtQk+14B6MDHKRJIdVfVT1eCD7Su5ogPrM8ZDLbPp7Q=; b=arFFLHkMUs3O/AS5l0aoGZ+g5310t9zJT8iTd+loIJACBm9p1To1WtQCqROXVRDUMX5e5Wzt/P+jVafRZawUc6M+P39D2Tc4uzM94fGGGiSC+6xXk0VRwU4MhD1Q3NE/mp+EB+ixHV9OwaguerCFJWg+KIjlOlMpl+GxFCTik6E= 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 1595961696984341.865755915132; Tue, 28 Jul 2020 11:41:36 -0700 (PDT) Received: from localhost ([::1]:41972 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k0UXf-0004Zl-Nh for importer@patchew.org; Tue, 28 Jul 2020 14:41:35 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45814) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k0UUb-0008K3-Gs for qemu-devel@nongnu.org; Tue, 28 Jul 2020 14:38:26 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:46926 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 1k0UUY-0005U4-AW for qemu-devel@nongnu.org; Tue, 28 Jul 2020 14:38:25 -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-399-qCA8Z-MsO8udX1zSIxEVGQ-1; Tue, 28 Jul 2020 14:38:19 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 1B14B79EC0; Tue, 28 Jul 2020 18:38:18 +0000 (UTC) Received: from thuth.com (ovpn-112-56.ams2.redhat.com [10.36.112.56]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9865460BF4; Tue, 28 Jul 2020 18:38:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1595961501; 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=QtQk+14B6MDHKRJIdVfVT1eCD7Su5ogPrM8ZDLbPp7Q=; b=EC7o9P2OpfMvStdRMkzwQQ3LdCK1tla6jgjKdxuu5mItEamyF99HwRXZ2yo3ydoI0uSmc4 1bEcBKkKQ9J6uSARNSyu1K6sjOrp615bQemDNF2mmHhHtyY52k6wQEITyfN9XnwYDQNf4f YsQOEiO80xGrLhv/KFFwW6+D6kDYrXc= X-MC-Unique: qCA8Z-MsO8udX1zSIxEVGQ-1 From: Thomas Huth To: qemu-s390x@nongnu.org, qemu-devel@nongnu.org Subject: [PATCH for-5.2 5/6] pc-bios/s390-ccw: Scan through all boot devices if none has been specified Date: Tue, 28 Jul 2020 20:37:33 +0200 Message-Id: <20200728183734.7838-6-thuth@redhat.com> In-Reply-To: <20200728183734.7838-1-thuth@redhat.com> References: <20200728183734.7838-1-thuth@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 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/07/28 10:28:27 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 , 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 Signed-off-by: Thomas Huth Reviewed-by: Cornelia Huck --- 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 3cd01cd80f..0af872f9e3 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); @@ -260,14 +248,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 check_sch_no(-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 Fri Mar 29 02:13:11 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=1595961688; cv=none; d=zohomail.com; s=zohoarc; b=f//VehnB+jGMQ9udhCLGpuJmz1GRb0ifG9UB3vHzplUt+syvIDNkUPKbqr6MHQuxT9nm9ZDEfjICVQq5qOFTKmXP2vtdDCxqzJjWwbv7tWt8Dryg2N59VcabRLI1hE7s3/4X+xKOxbTe+lfU5iQNtCAHQsQ+5sED/F/Bgqpn1IQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1595961688; 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=ZlMOOYPtIc17o+D4TQ7LUzqji8ZwJbFNeBPPqmPkGaM=; b=EyZvq5mlOceAkNFYfc8Vlymae54Lakl+yNqLIi5O2xkxNXHkufAr5fCq+zwUn0TUNypr22cu6UypDxSb9qVfJ/Y8WtlTBCp2skD/8MGx06EQD/B27Ae4WZ8Dp6wvaTzoYPptYZLH0cApE/Kh86iCjzLzNCs4MHQc5duZ3g9Mq+U= 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 159596168878938.07856055118589; Tue, 28 Jul 2020 11:41:28 -0700 (PDT) Received: from localhost ([::1]:41296 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k0UXW-0004H2-Ab for importer@patchew.org; Tue, 28 Jul 2020 14:41:26 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45852) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k0UUi-00006X-UL for qemu-devel@nongnu.org; Tue, 28 Jul 2020 14:38:33 -0400 Received: from us-smtp-1.mimecast.com ([207.211.31.81]:34436 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 1k0UUh-0005X9-HF for qemu-devel@nongnu.org; Tue, 28 Jul 2020 14:38:32 -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-251-BDsPrQmXOL6Wo_yelpB3tA-1; Tue, 28 Jul 2020 14:38:25 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id C5A09800475; Tue, 28 Jul 2020 18:38:23 +0000 (UTC) Received: from thuth.com (ovpn-112-56.ams2.redhat.com [10.36.112.56]) by smtp.corp.redhat.com (Postfix) with ESMTP id 79B7060BF4; Tue, 28 Jul 2020 18:38:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1595961510; 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=ZlMOOYPtIc17o+D4TQ7LUzqji8ZwJbFNeBPPqmPkGaM=; b=ZFeEfFi9fDlEdFaC8JfLOcQk9UA7b+Csdp9dK6oIsqnEONYtATLIj7PDAOcN2G3oL+l4Ux guPkbowkRb7UYZKSgys5L3x8v+lWTMNXABet3HLl3sjJDgSahvdtAsRt9Us3FguL1bZEgQ 1g7ib7as4GM5Z7GcxNDpSWWm96BblI4= X-MC-Unique: BDsPrQmXOL6Wo_yelpB3tA-1 From: Thomas Huth To: qemu-s390x@nongnu.org, qemu-devel@nongnu.org Subject: [PATCH for-5.2 6/6] pc-bios/s390-ccw: Allow booting in case the first virtio-blk disk is bad Date: Tue, 28 Jul 2020 20:37:34 +0200 Message-Id: <20200728183734.7838-7-thuth@redhat.com> In-Reply-To: <20200728183734.7838-1-thuth@redhat.com> References: <20200728183734.7838-1-thuth@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 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/07/28 10:31:13 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: 2 X-Spam_score: 0.2 X-Spam_bar: / X-Spam_report: (0.2 / 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_SBL_CSS=3.335, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no 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 , 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. Signed-off-by: Thomas Huth Reviewed-by: Cornelia Huck --- 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 0af872f9e3..4026e0ef20 100644 --- a/pc-bios/s390-ccw/main.c +++ b/pc-bios/s390-ccw/main.c @@ -239,7 +239,7 @@ static void ipl_boot_device(void) break; case CU_TYPE_VIRTIO: if (virtio_setup()) { - zipl_load(); /* no return */ + zipl_load(); /* Only returns in case of errors */ } break; default: --=20 2.18.1