From nobody Wed Oct 29 20:36:33 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=de.ibm.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1525788991470909.6812254932397; Tue, 8 May 2018 07:16:31 -0700 (PDT) Received: from localhost ([::1]:51472 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fG3Pm-0007XI-8n for importer@patchew.org; Tue, 08 May 2018 10:16:26 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37757) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fG3Oi-0007Cy-TD for qemu-devel@nongnu.org; Tue, 08 May 2018 10:15:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fG3Od-0000Wp-92 for qemu-devel@nongnu.org; Tue, 08 May 2018 10:15:20 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:52150) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fG3Od-0000WY-0D for qemu-devel@nongnu.org; Tue, 08 May 2018 10:15:15 -0400 Received: from pps.filterd (m0098409.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w48EBe2V045090 for ; Tue, 8 May 2018 10:15:13 -0400 Received: from e06smtp15.uk.ibm.com (e06smtp15.uk.ibm.com [195.75.94.111]) by mx0a-001b2d01.pphosted.com with ESMTP id 2hubreny4b-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 08 May 2018 10:15:13 -0400 Received: from localhost by e06smtp15.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 8 May 2018 15:15:11 +0100 Received: from b06cxnps4074.portsmouth.uk.ibm.com (9.149.109.196) by e06smtp15.uk.ibm.com (192.168.101.145) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Tue, 8 May 2018 15:15:08 +0100 Received: from d06av24.portsmouth.uk.ibm.com (mk.ibm.com [9.149.105.60]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w48EF7au52428864; Tue, 8 May 2018 14:15:07 GMT Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id A2D0442045; Tue, 8 May 2018 15:06:10 +0100 (BST) Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 994354204F; Tue, 8 May 2018 15:06:10 +0100 (BST) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.152.85.9]) by d06av24.portsmouth.uk.ibm.com (Postfix) with ESMTPS; Tue, 8 May 2018 15:06:10 +0100 (BST) Received: by tuxmaker.boeblingen.de.ibm.com (Postfix, from userid 25651) id 18F1E20F211; Tue, 8 May 2018 16:15:07 +0200 (CEST) From: Christian Borntraeger To: Peter Maydell Date: Tue, 8 May 2018 16:15:06 +0200 X-Mailer: git-send-email 2.14.2 X-TM-AS-GCONF: 00 x-cbid: 18050814-0020-0000-0000-0000041A66F4 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18050814-0021-0000-0000-000042AFA114 Message-Id: <20180508141506.56480-1-borntraeger@de.ibm.com> Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2018-05-08_05:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1805080137 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] [fuzzy] X-Received-From: 148.163.156.1 Subject: [Qemu-devel] [PATCH] s390x/ipl: Try to detect Linux vs non Linux for initial IPL PSW X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Janosch Frank , Thomas Huth , David Hildenbrand , Alexander Graf , Cornelia Huck , Halil Pasic , qemu-devel , Christian Borntraeger , qemu-s390x , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Right now the IPL device always starts from address 0x10000 (the usual Linux entry point). To run other guests (e.g. test programs) it is useful to use the IPL PSW from address 0. We can use the Linux magic at 0x10008 to decide. Signed-off-by: Christian Borntraeger Acked-by: Jason J. Herne --- hw/s390x/ipl.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/hw/s390x/ipl.c b/hw/s390x/ipl.c index 150f6c0582..c0fed26f03 100644 --- a/hw/s390x/ipl.c +++ b/hw/s390x/ipl.c @@ -104,7 +104,9 @@ static uint64_t bios_translate_addr(void *opaque, uint6= 4_t srcaddr) static void s390_ipl_realize(DeviceState *dev, Error **errp) { S390IPLState *ipl =3D S390_IPL(dev); - uint64_t pentry =3D KERN_IMAGE_START; + uint64_t *iplpsw; + uint64_t pentry; + char *magic; int kernel_size; Error *err =3D NULL; =20 @@ -156,6 +158,17 @@ static void s390_ipl_realize(DeviceState *dev, Error *= *errp) NULL, 1, EM_S390, 0, 0); if (kernel_size < 0) { kernel_size =3D load_image_targphys(ipl->kernel, 0, ram_size); + /* if this is Linux use KERN_IMAGE_START */ + magic =3D rom_ptr(0x10008); + if (magic && !memcmp(magic, "S390EP", 6)) { + pentry =3D KERN_IMAGE_START; + } else { + /* if not Linux use the IPL PSW */ + iplpsw =3D rom_ptr(0); + if (iplpsw) { + pentry =3D *iplpsw & 0x7fffffffUL; + } + } } if (kernel_size < 0) { error_setg(&err, "could not load kernel '%s'", ipl->kernel); --=20 2.14.2