From nobody Sat May 18 18:58:04 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.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; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linux.ibm.com ARC-Seal: i=1; a=rsa-sha256; t=1573486224; cv=none; d=zoho.com; s=zohoarc; b=kShpp4mHglH1kUV6Afu9lzwFttSBVwuGZG/nIGW/yLaimTh9Nlwc6r2Q+JDu6U/NNnKYueTqSutUyiv1Hggs6rat6jAfUWt08KDxOcnbb4l2Q7SHxKtdDK92rl8F1IHcDeaRtYuLmnDuTREFsjjx1qIUW62/lrqTOz8zeDwtmgg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1573486224; h=Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=7zPOpmR+cNKJkNVacsCkmOlRh85BhFiPbCPbiDZ9je4=; b=aoXFDr996pTAWWFkFu2c+X/LJjVSr6C9v0S143rDvOMJPKDz5LPTtQuCGMHmxyEhGnVM/dLn4yOOghuAMStDP0zTkDPfqRXfgxrxf3X6NmSnAqMhun7n44n/JtaoDA6iY70VxlEm2uQTVjTJNw03A4H/pEyjTxPNUNr/KMBo3po= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1573486224366408.17492076879944; Mon, 11 Nov 2019 07:30:24 -0800 (PST) Received: from localhost ([::1]:54058 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iUBe3-0007us-79 for importer@patchew.org; Mon, 11 Nov 2019 10:30:23 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:34447) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iUBcB-0006X2-C9 for qemu-devel@nongnu.org; Mon, 11 Nov 2019 10:28:28 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iUBcA-0002GL-5T for qemu-devel@nongnu.org; Mon, 11 Nov 2019 10:28:27 -0500 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:20434) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iUBc9-0002Fu-SR for qemu-devel@nongnu.org; Mon, 11 Nov 2019 10:28:26 -0500 Received: from pps.filterd (m0098410.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id xABFP6L5083343 for ; Mon, 11 Nov 2019 10:28:24 -0500 Received: from e06smtp02.uk.ibm.com (e06smtp02.uk.ibm.com [195.75.94.98]) by mx0a-001b2d01.pphosted.com with ESMTP id 2w7923mgfa-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 11 Nov 2019 10:28:23 -0500 Received: from localhost by e06smtp02.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 11 Nov 2019 15:28:21 -0000 Received: from b06cxnps4075.portsmouth.uk.ibm.com (9.149.109.197) by e06smtp02.uk.ibm.com (192.168.101.132) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Mon, 11 Nov 2019 15:28:18 -0000 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id xABFSHJj28770468 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 11 Nov 2019 15:28:17 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id AC20C4C04E; Mon, 11 Nov 2019 15:28:17 +0000 (GMT) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 6E1654C04A; Mon, 11 Nov 2019 15:28:16 +0000 (GMT) Received: from localhost.localdomain (unknown [9.145.179.89]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTP; Mon, 11 Nov 2019 15:28:16 +0000 (GMT) From: Janosch Frank To: qemu-devel@nongnu.org Subject: [PATCH v2] s390x: Properly fetch the short psw on diag308 subc 0/1 Date: Mon, 11 Nov 2019 10:28:08 -0500 X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 x-cbid: 19111115-0008-0000-0000-0000032E107B X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19111115-0009-0000-0000-00004A4D1142 Message-Id: <20191111152808.13371-1-frankja@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-11-11_05:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=1 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1910280000 definitions=main-1911110141 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] [fuzzy] X-Received-From: 148.163.156.1 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, cohuck@redhat.com, david@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" We need to actually fetch the cpu mask and set it. As we invert the short psw indication in the mask, SIE will report a specification exception, if it wasn't present in the reset psw. Signed-off-by: Janosch Frank Reviewed-by: David Hildenbrand --- target/s390x/cpu.c | 12 ++++++++++-- target/s390x/cpu.h | 1 + 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/target/s390x/cpu.c b/target/s390x/cpu.c index 736a7903e2..40aa42e092 100644 --- a/target/s390x/cpu.c +++ b/target/s390x/cpu.c @@ -76,8 +76,16 @@ static bool s390_cpu_has_work(CPUState *cs) static void s390_cpu_load_normal(CPUState *s) { S390CPU *cpu =3D S390_CPU(s); - cpu->env.psw.addr =3D ldl_phys(s->as, 4) & PSW_MASK_ESA_ADDR; - cpu->env.psw.mask =3D PSW_MASK_32 | PSW_MASK_64; + uint64_t spsw =3D ldq_phys(s->as, 0); + + cpu->env.psw.mask =3D spsw & 0xffffffff80000000UL; + /* + * Invert short psw indication, so SIE will report a specification + * exception if it was not set. + */ + cpu->env.psw.mask ^=3D PSW_MASK_SHORTPSW; + cpu->env.psw.addr =3D spsw & 0x7fffffffUL; + s390_cpu_set_state(S390_CPU_STATE_OPERATING, cpu); } #endif diff --git a/target/s390x/cpu.h b/target/s390x/cpu.h index 947553386f..2c687185f1 100644 --- a/target/s390x/cpu.h +++ b/target/s390x/cpu.h @@ -261,6 +261,7 @@ extern const struct VMStateDescription vmstate_s390_cpu; #define PSW_MASK_EXT 0x0100000000000000ULL #define PSW_MASK_KEY 0x00F0000000000000ULL #define PSW_SHIFT_KEY 52 +#define PSW_MASK_SHORTPSW 0x0008000000000000ULL #define PSW_MASK_MCHECK 0x0004000000000000ULL #define PSW_MASK_WAIT 0x0002000000000000ULL #define PSW_MASK_PSTATE 0x0001000000000000ULL --=20 2.20.1