From patchwork Tue Oct 6 18:31:07 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Huth X-Patchwork-Id: 11819039 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4B4C0139F for ; Tue, 6 Oct 2020 18:33:30 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 8DEFA206F7 for ; Tue, 6 Oct 2020 18:33:29 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="CuOIHmmR" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8DEFA206F7 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:40168 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kPrmC-0004mC-3A for patchwork-qemu-devel@patchwork.kernel.org; Tue, 06 Oct 2020 14:33:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57250) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kPrkY-0002xU-PE for qemu-devel@nongnu.org; Tue, 06 Oct 2020 14:31:47 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:33649) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kPrkU-0006OF-H3 for qemu-devel@nongnu.org; Tue, 06 Oct 2020 14:31:44 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1602009100; 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=Rm21lPZM1L70ZjyGFowNYjOpvCLQ+tn80dvwCPvgDgQ=; b=CuOIHmmR7S6UdriZhAnzyabLL1OJSQ4TeRgCXwTy0X4VLNWQ6cSnw//AUQReLSuKnft61x xAZ2xzoGl675OYp/VZDGY1RNWJDkVFpKn6O+nW1CoxGI9amABKmzdqjRmvz16BJIqdO8W+ 47IzoSenTzCmlvpe292g0HbpkA3AwrI= 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-239-SXYBLxivMeucdA-dKTgtig-1; Tue, 06 Oct 2020 14:31:35 -0400 X-MC-Unique: SXYBLxivMeucdA-dKTgtig-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 21A2C18A8223; Tue, 6 Oct 2020 18:31:34 +0000 (UTC) Received: from thuth.com (ovpn-113-60.ams2.redhat.com [10.36.113.60]) by smtp.corp.redhat.com (Postfix) with ESMTP id D224D6EF43; Tue, 6 Oct 2020 18:31:31 +0000 (UTC) From: Thomas Huth To: qemu-devel@nongnu.org, Peter Maydell Subject: [PULL 01/16] pc-bios/s390-ccw/Makefile: Compile with -std=gnu99, -fwrapv and -fno-common Date: Tue, 6 Oct 2020 20:31:07 +0200 Message-Id: <20201006183122.155609-2-thuth@redhat.com> In-Reply-To: <20201006183122.155609-1-thuth@redhat.com> References: <20201006183122.155609-1-thuth@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 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 client-ip=216.205.24.124; envelope-from=thuth@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/06 00:55:20 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.733, 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_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, 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: Christian Borntraeger , qemu-s390x@nongnu.org, Cornelia Huck , Marc Hartmayer , Janosch Frank Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" The main QEMU code is compiled with -std=gnu99, -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=... 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 Message-Id: <20200806105349.632-2-thuth@redhat.com> 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 3eb785048a..29fd9019b8 100644 --- a/pc-bios/s390-ccw/Makefile +++ b/pc-bios/s390-ccw/Makefile @@ -30,10 +30,11 @@ OBJECTS = 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 QEMU_CFLAGS := -Wall $(filter -W%, $(QEMU_CFLAGS)) -QEMU_CFLAGS += -ffreestanding -fno-delete-null-pointer-checks -msoft-float -QEMU_CFLAGS += -march=z900 -fPIE -fno-strict-aliasing -QEMU_CFLAGS += -fno-asynchronous-unwind-tables +QEMU_CFLAGS += -ffreestanding -fno-delete-null-pointer-checks -fno-common -fPIE +QEMU_CFLAGS += -fwrapv -fno-strict-aliasing -fno-asynchronous-unwind-tables QEMU_CFLAGS += $(call cc-option, $(QEMU_CFLAGS), -fno-stack-protector) +QEMU_CFLAGS += -msoft-float -march=z900 +QEMU_CFLAGS += -std=gnu99 LDFLAGS += -Wl,-pie -nostdlib build-all: s390-ccw.img s390-netboot.img From patchwork Tue Oct 6 18:31:08 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Huth X-Patchwork-Id: 11819047 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 78497139F for ; Tue, 6 Oct 2020 18:36:35 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 1D47C20789 for ; Tue, 6 Oct 2020 18:36:34 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="i4HJi1aU" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1D47C20789 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:48716 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kPrpB-0008Ny-Od for patchwork-qemu-devel@patchwork.kernel.org; Tue, 06 Oct 2020 14:36:33 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57342) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kPrke-0002zt-Or for qemu-devel@nongnu.org; Tue, 06 Oct 2020 14:31:52 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:36840) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kPrkY-0006OP-GF for qemu-devel@nongnu.org; Tue, 06 Oct 2020 14:31:52 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1602009102; 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=sLIn+FGQAWTEZgbaO4083ah3ZttjRz20DY3Xv8EoCfE=; b=i4HJi1aU+HRUJpoP+cqLUkIP6/i4y/RETHUL1bh9iVpk4RdR5sxlAB4UJJdnwjRJUcEzPS kJs397aUwP8AR1D5aqcOcTSlxe6pDxVQu4p1MD/lKCtUQPagtMQ8FGgP2XXHSoRm2Aq1gX o2if7qaQKEcLIfr2G3TwGz5ciq7lsxA= 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-174-0OFCYIJtPsu7no4qLUGdOQ-1; Tue, 06 Oct 2020 14:31:38 -0400 X-MC-Unique: 0OFCYIJtPsu7no4qLUGdOQ-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id C526418A822F; Tue, 6 Oct 2020 18:31:36 +0000 (UTC) Received: from thuth.com (ovpn-113-60.ams2.redhat.com [10.36.113.60]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7E7B06EF43; Tue, 6 Oct 2020 18:31:34 +0000 (UTC) From: Thomas Huth To: qemu-devel@nongnu.org, Peter Maydell Subject: [PULL 02/16] pc-bios/s390-ccw: Move ipl-related code from main() into a separate function Date: Tue, 6 Oct 2020 20:31:08 +0200 Message-Id: <20201006183122.155609-3-thuth@redhat.com> In-Reply-To: <20201006183122.155609-1-thuth@redhat.com> References: <20201006183122.155609-1-thuth@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 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 client-ip=63.128.21.124; envelope-from=thuth@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/06 01:55:55 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.733, 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_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, 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: Christian Borntraeger , qemu-s390x@nongnu.org, Cornelia Huck , Marc Hartmayer , Janosch Frank Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" 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 Message-Id: <20200806105349.632-3-thuth@redhat.com> 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) } } -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(); panic("Failed to load OS from hard disk\n"); return 0; /* make compiler happy */ From patchwork Tue Oct 6 18:31:09 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Huth X-Patchwork-Id: 11819041 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id CC9726CB for ; Tue, 6 Oct 2020 18:33:31 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 79FA1206F7 for ; Tue, 6 Oct 2020 18:33:31 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="JabQMd9Q" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 79FA1206F7 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:40318 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kPrmE-0004pz-2N for patchwork-qemu-devel@patchwork.kernel.org; Tue, 06 Oct 2020 14:33:30 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57308) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kPrkc-0002zF-UF for qemu-devel@nongnu.org; Tue, 06 Oct 2020 14:31:50 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:50020) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kPrkY-0006PB-Fb for qemu-devel@nongnu.org; Tue, 06 Oct 2020 14:31:50 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1602009105; 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=T6YP8hrHQXev/+boFaf2AQK9gihkEjg8LhNi5eosoCs=; b=JabQMd9QHURcPaLmHMN4KKnw0JUerEQIT+xZnMRN1I8r3fnJ2oyZbx0Ak+SChGLD6ZTLin 5gPASvIy9BwJud5+d3CoZYkMU7dGkzYs7LxeZnvTcftpsXyYtKLiK3hb+YY1/LIEWXfHyC NT1XoY0XpD6EBeTMulq3Sn2wa6L31BM= 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-279-VNXk1h8mNZuWXpI81M38VQ-1; Tue, 06 Oct 2020 14:31:40 -0400 X-MC-Unique: VNXk1h8mNZuWXpI81M38VQ-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 3DEC618A8230; Tue, 6 Oct 2020 18:31:39 +0000 (UTC) Received: from thuth.com (ovpn-113-60.ams2.redhat.com [10.36.113.60]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4E9FB6EF46; Tue, 6 Oct 2020 18:31:36 +0000 (UTC) From: Thomas Huth To: qemu-devel@nongnu.org, Peter Maydell Subject: [PULL 03/16] pc-bios/s390-ccw: Introduce ENODEV define and remove guards of others Date: Tue, 6 Oct 2020 20:31:09 +0200 Message-Id: <20201006183122.155609-4-thuth@redhat.com> In-Reply-To: <20201006183122.155609-1-thuth@redhat.com> References: <20201006183122.155609-1-thuth@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 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 client-ip=216.205.24.124; envelope-from=thuth@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/06 00:55:20 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.733, 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_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, 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: Christian Borntraeger , qemu-s390x@nongnu.org, Cornelia Huck , Marc Hartmayer , Janosch Frank Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" 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. Message-Id: <20200806105349.632-4-thuth@redhat.com> Reviewed-by: Cornelia Huck Reviewed-by: Janosch Frank Signed-off-by: Thomas Huth --- 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 -#ifndef EIO #define EIO 1 -#endif -#ifndef EBUSY #define EBUSY 2 -#endif +#define ENODEV 3 + #ifndef NULL #define NULL 0 #endif From patchwork Tue Oct 6 18:31:10 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Huth X-Patchwork-Id: 11819043 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1929C1580 for ; Tue, 6 Oct 2020 18:33:33 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 8F551206F7 for ; Tue, 6 Oct 2020 18:33:32 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="AVlW44aZ" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8F551206F7 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:40438 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kPrmF-0004sz-Dv for patchwork-qemu-devel@patchwork.kernel.org; Tue, 06 Oct 2020 14:33:31 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57386) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kPrkg-00031y-Ew for qemu-devel@nongnu.org; Tue, 06 Oct 2020 14:31:54 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:21604) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kPrkY-0006P5-Ik for qemu-devel@nongnu.org; Tue, 06 Oct 2020 14:31:54 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1602009105; 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=dzyh+Pz8mpV1UPExogx8Gf8Vc0kVGigC56axXcGuahA=; b=AVlW44aZmjIasvUzraGXk1UpJt75XJHFSPeiNyfPDge+sTHdbgXq9xjiotdHrZ+sdIDVzz XS+pdBqj0sZJBDCbFm7A75/C6hQSmeDJpa/fSDFZF7n4csxpyOGCQNGC7ydmHUmViJfCe1 H4UFcPD2oddegvTCNyP0VMP8XAFVMcI= 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-258-CU8ZGVnyMf2MLb_7SiCUkQ-1; Tue, 06 Oct 2020 14:31:42 -0400 X-MC-Unique: CU8ZGVnyMf2MLb_7SiCUkQ-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 7D0CF80365F; Tue, 6 Oct 2020 18:31:41 +0000 (UTC) Received: from thuth.com (ovpn-113-60.ams2.redhat.com [10.36.113.60]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9BFE36EF43; Tue, 6 Oct 2020 18:31:39 +0000 (UTC) From: Thomas Huth To: qemu-devel@nongnu.org, Peter Maydell Subject: [PULL 04/16] pc-bios/s390-ccw: Move the inner logic of find_subch() to a separate function Date: Tue, 6 Oct 2020 20:31:10 +0200 Message-Id: <20201006183122.155609-5-thuth@redhat.com> In-Reply-To: <20201006183122.155609-1-thuth@redhat.com> References: <20201006183122.155609-1-thuth@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 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 client-ip=63.128.21.124; envelope-from=thuth@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/06 01:55:55 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.733, 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_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, 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: Christian Borntraeger , qemu-s390x@nongnu.org, Cornelia Huck , Marc Hartmayer , Janosch Frank Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" Move the code to a separate function to be able to re-use it from a different spot later. Reviewed-by: Claudio Imbrenda Message-Id: <20200806105349.632-5-thuth@redhat.com> Reviewed-by: Cornelia Huck Reviewed-by: Janosch Frank Signed-off-by: Thomas Huth --- 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); } +static int is_dev_possibly_bootable(int dev_no, int sch_no) +{ + bool is_virtio; + Schib schib; + int r; + + blk_schid.sch_no = sch_no; + r = stsch_err(blk_schid, &schib); + if (r == 3 || r == -EIO) { + return -ENODEV; + } + if (!schib.pmcw.dnv) { + return false; + } + + enable_subchannel(blk_schid); + cutype = 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 = 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() != 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 == 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 info. @@ -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; for (i = 0; i < 0x10000; i++) { - blk_schid.sch_no = i; - r = stsch_err(blk_schid, &schib); - if ((r == 3) || (r == -EIO)) { + r = is_dev_possibly_bootable(dev_no, i); + if (r < 0) { break; } - if (!schib.pmcw.dnv) { - continue; - } - - enable_subchannel(blk_schid); - cutype = 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 = 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() != 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 == dev_no) { + if (r == true) { return true; } } From patchwork Tue Oct 6 18:31:11 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Huth X-Patchwork-Id: 11819055 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 115746CB for ; Tue, 6 Oct 2020 18:39:20 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 9B26320796 for ; Tue, 6 Oct 2020 18:39:19 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="hGgYRS+/" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9B26320796 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:57434 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kPrrq-0003Xy-Ce for patchwork-qemu-devel@patchwork.kernel.org; Tue, 06 Oct 2020 14:39:18 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57538) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kPrkr-000374-13 for qemu-devel@nongnu.org; Tue, 06 Oct 2020 14:32:06 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:49826) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kPrkc-0006Q4-LR for qemu-devel@nongnu.org; Tue, 06 Oct 2020 14:32:03 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1602009109; 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=MnWZwUdy4Q6HkOQDCypZN0dlkm5RNq9Fpgh72pTp3Sk=; b=hGgYRS+/bndExhN56Nqd0pennwgwUQ191ZilAiC55lJxBjq72NpU78hTsW1kTs3pdCzGWm Fyql3GYXpTdd4mh4uE8Gj6fwEb9xvx7z1QujzhwnZ6uyDgKz6MHHnIRNjMYnRy88cYSSpp 6b3xTG3i+wFLM6qDxh6Rll/+emm0d0o= 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-252-1nGCefFENruyeOMjCzFKkQ-1; Tue, 06 Oct 2020 14:31:45 -0400 X-MC-Unique: 1nGCefFENruyeOMjCzFKkQ-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id BB74B18A8223; Tue, 6 Oct 2020 18:31:43 +0000 (UTC) Received: from thuth.com (ovpn-113-60.ams2.redhat.com [10.36.113.60]) by smtp.corp.redhat.com (Postfix) with ESMTP id D9DD86EF43; Tue, 6 Oct 2020 18:31:41 +0000 (UTC) From: Thomas Huth To: qemu-devel@nongnu.org, Peter Maydell Subject: [PULL 05/16] pc-bios/s390-ccw: Do not bail out early if not finding a SCSI disk Date: Tue, 6 Oct 2020 20:31:11 +0200 Message-Id: <20201006183122.155609-6-thuth@redhat.com> In-Reply-To: <20201006183122.155609-1-thuth@redhat.com> References: <20201006183122.155609-1-thuth@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 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 client-ip=63.128.21.124; envelope-from=thuth@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/06 01:55:55 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.733, 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_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, 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: Christian Borntraeger , qemu-s390x@nongnu.org, Cornelia Huck , Marc Hartmayer , Janosch Frank Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" 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. Message-Id: <20200806105349.632-6-thuth@redhat.com> Reviewed-by: Cornelia Huck Signed-off-by: Thomas Huth --- 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"); } -static void virtio_setup(void) +static int virtio_setup(void) { VDev *vdev = virtio_get_device(); QemuIplParameters *early_qipl = (QemuIplParameters *)QIPL_ADDRESS; @@ -233,9 +233,14 @@ static void virtio_setup(void) sclp_print("Network boot device detected\n"); vdev->netboot_start_addr = qipl.netboot_start_addr; } else { - virtio_blk_setup_device(blk_schid); + int ret = virtio_blk_setup_device(blk_schid); + if (ret) { + return ret; + } IPL_assert(virtio_ipl_disk_is_valid(), "No valid IPL device detected"); } + + return 0; } 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() == 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); /* bootmap.c */ diff --git a/pc-bios/s390-ccw/virtio-blkdev.c b/pc-bios/s390-ccw/virtio-blkdev.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; } -void virtio_blk_setup_device(SubChannelId schid) +int virtio_blk_setup_device(SubChannelId schid) { VDev *vdev = virtio_get_device(); + int ret = 0; vdev->schid = schid; virtio_setup_ccw(vdev); @@ -288,9 +289,11 @@ void virtio_blk_setup_device(SubChannelId schid) "Config: CDB size mismatch"); sclp_print("Using virtio-scsi.\n"); - virtio_scsi_setup(vdev); + ret = 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, /* virtio-scsi routines */ -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 = 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 == 0, "non-zero channel requested"); IPL_check(sdev->target <= vdev->config.scsi.max_target, "target# high"); IPL_check(sdev->lun <= vdev->config.scsi.max_lun, "LUN# high"); - return; + return 0; } for (target = 0; target <= vdev->config.scsi.max_target; target++) { @@ -247,18 +252,20 @@ static void virtio_scsi_locate_device(VDev *vdev) */ sdev->lun = 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 = 0; i < luns; i++) { if (r->lun[i].v64) { /* Look for non-zero LUN - we have where to choose from */ sdev->lun = 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; } int virtio_scsi_read_many(VDev *vdev, @@ -322,17 +329,20 @@ static void scsi_parse_capacity_report(void *data, } } -void virtio_scsi_setup(VDev *vdev) +int virtio_scsi_setup(VDev *vdev) { int retry_test_unit_ready = 3; uint8_t data[256]; uint32_t data_size = sizeof(data); ScsiInquiryEvpdPages *evpd = &scsi_inquiry_evpd_pages_response; ScsiInquiryEvpdBl *evpd_bl = &scsi_inquiry_evpd_bl_response; - int i; + int i, ret; vdev->scsi_device = &default_scsi_device; - virtio_scsi_locate_device(vdev); + ret = virtio_scsi_locate_device(vdev); + if (ret < 0) { + return ret; + } /* 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 VirtioScsiCmdResp *r) return r->response == VIRTIO_SCSI_S_OK && r->status == CDB_STATUS_GOOD; } -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); From patchwork Tue Oct 6 18:31:12 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Huth X-Patchwork-Id: 11819049 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id DDDB5139F for ; Tue, 6 Oct 2020 18:36:36 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 8446020789 for ; Tue, 6 Oct 2020 18:36:36 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="A0ktQrIl" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8446020789 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:48898 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kPrpD-0008SN-Gc for patchwork-qemu-devel@patchwork.kernel.org; Tue, 06 Oct 2020 14:36:35 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57536) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kPrkr-000371-0z for qemu-devel@nongnu.org; Tue, 06 Oct 2020 14:32:06 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:46036) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kPrke-0006QR-Qd for qemu-devel@nongnu.org; Tue, 06 Oct 2020 14:32:03 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1602009112; 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=oXmN++jhEaNJnngbfUargtNjzn1XA9jM2TKvsuKwQJg=; b=A0ktQrIlQvUxVmTX+DgR9Gk9bLzjvuZOwmXy8LZELRWSMd1QS/Tm8e8U9t+Vl9m/UI37Ps 8oNrG/LIEXVSZe91PBp5+mEl8pTHqIt7cGrTn2DgLX0HJiOtGlMblsIzNm0qx8YukKOTTE 7ppngBT4B//B4O7YBV5qQwfxYsGAnPw= 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-560-ShqeSJNKP-WNZn3EGFzxvA-1; Tue, 06 Oct 2020 14:31:48 -0400 X-MC-Unique: ShqeSJNKP-WNZn3EGFzxvA-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 43C1210BBEC4; Tue, 6 Oct 2020 18:31:46 +0000 (UTC) Received: from thuth.com (ovpn-113-60.ams2.redhat.com [10.36.113.60]) by smtp.corp.redhat.com (Postfix) with ESMTP id 24A7A6EF46; Tue, 6 Oct 2020 18:31:43 +0000 (UTC) From: Thomas Huth To: qemu-devel@nongnu.org, Peter Maydell Subject: [PULL 06/16] pc-bios/s390-ccw: Scan through all devices if no boot device specified Date: Tue, 6 Oct 2020 20:31:12 +0200 Message-Id: <20201006183122.155609-7-thuth@redhat.com> In-Reply-To: <20201006183122.155609-1-thuth@redhat.com> References: <20201006183122.155609-1-thuth@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 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 client-ip=63.128.21.124; envelope-from=thuth@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/06 01:55:55 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.733, 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_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, 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: Christian Borntraeger , qemu-s390x@nongnu.org, Cornelia Huck , Marc Hartmayer , Janosch Frank Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" If no boot device has been specified (via "bootindex=..."), 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=..." 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=1846975 Reviewed-by: Cornelia Huck Message-Id: <20200806105349.632-7-thuth@redhat.com> 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 = virtio_get_device(); - int ssid; bool found; - if (!have_iplb) { - for (ssid = 0; ssid < 0x3; ssid++) { - blk_schid.ssid = ssid; - found = 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) } } +/* + * 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 = 0; ssid < 0x3; ssid++) { + blk_schid.ssid = ssid; + for (sch_no = 0; sch_no < 0x10000; sch_no++) { + ret = is_dev_possibly_bootable(-1, sch_no); + if (ret < 0) { + break; + } + if (ret == 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(); + } panic("Failed to load OS from hard disk\n"); return 0; /* make compiler happy */ From patchwork Tue Oct 6 18:31:13 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Huth X-Patchwork-Id: 11819069 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 24FDA6CB for ; Tue, 6 Oct 2020 18:44:04 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C59F120760 for ; Tue, 6 Oct 2020 18:44:03 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="MTfGT//H" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C59F120760 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:40874 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kPrwO-0008P8-QI for patchwork-qemu-devel@patchwork.kernel.org; Tue, 06 Oct 2020 14:44:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57614) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kPrkv-00039w-Em for qemu-devel@nongnu.org; Tue, 06 Oct 2020 14:32:10 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:48129) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kPrkh-0006RH-DT for qemu-devel@nongnu.org; Tue, 06 Oct 2020 14:32:09 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1602009114; 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=DxCDr3nu+963JbS2KIIO8+qacFUqodOblwlj1/IPPAs=; b=MTfGT//HbxvuHjKBhxAMZXn+8fSazDI6sxEGFjxgEs4SfuIPnzCiPEhRfJg5Hs0ibpmLHw t5CnnYvlycLYay2ALWrFcIp5q3tjAj3Td8j5Y2y0S8HV761YBGFYeF/jku2k+o2cD7lvoA fHm5BxYIbI+9HbH9ogF5+KhT2KVcuTo= 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-589-hHb2DlbWMwqg2FLyo0ta2Q-1; Tue, 06 Oct 2020 14:31:49 -0400 X-MC-Unique: hHb2DlbWMwqg2FLyo0ta2Q-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 5B33B10BBEC0; Tue, 6 Oct 2020 18:31:48 +0000 (UTC) Received: from thuth.com (ovpn-113-60.ams2.redhat.com [10.36.113.60]) by smtp.corp.redhat.com (Postfix) with ESMTP id 79D9B6EF43; Tue, 6 Oct 2020 18:31:46 +0000 (UTC) From: Thomas Huth To: qemu-devel@nongnu.org, Peter Maydell Subject: [PULL 07/16] pc-bios/s390-ccw: Allow booting in case the first virtio-blk disk is bad Date: Tue, 6 Oct 2020 20:31:13 +0200 Message-Id: <20201006183122.155609-8-thuth@redhat.com> In-Reply-To: <20201006183122.155609-1-thuth@redhat.com> References: <20201006183122.155609-1-thuth@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 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 client-ip=216.205.24.124; envelope-from=thuth@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/06 00:55:20 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.733, 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_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, 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: Christian Borntraeger , qemu-s390x@nongnu.org, Cornelia Huck , Marc Hartmayer , Janosch Frank Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" 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 Message-Id: <20200806105349.632-8-thuth@redhat.com> 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"); mbr = &ipl2->mbr; - IPL_assert(magic_match(mbr, ZIPL_MAGIC), "No zIPL section in IPL2 record."); - IPL_assert(block_size_ok(mbr->blockptr.xeckd.bptr.size), - "Bad block size in zIPL section of IPL2 record."); - IPL_assert(mbr->dev_type == 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 == DEV_TYPE_ECKD) { + sclp_print("Non-ECKD device type in zIPL section of IPL2 record.\n"); + return; + } /* save pointer to Boot Map Table */ bmt_block_nr = eckd_block_num(&mbr->blockptr.xeckd.bptr.chs); @@ -303,10 +310,14 @@ static void ipl_eckd_cdl(void) 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); 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"); if (magic_match(mbr->magic, IPL1_MAGIC)) { - ipl_eckd_cdl(); /* no return */ + ipl_eckd_cdl(); /* only returns in case of error */ + return; } /* LDL/CMS? */ @@ -825,5 +837,5 @@ void zipl_load(void) panic("\n! Unknown IPL device type !\n"); } - 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() == 0) { - zipl_load(); /* no return */ + zipl_load(); /* Only returns in case of errors */ } break; default: From patchwork Tue Oct 6 18:31:14 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Huth X-Patchwork-Id: 11819051 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4C64F1752 for ; Tue, 6 Oct 2020 18:36:39 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E84FE20789 for ; Tue, 6 Oct 2020 18:36:38 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="P4bFEA6P" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E84FE20789 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:49108 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kPrpF-00005s-OC for patchwork-qemu-devel@patchwork.kernel.org; Tue, 06 Oct 2020 14:36:37 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57542) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kPrkr-00037B-2n for qemu-devel@nongnu.org; Tue, 06 Oct 2020 14:32:06 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:42344) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kPrkg-0006R2-TU for qemu-devel@nongnu.org; Tue, 06 Oct 2020 14:32:04 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1602009114; 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=4B9LkdA0MGaeohHjLbvlVV7WsFAAJx550taNu8byM34=; b=P4bFEA6PhRXzWs4Z5ZZB1thjnf1AK/vXBa/bbsSwf9xjI3p8prpOYOBchAkWEZbo5SWVM/ NplSKcSWv7NhbxwpmXnlIoGz1qgohWT64haYI/lseOGKxupX6pjkpifhDbzKW1tVLnZ4GK 4uYg80vjTP5izxuNLdOgfaGviIGkh4c= 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-76-rs9MovxvNN6C7QKwIqRqTw-1; Tue, 06 Oct 2020 14:31:52 -0400 X-MC-Unique: rs9MovxvNN6C7QKwIqRqTw-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B156E87950B; Tue, 6 Oct 2020 18:31:50 +0000 (UTC) Received: from thuth.com (ovpn-113-60.ams2.redhat.com [10.36.113.60]) by smtp.corp.redhat.com (Postfix) with ESMTP id B81056EF43; Tue, 6 Oct 2020 18:31:48 +0000 (UTC) From: Thomas Huth To: qemu-devel@nongnu.org, Peter Maydell Subject: [PULL 08/16] pc-bios/s390-ccw/main: Remove superfluous call to enable_subchannel() Date: Tue, 6 Oct 2020 20:31:14 +0200 Message-Id: <20201006183122.155609-9-thuth@redhat.com> In-Reply-To: <20201006183122.155609-1-thuth@redhat.com> References: <20201006183122.155609-1-thuth@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 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 client-ip=63.128.21.124; envelope-from=thuth@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/06 01:55:55 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.733, 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_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, 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: Christian Borntraeger , qemu-s390x@nongnu.org, Cornelia Huck , Marc Hartmayer , Janosch Frank Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" 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. Message-Id: <20200806105349.632-9-thuth@redhat.com> Reviewed-by: Cornelia Huck Signed-off-by: Thomas Huth --- 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(); From patchwork Tue Oct 6 18:31:15 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Huth X-Patchwork-Id: 11819053 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 681A56CA for ; Tue, 6 Oct 2020 18:37:25 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 179D920797 for ; Tue, 6 Oct 2020 18:37:25 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="Y/m+yGIY" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 179D920797 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:52112 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kPrq0-0001L1-2t for patchwork-qemu-devel@patchwork.kernel.org; Tue, 06 Oct 2020 14:37:24 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57572) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kPrks-00037W-9r for qemu-devel@nongnu.org; Tue, 06 Oct 2020 14:32:06 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:53459) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kPrkp-0006Rt-5h for qemu-devel@nongnu.org; Tue, 06 Oct 2020 14:32:05 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1602009118; 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=qQGr/uV1PD5lIMUXmn+4rxg1HAJlU+Yywd3806b1hgY=; b=Y/m+yGIYS5BwSYvfXJYCTVbHFzOd61dmxQCIyRWGuMgTLl5lBoK/kQmh5AV7MDD3ujyc8Q ghw0XjQJKOROjLUo6dMa5BWa4z59V//ZjEJ2Vuc5cABaUOlFZdWQ/yjltbYle6lAZuLKmn WpWxceohdN0vhvSUKxhiMBoTeFVCFbo= 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-377-yx7fk2SYMEG_J_Vsx8Tl1g-1; Tue, 06 Oct 2020 14:31:55 -0400 X-MC-Unique: yx7fk2SYMEG_J_Vsx8Tl1g-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 2C30A18A8226; Tue, 6 Oct 2020 18:31:53 +0000 (UTC) Received: from thuth.com (ovpn-113-60.ams2.redhat.com [10.36.113.60]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1A65E6EF46; Tue, 6 Oct 2020 18:31:50 +0000 (UTC) From: Thomas Huth To: qemu-devel@nongnu.org, Peter Maydell Subject: [PULL 09/16] pc-bios/s390-ccw: fix off-by-one error Date: Tue, 6 Oct 2020 20:31:15 +0200 Message-Id: <20201006183122.155609-10-thuth@redhat.com> In-Reply-To: <20201006183122.155609-1-thuth@redhat.com> References: <20201006183122.155609-1-thuth@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 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 client-ip=216.205.24.124; envelope-from=thuth@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/06 00:55:20 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.733, 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_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, 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: Christian Borntraeger , qemu-s390x@nongnu.org, Cornelia Huck , Marc Hartmayer , Janosch Frank Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: Marc Hartmayer This error takes effect when the magic value "zIPL" is located at the end of a block. For example if s2_cur_blk = 0x7fe18000 and the magic value "zIPL" is located at 0x7fe18ffc - 0x7fe18fff. Fixes: ba831b25262a ("s390-ccw: read stage2 boot loader data to find menu") Reviewed-by: Collin Walling Signed-off-by: Marc Hartmayer Message-Id: <20200924085926.21709-2-mhartmay@linux.ibm.com> Reviewed-by: Thomas Huth [thuth: Use "<= ... - 4" instead of "< ... - 3"] Signed-off-by: Thomas Huth --- pc-bios/s390-ccw/bootmap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pc-bios/s390-ccw/bootmap.c b/pc-bios/s390-ccw/bootmap.c index 0ef6b851f3..767bb612db 100644 --- a/pc-bios/s390-ccw/bootmap.c +++ b/pc-bios/s390-ccw/bootmap.c @@ -163,7 +163,7 @@ static bool find_zipl_boot_menu_banner(int *offset) int i; /* Menu banner starts with "zIPL" */ - for (i = 0; i < virtio_get_block_size() - 4; i++) { + for (i = 0; i <= virtio_get_block_size() - 4; i++) { if (magic_match(s2_cur_blk + i, ZIPL_MAGIC_EBCDIC)) { *offset = i; return true; From patchwork Tue Oct 6 18:31:16 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Huth X-Patchwork-Id: 11819057 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4AC066CB for ; Tue, 6 Oct 2020 18:39:26 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B4F8B20789 for ; Tue, 6 Oct 2020 18:39:25 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="NxnUgKr4" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B4F8B20789 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:57504 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kPrrw-0003Zl-Ju for patchwork-qemu-devel@patchwork.kernel.org; Tue, 06 Oct 2020 14:39:24 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57600) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kPrkv-00039n-3o for qemu-devel@nongnu.org; Tue, 06 Oct 2020 14:32:10 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:33676) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kPrkq-0006S9-GK for qemu-devel@nongnu.org; Tue, 06 Oct 2020 14:32:08 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1602009120; 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=bat8GjmkjNyQ7PxcbFwQEPYIJCD1eZaYfT8QTugA/fs=; b=NxnUgKr4EcJVIOwnij5YkzC3LnCwd6I/xA5e9pC5Kzir54VLBXF8YjJFbpobpvy66fA1ny 8x3KjgSmeTE6Nf05JZhXB50yFPhI66PXtnCkjoJoyovgd4YFBifr6WUo2eb1e2O25+ZCZp Map1hV+Ysk5+APSs3TNbq+ZzU1TEnz8= 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-484-Ul5Uq7u2PZeKUcuWQqwLVA-1; Tue, 06 Oct 2020 14:31:56 -0400 X-MC-Unique: Ul5Uq7u2PZeKUcuWQqwLVA-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 72DC310BBEC4; Tue, 6 Oct 2020 18:31:55 +0000 (UTC) Received: from thuth.com (ovpn-113-60.ams2.redhat.com [10.36.113.60]) by smtp.corp.redhat.com (Postfix) with ESMTP id 89ACD6EF46; Tue, 6 Oct 2020 18:31:53 +0000 (UTC) From: Thomas Huth To: qemu-devel@nongnu.org, Peter Maydell Subject: [PULL 10/16] pc-bios/s390-ccw: break loop if a null block number is reached Date: Tue, 6 Oct 2020 20:31:16 +0200 Message-Id: <20201006183122.155609-11-thuth@redhat.com> In-Reply-To: <20201006183122.155609-1-thuth@redhat.com> References: <20201006183122.155609-1-thuth@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 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 client-ip=63.128.21.124; envelope-from=thuth@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/06 01:55:55 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.733, 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_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, 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: Christian Borntraeger , qemu-s390x@nongnu.org, Cornelia Huck , Marc Hartmayer , Janosch Frank Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: Marc Hartmayer Break the loop if `cur_block_nr` is a null block number because this means that the end of chunk is reached. In this case we will try to boot the default entry. Fixes: ba831b25262a ("s390-ccw: read stage2 boot loader data to find menu") Reviewed-by: Collin Walling Signed-off-by: Marc Hartmayer Message-Id: <20200924085926.21709-3-mhartmay@linux.ibm.com> Signed-off-by: Thomas Huth --- pc-bios/s390-ccw/bootmap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pc-bios/s390-ccw/bootmap.c b/pc-bios/s390-ccw/bootmap.c index 767bb612db..942fba3fa7 100644 --- a/pc-bios/s390-ccw/bootmap.c +++ b/pc-bios/s390-ccw/bootmap.c @@ -192,7 +192,7 @@ static int eckd_get_boot_menu_index(block_number_t s1b_block_nr) for (i = 0; i < STAGE2_BLK_CNT_MAX; i++) { cur_block_nr = eckd_block_num(&s1b->seek[i].chs); - if (!cur_block_nr) { + if (!cur_block_nr || is_null_block_number(cur_block_nr)) { break; } From patchwork Tue Oct 6 18:31:17 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Huth X-Patchwork-Id: 11819063 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5DDDA6CA for ; Tue, 6 Oct 2020 18:43:16 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0E9BB20760 for ; Tue, 6 Oct 2020 18:43:16 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="ZWZIw7mj" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0E9BB20760 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:37806 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kPrvf-0007BE-1h for patchwork-qemu-devel@patchwork.kernel.org; Tue, 06 Oct 2020 14:43:15 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57602) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kPrkv-00039u-7e for qemu-devel@nongnu.org; Tue, 06 Oct 2020 14:32:10 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:30315) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kPrkq-0006SZ-Io for qemu-devel@nongnu.org; Tue, 06 Oct 2020 14:32:08 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1602009123; 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=reA2jGEO0WxqXPBXnp+mqNftr2aAiep6CvRVSdocT/Y=; b=ZWZIw7mjvf8nfZQak3Cwf1dNA+/Y6PPX9W2C5QeMoyZge9fjXxL+ZBpIUOS8qYjp3sTVf+ piiiH5a4ww8A22KOuGZjFqg/b9ToBVZA/yub71/CCwUM8RxBED8Tf6tymqaOR3CZnNct9j 53DwDRJsJLgS9Ng+vcRfo76j/dhyxno= 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-3-ssEg3xbkMtG1OB2r3I0fYg-1; Tue, 06 Oct 2020 14:31:59 -0400 X-MC-Unique: ssEg3xbkMtG1OB2r3I0fYg-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id BF6F6802B73; Tue, 6 Oct 2020 18:31:57 +0000 (UTC) Received: from thuth.com (ovpn-113-60.ams2.redhat.com [10.36.113.60]) by smtp.corp.redhat.com (Postfix) with ESMTP id E06B56EF43; Tue, 6 Oct 2020 18:31:55 +0000 (UTC) From: Thomas Huth To: qemu-devel@nongnu.org, Peter Maydell Subject: [PULL 11/16] pc-bios: s390x: Fix bootmap.c zipl component entry data handling Date: Tue, 6 Oct 2020 20:31:17 +0200 Message-Id: <20201006183122.155609-12-thuth@redhat.com> In-Reply-To: <20201006183122.155609-1-thuth@redhat.com> References: <20201006183122.155609-1-thuth@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 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 client-ip=216.205.24.124; envelope-from=thuth@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/06 00:55:20 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.733, 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_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, 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: Christian Borntraeger , qemu-s390x@nongnu.org, Cornelia Huck , Marc Hartmayer , Janosch Frank Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: Janosch Frank The two main types of zipl component entries are execute and load/data. The last member of the component entry struct therefore denotes either a PSW or an address. Let's make this a bit more clear by introducing a union and cleaning up the code that uses that struct member. The execute type component entries written by zipl contain short PSWs, not addresses. Let's mask them and only pass the address part to jump_to_IPL_code(uint64_t address) because it expects an address as visible by the name of the argument. Signed-off-by: Janosch Frank Reviewed-by: Thomas Huth Message-Id: <20201006094249.50640-2-frankja@linux.ibm.com> Signed-off-by: Thomas Huth --- pc-bios/s390-ccw/bootmap.c | 5 +++-- pc-bios/s390-ccw/bootmap.h | 7 ++++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/pc-bios/s390-ccw/bootmap.c b/pc-bios/s390-ccw/bootmap.c index 942fba3fa7..73471801de 100644 --- a/pc-bios/s390-ccw/bootmap.c +++ b/pc-bios/s390-ccw/bootmap.c @@ -10,6 +10,7 @@ #include "libc.h" #include "s390-ccw.h" +#include "s390-arch.h" #include "bootmap.h" #include "virtio.h" #include "bswap.h" @@ -448,7 +449,7 @@ static void zipl_load_segment(ComponentEntry *entry) char *blk_no = &err_msg[30]; /* where to print blockno in (those ZZs) */ blockno = entry->data.blockno; - address = entry->load_address; + address = entry->compdat.load_addr; debug_print_int("loading segment at block", blockno); debug_print_int("addr", address); @@ -526,7 +527,7 @@ static void zipl_run(ScsiBlockPtr *pte) IPL_assert(entry->component_type == ZIPL_COMP_ENTRY_EXEC, "No EXEC entry"); /* should not return */ - jump_to_IPL_code(entry->load_address); + jump_to_IPL_code(entry->compdat.load_psw & PSW_MASK_SHORT_ADDR); } static void ipl_scsi(void) diff --git a/pc-bios/s390-ccw/bootmap.h b/pc-bios/s390-ccw/bootmap.h index 12a0166aae..3946aa3f8d 100644 --- a/pc-bios/s390-ccw/bootmap.h +++ b/pc-bios/s390-ccw/bootmap.h @@ -64,11 +64,16 @@ typedef struct BootMapTable { BootMapPointer entry[]; } __attribute__ ((packed)) BootMapTable; +typedef union ComponentEntryData { + uint64_t load_psw; + uint64_t load_addr; +} ComponentEntryData; + typedef struct ComponentEntry { ScsiBlockPtr data; uint8_t pad[7]; uint8_t component_type; - uint64_t load_address; + ComponentEntryData compdat; } __attribute((packed)) ComponentEntry; typedef struct ComponentHeader { From patchwork Tue Oct 6 18:31:18 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Huth X-Patchwork-Id: 11819061 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A476D6CB for ; Tue, 6 Oct 2020 18:40:32 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3541E20789 for ; Tue, 6 Oct 2020 18:40:32 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="QRY5uQof" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3541E20789 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:60618 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kPrt1-0004u6-6q for patchwork-qemu-devel@patchwork.kernel.org; Tue, 06 Oct 2020 14:40:31 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57588) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kPrkt-00038F-2h for qemu-devel@nongnu.org; Tue, 06 Oct 2020 14:32:08 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:52986) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kPrkq-0006SY-J6 for qemu-devel@nongnu.org; Tue, 06 Oct 2020 14:32:06 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1602009123; 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=EZv8pIPA7LU9OgUgEDUhL6HYRrYj/hNMme/Zf2EHFxk=; b=QRY5uQofXEITzxP5RtILCvdWFcK7DKWRjAIx0qJycMwSQ+7X9xJDNRmhs5y/+Ah2rk4Or5 3cBYJTfUtI8PSD1JTfXvZL63+Yzxi97LzQJq4UFtc0QJZmmM5VhB6Wqxu0LibFd06nt2ke gl9bRXyfkZRBpLmPKKZaw1jyXHYCXyM= 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-287-WxlLRyDaOmmZ1T9C-Y3thA-1; Tue, 06 Oct 2020 14:32:01 -0400 X-MC-Unique: WxlLRyDaOmmZ1T9C-Y3thA-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 239EB8018A1; Tue, 6 Oct 2020 18:32:00 +0000 (UTC) Received: from thuth.com (ovpn-113-60.ams2.redhat.com [10.36.113.60]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2A0B16EF43; Tue, 6 Oct 2020 18:31:57 +0000 (UTC) From: Thomas Huth To: qemu-devel@nongnu.org, Peter Maydell Subject: [PULL 12/16] pc-bios: s390x: Save PSW rework Date: Tue, 6 Oct 2020 20:31:18 +0200 Message-Id: <20201006183122.155609-13-thuth@redhat.com> In-Reply-To: <20201006183122.155609-1-thuth@redhat.com> References: <20201006183122.155609-1-thuth@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 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 client-ip=216.205.24.124; envelope-from=thuth@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/06 00:55:20 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.733, 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_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, 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: Christian Borntraeger , qemu-s390x@nongnu.org, Cornelia Huck , Marc Hartmayer , Janosch Frank Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: Janosch Frank We don't need to save the ipl_continue variable in lowcore and have it limited to 32 bits because of the lowcore layout. Let's move it to a new 64 bit variable and get rid of the reset info struct. Signed-off-by: Janosch Frank Reviewed-by: Thomas Huth Message-Id: <20201006094249.50640-3-frankja@linux.ibm.com> Signed-off-by: Thomas Huth --- pc-bios/s390-ccw/jump2ipl.c | 33 +++++++++++++-------------------- 1 file changed, 13 insertions(+), 20 deletions(-) diff --git a/pc-bios/s390-ccw/jump2ipl.c b/pc-bios/s390-ccw/jump2ipl.c index 767012bf0c..b6aad32def 100644 --- a/pc-bios/s390-ccw/jump2ipl.c +++ b/pc-bios/s390-ccw/jump2ipl.c @@ -13,20 +13,17 @@ #define KERN_IMAGE_START 0x010000UL #define RESET_PSW_MASK (PSW_MASK_SHORTPSW | PSW_MASK_64) -typedef struct ResetInfo { - uint64_t ipl_psw; - uint32_t ipl_continue; -} ResetInfo; +static uint64_t *reset_psw = 0, save_psw, ipl_continue; -static ResetInfo save; - -static void jump_to_IPL_2(void) +static void jump_to_IPL_addr(void) { - ResetInfo *current = 0; + __attribute__((noreturn)) void (*ipl)(void) = (void *)ipl_continue; + + /* Restore reset PSW */ + *reset_psw = save_psw; - void (*ipl)(void) = (void *) (uint64_t) current->ipl_continue; - *current = save; - ipl(); /* should not return */ + ipl(); + /* should not return */ } void jump_to_IPL_code(uint64_t address) @@ -46,15 +43,11 @@ void jump_to_IPL_code(uint64_t address) * content of non-BIOS memory after we loaded the guest, so we * save the original content and restore it in jump_to_IPL_2. */ - ResetInfo *current = 0; - - save = *current; - - current->ipl_psw = (uint64_t) &jump_to_IPL_2; - current->ipl_psw |= RESET_PSW_MASK; - current->ipl_continue = address & PSW_MASK_SHORT_ADDR; - - debug_print_int("set IPL addr to", current->ipl_continue); + save_psw = *reset_psw; + *reset_psw = (uint64_t) &jump_to_IPL_addr; + *reset_psw |= RESET_PSW_MASK; + ipl_continue = address; + debug_print_int("set IPL addr to", ipl_continue); /* Ensure the guest output starts fresh */ sclp_print("\n"); From patchwork Tue Oct 6 18:31:19 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Huth X-Patchwork-Id: 11819065 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1CA9B6CA for ; Tue, 6 Oct 2020 18:43:19 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id BD5D320760 for ; Tue, 6 Oct 2020 18:43:18 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="JE3SrRpc" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BD5D320760 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:38076 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kPrvh-0007Iu-C7 for patchwork-qemu-devel@patchwork.kernel.org; Tue, 06 Oct 2020 14:43:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57668) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kPrky-0003DT-0M for qemu-devel@nongnu.org; Tue, 06 Oct 2020 14:32:12 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:31419) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kPrku-0006TH-Ku for qemu-devel@nongnu.org; Tue, 06 Oct 2020 14:32:11 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1602009126; 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=WtwDc9uoIARLLDq0qD5HvAZGCav1uxxS0aRTtSBdIi8=; b=JE3SrRpcN7Dr4a1VAWoFX5bv6DezqyJQnMSwGRO22BhIbQTA5pjciPqot+q2Nnc3A756X6 FdV0df1gdLTC1sKWg7ebVSbfTKt7yrI45TkxK4HpHgYxwoVHxCPF093+Rw0Q8Iz9dtzDWH HE0kWgFqOpGiTOh/4fCoSH/9mvT1Vew= 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-509-BHoNRXJ5M369xqDcUee2zQ-1; Tue, 06 Oct 2020 14:32:04 -0400 X-MC-Unique: BHoNRXJ5M369xqDcUee2zQ-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 78C9556BE4; Tue, 6 Oct 2020 18:32:02 +0000 (UTC) Received: from thuth.com (ovpn-113-60.ams2.redhat.com [10.36.113.60]) by smtp.corp.redhat.com (Postfix) with ESMTP id 842D66EF43; Tue, 6 Oct 2020 18:32:00 +0000 (UTC) From: Thomas Huth To: qemu-devel@nongnu.org, Peter Maydell Subject: [PULL 13/16] pc-bios: s390x: Use reset PSW if avaliable Date: Tue, 6 Oct 2020 20:31:19 +0200 Message-Id: <20201006183122.155609-14-thuth@redhat.com> In-Reply-To: <20201006183122.155609-1-thuth@redhat.com> References: <20201006183122.155609-1-thuth@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 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 client-ip=216.205.24.124; envelope-from=thuth@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/06 00:55:20 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.733, 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_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, 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: Christian Borntraeger , qemu-s390x@nongnu.org, Cornelia Huck , Marc Hartmayer , Janosch Frank Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: Janosch Frank If a blob provides a reset PSW then we should use it instead of branching to the PSW address and using our own mask. Signed-off-by: Janosch Frank Reviewed-by: Thomas Huth Message-Id: <20201006094249.50640-4-frankja@linux.ibm.com> [thuth: Use Elvis operator to shorten long line] Signed-off-by: Thomas Huth --- pc-bios/s390-ccw/bootmap.c | 6 ++++-- pc-bios/s390-ccw/jump2ipl.c | 26 +++++++++++++++++++------- pc-bios/s390-ccw/s390-ccw.h | 1 + 3 files changed, 24 insertions(+), 9 deletions(-) diff --git a/pc-bios/s390-ccw/bootmap.c b/pc-bios/s390-ccw/bootmap.c index 73471801de..44df7d16af 100644 --- a/pc-bios/s390-ccw/bootmap.c +++ b/pc-bios/s390-ccw/bootmap.c @@ -273,7 +273,8 @@ static void run_eckd_boot_script(block_number_t bmt_block_nr, IPL_assert(bms->entry[i].type == BOOT_SCRIPT_EXEC, "Unknown script entry type"); - jump_to_IPL_code(bms->entry[i].address.load_address); /* no return */ + write_reset_psw(bms->entry[i].address.load_address); /* no return */ + jump_to_IPL_code(0); /* no return */ } static void ipl_eckd_cdl(void) @@ -527,7 +528,8 @@ static void zipl_run(ScsiBlockPtr *pte) IPL_assert(entry->component_type == ZIPL_COMP_ENTRY_EXEC, "No EXEC entry"); /* should not return */ - jump_to_IPL_code(entry->compdat.load_psw & PSW_MASK_SHORT_ADDR); + write_reset_psw(entry->compdat.load_psw); + jump_to_IPL_code(0); } static void ipl_scsi(void) diff --git a/pc-bios/s390-ccw/jump2ipl.c b/pc-bios/s390-ccw/jump2ipl.c index b6aad32def..fbae45b03c 100644 --- a/pc-bios/s390-ccw/jump2ipl.c +++ b/pc-bios/s390-ccw/jump2ipl.c @@ -12,15 +12,21 @@ #define KERN_IMAGE_START 0x010000UL #define RESET_PSW_MASK (PSW_MASK_SHORTPSW | PSW_MASK_64) +#define RESET_PSW ((uint64_t)&jump_to_IPL_addr | RESET_PSW_MASK) static uint64_t *reset_psw = 0, save_psw, ipl_continue; +void write_reset_psw(uint64_t psw) +{ + *reset_psw = psw; +} + static void jump_to_IPL_addr(void) { __attribute__((noreturn)) void (*ipl)(void) = (void *)ipl_continue; /* Restore reset PSW */ - *reset_psw = save_psw; + write_reset_psw(save_psw); ipl(); /* should not return */ @@ -43,11 +49,12 @@ void jump_to_IPL_code(uint64_t address) * content of non-BIOS memory after we loaded the guest, so we * save the original content and restore it in jump_to_IPL_2. */ - save_psw = *reset_psw; - *reset_psw = (uint64_t) &jump_to_IPL_addr; - *reset_psw |= RESET_PSW_MASK; - ipl_continue = address; - debug_print_int("set IPL addr to", ipl_continue); + if (address) { + save_psw = *reset_psw; + write_reset_psw(RESET_PSW); + ipl_continue = address; + } + debug_print_int("set IPL addr to", address ?: *reset_psw & PSW_MASK_SHORT_ADDR); /* Ensure the guest output starts fresh */ sclp_print("\n"); @@ -77,7 +84,12 @@ void jump_to_low_kernel(void) /* Trying to get PSW at zero address */ if (*((uint64_t *)0) & RESET_PSW_MASK) { - jump_to_IPL_code((*((uint64_t *)0)) & PSW_MASK_SHORT_ADDR); + /* + * Surely nobody will try running directly from lowcore, so + * let's use 0 as an indication that we want to load the reset + * psw at 0x0 and not jump to the entry. + */ + jump_to_IPL_code(0); } /* No other option left, so use the Linux kernel start address */ diff --git a/pc-bios/s390-ccw/s390-ccw.h b/pc-bios/s390-ccw/s390-ccw.h index 9b86c120b4..6cd92669e9 100644 --- a/pc-bios/s390-ccw/s390-ccw.h +++ b/pc-bios/s390-ccw/s390-ccw.h @@ -76,6 +76,7 @@ int virtio_read(ulong sector, void *load_addr); void zipl_load(void); /* jump2ipl.c */ +void write_reset_psw(uint64_t psw); void jump_to_IPL_code(uint64_t address); void jump_to_low_kernel(void); From patchwork Tue Oct 6 18:31:20 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Huth X-Patchwork-Id: 11819059 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id CDF916CA for ; Tue, 6 Oct 2020 18:39:41 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 54A1D20789 for ; Tue, 6 Oct 2020 18:39:41 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="SdKWNKd/" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 54A1D20789 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:58080 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kPrsC-0003oE-DJ for patchwork-qemu-devel@patchwork.kernel.org; Tue, 06 Oct 2020 14:39:40 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57704) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kPrkz-0003JA-UU for qemu-devel@nongnu.org; Tue, 06 Oct 2020 14:32:14 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:36045) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kPrkx-0006Tz-5m for qemu-devel@nongnu.org; Tue, 06 Oct 2020 14:32:13 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1602009130; 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=wzA/NKjQjDu4yvwdxTP5UjdOn7lcNmZtyqys79a2g2o=; b=SdKWNKd/PNFnkpqmDamAsTE0JpqMyqorGMFYVxbOfNEdSUnR2T1izHbZjpyYafMPs7PW1m FdeOcSCuzO6JGlKsyS+kb38Qd7oCj9lO83tbQtLGag0gG26u0gsmbt3pa0IEgmqklOfQSA 1M4yJkQNVDwTypEzyoM94nYnzE0a04c= 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-496-EYS2Ok7yOpiDU4xLJy9f6w-1; Tue, 06 Oct 2020 14:32:06 -0400 X-MC-Unique: EYS2Ok7yOpiDU4xLJy9f6w-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B6B6487951A; Tue, 6 Oct 2020 18:32:04 +0000 (UTC) Received: from thuth.com (ovpn-113-60.ams2.redhat.com [10.36.113.60]) by smtp.corp.redhat.com (Postfix) with ESMTP id CA4726EF43; Tue, 6 Oct 2020 18:32:02 +0000 (UTC) From: Thomas Huth To: qemu-devel@nongnu.org, Peter Maydell Subject: [PULL 14/16] pc-bios: s390x: Go into disabled wait when encountering a PGM exception Date: Tue, 6 Oct 2020 20:31:20 +0200 Message-Id: <20201006183122.155609-15-thuth@redhat.com> In-Reply-To: <20201006183122.155609-1-thuth@redhat.com> References: <20201006183122.155609-1-thuth@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 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 client-ip=63.128.21.124; envelope-from=thuth@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/06 01:55:55 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.733, 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_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, 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: Christian Borntraeger , qemu-s390x@nongnu.org, Cornelia Huck , Marc Hartmayer , Janosch Frank Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From: Janosch Frank Let's setup a PGM PSW, so we won't load 0s when a program exception happens. Instead we'll load a disabled wait PSW. Signed-off-by: Janosch Frank Reviewed-by: Christian Borntraeger Reviewed-by: Thomas Huth Message-Id: <20201006094249.50640-5-frankja@linux.ibm.com> Signed-off-by: Thomas Huth --- pc-bios/s390-ccw/start.S | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pc-bios/s390-ccw/start.S b/pc-bios/s390-ccw/start.S index ce519300a1..4d5ad21653 100644 --- a/pc-bios/s390-ccw/start.S +++ b/pc-bios/s390-ccw/start.S @@ -34,7 +34,10 @@ remainder: larl %r2,memsetxc ex %r3,0(%r2) done: - j main /* And call C */ + /* set up a pgm exception disabled wait psw */ + larl %r2, disabled_wait_psw + mvc 0x01d0(16), 0(%r2) + j main /* And call C */ memsetxc: xc 0(1,%r1),0(%r1) From patchwork Tue Oct 6 18:31:22 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Huth X-Patchwork-Id: 11819067 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 891226CA for ; Tue, 6 Oct 2020 18:43:21 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4044C20760 for ; Tue, 6 Oct 2020 18:43:21 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="Ln59PI2Q" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4044C20760 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:38404 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kPrvk-0007Qs-6n for patchwork-qemu-devel@patchwork.kernel.org; Tue, 06 Oct 2020 14:43:20 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57730) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kPrl4-0003Te-3b for qemu-devel@nongnu.org; Tue, 06 Oct 2020 14:32:18 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:32774) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kPrl2-0006Vt-5e for qemu-devel@nongnu.org; Tue, 06 Oct 2020 14:32:17 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1602009135; 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=fD5E2K+868OB2LS0wj4I/F+lGpAXgFollDxn0a6UnOs=; b=Ln59PI2QJ2fnEiEbo0TpODyrLoZHKVfu77Ut21EmRxcfoGpJ8XGjUOBPZXK7m84yIksbIJ mNR0a2ZpBX8J0R3ZdoCixm3AHlz0KlTq8zjC57FVEsh22Q0sGiboTOyYFkv2mQvTn8l2B2 EdPRGyRnlk5nSN+BQa2fR0AmXRBnQnQ= 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-368-TEEeXkMmMjebduS5hsOPig-1; Tue, 06 Oct 2020 14:32:12 -0400 X-MC-Unique: TEEeXkMmMjebduS5hsOPig-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id DFDD810BBEC0; Tue, 6 Oct 2020 18:32:10 +0000 (UTC) Received: from thuth.com (ovpn-113-60.ams2.redhat.com [10.36.113.60]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7F2496EF43; Tue, 6 Oct 2020 18:32:08 +0000 (UTC) From: Thomas Huth To: qemu-devel@nongnu.org, Peter Maydell Subject: [PULL 16/16] tests/qtest/cdrom: Add more s390x-related boot tests Date: Tue, 6 Oct 2020 20:31:22 +0200 Message-Id: <20201006183122.155609-17-thuth@redhat.com> In-Reply-To: <20201006183122.155609-1-thuth@redhat.com> References: <20201006183122.155609-1-thuth@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 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 client-ip=63.128.21.124; envelope-from=thuth@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/06 01:55:55 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.733, 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_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, 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: Christian Borntraeger , qemu-s390x@nongnu.org, Cornelia Huck , Marc Hartmayer , Janosch Frank Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" 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. Message-Id: <20200806105349.632-10-thuth@redhat.com> Reviewed-by: Cornelia Huck Acked-by: Janosch Frank Signed-off-by: Thomas Huth --- 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 e9afab693c..eef242dc80 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=cdr " "-blockdev file,node-name=cdr,filename=", test_cdboot); + qtest_add_data_func("cdrom/boot/with-bootindex", + "-device virtio-serial -device virtio-scsi " + "-device virtio-blk,drive=d1 " + "-drive driver=null-co,read-zeroes=on,if=none,id=d1 " + "-device virtio-blk,drive=d2,bootindex=1 " + "-drive if=none,id=d2,media=cdrom,file=", test_cdboot); + qtest_add_data_func("cdrom/boot/without-bootindex", + "-device virtio-scsi -device virtio-serial " + "-device x-terminal3270 -device virtio-blk,drive=d1 " + "-drive driver=null-co,read-zeroes=on,if=none,id=d1 " + "-device virtio-blk,drive=d2 " + "-drive if=none,id=d2,media=cdrom,file=", test_cdboot); } int main(int argc, char **argv)