From nobody Tue May 21 01:42:50 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linux.ibm.com ARC-Seal: i=1; a=rsa-sha256; t=1598886664; cv=none; d=zohomail.com; s=zohoarc; b=BRCw3mhb8t9xVUy2CM2yHPR8sXtGsrSDh0vr3Bzqd7TQZFlNzaw++obgDfhNgYI31Sy/STz6L5ucdCixY9j+oUg5kAwLq5BWnkJF/RZQeCLgDUgdMYpxLf5qME6c/Hqx7ht3pf1DAnswqwAds7606Q/jBSO0XykSjkFIViTw/H0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1598886664; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=4DwvKU+klFJRrmZu4dlvRVnUY3gvooEZ199bNOhdDIA=; b=Kj6POJgRHT9aiI/SJfg22v8pRVhuQqW8Qhlu3a4M+/dUzzzgUHmwiJYILy0RfZ+ZlWm3uckfc5Eod64uIHjzr0bPG7fvF7LmrIvDouHPlnDWeDkFF5HwhbcwAvn6lDA7K8mmCmHHPhHEVE51Bb/kjWyQGq+pLTjfnedBcrevTGk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1598886664854186.03977339205244; Mon, 31 Aug 2020 08:11:04 -0700 (PDT) Received: from localhost ([::1]:59286 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kClSZ-0001ME-A2 for importer@patchew.org; Mon, 31 Aug 2020 11:11:03 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45894) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kClR0-00080Z-AB for qemu-devel@nongnu.org; Mon, 31 Aug 2020 11:09:26 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:21470 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 1kClQw-0005ls-Oq for qemu-devel@nongnu.org; Mon, 31 Aug 2020 11:09:25 -0400 Received: from pps.filterd (m0098416.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 07VF2gqe068354 for ; Mon, 31 Aug 2020 11:09:20 -0400 Received: from pps.reinject (localhost [127.0.0.1]) by mx0b-001b2d01.pphosted.com with ESMTP id 3392cp2bw8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 31 Aug 2020 11:09:20 -0400 Received: from m0098416.ppops.net (m0098416.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.36/8.16.0.36) with SMTP id 07VF2pFS069341 for ; Mon, 31 Aug 2020 11:09:19 -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 3392cp2bv0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 31 Aug 2020 11:09:19 -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 07VF8VaX014135; Mon, 31 Aug 2020 15:09:18 GMT Received: from b06cxnps3074.portsmouth.uk.ibm.com (d06relay09.portsmouth.uk.ibm.com [9.149.109.194]) by ppma03fra.de.ibm.com with ESMTP id 337en89cqu-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 31 Aug 2020 15:09:17 +0000 Received: from d06av23.portsmouth.uk.ibm.com (d06av23.portsmouth.uk.ibm.com [9.149.105.59]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 07VF9Ft330212364 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 31 Aug 2020 15:09:15 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B6363A4055; Mon, 31 Aug 2020 15:09:15 +0000 (GMT) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 21B69A4040; Mon, 31 Aug 2020 15:09:15 +0000 (GMT) Received: from linux01.pok.stglabs.ibm.com (unknown [9.114.17.81]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTP; Mon, 31 Aug 2020 15:09:15 +0000 (GMT) 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=N62n0f/oUUjyS9vAWEXZB+ammm8sAbT8tl9bftiay2cBVdw8SgXd5qgAE0UQ/PNBvLyV MjYXzNZEhRniRcE8UHm9lvr8MZIP8yQ8L0cd7Jb5gFX6xul1Gv8UcBf+jV0aEqLwsZfR /3sNXrLq2Vh+KPJHq6eHbXTUCcEowsDreGB73wMnn+MLW8t/gGqX079sS/J9lUZlAQf4 333hledkO7XJN7zvUGbK62B3hCN793XjcceljuLRj1v3nh6IchepasvE1SezXPTxBVCl xcoALzMIJfD11F3h/7WUNiSBa10ik5yRjFUfOumIfhm8Npgjrv0dbNsco5fbGLKmmIaS GA== From: Janosch Frank To: qemu-devel@nongnu.org Subject: [PATCH v3 1/5] pc-bios: s390x: Fix bootmap.c zipl component entry data handling Date: Mon, 31 Aug 2020 11:09:06 -0400 Message-Id: <20200831150910.317171-2-frankja@linux.ibm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200831150910.317171-1-frankja@linux.ibm.com> References: <20200831150910.317171-1-frankja@linux.ibm.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.235, 18.0.687 definitions=2020-08-31_06:2020-08-31, 2020-08-31 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 phishscore=0 mlxscore=0 adultscore=0 mlxlogscore=999 impostorscore=0 clxscore=1015 suspectscore=1 spamscore=0 lowpriorityscore=0 malwarescore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2008310086 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=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/08/31 11:09:20 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @ibm.com) Content-Type: text/plain; charset="utf-8" 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 @@ =20 #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 =3D &err_msg[30]; /* where to print blockno in (those ZZs= ) */ =20 blockno =3D entry->data.blockno; - address =3D entry->load_address; + address =3D entry->compdat.load_addr; =20 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 =3D=3D ZIPL_COMP_ENTRY_EXEC, "No EXEC= entry"); =20 /* should not return */ - jump_to_IPL_code(entry->load_address); + jump_to_IPL_code(entry->compdat.load_psw & PSW_MASK_SHORT_ADDR); } =20 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; =20 +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; =20 typedef struct ComponentHeader { --=20 2.25.1 From nobody Tue May 21 01:42:50 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linux.ibm.com ARC-Seal: i=1; a=rsa-sha256; t=1598886647; cv=none; d=zohomail.com; s=zohoarc; b=MHIGqIvmO7W10JurBC3TYaKSjYNpN+FrxDQVPW3bmXbjD/FLjkdQD2OvXscUhGRxFGPM8PQIJmnbvGvODtfXJBzprd6si7tNGv6p7EFZUN24zQKgN4kKJdUhvYWigjC1/8UpSgiGZ8xQW2/YlnLB5iZzNsdRb2DmjJohrapi1IM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1598886647; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=d39EoDnLoQiZEpv6UafLFDNJocy9Tjk1Fk0UzspxBEo=; b=gIQpm/J2vYYVBwMKgQP48CFEnGT5+pKU0EmPBLO4D0LrOnc/zl2CnCck5fqGnZx/3qctYOlLQCdl2ro/TuiVgEcgz4SL/OMQV2tM9v3Wu99ZCjfyzkVrYI5JrW6fJx/Wez8dMOiyv6/1CZ+l7oznk1YxjQj3W+gWhnQtU1LFqmU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1598886647572942.2005927058387; Mon, 31 Aug 2020 08:10:47 -0700 (PDT) Received: from localhost ([::1]:59040 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kClSH-0001DC-RJ for importer@patchew.org; Mon, 31 Aug 2020 11:10:45 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45890) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kClR0-00080F-5f for qemu-devel@nongnu.org; Mon, 31 Aug 2020 11:09:26 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:24240) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kClQx-0005m2-6J for qemu-devel@nongnu.org; Mon, 31 Aug 2020 11:09:25 -0400 Received: from pps.filterd (m0098394.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 07VF3SIZ079073 for ; Mon, 31 Aug 2020 11:09:21 -0400 Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 33937brq4x-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 31 Aug 2020 11:09:21 -0400 Received: from m0098394.ppops.net (m0098394.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.36/8.16.0.36) with SMTP id 07VF3cMo080418 for ; Mon, 31 Aug 2020 11:09:21 -0400 Received: from ppma06ams.nl.ibm.com (66.31.33a9.ip4.static.sl-reverse.com [169.51.49.102]) by mx0a-001b2d01.pphosted.com with ESMTP id 33937brq3w-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 31 Aug 2020 11:09:21 -0400 Received: from pps.filterd (ppma06ams.nl.ibm.com [127.0.0.1]) by ppma06ams.nl.ibm.com (8.16.0.42/8.16.0.42) with SMTP id 07VF72sl014199; Mon, 31 Aug 2020 15:09:19 GMT Received: from b06cxnps3075.portsmouth.uk.ibm.com (d06relay10.portsmouth.uk.ibm.com [9.149.109.195]) by ppma06ams.nl.ibm.com with ESMTP id 337e9gta6w-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 31 Aug 2020 15:09:18 +0000 Received: from d06av23.portsmouth.uk.ibm.com (d06av23.portsmouth.uk.ibm.com [9.149.105.59]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 07VF9GIv22544684 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 31 Aug 2020 15:09:16 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 7C74FA405E; Mon, 31 Aug 2020 15:09:16 +0000 (GMT) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id DCFC1A4055; Mon, 31 Aug 2020 15:09:15 +0000 (GMT) Received: from linux01.pok.stglabs.ibm.com (unknown [9.114.17.81]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTP; Mon, 31 Aug 2020 15:09:15 +0000 (GMT) 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=d39EoDnLoQiZEpv6UafLFDNJocy9Tjk1Fk0UzspxBEo=; b=AWOEs6yKHAHC4zIms2+XmM+OEPV1i9iYHa/8lViQPCO7ppwpqoUahKV8oSCsk4zTNTl4 1MQaVZkKPiNTu4Zd4GQ1ORNE0RDU3iG3LZs/Tq+BBkwJI/cpJ88KPv1UkRjdG7elEXjE gQvdEXK9v8p/LfFkBl/Tc4PLjMkyYqzriuwZg84/mUIu0bT7P5oB65FVE8mHTeRaFUDq tZy0tQp7BxWXaHjS8ejvqafkADROb+w+4BwY3r3q+/xmXzLogbPE+Gu4gKkDDrnOzMLI 87vS5+LTns2Xnv3rk8+V0+yjdhP1vJPPKy0LySGl3UXlqOF8xgFhxGdG7YsgAo9zLlTR Qw== From: Janosch Frank To: qemu-devel@nongnu.org Subject: [PATCH v3 2/5] pc-bios: s390x: Save PSW rework Date: Mon, 31 Aug 2020 11:09:07 -0400 Message-Id: <20200831150910.317171-3-frankja@linux.ibm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200831150910.317171-1-frankja@linux.ibm.com> References: <20200831150910.317171-1-frankja@linux.ibm.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.235, 18.0.687 definitions=2020-08-31_07:2020-08-31, 2020-08-31 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 clxscore=1015 phishscore=0 adultscore=0 impostorscore=0 spamscore=0 lowpriorityscore=0 suspectscore=1 mlxscore=0 priorityscore=1501 mlxlogscore=999 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2008310086 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=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/08/31 11:09:22 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @ibm.com) Content-Type: text/plain; charset="utf-8" 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) =20 -typedef struct ResetInfo { - uint64_t ipl_psw; - uint32_t ipl_continue; -} ResetInfo; +static uint64_t *reset_psw =3D 0, save_psw, ipl_continue; =20 -static ResetInfo save; - -static void jump_to_IPL_2(void) +static void jump_to_IPL_addr(void) { - ResetInfo *current =3D 0; + __attribute__((noreturn)) void (*ipl)(void) =3D (void *)ipl_continue; =20 - void (*ipl)(void) =3D (void *) (uint64_t) current->ipl_continue; - *current =3D save; - ipl(); /* should not return */ + /* Restore reset PSW */ + *reset_psw =3D save_psw; + + ipl(); + /* should not return */ } =20 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 =3D 0; - - save =3D *current; - - current->ipl_psw =3D (uint64_t) &jump_to_IPL_2; - current->ipl_psw |=3D RESET_PSW_MASK; - current->ipl_continue =3D address & PSW_MASK_SHORT_ADDR; - - debug_print_int("set IPL addr to", current->ipl_continue); + save_psw =3D *reset_psw; + *reset_psw =3D (uint64_t) &jump_to_IPL_addr; + *reset_psw |=3D RESET_PSW_MASK; + ipl_continue =3D address; + debug_print_int("set IPL addr to", ipl_continue); =20 /* Ensure the guest output starts fresh */ sclp_print("\n"); --=20 2.25.1 From nobody Tue May 21 01:42:50 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linux.ibm.com ARC-Seal: i=1; a=rsa-sha256; t=1598886754; cv=none; d=zohomail.com; s=zohoarc; b=IJI5gn0n9ZCA+dcfl9T8fY9Z8QiLJUgaPcCN5JOmHFSRy+sIhpdPcTgX1KTPy4cmoIRJRE86fsfBaWKFryCK2pJwzJEi10OTjt3hDD486AQrVF6gAsxUGj7hJgAqAibypJ4snwOIltgTbU1kk4TIG7cTKms2vKakeDz7Z2qABXs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1598886754; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=awjFdXsWMaMNn8wNz7SVZG/HyxuBpMRmmzkgAlDYE68=; b=jfUmWRcI76ec5X+8Wguwwu2p7RvCtkay16QppMHsJYjzjWMghgQNM31akLohMVOCjZMqxs99ReaXsmaN6bYX9BEqxsMj6uDAO8rq89XEV/MW1SvSKFyq+zc5dA9xPhdJ+2lz8vIGb0M2OzI43g/rNf6cuSIf+3ZA/aPVDqq6h1w= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1598886754828542.0885322781457; Mon, 31 Aug 2020 08:12:34 -0700 (PDT) Received: from localhost ([::1]:39110 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kClU1-0004lw-G4 for importer@patchew.org; Mon, 31 Aug 2020 11:12:33 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45842) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kClQy-0007yj-Mr for qemu-devel@nongnu.org; Mon, 31 Aug 2020 11:09:24 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:39276 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 1kClQw-0005m0-Jc for qemu-devel@nongnu.org; Mon, 31 Aug 2020 11:09:24 -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 07VF2BJh168209 for ; Mon, 31 Aug 2020 11:09:21 -0400 Received: from pps.reinject (localhost [127.0.0.1]) by mx0b-001b2d01.pphosted.com with ESMTP id 338xes900g-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 31 Aug 2020 11:09:21 -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 07VF2C2q168383 for ; Mon, 31 Aug 2020 11:09:21 -0400 Received: from ppma02fra.de.ibm.com (47.49.7a9f.ip4.static.sl-reverse.com [159.122.73.71]) by mx0b-001b2d01.pphosted.com with ESMTP id 338xes8yy7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 31 Aug 2020 11:09:21 -0400 Received: from pps.filterd (ppma02fra.de.ibm.com [127.0.0.1]) by ppma02fra.de.ibm.com (8.16.0.42/8.16.0.42) with SMTP id 07VF86S7001863; Mon, 31 Aug 2020 15:09:19 GMT Received: from b06cxnps4074.portsmouth.uk.ibm.com (d06relay11.portsmouth.uk.ibm.com [9.149.109.196]) by ppma02fra.de.ibm.com with ESMTP id 337en7hd0a-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 31 Aug 2020 15:09:19 +0000 Received: from d06av23.portsmouth.uk.ibm.com (d06av23.portsmouth.uk.ibm.com [9.149.105.59]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 07VF9H3921496162 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 31 Aug 2020 15:09:17 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 42E9BA4040; Mon, 31 Aug 2020 15:09:17 +0000 (GMT) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id A3755A4053; Mon, 31 Aug 2020 15:09:16 +0000 (GMT) Received: from linux01.pok.stglabs.ibm.com (unknown [9.114.17.81]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTP; Mon, 31 Aug 2020 15:09:16 +0000 (GMT) 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=awjFdXsWMaMNn8wNz7SVZG/HyxuBpMRmmzkgAlDYE68=; b=MLhhy7Y94H8mJh0mGB+ZiTQLXV3iO9vrt0yPW9/ShhRvFpvE1sLUBskkCsWhwzl4Wq0C QI7Sal3k5/EgwxJG5QzHBNUyGsRgM9BaVGU3n5fZOpvnK3q+ENJFA20fxXvZ7PhgyHD1 KIoUeW2lp0jvT9iRd+uxvkp8FvNuFqlFWr3/d79NId3mlqNY7V/f3rQITbhgI7lTO0CU JSQsRhXb91QrbLh+BKyuSe6qxm0fNP63mQIcIM/gP/LvjT5LH2t8dNm9nc4gwfwygQYB AvfVgBG9UWKZKwpuaMCxFNtZTC3RdCylyGhabfIzk+yZ7cmIMViL2bl2mQ+Ws91tdKXM xA== From: Janosch Frank To: qemu-devel@nongnu.org Subject: [PATCH v3 3/5] pc-bios: s390x: Use reset PSW if avaliable Date: Mon, 31 Aug 2020 11:09:08 -0400 Message-Id: <20200831150910.317171-4-frankja@linux.ibm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200831150910.317171-1-frankja@linux.ibm.com> References: <20200831150910.317171-1-frankja@linux.ibm.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.235, 18.0.687 definitions=2020-08-31_06:2020-08-31, 2020-08-31 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 adultscore=0 spamscore=0 suspectscore=1 priorityscore=1501 phishscore=0 bulkscore=0 clxscore=1015 lowpriorityscore=0 mlxlogscore=999 mlxscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2008310086 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=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/08/31 11:09:20 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @ibm.com) Content-Type: text/plain; charset="utf-8" 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 | 3 ++- pc-bios/s390-ccw/jump2ipl.c | 22 +++++++++++++++++----- pc-bios/s390-ccw/s390-ccw.h | 1 + 3 files changed, 20 insertions(+), 6 deletions(-) diff --git a/pc-bios/s390-ccw/bootmap.c b/pc-bios/s390-ccw/bootmap.c index 8747c4ea26..5a03b1eb8b 100644 --- a/pc-bios/s390-ccw/bootmap.c +++ b/pc-bios/s390-ccw/bootmap.c @@ -515,7 +515,8 @@ static void zipl_run(ScsiBlockPtr *pte) IPL_assert(entry->component_type =3D=3D ZIPL_COMP_ENTRY_EXEC, "No EXEC= entry"); =20 /* 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); } =20 static void ipl_scsi(void) diff --git a/pc-bios/s390-ccw/jump2ipl.c b/pc-bios/s390-ccw/jump2ipl.c index b6aad32def..5b8352d257 100644 --- a/pc-bios/s390-ccw/jump2ipl.c +++ b/pc-bios/s390-ccw/jump2ipl.c @@ -12,15 +12,21 @@ =20 #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) =20 static uint64_t *reset_psw =3D 0, save_psw, ipl_continue; =20 +void write_reset_psw(uint64_t psw) +{ + *reset_psw =3D psw; +} + static void jump_to_IPL_addr(void) { __attribute__((noreturn)) void (*ipl)(void) =3D (void *)ipl_continue; =20 /* Restore reset PSW */ - *reset_psw =3D save_psw; + write_reset_psw(save_psw); =20 ipl(); /* should not return */ @@ -43,9 +49,10 @@ 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 =3D *reset_psw; - *reset_psw =3D (uint64_t) &jump_to_IPL_addr; - *reset_psw |=3D RESET_PSW_MASK; + if (address) { + save_psw =3D *reset_psw; + write_reset_psw(RESET_PSW); + } ipl_continue =3D address; debug_print_int("set IPL addr to", ipl_continue); =20 @@ -77,7 +84,12 @@ void jump_to_low_kernel(void) =20 /* 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); } =20 /* 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); =20 /* jump2ipl.c */ +void write_reset_psw(uint64_t psw); void jump_to_IPL_code(uint64_t address); void jump_to_low_kernel(void); =20 --=20 2.25.1 From nobody Tue May 21 01:42:50 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linux.ibm.com ARC-Seal: i=1; a=rsa-sha256; t=1598886747; cv=none; d=zohomail.com; s=zohoarc; b=BjBzCYS4hMy3g9WLs7WL3e/jMh2STS+ScQGf5AL3e0KBOQJ+9dOCJIcuKm20K4+6fotkVVdIghILmnKmeK+/hckc31O0MyXtp9+11zYkaTMf73D/fTk2Ifp8MjMezIGtTv1MnA5MxJNWk57GZnxqhgC7cqntIeQDsnd2Knw8K6o= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1598886747; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=zyTbis7odQ73yFoGFelxijktaeMXbkCz6c+59IjzkCE=; b=QLc8Y8fO+SXMV56MUXFdyqlEti9F+v3hc27P4GFdS0+BW+9fPubj5l2jnGaGa6IK8geWUFmudKTFPUf1uJUz81M0kpzzVjlVr/7tDOPeZBoy4ZmaQJXhZSKLN8k0eroMMZWp9zVVQ53LsRgei1wfPCIA5ppVnnowlqd2IHXu5l0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1598886747961481.0411680173877; Mon, 31 Aug 2020 08:12:27 -0700 (PDT) Received: from localhost ([::1]:38498 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kClTu-0004VP-Mi for importer@patchew.org; Mon, 31 Aug 2020 11:12:26 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45900) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kClR0-00081E-K0 for qemu-devel@nongnu.org; Mon, 31 Aug 2020 11:09:26 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:46206) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kClQy-0005mA-LD for qemu-devel@nongnu.org; Mon, 31 Aug 2020 11:09:26 -0400 Received: from pps.filterd (m0098394.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 07VF3XhU079596 for ; Mon, 31 Aug 2020 11:09:23 -0400 Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 33937brq5v-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 31 Aug 2020 11:09:23 -0400 Received: from m0098394.ppops.net (m0098394.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.36/8.16.0.36) with SMTP id 07VF3kCX081612 for ; Mon, 31 Aug 2020 11:09:22 -0400 Received: from ppma04fra.de.ibm.com (6a.4a.5195.ip4.static.sl-reverse.com [149.81.74.106]) by mx0a-001b2d01.pphosted.com with ESMTP id 33937brq4s-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 31 Aug 2020 11:09:22 -0400 Received: from pps.filterd (ppma04fra.de.ibm.com [127.0.0.1]) by ppma04fra.de.ibm.com (8.16.0.42/8.16.0.42) with SMTP id 07VF6jYP027548; Mon, 31 Aug 2020 15:09:20 GMT Received: from b06cxnps4075.portsmouth.uk.ibm.com (d06relay12.portsmouth.uk.ibm.com [9.149.109.197]) by ppma04fra.de.ibm.com with ESMTP id 338pkx0dqa-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 31 Aug 2020 15:09:20 +0000 Received: from d06av23.portsmouth.uk.ibm.com (d06av23.portsmouth.uk.ibm.com [9.149.105.59]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 07VF9Ieq22675744 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 31 Aug 2020 15:09:18 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 0892AA404D; Mon, 31 Aug 2020 15:09:18 +0000 (GMT) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 69BCAA4051; Mon, 31 Aug 2020 15:09:17 +0000 (GMT) Received: from linux01.pok.stglabs.ibm.com (unknown [9.114.17.81]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTP; Mon, 31 Aug 2020 15:09:17 +0000 (GMT) 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=zyTbis7odQ73yFoGFelxijktaeMXbkCz6c+59IjzkCE=; b=nAbXN3SwXog4DvEsIMfzYOPojhfY72EhtgIOK8kbvlBglHO4TrzEknxisuq6sz4jGt1L YYgY2znOpuXkt+WdTaj8IxGzBWTy3ns064beE7jboPvy4EHi17+ZJknWYxFI6IhO6KWZ qI2wUdOl3I+A29Xe4BfZj5pDXQ/kAfAJZ9OWUdO9li4351ismXS1D0U1Rt2xPl8V/5Zf pSQTFjnEsndoS0rDrPtO/f83tZifosF+HN08FqybKgmKooDRGhqOekn6xb9c3ycIh0Oh j+vcilmRgOTtJbN2/WtQX9fGGs308OZi28sRfcEn1aLHJMdcxdK3q7i1b/ELoLC7oPcM sQ== From: Janosch Frank To: qemu-devel@nongnu.org Subject: [PATCH v3 4/5] pc-bios: s390x: Save io and external new PSWs before overwriting them Date: Mon, 31 Aug 2020 11:09:09 -0400 Message-Id: <20200831150910.317171-5-frankja@linux.ibm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200831150910.317171-1-frankja@linux.ibm.com> References: <20200831150910.317171-1-frankja@linux.ibm.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.235, 18.0.687 definitions=2020-08-31_07:2020-08-31, 2020-08-31 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 clxscore=1015 phishscore=0 adultscore=0 impostorscore=0 spamscore=0 lowpriorityscore=0 suspectscore=1 mlxscore=0 priorityscore=1501 mlxlogscore=999 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2008310086 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=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/08/31 11:09:22 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @ibm.com) Content-Type: text/plain; charset="utf-8" Currently we always overwrite the mentioned exception new PSWs before loading the enabled wait PSW. Let's save the PSW before overwriting and restore it right before starting the loaded kernel. Signed-off-by: Janosch Frank --- pc-bios/s390-ccw/jump2ipl.c | 4 +++ pc-bios/s390-ccw/netmain.c | 3 ++ pc-bios/s390-ccw/start.S | 62 +++++++++++++++++++++++++++---------- 3 files changed, 52 insertions(+), 17 deletions(-) diff --git a/pc-bios/s390-ccw/jump2ipl.c b/pc-bios/s390-ccw/jump2ipl.c index 5b8352d257..bb94ba7550 100644 --- a/pc-bios/s390-ccw/jump2ipl.c +++ b/pc-bios/s390-ccw/jump2ipl.c @@ -14,6 +14,7 @@ #define RESET_PSW_MASK (PSW_MASK_SHORTPSW | PSW_MASK_64) #define RESET_PSW ((uint64_t)&jump_to_IPL_addr | RESET_PSW_MASK) =20 +extern uint64_t psw_save_io[], psw_save_ext[]; static uint64_t *reset_psw =3D 0, save_psw, ipl_continue; =20 void write_reset_psw(uint64_t psw) @@ -59,6 +60,9 @@ void jump_to_IPL_code(uint64_t address) /* Ensure the guest output starts fresh */ sclp_print("\n"); =20 + memcpy(&lowcore->io_new_psw, psw_save_io, 16); + memcpy(&lowcore->external_new_psw, psw_save_ext, 16); + /* * HACK ALERT. * We use the load normal reset to keep r15 unchanged. jump_to_IPL_2 diff --git a/pc-bios/s390-ccw/netmain.c b/pc-bios/s390-ccw/netmain.c index 056e93a818..74ef28fbc6 100644 --- a/pc-bios/s390-ccw/netmain.c +++ b/pc-bios/s390-ccw/netmain.c @@ -32,6 +32,7 @@ #include #include =20 +#include "s390-arch.h" #include "s390-ccw.h" #include "cio.h" #include "virtio.h" @@ -43,6 +44,8 @@ extern char _start[]; void write_iplb_location(void) {} =20 +LowCore *lowcore; /* Yes, this *is* a pointer to address 0 */ + #define KERNEL_ADDR ((void *)0L) #define KERNEL_MAX_SIZE ((long)_start) #define ARCH_COMMAND_LINE_SIZE 896 /* Taken from Linux kerne= l */ diff --git a/pc-bios/s390-ccw/start.S b/pc-bios/s390-ccw/start.S index ce519300a1..939aac3a7c 100644 --- a/pc-bios/s390-ccw/start.S +++ b/pc-bios/s390-ccw/start.S @@ -34,7 +34,17 @@ remainder: larl %r2,memsetxc ex %r3,0(%r2) done: - j main /* And call C */ + /* prepare i/o call handler */ + larl %r1, io_new_code + larl %r2, io_new_psw + stg %r1, 8(%r2) + mvc 0x1f0(16),0(%r2) + /* prepare external call handler */ + larl %r1, external_new_code + larl %r2, external_new_psw + stg %r1, 8(%r2) + mvc 0x1b0(16),0(%r2) + j main /* And call C */ =20 memsetxc: xc 0(1,%r1),0(%r1) @@ -64,13 +74,16 @@ consume_sclp_int: oi 6(%r15),0x2 lctlg %c0,%c0,0(%r15) /* prepare external call handler */ - larl %r1, external_new_code - stg %r1, 0x1b8 - larl %r1, external_new_mask - mvc 0x1b0(8),0(%r1) - /* load enabled wait PSW */ - larl %r1, enabled_wait_psw - lpswe 0(%r1) + larl %r1, external_new_psw + lghi %r2, 0x1b0 + /* Is the BIOS' external new PSW already set? */ + clc 0(16, %r1), 0(%r2) + je load_ewait + /* No, save old PSW and write BIOS PSW */ + larl %r3, psw_save_ext + mvc 0(16, %r3), 0x1b0 + mvc 0x1b0(16),0(%r1) + j load_ewait =20 /* * void consume_io_int(void) @@ -84,11 +97,20 @@ consume_io_int: oi 4(%r15), 0xff lctlg %c6,%c6,0(%r15) /* prepare i/o call handler */ - larl %r1, io_new_code - stg %r1, 0x1f8 - larl %r1, io_new_mask - mvc 0x1f0(8),0(%r1) - /* load enabled wait PSW */ + larl %r1, io_new_psw + lghi %r2, 0x1f0 + /* Is the BIOS' PSW already set? */ + larl %r3, load_ewait + clc 0(16, %r1), 0(%r2) + bcr 8, %r3 + /* No, save old PSW and write BIOS PSW */ + larl %r3, psw_save_io + mvc 0(16, %r3), 0x1f0 + mvc 0x1f0(16),0(%r1) + j load_ewait + +load_ewait: + /* PSW is the correct one, time to load the enabled wait PSW */ larl %r1, enabled_wait_psw lpswe 0(%r1) =20 @@ -107,11 +129,17 @@ io_new_code: br %r14 =20 .align 8 + .globl psw_save_io + .globl psw_save_ext disabled_wait_psw: .quad 0x0002000180000000,0x0000000000000000 enabled_wait_psw: .quad 0x0302000180000000,0x0000000000000000 -external_new_mask: - .quad 0x0000000180000000 -io_new_mask: - .quad 0x0000000180000000 +external_new_psw: + .quad 0x0000000180000000,0 +io_new_psw: + .quad 0x0000000180000000,0 +psw_save_io: + .quad 0,0 +psw_save_ext: + .quad 0,0 --=20 2.25.1 From nobody Tue May 21 01:42:50 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linux.ibm.com ARC-Seal: i=1; a=rsa-sha256; t=1598886817; cv=none; d=zohomail.com; s=zohoarc; b=LC6sXrSMQRz0VgSWOzDeTyKhrUXFjNpkzQxVh9n5RDS2IZ6Xeoqm9kTqKxpwLjG2H9+66IuDbKM8B6YkvIZKp1o6GLcsiq/DCwJEdfCpPTRzQfkKB3BBaoVwdRpZBqK7FGZAovIgAmI2Imtk9/sWnegMEz63r6m8MKISEsZTEDc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1598886817; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=ewISRNzAsQs3texf9cSX1KatK1L6SRb6IyOVU2F1Vew=; b=W3Vlsd7pS+a2CBU8LocZFs4QgrQNVbFOagl1m5DVspd5O82Ane5bIcAV+Zfhe6I+uHmFUUo0r1SxBK6LIc65wTRG+RU2vYuZNicixVkAIprHhrH7taw+3bb8Fzar94ps88q39GPq5CPFnvzzW4ZL2jaVZgC7QTzw5sT/LBX1FdE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1598886817255706.4999977114893; Mon, 31 Aug 2020 08:13:37 -0700 (PDT) Received: from localhost ([::1]:44556 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kClV1-0006yk-P4 for importer@patchew.org; Mon, 31 Aug 2020 11:13:35 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45904) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kClR1-00082e-DT for qemu-devel@nongnu.org; Mon, 31 Aug 2020 11:09:27 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:12738) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kClQz-0005mD-2F for qemu-devel@nongnu.org; Mon, 31 Aug 2020 11:09:27 -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 07VF1t3D044264 for ; Mon, 31 Aug 2020 11:09:23 -0400 Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 3390qc5c90-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 31 Aug 2020 11:09:23 -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 07VF25Zs045108 for ; Mon, 31 Aug 2020 11:09:23 -0400 Received: from ppma06ams.nl.ibm.com (66.31.33a9.ip4.static.sl-reverse.com [169.51.49.102]) by mx0a-001b2d01.pphosted.com with ESMTP id 3390qc5c7w-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 31 Aug 2020 11:09:23 -0400 Received: from pps.filterd (ppma06ams.nl.ibm.com [127.0.0.1]) by ppma06ams.nl.ibm.com (8.16.0.42/8.16.0.42) with SMTP id 07VF70hJ014191; Mon, 31 Aug 2020 15:09:21 GMT Received: from b06cxnps4075.portsmouth.uk.ibm.com (d06relay12.portsmouth.uk.ibm.com [9.149.109.197]) by ppma06ams.nl.ibm.com with ESMTP id 337e9gta70-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 31 Aug 2020 15:09:21 +0000 Received: from d06av23.portsmouth.uk.ibm.com (d06av23.portsmouth.uk.ibm.com [9.149.105.59]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 07VF9IhB30474734 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 31 Aug 2020 15:09:19 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id CC107A404D; Mon, 31 Aug 2020 15:09:18 +0000 (GMT) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 2F175A4051; Mon, 31 Aug 2020 15:09:18 +0000 (GMT) Received: from linux01.pok.stglabs.ibm.com (unknown [9.114.17.81]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTP; Mon, 31 Aug 2020 15:09:18 +0000 (GMT) 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=ewISRNzAsQs3texf9cSX1KatK1L6SRb6IyOVU2F1Vew=; b=YvpRJDXlilA/duiEVWI+nWgKmiRTZXGuOueTg6pvgLackeaS+BxheWudn0bWTxtpe3Q7 FzY/vlSVmJmUN9vn5NyBZm9671vg8TYNjX4nPoU7k95uxyg1XX1Q6wSjwMXAqzGWT9x6 QHNN0Gt09fYGREaI90oXwHegXfTx3w2ePIWdfaf01+0ht0S+PqIuke0GUaUhnsVd+/1R eTY2fSlIAXZoqcALZ5Lbj+9adwq9+ULvl5/D5nSvfwpJm4w0woUyGcKWkM5FVPzUSzDn /J+bPBN+yHrn65ewxvMNYfoahd81YUXSecn1eQuqFErgnq8WKJDcMNLHBz32PzHIyiF0 hA== From: Janosch Frank To: qemu-devel@nongnu.org Subject: [PATCH v3 5/5] pc-bios: s390x: Go into disabled wait when encountering a PGM exception Date: Mon, 31 Aug 2020 11:09:10 -0400 Message-Id: <20200831150910.317171-6-frankja@linux.ibm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200831150910.317171-1-frankja@linux.ibm.com> References: <20200831150910.317171-1-frankja@linux.ibm.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.235, 18.0.687 definitions=2020-08-31_06:2020-08-31, 2020-08-31 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 lowpriorityscore=0 mlxscore=0 impostorscore=0 phishscore=0 spamscore=0 suspectscore=1 priorityscore=1501 malwarescore=0 mlxlogscore=834 clxscore=1015 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2008310086 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=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/08/31 11:09:22 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @ibm.com) Content-Type: text/plain; charset="utf-8" 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 | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pc-bios/s390-ccw/start.S b/pc-bios/s390-ccw/start.S index 939aac3a7c..775b45baeb 100644 --- a/pc-bios/s390-ccw/start.S +++ b/pc-bios/s390-ccw/start.S @@ -44,6 +44,9 @@ done: larl %r2, external_new_psw stg %r1, 8(%r2) mvc 0x1b0(16),0(%r2) + /* set up a pgm exception disabled wait psw */ + larl %r2, disabled_wait_psw + mvc 0x01d0(16), 0(%r2) j main /* And call C */ =20 memsetxc: --=20 2.25.1