From patchwork Tue Oct 6 09:42:46 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Janosch Frank X-Patchwork-Id: 11818377 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 C9DE66CA for ; Tue, 6 Oct 2020 09:45:56 +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 3D3D3206B5 for ; Tue, 6 Oct 2020 09:45:56 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="OPbHXdsK" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3D3D3206B5 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.ibm.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]:56816 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kPjXf-00039s-61 for patchwork-qemu-devel@patchwork.kernel.org; Tue, 06 Oct 2020 05:45:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41428) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kPjUx-0007ZX-6n for qemu-devel@nongnu.org; Tue, 06 Oct 2020 05:43:07 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:54958) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kPjUu-0002Dr-28 for qemu-devel@nongnu.org; Tue, 06 Oct 2020 05:43:06 -0400 Received: from pps.filterd (m0098417.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 0969Vonc193822 for ; Tue, 6 Oct 2020 05:43:01 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=pp1; bh=4DwvKU+klFJRrmZu4dlvRVnUY3gvooEZ199bNOhdDIA=; b=OPbHXdsKo1/0Mz6fYMDk52ISG6pMs8MK9+yJfZ/fAj1UaFnscHNLftQxMNI9SE7AwW1M jU6owXYKz3vtsAnbq8x/ZDsPqs18SNiofPRpdLF6cX7HUWgoJVSNP5mDZF1OaPLAUT34 qUqzQyNNgeU6c9bmMhjp6T0UhjbNdKI9aWNFL1sdfaBxlVUHxW9f0mbyJdtXIkBZnSOp g++MmgAJasU/aVHBSVupHqVsLK9D1rk/dwx+3ODOH6hzy7xGrfCJEAUJ7r8ZUZiMDrO2 EQfzMI1bzYrnv4pwZyOZgvuY26hwSHF6ndq4EorkBC9Wj4sb0wuUsHGhTDn3sFFV4Hts vA== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 340nej9k1s-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 06 Oct 2020 05:43:01 -0400 Received: from m0098417.ppops.net (m0098417.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.36/8.16.0.36) with SMTP id 0969W3OF194814 for ; Tue, 6 Oct 2020 05:43:00 -0400 Received: from ppma01fra.de.ibm.com (46.49.7a9f.ip4.static.sl-reverse.com [159.122.73.70]) by mx0a-001b2d01.pphosted.com with ESMTP id 340nej9k19-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 06 Oct 2020 05:43:00 -0400 Received: from pps.filterd (ppma01fra.de.ibm.com [127.0.0.1]) by ppma01fra.de.ibm.com (8.16.0.42/8.16.0.42) with SMTP id 0969R5Ec006359; Tue, 6 Oct 2020 09:42:59 GMT Received: from b06cxnps4074.portsmouth.uk.ibm.com (d06relay11.portsmouth.uk.ibm.com [9.149.109.196]) by ppma01fra.de.ibm.com with ESMTP id 33xgx7ske7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 06 Oct 2020 09:42:58 +0000 Received: from d06av21.portsmouth.uk.ibm.com (d06av21.portsmouth.uk.ibm.com [9.149.105.232]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 0969guC617498454 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 6 Oct 2020 09:42:56 GMT Received: from d06av21.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id AC67152051; Tue, 6 Oct 2020 09:42:56 +0000 (GMT) Received: from linux01.pok.stglabs.ibm.com (unknown [9.114.17.81]) by d06av21.portsmouth.uk.ibm.com (Postfix) with ESMTP id 1A3725204F; Tue, 6 Oct 2020 09:42:56 +0000 (GMT) From: Janosch Frank To: qemu-devel@nongnu.org Subject: [PATCH v4 1/4] pc-bios: s390x: Fix bootmap.c zipl component entry data handling Date: Tue, 6 Oct 2020 05:42:46 -0400 Message-Id: <20201006094249.50640-2-frankja@linux.ibm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201006094249.50640-1-frankja@linux.ibm.com> References: <20201006094249.50640-1-frankja@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.235, 18.0.687 definitions=2020-10-06_03:2020-10-06, 2020-10-06 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 bulkscore=0 mlxscore=0 lowpriorityscore=0 spamscore=0 clxscore=1015 priorityscore=1501 suspectscore=1 phishscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2010060058 Received-SPF: pass client-ip=148.163.158.5; envelope-from=frankja@linux.ibm.com; helo=mx0b-001b2d01.pphosted.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/06 05:43:01 X-ACL-Warn: Detected OS = Linux 3.x [generic] X-Spam_score_int: -26 X-Spam_score: -2.7 X-Spam_bar: -- X-Spam_report: (-2.7 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-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: borntraeger@de.ibm.com, thuth@redhat.com, cohuck@redhat.com, david@redhat.com Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" 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 --- 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 97205674e5..8747c4ea26 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" @@ -436,7 +437,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); @@ -514,7 +515,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 09:42:47 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Janosch Frank X-Patchwork-Id: 11818375 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 13A696CB for ; Tue, 6 Oct 2020 09:43:51 +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 918FE206B5 for ; Tue, 6 Oct 2020 09:43:50 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="SBo9IEVh" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 918FE206B5 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.ibm.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]:50438 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kPjVd-0000Q6-J9 for patchwork-qemu-devel@patchwork.kernel.org; Tue, 06 Oct 2020 05:43:49 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41424) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kPjUw-0007ZR-SF for qemu-devel@nongnu.org; Tue, 06 Oct 2020 05:43:06 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:58454 helo=mx0a-001b2d01.pphosted.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kPjUt-0002E0-OJ for qemu-devel@nongnu.org; Tue, 06 Oct 2020 05:43:06 -0400 Received: from pps.filterd (m0098413.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 0969Uc5v183518 for ; Tue, 6 Oct 2020 05:43:02 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=pp1; bh=pOYN3D6eRtOl+bQ+IMNL0ENNCvUrMDsumJMcxXKpJKU=; b=SBo9IEVhr7GMzw222ewmsQUt0BNRsAVvOQmvzZB1c/WYXl4MPHeCJANv5mGTPBTT4AWs 4vZ98UW1JHz36ftfwjfolOR9yW5BCAWZJXT7LGCY9uBZNVsz1IYVxEPVNnUG3/Q8Mpq5 cbqOZFNb0L+9f5nBSUP0VncLEph6tVilZRmbMmKudLLOfa/ED0bDAq+jiKQGeaM0hVWu mJz0BowPsM44b+2LApYnX8WSYWzF/PV1vKot4G438RpAYDT7Wh2Clhxrr9boEIQSpY2G mjgYhcc8FLcth+Q4Yy/f5V4ei5UaPIbCoYnRtkMHv/QYL9ZEkVJwPuRsE6ZZn1cxY2u0 tg== Received: from pps.reinject (localhost [127.0.0.1]) by mx0b-001b2d01.pphosted.com with ESMTP id 340n5ut357-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 06 Oct 2020 05:43:02 -0400 Received: from m0098413.ppops.net (m0098413.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.36/8.16.0.36) with SMTP id 0969X8Qu191696 for ; Tue, 6 Oct 2020 05:43:01 -0400 Received: from ppma01fra.de.ibm.com (46.49.7a9f.ip4.static.sl-reverse.com [159.122.73.70]) by mx0b-001b2d01.pphosted.com with ESMTP id 340n5ut347-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 06 Oct 2020 05:43:01 -0400 Received: from pps.filterd (ppma01fra.de.ibm.com [127.0.0.1]) by ppma01fra.de.ibm.com (8.16.0.42/8.16.0.42) with SMTP id 0969R10E005971; Tue, 6 Oct 2020 09:42:59 GMT Received: from b06cxnps4075.portsmouth.uk.ibm.com (d06relay12.portsmouth.uk.ibm.com [9.149.109.197]) by ppma01fra.de.ibm.com with ESMTP id 33xgx7skea-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 06 Oct 2020 09:42:59 +0000 Received: from d06av21.portsmouth.uk.ibm.com (d06av21.portsmouth.uk.ibm.com [9.149.105.232]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 0969gv4M26804548 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 6 Oct 2020 09:42:57 GMT Received: from d06av21.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 6831C52059; Tue, 6 Oct 2020 09:42:57 +0000 (GMT) Received: from linux01.pok.stglabs.ibm.com (unknown [9.114.17.81]) by d06av21.portsmouth.uk.ibm.com (Postfix) with ESMTP id C8DFC52052; Tue, 6 Oct 2020 09:42:56 +0000 (GMT) From: Janosch Frank To: qemu-devel@nongnu.org Subject: [PATCH v4 2/4] pc-bios: s390x: Save PSW rework Date: Tue, 6 Oct 2020 05:42:47 -0400 Message-Id: <20201006094249.50640-3-frankja@linux.ibm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201006094249.50640-1-frankja@linux.ibm.com> References: <20201006094249.50640-1-frankja@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.235, 18.0.687 definitions=2020-10-06_03:2020-10-06, 2020-10-06 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 bulkscore=0 adultscore=0 suspectscore=1 impostorscore=0 priorityscore=1501 lowpriorityscore=0 phishscore=0 malwarescore=0 mlxlogscore=999 clxscore=1015 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2010060058 Received-SPF: pass client-ip=148.163.158.5; envelope-from=frankja@linux.ibm.com; helo=mx0a-001b2d01.pphosted.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/06 05:43:01 X-ACL-Warn: Detected OS = Linux 3.x [generic] X-Spam_score_int: -26 X-Spam_score: -2.7 X-Spam_bar: -- X-Spam_report: (-2.7 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-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: borntraeger@de.ibm.com, thuth@redhat.com, cohuck@redhat.com, david@redhat.com Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" 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 --- 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; - void (*ipl)(void) = (void *) (uint64_t) current->ipl_continue; - *current = save; - ipl(); /* should not return */ + /* Restore reset PSW */ + *reset_psw = save_psw; + + 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 09:42:48 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Janosch Frank X-Patchwork-Id: 11818371 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 4BC266CB for ; Tue, 6 Oct 2020 09:43:49 +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 CF71E206B5 for ; Tue, 6 Oct 2020 09:43:48 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="Z+0UNYSh" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CF71E206B5 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.ibm.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]:50340 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kPjVb-0000NQ-MP for patchwork-qemu-devel@patchwork.kernel.org; Tue, 06 Oct 2020 05:43:47 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41386) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kPjUv-0007ZB-Hz for qemu-devel@nongnu.org; Tue, 06 Oct 2020 05:43:05 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:19376 helo=mx0a-001b2d01.pphosted.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kPjUt-0002E7-G9 for qemu-devel@nongnu.org; Tue, 06 Oct 2020 05:43:05 -0400 Received: from pps.filterd (m0098420.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 0969WGBE115185 for ; Tue, 6 Oct 2020 05:43:02 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=pp1; bh=Meo3yYgoewKhZPN+zN1BhVnb0lBhWLH5mHe+wthkhpg=; b=Z+0UNYShPg0lioyGAp4IOkDMJQQGvlMNoHVM7i3yGnS6V3I3l+tATXfkaPDdwFuGuYut 0oEusHllT0x/8lpnDWMCQobapa2IoWeBElJ5SPTcEShSEfAgdKh6qLIQrUZhzs/jOmxu oEKInA3oe4upnL2YmjY6R+ItuNmmcNfQ6yjpbDyTO5LkYPzD0xiTLNNHcWnrjk6NiwS1 0VhoK+0R97N9d/Qhys/zlbOlas9vdFCO6/xMzGbbDzUOgwh/4DdPmd2ahsUdj9JE2zs7 OjXBD3VQmL1wlP6C1f9nFDGTN22yeQsEoPGRbGBMjWRoanU+KH3STET+tgUviVFAXFv0 5A== Received: from pps.reinject (localhost [127.0.0.1]) by mx0b-001b2d01.pphosted.com with ESMTP id 340nuc8mqd-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 06 Oct 2020 05:43:02 -0400 Received: from m0098420.ppops.net (m0098420.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.36/8.16.0.36) with SMTP id 0969XM67118295 for ; Tue, 6 Oct 2020 05:43:02 -0400 Received: from ppma03fra.de.ibm.com (6b.4a.5195.ip4.static.sl-reverse.com [149.81.74.107]) by mx0b-001b2d01.pphosted.com with ESMTP id 340nuc8mps-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 06 Oct 2020 05:43:02 -0400 Received: from pps.filterd (ppma03fra.de.ibm.com [127.0.0.1]) by ppma03fra.de.ibm.com (8.16.0.42/8.16.0.42) with SMTP id 0969SCJd000424; Tue, 6 Oct 2020 09:43:00 GMT Received: from b06cxnps4076.portsmouth.uk.ibm.com (d06relay13.portsmouth.uk.ibm.com [9.149.109.198]) by ppma03fra.de.ibm.com with ESMTP id 33xgx7sk6m-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 06 Oct 2020 09:43:00 +0000 Received: from d06av21.portsmouth.uk.ibm.com (d06av21.portsmouth.uk.ibm.com [9.149.105.232]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 0969gwjq31195482 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 6 Oct 2020 09:42:58 GMT Received: from d06av21.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 230CB5204F; Tue, 6 Oct 2020 09:42:58 +0000 (GMT) Received: from linux01.pok.stglabs.ibm.com (unknown [9.114.17.81]) by d06av21.portsmouth.uk.ibm.com (Postfix) with ESMTP id 858B152051; Tue, 6 Oct 2020 09:42:57 +0000 (GMT) From: Janosch Frank To: qemu-devel@nongnu.org Subject: [PATCH v4 3/4] pc-bios: s390x: Use reset PSW if avaliable Date: Tue, 6 Oct 2020 05:42:48 -0400 Message-Id: <20201006094249.50640-4-frankja@linux.ibm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201006094249.50640-1-frankja@linux.ibm.com> References: <20201006094249.50640-1-frankja@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.235, 18.0.687 definitions=2020-10-06_03:2020-10-06, 2020-10-06 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 phishscore=0 suspectscore=1 bulkscore=0 impostorscore=0 lowpriorityscore=0 malwarescore=0 mlxscore=0 clxscore=1015 spamscore=0 mlxlogscore=999 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2010060058 Received-SPF: pass client-ip=148.163.158.5; envelope-from=frankja@linux.ibm.com; helo=mx0a-001b2d01.pphosted.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/06 05:43:01 X-ACL-Warn: Detected OS = Linux 3.x [generic] X-Spam_score_int: -26 X-Spam_score: -2.7 X-Spam_bar: -- X-Spam_report: (-2.7 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-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: borntraeger@de.ibm.com, thuth@redhat.com, cohuck@redhat.com, david@redhat.com Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" 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 --- 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 8747c4ea26..88bd12d5d7 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) @@ -515,7 +516,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..63afa4a349 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 ? 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 36b884cced..7090720422 100644 --- a/pc-bios/s390-ccw/s390-ccw.h +++ b/pc-bios/s390-ccw/s390-ccw.h @@ -78,6 +78,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 09:42:49 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Janosch Frank X-Patchwork-Id: 11818373 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 D93C76CA for ; Tue, 6 Oct 2020 09:43:49 +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 81667206B5 for ; Tue, 6 Oct 2020 09:43:49 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="A2E+V+1+" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 81667206B5 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.ibm.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]:50414 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kPjVc-0000PQ-Hi for patchwork-qemu-devel@patchwork.kernel.org; Tue, 06 Oct 2020 05:43:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41430) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kPjUx-0007Zc-C3 for qemu-devel@nongnu.org; Tue, 06 Oct 2020 05:43:07 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:32312) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kPjUv-0002EG-FC for qemu-devel@nongnu.org; Tue, 06 Oct 2020 05:43:07 -0400 Received: from pps.filterd (m0098404.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 0969gXce043481 for ; Tue, 6 Oct 2020 05:43:04 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=pp1; bh=+u+yVVICuIk67PlOUdHTDLXAjBpKna4dj+jy3/sXglc=; b=A2E+V+1+QHIQqt2Zp2bSZDxvtWmWlbwD8XtH0BbGP01EXiFEICVlApPwZqS/Cwl1W1YZ c2ja9ALUlXFmXJgwXqMI65h37SVjuVCGwhJCyACOz/x8D+QUq8ZbKZ+heQu7CXKiRZKh HW0cKddRjAsBKvlQjAnywXSacNufNb0ciOfSCrKOLTSx7HtGqsqR4sF5Oj2A1UGSuPNV bqggbiisFP1b3Y16LMb/LHUGVxD+qyVvTf3T/s0+1XmbqYYFneoyGQclj10ePELSo9Sp n0EZibMaCv/se3/2gQG4SDsdP5el/6KoaNj3k7pm9b3nTZEYdYRjo7FCDm8LvjlRfQP8 9A== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 340p69808f-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 06 Oct 2020 05:43:04 -0400 Received: from m0098404.ppops.net (m0098404.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.36/8.16.0.36) with SMTP id 0969h3Be046320 for ; Tue, 6 Oct 2020 05:43:03 -0400 Received: from ppma03ams.nl.ibm.com (62.31.33a9.ip4.static.sl-reverse.com [169.51.49.98]) by mx0a-001b2d01.pphosted.com with ESMTP id 340p698082-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 06 Oct 2020 05:43:03 -0400 Received: from pps.filterd (ppma03ams.nl.ibm.com [127.0.0.1]) by ppma03ams.nl.ibm.com (8.16.0.42/8.16.0.42) with SMTP id 0969Rrm1011476; Tue, 6 Oct 2020 09:43:01 GMT Received: from b06avi18878370.portsmouth.uk.ibm.com (b06avi18878370.portsmouth.uk.ibm.com [9.149.26.194]) by ppma03ams.nl.ibm.com with ESMTP id 33xgx8b2vj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 06 Oct 2020 09:43:01 +0000 Received: from d06av21.portsmouth.uk.ibm.com (d06av21.portsmouth.uk.ibm.com [9.149.105.232]) by b06avi18878370.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 0969gx5J29295016 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 6 Oct 2020 09:42:59 GMT Received: from d06av21.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id DE4865204F; Tue, 6 Oct 2020 09:42:58 +0000 (GMT) Received: from linux01.pok.stglabs.ibm.com (unknown [9.114.17.81]) by d06av21.portsmouth.uk.ibm.com (Postfix) with ESMTP id 4177952051; Tue, 6 Oct 2020 09:42:58 +0000 (GMT) From: Janosch Frank To: qemu-devel@nongnu.org Subject: [PATCH v4 4/4] pc-bios: s390x: Go into disabled wait when encountering a PGM exception Date: Tue, 6 Oct 2020 05:42:49 -0400 Message-Id: <20201006094249.50640-5-frankja@linux.ibm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201006094249.50640-1-frankja@linux.ibm.com> References: <20201006094249.50640-1-frankja@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.235, 18.0.687 definitions=2020-10-06_03:2020-10-06, 2020-10-06 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 mlxscore=0 suspectscore=1 malwarescore=0 phishscore=0 clxscore=1015 lowpriorityscore=0 spamscore=0 mlxlogscore=926 priorityscore=1501 bulkscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2010060058 Received-SPF: pass client-ip=148.163.156.1; envelope-from=frankja@linux.ibm.com; helo=mx0a-001b2d01.pphosted.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/06 04:55:29 X-ACL-Warn: Detected OS = Linux 3.x [generic] [fuzzy] X-Spam_score_int: -26 X-Spam_score: -2.7 X-Spam_bar: -- X-Spam_report: (-2.7 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-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: borntraeger@de.ibm.com, thuth@redhat.com, cohuck@redhat.com, david@redhat.com Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" 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 --- 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)