From patchwork Fri Aug 13 07:36:08 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Janosch Frank X-Patchwork-Id: 12435031 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6CAE9C43216 for ; Fri, 13 Aug 2021 07:37:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4D52B61042 for ; Fri, 13 Aug 2021 07:37:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239506AbhHMHiD (ORCPT ); Fri, 13 Aug 2021 03:38:03 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:45558 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239498AbhHMHiC (ORCPT ); Fri, 13 Aug 2021 03:38:02 -0400 Received: from pps.filterd (m0098393.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 17D7ZL1o022910; Fri, 13 Aug 2021 03:37:36 -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=6wsSJUpFw8hagatPWCSSpQjiNM5xmlAXezXDQEdcvMA=; b=jf2JOKZPLv0lp8TABSTDuut1d4tvXsELaLgzdSEURj89kIjWJVs710BJmRfIrX3FLw6U sSMild+tvW3txnEWtT0oFTfRDkn+Dw88dXmjfv8qvQoyG5pspJpQm8suA4UIqdpSnGzp yavq/BuanQYiVkrsAFkVsKPMhbWRrJUPiqyf1PYOyYp/3Eq8XZtt8QlwDL2hIl6Zuu0R rIzCZdwaQs1VyeKwUC4eKc3RUh9AtUiN8DddOCCjkIJ2vqi0VERg+0es9SK/FcudOSvw lN/4QNBlEHusfJ6Pe3hhX0WavobPXXOr1a0NtKSLUmcgWpQbhNx/PIn3kmrnlk7FjZvq jQ== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 3accugkr18-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 13 Aug 2021 03:37:36 -0400 Received: from m0098393.ppops.net (m0098393.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 17D7ZNIC023175; Fri, 13 Aug 2021 03:37:35 -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 3accugkr0a-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 13 Aug 2021 03:37:35 -0400 Received: from pps.filterd (ppma03ams.nl.ibm.com [127.0.0.1]) by ppma03ams.nl.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 17D7MnKp024987; Fri, 13 Aug 2021 07:37:33 GMT Received: from b06cxnps3075.portsmouth.uk.ibm.com (d06relay10.portsmouth.uk.ibm.com [9.149.109.195]) by ppma03ams.nl.ibm.com with ESMTP id 3ad4kqh5h2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 13 Aug 2021 07:37:33 +0000 Received: from d06av24.portsmouth.uk.ibm.com (mk.ibm.com [9.149.105.60]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 17D7bUE354854100 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 13 Aug 2021 07:37:30 GMT Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id A898342052; Fri, 13 Aug 2021 07:37:30 +0000 (GMT) Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 5D1DE4203F; Fri, 13 Aug 2021 07:37:30 +0000 (GMT) Received: from t46lp67.lnxne.boe (unknown [9.152.108.100]) by d06av24.portsmouth.uk.ibm.com (Postfix) with ESMTP; Fri, 13 Aug 2021 07:37:30 +0000 (GMT) From: Janosch Frank To: kvm@vger.kernel.org Cc: linux-s390@vger.kernel.org, imbrenda@linux.ibm.com, david@redhat.com, thuth@redhat.com, cohuck@redhat.com Subject: [kvm-unit-tests PATCH 1/8] s390x: lib: Extend bitops Date: Fri, 13 Aug 2021 07:36:08 +0000 Message-Id: <20210813073615.32837-2-frankja@linux.ibm.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210813073615.32837-1-frankja@linux.ibm.com> References: <20210813073615.32837-1-frankja@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: ZXhHsFOb40ANnis52xofg0GZkUV_A__O X-Proofpoint-ORIG-GUID: rdNfxx_hugVG-8gPg7ybge2MszAMt5Ai X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.391,18.0.790 definitions=2021-08-13_01:2021-08-12,2021-08-13 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 adultscore=0 spamscore=0 mlxlogscore=999 clxscore=1015 impostorscore=0 bulkscore=0 priorityscore=1501 malwarescore=0 mlxscore=0 phishscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2107140000 definitions=main-2108130044 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org Bit setting and clearing is never bad to have. Signed-off-by: Janosch Frank --- lib/s390x/asm/bitops.h | 102 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 102 insertions(+) diff --git a/lib/s390x/asm/bitops.h b/lib/s390x/asm/bitops.h index 792881ec..f5612855 100644 --- a/lib/s390x/asm/bitops.h +++ b/lib/s390x/asm/bitops.h @@ -17,6 +17,78 @@ #define BITS_PER_LONG 64 +static inline unsigned long *bitops_word(unsigned long nr, + const volatile unsigned long *ptr) +{ + unsigned long addr; + + addr = (unsigned long)ptr + ((nr ^ (nr & (BITS_PER_LONG - 1))) >> 3); + return (unsigned long *)addr; +} + +static inline unsigned long bitops_mask(unsigned long nr) +{ + return 1UL << (nr & (BITS_PER_LONG - 1)); +} + +static inline uint64_t laog(volatile unsigned long *ptr, uint64_t mask) +{ + uint64_t old; + + /* load and or 64bit concurrent and interlocked */ + asm volatile( + " laog %[old],%[mask],%[ptr]\n" + : [old] "=d" (old), [ptr] "+Q" (*ptr) + : [mask] "d" (mask) + : "memory", "cc" ); + return old; +} + +static inline uint64_t lang(volatile unsigned long *ptr, uint64_t mask) +{ + uint64_t old; + + /* load and and 64bit concurrent and interlocked */ + asm volatile( + " lang %[old],%[mask],%[ptr]\n" + : [old] "=d" (old), [ptr] "+Q" (*ptr) + : [mask] "d" (mask) + : "memory", "cc" ); + return old; +} + +static inline void set_bit(unsigned long nr, + const volatile unsigned long *ptr) +{ + uint64_t mask = bitops_mask(nr); + uint64_t *addr = bitops_word(nr, ptr); + + laog(addr, mask); +} + +static inline void set_bit_inv(unsigned long nr, + const volatile unsigned long *ptr) +{ + return set_bit(nr ^ (BITS_PER_LONG - 1), ptr); +} + +static inline void clear_bit(unsigned long nr, + const volatile unsigned long *ptr) +{ + uint64_t mask = bitops_mask(nr); + uint64_t *addr = bitops_word(nr, ptr); + + lang(addr, ~mask); +} + +static inline void clear_bit_inv(unsigned long nr, + const volatile unsigned long *ptr) +{ + return clear_bit(nr ^ (BITS_PER_LONG - 1), ptr); +} + +/* non-atomic bit manipulation functions */ + static inline bool test_bit(unsigned long nr, const volatile unsigned long *ptr) { @@ -33,4 +105,34 @@ static inline bool test_bit_inv(unsigned long nr, return test_bit(nr ^ (BITS_PER_LONG - 1), ptr); } +static inline void __set_bit(unsigned long nr, + const volatile unsigned long *ptr) +{ + uint64_t mask = bitops_mask(nr); + uint64_t *addr = bitops_word(nr, ptr); + + *addr |= mask; +} + +static inline void __set_bit_inv(unsigned long nr, + const volatile unsigned long *ptr) +{ + return __set_bit(nr ^ (BITS_PER_LONG - 1), ptr); +} + +static inline void __clear_bit(unsigned long nr, + const volatile unsigned long *ptr) +{ + uint64_t mask = bitops_mask(nr); + uint64_t *addr = bitops_word(nr, ptr); + + *addr &= ~mask; +} + +static inline void __clear_bit_inv(unsigned long nr, + const volatile unsigned long *ptr) +{ + return __clear_bit(nr ^ (BITS_PER_LONG - 1), ptr); +} + #endif From patchwork Fri Aug 13 07:36:09 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Janosch Frank X-Patchwork-Id: 12435033 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 53756C00144 for ; Fri, 13 Aug 2021 07:37:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2D5156103E for ; Fri, 13 Aug 2021 07:37:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239511AbhHMHiE (ORCPT ); Fri, 13 Aug 2021 03:38:04 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:57160 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230469AbhHMHiC (ORCPT ); Fri, 13 Aug 2021 03:38:02 -0400 Received: from pps.filterd (m0098396.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 17D7Whtq048340; Fri, 13 Aug 2021 03:37:36 -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=MY95BHSRozJZTcRpwvoslnplJSwCGmTxBEimIieDAno=; b=OwUXTpo6PtvI7wchYPPJ+5Zan+IDI+04f++864AvUXa77+fSXdVgIGUdGd7iHtEct7B4 Z+HTEXUdHAlI3ts9sOUNY++H0IW9P22W1RMwpRSx0e+ETZNtq7ipTYy/8vGuVD89ETRz ubfLe9gFrh8mtCovQci2Tnqm5I+JbHBHb1DfskGj+k+f1EhOCBY8N60j2rLIAVw1q2ls BGPHnfAdqDjFtKE/HcLO+FBBVmwtETL9I2Oay9DHup63SPXTpgPYnCLdSbD7hQWA7sa6 8dP31lxfo3Ulxqm2WeGvWs64ceiVusECsFzvg5oKpYa9Q2fn/vBtdPcpbTJ94s8sf6TI +g== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 3ad1r15uts-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 13 Aug 2021 03:37:36 -0400 Received: from m0098396.ppops.net (m0098396.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 17D7XBqD050142; Fri, 13 Aug 2021 03:37:36 -0400 Received: from ppma03fra.de.ibm.com (6b.4a.5195.ip4.static.sl-reverse.com [149.81.74.107]) by mx0a-001b2d01.pphosted.com with ESMTP id 3ad1r15us9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 13 Aug 2021 03:37:35 -0400 Received: from pps.filterd (ppma03fra.de.ibm.com [127.0.0.1]) by ppma03fra.de.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 17D7MWZ6003185; Fri, 13 Aug 2021 07:37:33 GMT Received: from b06cxnps4074.portsmouth.uk.ibm.com (d06relay11.portsmouth.uk.ibm.com [9.149.109.196]) by ppma03fra.de.ibm.com with ESMTP id 3ada8sgjmd-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 13 Aug 2021 07:37:33 +0000 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 17D7bVEa51380688 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 13 Aug 2021 07:37:31 GMT Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 0FBD24204F; Fri, 13 Aug 2021 07:37:31 +0000 (GMT) Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B869B4203F; Fri, 13 Aug 2021 07:37:30 +0000 (GMT) Received: from t46lp67.lnxne.boe (unknown [9.152.108.100]) by d06av24.portsmouth.uk.ibm.com (Postfix) with ESMTP; Fri, 13 Aug 2021 07:37:30 +0000 (GMT) From: Janosch Frank To: kvm@vger.kernel.org Cc: linux-s390@vger.kernel.org, imbrenda@linux.ibm.com, david@redhat.com, thuth@redhat.com, cohuck@redhat.com Subject: [kvm-unit-tests PATCH 2/8] lib: s390x: Add 0x3d, 0x3e and 0x3f PGM constants Date: Fri, 13 Aug 2021 07:36:09 +0000 Message-Id: <20210813073615.32837-3-frankja@linux.ibm.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210813073615.32837-1-frankja@linux.ibm.com> References: <20210813073615.32837-1-frankja@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: -mueoyQH7zW3DzkgykEOIGnia_foDmZB X-Proofpoint-ORIG-GUID: buVezn8skMzFyvDgPsabWF9QXGmTfwS7 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.391,18.0.790 definitions=2021-08-13_01:2021-08-12,2021-08-13 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 priorityscore=1501 mlxscore=0 adultscore=0 malwarescore=0 bulkscore=0 suspectscore=0 lowpriorityscore=0 clxscore=1015 mlxlogscore=999 impostorscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2107140000 definitions=main-2108130044 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org For UV and format 4 SIE tests we need to handle the following PGM exceptions: 0x3d Secure Storage Access (non-secure CPU accesses secure storage) 0x3e Non-Secure Storage Access (secure CPU accesses non-secure storage) 0x3f Mapping of secure guest is wrong Signed-off-by: Janosch Frank Reviewed-by: Claudio Imbrenda --- lib/s390x/asm/arch_def.h | 3 +++ lib/s390x/interrupt.c | 3 +++ 2 files changed, 6 insertions(+) diff --git a/lib/s390x/asm/arch_def.h b/lib/s390x/asm/arch_def.h index 15cf7d48..4ca02c1d 100644 --- a/lib/s390x/asm/arch_def.h +++ b/lib/s390x/asm/arch_def.h @@ -177,6 +177,9 @@ _Static_assert(sizeof(struct lowcore) == 0x1900, "Lowcore size"); #define PGM_INT_CODE_REGION_FIRST_TRANS 0x39 #define PGM_INT_CODE_REGION_SECOND_TRANS 0x3a #define PGM_INT_CODE_REGION_THIRD_TRANS 0x3b +#define PGM_INT_CODE_SECURE_STOR_ACCESS 0x3d +#define PGM_INT_CODE_NON_SECURE_STOR_ACCESS 0x3e +#define PGM_INT_CODE_SECURE_STOR_VIOLATION 0x3f #define PGM_INT_CODE_MONITOR_EVENT 0x40 #define PGM_INT_CODE_PER 0x80 #define PGM_INT_CODE_CRYPTO_OPERATION 0x119 diff --git a/lib/s390x/interrupt.c b/lib/s390x/interrupt.c index 785b7355..01ded49d 100644 --- a/lib/s390x/interrupt.c +++ b/lib/s390x/interrupt.c @@ -115,6 +115,9 @@ static void fixup_pgm_int(struct stack_frame_int *stack) case PGM_INT_CODE_REGION_THIRD_TRANS: case PGM_INT_CODE_PER: case PGM_INT_CODE_CRYPTO_OPERATION: + case PGM_INT_CODE_SECURE_STOR_ACCESS: + case PGM_INT_CODE_NON_SECURE_STOR_ACCESS: + case PGM_INT_CODE_SECURE_STOR_VIOLATION: /* The interrupt was nullified, the old PSW points at the * responsible instruction. Forward the PSW so we don't loop. */ From patchwork Fri Aug 13 07:36:10 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Janosch Frank X-Patchwork-Id: 12435037 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id EE17AC19F39 for ; Fri, 13 Aug 2021 07:37:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D730B61042 for ; Fri, 13 Aug 2021 07:37:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239519AbhHMHiF (ORCPT ); Fri, 13 Aug 2021 03:38:05 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:55548 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239500AbhHMHiD (ORCPT ); Fri, 13 Aug 2021 03:38:03 -0400 Received: from pps.filterd (m0187473.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 17D7Wugp010824; Fri, 13 Aug 2021 03:37:37 -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=1xgwdT55J9MdPF5mjrNWsmq7f6mDR+p/lf+LhvMQ/N0=; b=UBu7XOH8RS9G3ssXgG5X5N8FPrV3QDAyaNOYuZM+n7/Fx7Dzobm/t4GLTG7j3oG6fE4T p0MHGBM2ayw5Zv7V8nXayxID19G7/A9E/rOtySfCpGFHhFRtlCVp0hYp9Qkvc3BA0fYQ wXgJhniB/ijeZFw2wGPiXxwNx9YIKWrFCXwOploUQrlffLM7S3CDPW+igZzNvRfN2+dZ v+nOaMwVVVvJN2DyV6Br2dgu7PBLMpfs0Nm8JDJ4mstzPtroaRBtK2GD9z3MIMJJK4+E lOht69OpypJKgiaZ8vED5Q61GYWA5Kf6vcuRpjhYI0UFYYMrYScwszC53hTX5Xwz0xx2 Kg== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 3acstpk5dk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 13 Aug 2021 03:37:36 -0400 Received: from m0187473.ppops.net (m0187473.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 17D7YX2f016357; Fri, 13 Aug 2021 03:37:36 -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 3acstpk5cm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 13 Aug 2021 03:37:36 -0400 Received: from pps.filterd (ppma03ams.nl.ibm.com [127.0.0.1]) by ppma03ams.nl.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 17D7N7kK025212; Fri, 13 Aug 2021 07:37:34 GMT Received: from b06cxnps4074.portsmouth.uk.ibm.com (d06relay11.portsmouth.uk.ibm.com [9.149.109.196]) by ppma03ams.nl.ibm.com with ESMTP id 3ad4kqh5h3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 13 Aug 2021 07:37:33 +0000 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 17D7bV9u56492542 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 13 Aug 2021 07:37:31 GMT Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 64D9842047; Fri, 13 Aug 2021 07:37:31 +0000 (GMT) Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 206E14203F; Fri, 13 Aug 2021 07:37:31 +0000 (GMT) Received: from t46lp67.lnxne.boe (unknown [9.152.108.100]) by d06av24.portsmouth.uk.ibm.com (Postfix) with ESMTP; Fri, 13 Aug 2021 07:37:31 +0000 (GMT) From: Janosch Frank To: kvm@vger.kernel.org Cc: linux-s390@vger.kernel.org, imbrenda@linux.ibm.com, david@redhat.com, thuth@redhat.com, cohuck@redhat.com Subject: [kvm-unit-tests PATCH 3/8] lib: s390x: Print addressing related exception information Date: Fri, 13 Aug 2021 07:36:10 +0000 Message-Id: <20210813073615.32837-4-frankja@linux.ibm.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210813073615.32837-1-frankja@linux.ibm.com> References: <20210813073615.32837-1-frankja@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: ZUSBVxdHH9z9yMmT0ZddPJMXwQ9q-xZK X-Proofpoint-ORIG-GUID: qGr_Ohpyt3q7npcA_muHr23PYfZ7fl1q X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.391,18.0.790 definitions=2021-08-13_01:2021-08-12,2021-08-13 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 malwarescore=0 adultscore=0 clxscore=1015 priorityscore=1501 bulkscore=0 suspectscore=0 mlxlogscore=999 phishscore=0 impostorscore=0 spamscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2107140000 definitions=main-2108130044 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org Right now we only get told the kind of program exception as well as the PSW at the point where it happened. For addressing exceptions the PSW is not always enough so let's print the TEID which contains the failing address and flags that tell us more about the kind of address exception. Signed-off-by: Janosch Frank --- lib/s390x/asm/arch_def.h | 4 +++ lib/s390x/interrupt.c | 72 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 76 insertions(+) diff --git a/lib/s390x/asm/arch_def.h b/lib/s390x/asm/arch_def.h index 4ca02c1d..39c5ba99 100644 --- a/lib/s390x/asm/arch_def.h +++ b/lib/s390x/asm/arch_def.h @@ -41,6 +41,10 @@ struct psw { uint64_t addr; }; +/* Let's ignore spaces we don't expect to use for now. */ +#define AS_PRIM 0 +#define AS_HOME 3 + #define PSW_MASK_EXT 0x0100000000000000UL #define PSW_MASK_IO 0x0200000000000000UL #define PSW_MASK_DAT 0x0400000000000000UL diff --git a/lib/s390x/interrupt.c b/lib/s390x/interrupt.c index 01ded49d..1248bceb 100644 --- a/lib/s390x/interrupt.c +++ b/lib/s390x/interrupt.c @@ -12,6 +12,7 @@ #include #include #include +#include static bool pgm_int_expected; static bool ext_int_expected; @@ -126,6 +127,73 @@ static void fixup_pgm_int(struct stack_frame_int *stack) /* suppressed/terminated/completed point already at the next address */ } +static void decode_pgm_prot(uint64_t teid) +{ + /* Low-address protection exception, 100 */ + if (test_bit_inv(56, &teid) && !test_bit_inv(60, &teid) && !test_bit_inv(61, &teid)) { + printf("Type: LAP\n"); + return; + } + + /* Instruction execution prevention, i.e. no-execute, 101 */ + if (test_bit_inv(56, &teid) && !test_bit_inv(60, &teid) && test_bit_inv(61, &teid)) { + printf("Type: IEP\n"); + return; + } + + /* Standard DAT exception, 001 */ + if (!test_bit_inv(56, &teid) && !test_bit_inv(60, &teid) && test_bit_inv(61, &teid)) { + printf("Type: DAT\n"); + return; + } +} + +static void decode_teid(uint64_t teid) +{ + int asce_id = lc->trans_exc_id & 3; + bool dat = lc->pgm_old_psw.mask & PSW_MASK_DAT; + + printf("Memory exception information:\n"); + printf("TEID: %lx\n", teid); + printf("DAT: %s\n", dat ? "on" : "off"); + printf("AS: %s\n", asce_id == AS_PRIM ? "Primary" : "Home"); + + if (lc->pgm_int_code == PGM_INT_CODE_PROTECTION) + decode_pgm_prot(teid); + + /* + * If teid bit 61 is off for these two exception the reported + * address is unpredictable. + */ + if ((lc->pgm_int_code == PGM_INT_CODE_SECURE_STOR_ACCESS || + lc->pgm_int_code == PGM_INT_CODE_SECURE_STOR_VIOLATION) && + !test_bit_inv(61, &teid)) { + printf("Address: %lx, unpredictable\n ", teid & PAGE_MASK); + return; + } + printf("Address: %lx\n\n", teid & PAGE_MASK); +} + +static void print_storage_exception_information(void) +{ + switch (lc->pgm_int_code) { + case PGM_INT_CODE_PROTECTION: + case PGM_INT_CODE_PAGE_TRANSLATION: + case PGM_INT_CODE_SEGMENT_TRANSLATION: + case PGM_INT_CODE_ASCE_TYPE: + case PGM_INT_CODE_REGION_FIRST_TRANS: + case PGM_INT_CODE_REGION_SECOND_TRANS: + case PGM_INT_CODE_REGION_THIRD_TRANS: + case PGM_INT_CODE_SECURE_STOR_ACCESS: + case PGM_INT_CODE_NON_SECURE_STOR_ACCESS: + case PGM_INT_CODE_SECURE_STOR_VIOLATION: + decode_teid(lc->trans_exc_id); + break; + default: + return; + } +} + static void print_int_regs(struct stack_frame_int *stack) { printf("\n"); @@ -155,6 +223,10 @@ static void print_pgm_info(struct stack_frame_int *stack) lc->pgm_int_code, stap(), lc->pgm_old_psw.addr, lc->pgm_int_id); print_int_regs(stack); dump_stack(); + + /* Dump stack doesn't end with a \n so we add it here instead */ + printf("\n"); + print_storage_exception_information(); report_summary(); abort(); } From patchwork Fri Aug 13 07:36:11 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Janosch Frank X-Patchwork-Id: 12435035 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D44ECC19F3B for ; Fri, 13 Aug 2021 07:37:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C1AC66109D for ; Fri, 13 Aug 2021 07:37:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239524AbhHMHiG (ORCPT ); Fri, 13 Aug 2021 03:38:06 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:43946 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239505AbhHMHiD (ORCPT ); Fri, 13 Aug 2021 03:38:03 -0400 Received: from pps.filterd (m0098393.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 17D7ZHd9022476; Fri, 13 Aug 2021 03:37:37 -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=KyGO7FLlpd+rt5ORsA4SyMUviVJNOjLvEVvaHWGSibE=; b=iNXI36y1o0oZRgWB97IP6Zr67y25CUv71MNPVUHr/qmJlZQ7bMoWW5VhW7xjNiSBqvHT +6wRWibcQxT3KOPA4Q9Ak5AsJXz6v410EjYU/evynGeBV5l7MJkNBLauuCJh266mxlI4 B2TO9MznUtEfiwhxwq64BV6mSWFJEUmjiJ19SnB+wxNLQ8UEIzGFj5tPTUzl0y3r31BH FU6n/luL6kszqQk5DxrnH3B9YNb0H7W6mWGFJ6UkZSBdLmcSMxmqavWnpqrDh79W++Bc +jYtU+oCE3sf4bJLZGi9ICUSV4Kyq+KqRMPYk9jg3X2jKu1FaOVGfSyE+MeZfhB2GfYw 2Q== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 3accugkr1y-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 13 Aug 2021 03:37:37 -0400 Received: from m0098393.ppops.net (m0098393.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 17D7ZMtO023059; Fri, 13 Aug 2021 03:37:36 -0400 Received: from ppma06fra.de.ibm.com (48.49.7a9f.ip4.static.sl-reverse.com [159.122.73.72]) by mx0a-001b2d01.pphosted.com with ESMTP id 3accugkr10-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 13 Aug 2021 03:37:36 -0400 Received: from pps.filterd (ppma06fra.de.ibm.com [127.0.0.1]) by ppma06fra.de.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 17D7N5oA022622; Fri, 13 Aug 2021 07:37:34 GMT Received: from b06cxnps4074.portsmouth.uk.ibm.com (d06relay11.portsmouth.uk.ibm.com [9.149.109.196]) by ppma06fra.de.ibm.com with ESMTP id 3abaq4dxj0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 13 Aug 2021 07:37:34 +0000 Received: from d06av24.portsmouth.uk.ibm.com (d06av24.portsmouth.uk.ibm.com [9.149.105.60]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 17D7bV7u51511586 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 13 Aug 2021 07:37:31 GMT Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id CBCF642041; Fri, 13 Aug 2021 07:37:31 +0000 (GMT) Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 7E3854203F; Fri, 13 Aug 2021 07:37:31 +0000 (GMT) Received: from t46lp67.lnxne.boe (unknown [9.152.108.100]) by d06av24.portsmouth.uk.ibm.com (Postfix) with ESMTP; Fri, 13 Aug 2021 07:37:31 +0000 (GMT) From: Janosch Frank To: kvm@vger.kernel.org Cc: linux-s390@vger.kernel.org, imbrenda@linux.ibm.com, david@redhat.com, thuth@redhat.com, cohuck@redhat.com Subject: [kvm-unit-tests PATCH 4/8] lib: s390x: Start using bitops instead of magic constants Date: Fri, 13 Aug 2021 07:36:11 +0000 Message-Id: <20210813073615.32837-5-frankja@linux.ibm.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210813073615.32837-1-frankja@linux.ibm.com> References: <20210813073615.32837-1-frankja@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: 74ml6MDSE5nnVz6nb4ZRtkj607N3kdIg X-Proofpoint-ORIG-GUID: 6AXnAvxdWt3b7Bgf-47duwAJrIIdj1Ts X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.391,18.0.790 definitions=2021-08-13_01:2021-08-12,2021-08-13 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 adultscore=0 spamscore=0 mlxlogscore=999 clxscore=1015 impostorscore=0 bulkscore=0 priorityscore=1501 malwarescore=0 mlxscore=0 phishscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2107140000 definitions=main-2108130044 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org TEID data is specified in the Principles of Operation as bits so it makes more sens to test the bits instead of anding the mask. We need to set -Wno-address-of-packed-member since for test bit we take an address of a struct lowcore member. Signed-off-by: Janosch Frank Reviewed-by: Claudio Imbrenda --- lib/s390x/interrupt.c | 5 +++-- s390x/Makefile | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/s390x/interrupt.c b/lib/s390x/interrupt.c index 1248bceb..e05c212e 100644 --- a/lib/s390x/interrupt.c +++ b/lib/s390x/interrupt.c @@ -8,6 +8,7 @@ * David Hildenbrand */ #include +#include #include #include #include @@ -77,8 +78,8 @@ static void fixup_pgm_int(struct stack_frame_int *stack) break; case PGM_INT_CODE_PROTECTION: /* Handling for iep.c test case. */ - if (lc->trans_exc_id & 0x80UL && lc->trans_exc_id & 0x04UL && - !(lc->trans_exc_id & 0x08UL)) + if (test_bit_inv(56, &lc->trans_exc_id) && test_bit_inv(61, &lc->trans_exc_id) && + !test_bit_inv(60, &lc->trans_exc_id)) /* * We branched to the instruction that caused * the exception so we can use the return diff --git a/s390x/Makefile b/s390x/Makefile index ef8041a6..d260b336 100644 --- a/s390x/Makefile +++ b/s390x/Makefile @@ -45,6 +45,7 @@ CFLAGS += -O2 CFLAGS += -march=zEC12 CFLAGS += -mbackchain CFLAGS += -fno-delete-null-pointer-checks +CFLAGS += -Wno-address-of-packed-member LDFLAGS += -nostdlib -Wl,--build-id=none # We want to keep intermediate files From patchwork Fri Aug 13 07:36:12 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Janosch Frank X-Patchwork-Id: 12435039 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C76AEC43216 for ; Fri, 13 Aug 2021 07:37:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A5B7C6104F for ; Fri, 13 Aug 2021 07:37:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239530AbhHMHiH (ORCPT ); Fri, 13 Aug 2021 03:38:07 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:14918 "EHLO mx0b-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239508AbhHMHiE (ORCPT ); Fri, 13 Aug 2021 03:38:04 -0400 Received: from pps.filterd (m0098417.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 17D7Y7Wc004651; Fri, 13 Aug 2021 03:37:37 -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=NN/i62EjJProUv1yyj9rF15TOnLZNMYBCpicJKHwcdQ=; b=mi3mPaE60WwhSnJExRWcgxZmi3XrnfnTtUO2wWzNfDNEgBQHlGKL6mKzV/X9hZWe4RRE mqKdrqKW7xtX/cYhs3Y+isdM3VsJv3M9wD125mEmyHIur0KifgbjAx75JKwQXW/uM3YX R6j8bq9NBzCD35Uf6C+anpXeTfoPeaamR4AQKNLjk99JgTYPTTjQaWbwxE5+q3tP3VyS +SnHlHsqoWEKJclBmr8jHLvv0mvPKHWvR0yj5KBXKiPYg8Mv1X6gcmAB0ledl+Aeqn+D oCmcBrM5E66ir1nXsWiUxKYkWU379MS++sts2V3elrXdthjPH1ho3Tlor0jGRhmiA5JU Tw== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 3ad5sdxfxq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 13 Aug 2021 03:37:37 -0400 Received: from m0098417.ppops.net (m0098417.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 17D7ZNF6009106; Fri, 13 Aug 2021 03:37:36 -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 3ad5sdxfwy-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 13 Aug 2021 03:37:36 -0400 Received: from pps.filterd (ppma06ams.nl.ibm.com [127.0.0.1]) by ppma06ams.nl.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 17D7NXCg028759; Fri, 13 Aug 2021 07:37:35 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 3acf0kup7v-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 13 Aug 2021 07:37:34 +0000 Received: from d06av24.portsmouth.uk.ibm.com (d06av24.portsmouth.uk.ibm.com [9.149.105.60]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 17D7bWLm52167000 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 13 Aug 2021 07:37:32 GMT Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 34DC842054; Fri, 13 Aug 2021 07:37:32 +0000 (GMT) Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id DC2F442047; Fri, 13 Aug 2021 07:37:31 +0000 (GMT) Received: from t46lp67.lnxne.boe (unknown [9.152.108.100]) by d06av24.portsmouth.uk.ibm.com (Postfix) with ESMTP; Fri, 13 Aug 2021 07:37:31 +0000 (GMT) From: Janosch Frank To: kvm@vger.kernel.org Cc: linux-s390@vger.kernel.org, imbrenda@linux.ibm.com, david@redhat.com, thuth@redhat.com, cohuck@redhat.com Subject: [kvm-unit-tests PATCH 5/8] s390x: uv-host: Explain why we set up the home space and remove the space change Date: Fri, 13 Aug 2021 07:36:12 +0000 Message-Id: <20210813073615.32837-6-frankja@linux.ibm.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210813073615.32837-1-frankja@linux.ibm.com> References: <20210813073615.32837-1-frankja@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: FoBz53g9dzzOl_YLNZPv5WT9T6pCebVB X-Proofpoint-GUID: SNaic6cIt8rLcDjowtWNI58oTjT9uhQ0 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.391,18.0.790 definitions=2021-08-13_01:2021-08-12,2021-08-13 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 mlxlogscore=999 lowpriorityscore=0 malwarescore=0 mlxscore=0 adultscore=0 spamscore=0 priorityscore=1501 impostorscore=0 bulkscore=0 suspectscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2107140000 definitions=main-2108130044 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org UV home addresses don't require us to be in home space but we need to have it set up so hw/fw can use the home asce to translate home virtual addresses. Hence we add a comment why we're setting up the home asce and remove the address space since it's unneeded. Signed-off-by: Janosch Frank Reviewed-by: Claudio Imbrenda --- s390x/uv-host.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/s390x/uv-host.c b/s390x/uv-host.c index 426a67f6..28035707 100644 --- a/s390x/uv-host.c +++ b/s390x/uv-host.c @@ -444,13 +444,18 @@ static void test_clear(void) static void setup_vmem(void) { - uint64_t asce, mask; + uint64_t asce; setup_mmu(get_max_ram_size(), NULL); + /* + * setup_mmu() will enable DAT and set the primary address + * space but we need to have a valid home space since UV calls + * take home space virtual addresses. + * + * Hence we just copy the primary asce into the home space. + */ asce = stctg(1); lctlg(13, asce); - mask = extract_psw_mask() | 0x0000C00000000000UL; - load_psw_mask(mask); } int main(void) From patchwork Fri Aug 13 07:36:13 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Janosch Frank X-Patchwork-Id: 12435041 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CB792C4320A for ; Fri, 13 Aug 2021 07:37:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id AF7CF6104F for ; Fri, 13 Aug 2021 07:37:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239529AbhHMHiH (ORCPT ); Fri, 13 Aug 2021 03:38:07 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:1640 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239513AbhHMHiE (ORCPT ); Fri, 13 Aug 2021 03:38:04 -0400 Received: from pps.filterd (m0187473.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 17D7WvgA010839; Fri, 13 Aug 2021 03:37:38 -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=A/ph5QR+bUbPyXl7CPFyDqrcVFxCuzJjnqmTmMpIlg8=; b=XQ5CUbquGtDoc9dh/s8NBcH+5kIUlBfq0mrzHamcLPWIe4JkMBPQ6fwLVdsnGQ4sP4fk /oxVW1L7yReDF8swy6OzAbOHuKC7/0TEpavGTr8b3R883qVzdt4uYETYJJ+hWROAYoSj l/5iDskeOk8LArBSTyuwAX/MJuBvDxb2cTAK+sMlnU+nq94wDs6MF4ZCCfPau1suc1V2 Gc2LCN/Gqkkyear8V72LvQXzsrUr1y9+ZkP57qUT0w7wtyV3km2gmF8GtmrldMo+uz9c lw2TYgaNtLvES35f4RBL76K8WbIdwvvRn1mwdCaBI+MHdZzg15Udk7mOoq/+oCLhN2mk +g== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 3acstpk5e4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 13 Aug 2021 03:37:38 -0400 Received: from m0187473.ppops.net (m0187473.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 17D7Wxkg011084; Fri, 13 Aug 2021 03:37:37 -0400 Received: from ppma05fra.de.ibm.com (6c.4a.5195.ip4.static.sl-reverse.com [149.81.74.108]) by mx0a-001b2d01.pphosted.com with ESMTP id 3acstpk5d5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 13 Aug 2021 03:37:37 -0400 Received: from pps.filterd (ppma05fra.de.ibm.com [127.0.0.1]) by ppma05fra.de.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 17D7MMCA028629; Fri, 13 Aug 2021 07:37:35 GMT Received: from b06cxnps4075.portsmouth.uk.ibm.com (d06relay12.portsmouth.uk.ibm.com [9.149.109.197]) by ppma05fra.de.ibm.com with ESMTP id 3a9ht925gg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 13 Aug 2021 07:37:35 +0000 Received: from d06av24.portsmouth.uk.ibm.com (d06av24.portsmouth.uk.ibm.com [9.149.105.60]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 17D7bWYU52167004 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 13 Aug 2021 07:37:32 GMT Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 99F3742042; Fri, 13 Aug 2021 07:37:32 +0000 (GMT) Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 4F0D442041; Fri, 13 Aug 2021 07:37:32 +0000 (GMT) Received: from t46lp67.lnxne.boe (unknown [9.152.108.100]) by d06av24.portsmouth.uk.ibm.com (Postfix) with ESMTP; Fri, 13 Aug 2021 07:37:32 +0000 (GMT) From: Janosch Frank To: kvm@vger.kernel.org Cc: linux-s390@vger.kernel.org, imbrenda@linux.ibm.com, david@redhat.com, thuth@redhat.com, cohuck@redhat.com Subject: [kvm-unit-tests PATCH 6/8] lib: s390x: Add PSW_MASK_64 Date: Fri, 13 Aug 2021 07:36:13 +0000 Message-Id: <20210813073615.32837-7-frankja@linux.ibm.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210813073615.32837-1-frankja@linux.ibm.com> References: <20210813073615.32837-1-frankja@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: ZdwnVUsI_uaEOX9B1y5Ph3iP_BEJ6owE X-Proofpoint-ORIG-GUID: UEAJ0hBB8SJ1ANoGD2qRxKIm5SoHD-4h X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.391,18.0.790 definitions=2021-08-13_01:2021-08-12,2021-08-13 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 malwarescore=0 adultscore=0 clxscore=1015 priorityscore=1501 bulkscore=0 suspectscore=0 mlxlogscore=999 phishscore=0 impostorscore=0 spamscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2107140000 definitions=main-2108130044 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org Let's replace the magic 0x0000000180000000ULL numeric constants with PSW_MASK_64 as it's used more often since the introduction of smp and sie. Signed-off-by: Janosch Frank Reviewed-by: Claudio Imbrenda --- lib/s390x/asm/arch_def.h | 3 +++ lib/s390x/smp.c | 2 +- s390x/mvpg-sie.c | 2 +- s390x/sie.c | 2 +- s390x/skrf.c | 6 +++--- 5 files changed, 9 insertions(+), 6 deletions(-) diff --git a/lib/s390x/asm/arch_def.h b/lib/s390x/asm/arch_def.h index 39c5ba99..245453c3 100644 --- a/lib/s390x/asm/arch_def.h +++ b/lib/s390x/asm/arch_def.h @@ -50,6 +50,9 @@ struct psw { #define PSW_MASK_DAT 0x0400000000000000UL #define PSW_MASK_WAIT 0x0002000000000000UL #define PSW_MASK_PSTATE 0x0001000000000000UL +#define PSW_MASK_EA 0x0000000100000000UL +#define PSW_MASK_BA 0x0000000080000000UL +#define PSW_MASK_64 PSW_MASK_BA | PSW_MASK_EA; #define CR0_EXTM_SCLP 0x0000000000000200UL #define CR0_EXTM_EXTC 0x0000000000002000UL diff --git a/lib/s390x/smp.c b/lib/s390x/smp.c index ee68d676..228fe667 100644 --- a/lib/s390x/smp.c +++ b/lib/s390x/smp.c @@ -202,7 +202,7 @@ int smp_cpu_setup(uint16_t addr, struct psw psw) cpu->lowcore->sw_int_psw.addr = psw.addr; cpu->lowcore->sw_int_grs[14] = psw.addr; cpu->lowcore->sw_int_grs[15] = (uint64_t)cpu->stack + (PAGE_SIZE * 4); - lc->restart_new_psw.mask = 0x0000000180000000UL; + lc->restart_new_psw.mask = PSW_MASK_64; lc->restart_new_psw.addr = (uint64_t)smp_cpu_setup_state; lc->sw_int_crs[0] = 0x0000000000040000UL; diff --git a/s390x/mvpg-sie.c b/s390x/mvpg-sie.c index 70d2fcfa..ccc273b4 100644 --- a/s390x/mvpg-sie.c +++ b/s390x/mvpg-sie.c @@ -100,7 +100,7 @@ static void setup_guest(void) sie_guest_create(&vm, (uint64_t)guest, HPAGE_SIZE); vm.sblk->gpsw.addr = PAGE_SIZE * 4; - vm.sblk->gpsw.mask = 0x0000000180000000ULL; + vm.sblk->gpsw.mask = PSW_MASK_64; vm.sblk->ictl = ICTL_OPEREXC | ICTL_PINT; /* Enable MVPG interpretation as we want to test KVM and not ourselves */ vm.sblk->eca = ECA_MVPGI; diff --git a/s390x/sie.c b/s390x/sie.c index ed2c3263..87575b29 100644 --- a/s390x/sie.c +++ b/s390x/sie.c @@ -27,7 +27,7 @@ static struct vm vm; static void test_diag(u32 instr) { vm.sblk->gpsw.addr = PAGE_SIZE * 2; - vm.sblk->gpsw.mask = 0x0000000180000000ULL; + vm.sblk->gpsw.mask = PSW_MASK_64; memset(guest_instr, 0, PAGE_SIZE); memcpy(guest_instr, &instr, 4); diff --git a/s390x/skrf.c b/s390x/skrf.c index 94e906a6..9488c32b 100644 --- a/s390x/skrf.c +++ b/s390x/skrf.c @@ -125,15 +125,15 @@ static void ecall_cleanup(void) { struct lowcore *lc = (void *)0x0; - lc->ext_new_psw.mask = 0x0000000180000000UL; lc->sw_int_crs[0] = 0x0000000000040000; + lc->ext_new_psw.mask = PSW_MASK_64; /* * PGM old contains the ext new PSW, we need to clean it up, * so we don't get a special operation exception on the lpswe * of pgm old. */ - lc->pgm_old_psw.mask = 0x0000000180000000UL; + lc->pgm_old_psw.mask = PSW_MASK_64; check_pgm_int_code(PGM_INT_CODE_SPECIFICATION); set_flag(1); @@ -148,7 +148,7 @@ static void ecall_setup(void) register_pgm_cleanup_func(ecall_cleanup); expect_pgm_int(); /* Put a skey into the ext new psw */ - lc->ext_new_psw.mask = 0x00F0000180000000UL; + lc->ext_new_psw.mask = 0x00F0000000000000UL | PSW_MASK_64; /* Open up ext masks */ ctl_set_bit(0, CTL0_EXTERNAL_CALL); mask = extract_psw_mask(); From patchwork Fri Aug 13 07:36:14 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Janosch Frank X-Patchwork-Id: 12435043 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A3321C43214 for ; Fri, 13 Aug 2021 07:37:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8822E6104F for ; Fri, 13 Aug 2021 07:37:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239539AbhHMHiJ (ORCPT ); Fri, 13 Aug 2021 03:38:09 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:57766 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239514AbhHMHiF (ORCPT ); Fri, 13 Aug 2021 03:38:05 -0400 Received: from pps.filterd (m0098399.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 17D7Yebc069272; Fri, 13 Aug 2021 03:37:38 -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=7ZS//SnT4vnLEuH/or7zhxc2S4dFk27IL4g0CTpN7pk=; b=CJjfw6nPIWhZSRgqYHCOZtbFeDJZVQW7C682+RlaHS6fv2I+9gO407DDCBfx5VfkFxnR HvegCHDev2Ea542mzpGHUeD6VJpOqSJ0XcaD6I+MRkJMcHzvnwywBRTKWFF2sT6rZhL8 cO25WZQ+7bBLuHtZRDyvYGBvEvuVWfmNWrmrDjcUVuWa+Qna2kgrmpQhtzj8o09tdB4i deGXfRkHf+ph3kimv92MYhRmxowwHT3wVBt+T3w2ndt2g29+FPq+QCcAGnj2GWMPOZ2y QFTbd07khj7QJsUhOZ8hXA3lWloRsYSLj4s86GChKF5xKAX/EcfULUTNJlEJzI6fidvO Iw== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 3ad1kxx0gu-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 13 Aug 2021 03:37:38 -0400 Received: from m0098399.ppops.net (m0098399.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 17D7Z3TO071704; Fri, 13 Aug 2021 03:37:37 -0400 Received: from ppma04ams.nl.ibm.com (63.31.33a9.ip4.static.sl-reverse.com [169.51.49.99]) by mx0a-001b2d01.pphosted.com with ESMTP id 3ad1kxx0g2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 13 Aug 2021 03:37:37 -0400 Received: from pps.filterd (ppma04ams.nl.ibm.com [127.0.0.1]) by ppma04ams.nl.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 17D7PCAY015857; Fri, 13 Aug 2021 07:37:35 GMT Received: from b06cxnps4076.portsmouth.uk.ibm.com (d06relay13.portsmouth.uk.ibm.com [9.149.109.198]) by ppma04ams.nl.ibm.com with ESMTP id 3acn76b6p0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 13 Aug 2021 07:37:35 +0000 Received: from d06av24.portsmouth.uk.ibm.com (mk.ibm.com [9.149.105.60]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 17D7bXPW50004308 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 13 Aug 2021 07:37:33 GMT Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 04C5742049; Fri, 13 Aug 2021 07:37:33 +0000 (GMT) Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id AA48242041; Fri, 13 Aug 2021 07:37:32 +0000 (GMT) Received: from t46lp67.lnxne.boe (unknown [9.152.108.100]) by d06av24.portsmouth.uk.ibm.com (Postfix) with ESMTP; Fri, 13 Aug 2021 07:37:32 +0000 (GMT) From: Janosch Frank To: kvm@vger.kernel.org Cc: linux-s390@vger.kernel.org, imbrenda@linux.ibm.com, david@redhat.com, thuth@redhat.com, cohuck@redhat.com Subject: [kvm-unit-tests PATCH 7/8] lib: s390x: Control register constant cleanup Date: Fri, 13 Aug 2021 07:36:14 +0000 Message-Id: <20210813073615.32837-8-frankja@linux.ibm.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210813073615.32837-1-frankja@linux.ibm.com> References: <20210813073615.32837-1-frankja@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: ca487WlxaN7hZmT5IPzWFBetcjBm9OsN X-Proofpoint-ORIG-GUID: 8hcOMRIeddNW7ERsXJXNepRYnrcm8wgW X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.391,18.0.790 definitions=2021-08-13_01:2021-08-12,2021-08-13 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 malwarescore=0 mlxlogscore=999 mlxscore=0 adultscore=0 lowpriorityscore=0 priorityscore=1501 suspectscore=0 clxscore=1015 phishscore=0 spamscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2107140000 definitions=main-2108130044 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org We had bits and masks defined and don't necessarily need both. Signed-off-by: Janosch Frank --- lib/s390x/asm/arch_def.h | 29 +++++++++++++---------------- lib/s390x/smp.c | 2 +- s390x/skrf.c | 2 +- 3 files changed, 15 insertions(+), 18 deletions(-) diff --git a/lib/s390x/asm/arch_def.h b/lib/s390x/asm/arch_def.h index 245453c3..4574a166 100644 --- a/lib/s390x/asm/arch_def.h +++ b/lib/s390x/asm/arch_def.h @@ -54,10 +54,19 @@ struct psw { #define PSW_MASK_BA 0x0000000080000000UL #define PSW_MASK_64 PSW_MASK_BA | PSW_MASK_EA; -#define CR0_EXTM_SCLP 0x0000000000000200UL -#define CR0_EXTM_EXTC 0x0000000000002000UL -#define CR0_EXTM_EMGC 0x0000000000004000UL -#define CR0_EXTM_MASK 0x0000000000006200UL +#define CTL0_LOW_ADDR_PROT (63 - 35) +#define CTL0_EDAT (63 - 40) +#define CTL0_IEP (63 - 43) +#define CTL0_AFP (63 - 45) +#define CTL0_VECTOR (63 - 46) +#define CTL0_EMERGENCY_SIGNAL (63 - 49) +#define CTL0_EXTERNAL_CALL (63 - 50) +#define CTL0_CLOCK_COMPARATOR (63 - 52) +#define CTL0_SERVICE_SIGNAL (63 - 54) +#define CR0_EXTM_MASK 0x0000000000006200UL /* Combined external masks */ +#define BIT_TO_MASK64(x) 1UL << x + +#define CTL2_GUARDED_STORAGE (63 - 59) struct lowcore { uint8_t pad_0x0000[0x0080 - 0x0000]; /* 0x0000 */ @@ -239,18 +248,6 @@ static inline uint64_t stctg(int cr) return value; } -#define CTL0_LOW_ADDR_PROT (63 - 35) -#define CTL0_EDAT (63 - 40) -#define CTL0_IEP (63 - 43) -#define CTL0_AFP (63 - 45) -#define CTL0_VECTOR (63 - 46) -#define CTL0_EMERGENCY_SIGNAL (63 - 49) -#define CTL0_EXTERNAL_CALL (63 - 50) -#define CTL0_CLOCK_COMPARATOR (63 - 52) -#define CTL0_SERVICE_SIGNAL (63 - 54) - -#define CTL2_GUARDED_STORAGE (63 - 59) - static inline void ctl_set_bit(int cr, unsigned int bit) { uint64_t reg; diff --git a/lib/s390x/smp.c b/lib/s390x/smp.c index 228fe667..c2c6ffec 100644 --- a/lib/s390x/smp.c +++ b/lib/s390x/smp.c @@ -204,7 +204,7 @@ int smp_cpu_setup(uint16_t addr, struct psw psw) cpu->lowcore->sw_int_grs[15] = (uint64_t)cpu->stack + (PAGE_SIZE * 4); lc->restart_new_psw.mask = PSW_MASK_64; lc->restart_new_psw.addr = (uint64_t)smp_cpu_setup_state; - lc->sw_int_crs[0] = 0x0000000000040000UL; + lc->sw_int_crs[0] = BIT_TO_MASK64(CTL0_AFP); /* Start processing */ smp_cpu_restart_nolock(addr, NULL); diff --git a/s390x/skrf.c b/s390x/skrf.c index 9488c32b..a350ada6 100644 --- a/s390x/skrf.c +++ b/s390x/skrf.c @@ -125,8 +125,8 @@ static void ecall_cleanup(void) { struct lowcore *lc = (void *)0x0; - lc->sw_int_crs[0] = 0x0000000000040000; lc->ext_new_psw.mask = PSW_MASK_64; + lc->sw_int_crs[0] = BIT_TO_MASK64(CTL0_AFP); /* * PGM old contains the ext new PSW, we need to clean it up, From patchwork Fri Aug 13 07:36:15 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Janosch Frank X-Patchwork-Id: 12435045 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4FCA2C4338F for ; Fri, 13 Aug 2021 07:37:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3406761042 for ; Fri, 13 Aug 2021 07:37:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239537AbhHMHiJ (ORCPT ); Fri, 13 Aug 2021 03:38:09 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:58870 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239518AbhHMHiF (ORCPT ); Fri, 13 Aug 2021 03:38:05 -0400 Received: from pps.filterd (m0187473.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 17D7WwiH010993; Fri, 13 Aug 2021 03:37:39 -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=gkbFMvLr/xV9N43Lk4ve3dXBfX3O6IpsQd3M1XBoxPg=; b=bHfCvVXy4WZAuZbwndhKNiZwnJYuHPqcAJ14EepSgyIEop204dvC2BkyDaR9oLvatpLM VXVWBzg4WQks94XioiHX1UkG3/TU7da3Bxcp+rxxgN2Y30Fb+UbKX13X4AIZA3O1/h2C r5eGNiU0qCwPBRjW3pltQ8/npNvHsXcwEOaV7DScmoEYujXmRYO/zaz8sMZGPlZlhM4s UxeQoUjgyNxwGHgKVH6UMgCf0aMNetbGrCQKSQhzANN1Zn1JjIRNXUFqMIw4wlS9lYHm PMOnVDOAr7KIji09euBIgBoLSzgH7KEXpL9j6yvnsWnX6NPdxkisdgD9+vRKQ4jNyC9C Rg== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 3acstpk5eg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 13 Aug 2021 03:37:38 -0400 Received: from m0187473.ppops.net (m0187473.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 17D7X24G011351; Fri, 13 Aug 2021 03:37:38 -0400 Received: from ppma03fra.de.ibm.com (6b.4a.5195.ip4.static.sl-reverse.com [149.81.74.107]) by mx0a-001b2d01.pphosted.com with ESMTP id 3acstpk5dm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 13 Aug 2021 03:37:38 -0400 Received: from pps.filterd (ppma03fra.de.ibm.com [127.0.0.1]) by ppma03fra.de.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 17D7MX5v003190; Fri, 13 Aug 2021 07:37:36 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 3ada8sgjme-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 13 Aug 2021 07:37:35 +0000 Received: from d06av24.portsmouth.uk.ibm.com (mk.ibm.com [9.149.105.60]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 17D7bXHC55640406 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 13 Aug 2021 07:37:33 GMT Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 659C44204B; Fri, 13 Aug 2021 07:37:33 +0000 (GMT) Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 153CB42041; Fri, 13 Aug 2021 07:37:33 +0000 (GMT) Received: from t46lp67.lnxne.boe (unknown [9.152.108.100]) by d06av24.portsmouth.uk.ibm.com (Postfix) with ESMTP; Fri, 13 Aug 2021 07:37:33 +0000 (GMT) From: Janosch Frank To: kvm@vger.kernel.org Cc: linux-s390@vger.kernel.org, imbrenda@linux.ibm.com, david@redhat.com, thuth@redhat.com, cohuck@redhat.com Subject: [kvm-unit-tests PATCH 8/8] lib: s390x: uv: Add rc 0x100 query error handling Date: Fri, 13 Aug 2021 07:36:15 +0000 Message-Id: <20210813073615.32837-9-frankja@linux.ibm.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210813073615.32837-1-frankja@linux.ibm.com> References: <20210813073615.32837-1-frankja@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: io-VadB7KvQ6acMTQXp2ixUg8Vg1ZUzE X-Proofpoint-ORIG-GUID: O8mU9nbWYtrTHN5-a20yUYU0LdYLMESf X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.391,18.0.790 definitions=2021-08-13_01:2021-08-12,2021-08-13 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 malwarescore=0 adultscore=0 clxscore=1015 priorityscore=1501 bulkscore=0 suspectscore=0 mlxlogscore=999 phishscore=0 impostorscore=0 spamscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2107140000 definitions=main-2108130044 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org Let's not get bitten by an extension of the query struct and handle the rc 0x100 error properly which does indicate that the UV has more data for us. Signed-off-by: Janosch Frank Reviewed-by: Claudio Imbrenda --- lib/s390x/uv.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/s390x/uv.c b/lib/s390x/uv.c index fd9de944..c5c69c47 100644 --- a/lib/s390x/uv.c +++ b/lib/s390x/uv.c @@ -49,6 +49,8 @@ int uv_setup(void) if (!test_facility(158)) return 0; - assert(!uv_call(0, (u64)&uvcb_qui)); + uv_call(0, (u64)&uvcb_qui); + + assert(uvcb_qui.header.rc == 1 || uvcb_qui.header.rc == 0x100); return 1; }