From patchwork Tue Nov 5 18:44:34 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Janosch Frank X-Patchwork-Id: 1189890 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.ibm.com 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 ozlabs.org (Postfix) with ESMTPS id 476zBW4yjpz9sNT for ; Wed, 6 Nov 2019 05:45:39 +1100 (AEDT) Received: from localhost ([::1]:47402 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iS3ph-0003vO-HD for incoming@patchwork.ozlabs.org; Tue, 05 Nov 2019 13:45:37 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:59821) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iS3ox-0003tT-Rd for qemu-devel@nongnu.org; Tue, 05 Nov 2019 13:44:54 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iS3ow-0003Ei-OW for qemu-devel@nongnu.org; Tue, 05 Nov 2019 13:44:51 -0500 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:7780) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iS3ow-0003DW-BZ for qemu-devel@nongnu.org; Tue, 05 Nov 2019 13:44:50 -0500 Received: from pps.filterd (m0098399.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id xA5IbPLd052194 for ; Tue, 5 Nov 2019 13:44:48 -0500 Received: from e06smtp05.uk.ibm.com (e06smtp05.uk.ibm.com [195.75.94.101]) by mx0a-001b2d01.pphosted.com with ESMTP id 2w3dd0tq3g-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 05 Nov 2019 13:44:47 -0500 Received: from localhost by e06smtp05.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 5 Nov 2019 18:44:45 -0000 Received: from b06avi18626390.portsmouth.uk.ibm.com (9.149.26.192) by e06smtp05.uk.ibm.com (192.168.101.135) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Tue, 5 Nov 2019 18:44:42 -0000 Received: from d06av25.portsmouth.uk.ibm.com (d06av25.portsmouth.uk.ibm.com [9.149.105.61]) by b06avi18626390.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id xA5Ii6FD28442960 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 5 Nov 2019 18:44:06 GMT Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 202F111C054; Tue, 5 Nov 2019 18:44:41 +0000 (GMT) Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 5A4CE11C052; Tue, 5 Nov 2019 18:44:39 +0000 (GMT) Received: from localhost.localdomain (unknown [9.145.10.78]) by d06av25.portsmouth.uk.ibm.com (Postfix) with ESMTP; Tue, 5 Nov 2019 18:44:39 +0000 (GMT) From: Janosch Frank To: qemu-devel@nongnu.org Subject: [PATCH] s390x: Properly fetch and test the short psw on diag308 subc 0/1 Date: Tue, 5 Nov 2019 13:44:34 -0500 X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 X-TM-AS-GCONF: 00 x-cbid: 19110518-0020-0000-0000-00000382D5D2 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19110518-0021-0000-0000-000021D9011B Message-Id: <20191105184434.16148-1-frankja@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-11-05_07:, , 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=1011 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=802 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1908290000 definitions=main-1911050155 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" We need to actually fetch the cpu mask and set it after checking for psw bit 12 instead of completely ignoring it. Signed-off-by: Janosch Frank --- target/s390x/cpu.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/target/s390x/cpu.c b/target/s390x/cpu.c index 736a7903e2..0acba843a7 100644 --- a/target/s390x/cpu.c +++ b/target/s390x/cpu.c @@ -76,8 +76,15 @@ static bool s390_cpu_has_work(CPUState *cs) static void s390_cpu_load_normal(CPUState *s) { S390CPU *cpu = S390_CPU(s); - cpu->env.psw.addr = ldl_phys(s->as, 4) & PSW_MASK_ESA_ADDR; - cpu->env.psw.mask = PSW_MASK_32 | PSW_MASK_64; + uint64_t spsw = ldq_phys(s->as, 0); + + /* Mask out bit 12 and instruction address */ + cpu->env.psw.mask = spsw & 0xfff7ffff80000000UL; + cpu->env.psw.addr = spsw & 0x7fffffffUL; + + if (!(spsw & 0x8000000000000UL)) { + s390_program_interrupt(&cpu->env, PGM_SPECIFICATION, 0, RA_IGNORED); + } s390_cpu_set_state(S390_CPU_STATE_OPERATING, cpu); } #endif