From patchwork Mon Oct 18 12:26:19 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Janosch Frank X-Patchwork-Id: 12566297 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 447E0C433FE for ; Mon, 18 Oct 2021 12:38:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2B2D360EE9 for ; Mon, 18 Oct 2021 12:38:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231715AbhJRMkT (ORCPT ); Mon, 18 Oct 2021 08:40:19 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:61068 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231495AbhJRMkR (ORCPT ); Mon, 18 Oct 2021 08:40:17 -0400 Received: from pps.filterd (m0098409.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 19IBKcTL029815; Mon, 18 Oct 2021 08:38:06 -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=vU9ShpWENoat/SX8LgXcexyNq6wy0kVeOlyru1Gj+kA=; b=rgcHzw+n2nI+Bzz6gudAdWfEGkuW8rWkkWhrmKZK0Znpp6HLnjq/9UAQ3rAWrdejm1jo bEmxGTLc5JLhXjG3YYOWGjx4nv2UrQtFC2JU/nl7lwspZtt17qtbKteokMMSCvIyAoWB FEKdoRDrhAaShv5dvC1UCZg5dtL785GePt3/imF9nkzsCIDGFTHUCZpYjvcsUpS0Jp1g DgyBrVkfi1ARzLHsqKQi6Lo51yZsH3vrUwH54aTK6UQwy0gDWcn9CeHnVfHX21fpeRjK 2uRHFiYo7JJe8UKErzG9XMJjHMYlXaKjuEYpYUbJTNpc891y0uRnLw/+a1L5XxtGc+CM PA== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 3bs7yg1m84-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 18 Oct 2021 08:38:06 -0400 Received: from m0098409.ppops.net (m0098409.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 19ICRVqD007885; Mon, 18 Oct 2021 08:38:05 -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 3bs7yg1m71-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 18 Oct 2021 08:38:05 -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 19ICc3vP000896; Mon, 18 Oct 2021 12:38:03 GMT Received: from b06cxnps3075.portsmouth.uk.ibm.com (d06relay10.portsmouth.uk.ibm.com [9.149.109.195]) by ppma04ams.nl.ibm.com with ESMTP id 3bqpca66y7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 18 Oct 2021 12:38:03 +0000 Received: from d06av21.portsmouth.uk.ibm.com (d06av21.portsmouth.uk.ibm.com [9.149.105.232]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 19ICbwF951773816 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 18 Oct 2021 12:37:58 GMT Received: from d06av21.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 8AAEA5205A; Mon, 18 Oct 2021 12:37:58 +0000 (GMT) Received: from localhost.localdomain.com (unknown [9.145.80.123]) by d06av21.portsmouth.uk.ibm.com (Postfix) with ESMTP id 121DB5204F; Mon, 18 Oct 2021 12:37:58 +0000 (GMT) From: Janosch Frank To: pbonzini@redhat.com Cc: kvm@vger.kernel.org, frankja@linux.ibm.com, david@redhat.com, borntraeger@de.ibm.com, linux-s390@vger.kernel.org, imbrenda@linux.ibm.com, thuth@redhat.com Subject: [kvm-unit-tests GIT PULL 01/17] s390x: uv-host: Explain why we set up the home space and remove the space change Date: Mon, 18 Oct 2021 14:26:19 +0200 Message-Id: <20211018122635.53614-2-frankja@linux.ibm.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211018122635.53614-1-frankja@linux.ibm.com> References: <20211018122635.53614-1-frankja@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: Ezty2MZLfFZsHBOyfhRYB168n9Oryh-k X-Proofpoint-GUID: fvri6bwa1DiLBRmETFgTtz0YsJULD0AG X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.182.1,Aquarius:18.0.790,Hydra:6.0.425,FMLib:17.0.607.475 definitions=2021-10-18_05,2021-10-14_02,2020-04-07_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 mlxlogscore=999 mlxscore=0 suspectscore=0 lowpriorityscore=0 bulkscore=0 phishscore=0 impostorscore=0 priorityscore=1501 clxscore=1015 adultscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2109230001 definitions=main-2110180077 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 Acked-by: Thomas Huth --- 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 Mon Oct 18 12:26:20 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Janosch Frank X-Patchwork-Id: 12566301 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 321BAC4167B for ; Mon, 18 Oct 2021 12:38:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1C74D60FC3 for ; Mon, 18 Oct 2021 12:38:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231744AbhJRMkU (ORCPT ); Mon, 18 Oct 2021 08:40:20 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:26230 "EHLO mx0b-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231528AbhJRMkR (ORCPT ); Mon, 18 Oct 2021 08:40:17 -0400 Received: from pps.filterd (m0098417.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 19IAovqT007165; Mon, 18 Oct 2021 08:38:05 -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=asOVZumR+HRQ9BuyhWufPwpk1Ta4HHQQAd+cUEAqqoQ=; b=KPICAwmw+EiHMc/32RWWoA3iQINw9+VIn+4fOoFOohf2js0pSYdBXbUZhAQtHKB2W7cU hQE7CRQFu9+3Gj2+LGYH41POkM/TEmSm8CkFOuaqX27KOqBypgDJjAd/XiC5K+qoWGig I1z5ddvMjJu9Vfeij7yWcUHi24Zq2+O7YMljMsIJGLom7+RA+EigdUnoM5aKbQBK5SFC 1dKxhc6xrYiroygUa6a4V0UK4+nLPnjHtcfNI0O9+WUX+5XrGc5FXR3P46OjaL+yoOpu kbuvmnWYd1wtd2C9Q0IAeUljV53R7YVNefWEPjXHGxAgr7WqPOoAzzhDmXpwzL2QSgvb 4A== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 3bs1u59e78-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 18 Oct 2021 08:38:05 -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 19IC0EYH012451; Mon, 18 Oct 2021 08:38:04 -0400 Received: from ppma01fra.de.ibm.com (46.49.7a9f.ip4.static.sl-reverse.com [159.122.73.70]) by mx0a-001b2d01.pphosted.com with ESMTP id 3bs1u59e6j-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 18 Oct 2021 08:38:04 -0400 Received: from pps.filterd (ppma01fra.de.ibm.com [127.0.0.1]) by ppma01fra.de.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 19ICWI5R026247; Mon, 18 Oct 2021 12:38:02 GMT Received: from b06cxnps4074.portsmouth.uk.ibm.com (d06relay11.portsmouth.uk.ibm.com [9.149.109.196]) by ppma01fra.de.ibm.com with ESMTP id 3bqpc9myns-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 18 Oct 2021 12:38:02 +0000 Received: from d06av21.portsmouth.uk.ibm.com (d06av21.portsmouth.uk.ibm.com [9.149.105.232]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 19ICbxXh56820218 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 18 Oct 2021 12:37:59 GMT Received: from d06av21.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 0E6A85205F; Mon, 18 Oct 2021 12:37:59 +0000 (GMT) Received: from localhost.localdomain.com (unknown [9.145.80.123]) by d06av21.portsmouth.uk.ibm.com (Postfix) with ESMTP id 9575C52065; Mon, 18 Oct 2021 12:37:58 +0000 (GMT) From: Janosch Frank To: pbonzini@redhat.com Cc: kvm@vger.kernel.org, frankja@linux.ibm.com, david@redhat.com, borntraeger@de.ibm.com, linux-s390@vger.kernel.org, imbrenda@linux.ibm.com, thuth@redhat.com Subject: [kvm-unit-tests GIT PULL 02/17] lib: s390x: Control register constant cleanup Date: Mon, 18 Oct 2021 14:26:20 +0200 Message-Id: <20211018122635.53614-3-frankja@linux.ibm.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211018122635.53614-1-frankja@linux.ibm.com> References: <20211018122635.53614-1-frankja@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: Pai-PblpJ57a3EwNyMvyfXkPpTsEcX50 X-Proofpoint-ORIG-GUID: i9JGrDlwfKsivIQ3Rw62TRAwwV8n7Y7C X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.182.1,Aquarius:18.0.790,Hydra:6.0.425,FMLib:17.0.607.475 definitions=2021-10-18_03,2021-10-14_02,2020-04-07_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 impostorscore=0 mlxlogscore=999 bulkscore=0 spamscore=0 clxscore=1015 adultscore=0 suspectscore=0 mlxscore=0 phishscore=0 malwarescore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2109230001 definitions=main-2110180075 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 Reviewed-by: Claudio Imbrenda Reviewed-by: Thomas Huth --- lib/s390x/asm/arch_def.h | 28 ++++++++++++---------------- lib/s390x/smp.c | 3 ++- s390x/skrf.c | 3 ++- 3 files changed, 16 insertions(+), 18 deletions(-) diff --git a/lib/s390x/asm/arch_def.h b/lib/s390x/asm/arch_def.h index 302ef1ff..24892bd8 100644 --- a/lib/s390x/asm/arch_def.h +++ b/lib/s390x/asm/arch_def.h @@ -50,10 +50,18 @@ 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 CTL2_GUARDED_STORAGE (63 - 59) struct lowcore { uint8_t pad_0x0000[0x0080 - 0x0000]; /* 0x0000 */ @@ -235,18 +243,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..da6d32f3 100644 --- a/lib/s390x/smp.c +++ b/lib/s390x/smp.c @@ -10,6 +10,7 @@ * Janosch Frank */ #include +#include #include #include #include @@ -204,7 +205,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_ULL(CTL0_AFP); /* Start processing */ smp_cpu_restart_nolock(addr, NULL); diff --git a/s390x/skrf.c b/s390x/skrf.c index 9488c32b..8ca7588c 100644 --- a/s390x/skrf.c +++ b/s390x/skrf.c @@ -8,6 +8,7 @@ * Janosch Frank */ #include +#include #include #include #include @@ -125,8 +126,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_ULL(CTL0_AFP); /* * PGM old contains the ext new PSW, we need to clean it up, From patchwork Mon Oct 18 12:26:21 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Janosch Frank X-Patchwork-Id: 12566299 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 60EFBC43219 for ; Mon, 18 Oct 2021 12:38:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4D55C60FDA for ; Mon, 18 Oct 2021 12:38:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231655AbhJRMkS (ORCPT ); Mon, 18 Oct 2021 08:40:18 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:18698 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231466AbhJRMkR (ORCPT ); Mon, 18 Oct 2021 08:40:17 -0400 Received: from pps.filterd (m0098393.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 19I9q4JK017306; Mon, 18 Oct 2021 08:38:06 -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=wSkxNw80qPLNYyjOQtr103eF1Eod7stDnWfnv9Zsa4U=; b=YC9uCGJqM2Q60S2/oZXnbdJh2iRm3S68zoxaIE/iR3i3IZHjx9SAGJIcPvQOk8MpVV1z zDnlVlSV31UKtdiSpNyptgA1BtLazSeljSDjIk3Mecw+Zvnqu6AtSNaaY/gDNkQ08MnN Nk/3RBFUdqHMn0k4flsPCDpKeUMQuZ0Mc7CcYVelf4TQPQqTpKOcP2TWERDwAi6zGhr8 aX0tAMwziGq/gRenpaw9VS7arUI6BXGJ3FbB01QhuXZe53IS6phEf3oOi1/9V/cOnPYl UpKcWXNOHGjbPnPxB7Tcwpks/285/qQw5K0RKIfBCaqjtAFsDVYn7MhW1ahElBIQRvQE GA== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 3bs6np3brs-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 18 Oct 2021 08:38:05 -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 19I9rGcX019293; Mon, 18 Oct 2021 08:38:05 -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 3bs6np3br7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 18 Oct 2021 08:38:05 -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 19ICbJoJ005206; Mon, 18 Oct 2021 12:38:03 GMT Received: from b06cxnps4074.portsmouth.uk.ibm.com (d06relay11.portsmouth.uk.ibm.com [9.149.109.196]) by ppma05fra.de.ibm.com with ESMTP id 3bqpc9cykp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 18 Oct 2021 12:38:02 +0000 Received: from d06av21.portsmouth.uk.ibm.com (d06av21.portsmouth.uk.ibm.com [9.149.105.232]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 19ICbx1U63701500 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 18 Oct 2021 12:37:59 GMT Received: from d06av21.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 7A49552050; Mon, 18 Oct 2021 12:37:59 +0000 (GMT) Received: from localhost.localdomain.com (unknown [9.145.80.123]) by d06av21.portsmouth.uk.ibm.com (Postfix) with ESMTP id 1845D52054; Mon, 18 Oct 2021 12:37:59 +0000 (GMT) From: Janosch Frank To: pbonzini@redhat.com Cc: kvm@vger.kernel.org, frankja@linux.ibm.com, david@redhat.com, borntraeger@de.ibm.com, linux-s390@vger.kernel.org, imbrenda@linux.ibm.com, thuth@redhat.com Subject: [kvm-unit-tests GIT PULL 03/17] lib: s390x: Print addressing related exception information Date: Mon, 18 Oct 2021 14:26:21 +0200 Message-Id: <20211018122635.53614-4-frankja@linux.ibm.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211018122635.53614-1-frankja@linux.ibm.com> References: <20211018122635.53614-1-frankja@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: KUqA0g2eobDtqYe4l1CwQRSMUrc_3g6C X-Proofpoint-ORIG-GUID: caoqCE6tQct9s303JpfYVDbc2mUBFmUm X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.182.1,Aquarius:18.0.790,Hydra:6.0.425,FMLib:17.0.607.475 definitions=2021-10-18_03,2021-10-14_02,2020-04-07_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 mlxlogscore=999 adultscore=0 bulkscore=0 lowpriorityscore=0 spamscore=0 phishscore=0 impostorscore=0 suspectscore=0 malwarescore=0 priorityscore=1501 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2109230001 definitions=main-2110180075 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 Reviewed-by: Claudio Imbrenda Reviewed-by: Thomas Huth --- lib/s390x/asm/arch_def.h | 5 +++ lib/s390x/fault.c | 76 ++++++++++++++++++++++++++++++++++++++++ lib/s390x/fault.h | 44 +++++++++++++++++++++++ lib/s390x/interrupt.c | 27 ++++++++++++-- s390x/Makefile | 1 + 5 files changed, 151 insertions(+), 2 deletions(-) create mode 100644 lib/s390x/fault.c create mode 100644 lib/s390x/fault.h diff --git a/lib/s390x/asm/arch_def.h b/lib/s390x/asm/arch_def.h index 24892bd8..aa80d840 100644 --- a/lib/s390x/asm/arch_def.h +++ b/lib/s390x/asm/arch_def.h @@ -41,6 +41,11 @@ struct psw { uint64_t addr; }; +#define AS_PRIM 0 +#define AS_ACCR 1 +#define AS_SECN 2 +#define AS_HOME 3 + #define PSW_MASK_EXT 0x0100000000000000UL #define PSW_MASK_IO 0x0200000000000000UL #define PSW_MASK_DAT 0x0400000000000000UL diff --git a/lib/s390x/fault.c b/lib/s390x/fault.c new file mode 100644 index 00000000..d3ef00e4 --- /dev/null +++ b/lib/s390x/fault.c @@ -0,0 +1,76 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* + * Library to decode addressing related exceptions + * + * Copyright 2021 IBM Corp. + * + * Authors: + * Janosch Frank + */ +#include +#include +#include +#include +#include + +static struct lowcore *lc = (struct lowcore *)0x0; + +/* Decodes the protection exceptions we'll most likely see */ +static void print_decode_pgm_prot(uint64_t teid) +{ + if (prot_is_lap(teid)) { + printf("Type: LAP\n"); + return; + } + + if (prot_is_iep(teid)) { + printf("Type: IEP\n"); + return; + } + + if (prot_is_datp(teid)) { + printf("Type: DAT\n"); + return; + } +} + +void print_decode_teid(uint64_t teid) +{ + int asce_id = teid & 3; + bool dat = lc->pgm_old_psw.mask & PSW_MASK_DAT; + + printf("Memory exception information:\n"); + printf("DAT: %s\n", dat ? "on" : "off"); + + printf("AS: "); + switch (asce_id) { + case AS_PRIM: + printf("Primary\n"); + break; + case AS_ACCR: + printf("Access Register\n"); + break; + case AS_SECN: + printf("Secondary\n"); + break; + case AS_HOME: + printf("Home\n"); + break; + } + + if (lc->pgm_int_code == PGM_INT_CODE_PROTECTION) + print_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("TEID: %lx\n", teid); + printf("Address: %lx\n\n", teid & PAGE_MASK); +} diff --git a/lib/s390x/fault.h b/lib/s390x/fault.h new file mode 100644 index 00000000..726da2f0 --- /dev/null +++ b/lib/s390x/fault.h @@ -0,0 +1,44 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +/* + * Headers for fault.c + * + * Copyright 2021 IBM Corp. + * + * Authors: + * Janosch Frank + */ +#ifndef _S390X_FAULT_H_ +#define _S390X_FAULT_H_ + +#include + +/* Instruction execution prevention, i.e. no-execute, 101 */ +static inline bool prot_is_iep(uint64_t teid) +{ + if (test_bit_inv(56, &teid) && !test_bit_inv(60, &teid) && test_bit_inv(61, &teid)) + return true; + + return false; +} + +/* Standard DAT exception, 001 */ +static inline bool prot_is_datp(uint64_t teid) +{ + if (!test_bit_inv(56, &teid) && !test_bit_inv(60, &teid) && test_bit_inv(61, &teid)) + return true; + + return false; +} + +/* Low-address protection exception, 100 */ +static inline bool prot_is_lap(uint64_t teid) +{ + if (test_bit_inv(56, &teid) && !test_bit_inv(60, &teid) && !test_bit_inv(61, &teid)) + return true; + + return false; +} + +void print_decode_teid(uint64_t teid); + +#endif /* _S390X_FAULT_H_ */ diff --git a/lib/s390x/interrupt.c b/lib/s390x/interrupt.c index 01ded49d..126d4c0a 100644 --- a/lib/s390x/interrupt.c +++ b/lib/s390x/interrupt.c @@ -12,6 +12,8 @@ #include #include #include +#include +#include static bool pgm_int_expected; static bool ext_int_expected; @@ -76,8 +78,7 @@ 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 (prot_is_iep(lc->trans_exc_id)) /* * We branched to the instruction that caused * the exception so we can use the return @@ -126,6 +127,24 @@ static void fixup_pgm_int(struct stack_frame_int *stack) /* suppressed/terminated/completed point already at the next address */ } +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: + print_decode_teid(lc->trans_exc_id); + break; + } +} + static void print_int_regs(struct stack_frame_int *stack) { printf("\n"); @@ -155,6 +174,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(); } diff --git a/s390x/Makefile b/s390x/Makefile index ef8041a6..5d1a33a0 100644 --- a/s390x/Makefile +++ b/s390x/Makefile @@ -72,6 +72,7 @@ cflatobjs += lib/s390x/css_lib.o cflatobjs += lib/s390x/malloc_io.o cflatobjs += lib/s390x/uv.o cflatobjs += lib/s390x/sie.o +cflatobjs += lib/s390x/fault.o OBJDIRS += lib/s390x From patchwork Mon Oct 18 12:26:22 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Janosch Frank X-Patchwork-Id: 12566295 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A79C1C4332F for ; Mon, 18 Oct 2021 12:38:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8F4B760FC3 for ; Mon, 18 Oct 2021 12:38:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231611AbhJRMkR (ORCPT ); Mon, 18 Oct 2021 08:40:17 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:15112 "EHLO mx0b-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229519AbhJRMkR (ORCPT ); Mon, 18 Oct 2021 08:40:17 -0400 Received: from pps.filterd (m0098421.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 19ICHdKH020112; Mon, 18 Oct 2021 08:38:05 -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 : content-transfer-encoding : mime-version; s=pp1; bh=9BVO1I602GuYBILh8b4kBSQDuvSlQUnWFliZ7VnvJYk=; b=I4p5wGvQyh87E5pv7PrONmnCoL7ZSiHsG3OwEQreoifaQ5fuojpFSH3qzZOslVmrXv33 hpETzS4y8azShKIWcGWXoGUuktrW8k9YEXgGzGyDTQtP7K9x+KyS/rntL6XCTb2lA2NE b3ADy+x0rQoTvqGqRZ78BDZCrRX0ZFPHvtmzVgNAlrn8A6TlQygRiGM6etnYjhqj+Bfu 6nu9p14t0TWw7xKLgkAS03q4RpbAY8ZKsZ0sosMD0t3TCDW9dExTFSNAf5v3sv/ptZP7 InFR+ZtEGC9c2wNRk1CGEiz/8+rSgsHAR/kMQ9ZYRoszAki6E9hHevL83vOJivDEsYTN gA== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 3bs8t88cnm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 18 Oct 2021 08:38:05 -0400 Received: from m0098421.ppops.net (m0098421.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 19ICIoIb022667; Mon, 18 Oct 2021 08:38:05 -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 3bs8t88cn1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 18 Oct 2021 08:38:04 -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 19ICbUOm021894; Mon, 18 Oct 2021 12:38:03 GMT Received: from b06cxnps3074.portsmouth.uk.ibm.com (d06relay09.portsmouth.uk.ibm.com [9.149.109.194]) by ppma06ams.nl.ibm.com with ESMTP id 3bqp0je836-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 18 Oct 2021 12:38:03 +0000 Received: from d06av21.portsmouth.uk.ibm.com (d06av21.portsmouth.uk.ibm.com [9.149.105.232]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 19ICc08v54853948 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 18 Oct 2021 12:38:00 GMT Received: from d06av21.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 034F452050; Mon, 18 Oct 2021 12:38:00 +0000 (GMT) Received: from localhost.localdomain.com (unknown [9.145.80.123]) by d06av21.portsmouth.uk.ibm.com (Postfix) with ESMTP id 8DBFC52067; Mon, 18 Oct 2021 12:37:59 +0000 (GMT) From: Janosch Frank To: pbonzini@redhat.com Cc: kvm@vger.kernel.org, frankja@linux.ibm.com, david@redhat.com, borntraeger@de.ibm.com, linux-s390@vger.kernel.org, imbrenda@linux.ibm.com, thuth@redhat.com Subject: [kvm-unit-tests GIT PULL 04/17] s390x: skey: Test for ADDRESSING exceptions Date: Mon, 18 Oct 2021 14:26:22 +0200 Message-Id: <20211018122635.53614-5-frankja@linux.ibm.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211018122635.53614-1-frankja@linux.ibm.com> References: <20211018122635.53614-1-frankja@linux.ibm.com> X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: X-BN1cRx4kP1QBefXupSAN9G8IGSrCt9 X-Proofpoint-GUID: 2nfq5lbTfjhHyn5FDt05CUNdS4WXt50I X-Proofpoint-UnRewURL: 0 URL was un-rewritten MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.182.1,Aquarius:18.0.790,Hydra:6.0.425,FMLib:17.0.607.475 definitions=2021-10-18_03,2021-10-14_02,2020-04-07_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 priorityscore=1501 clxscore=1015 phishscore=0 lowpriorityscore=0 suspectscore=0 malwarescore=0 mlxlogscore=999 impostorscore=0 spamscore=0 bulkscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2109230001 definitions=main-2110180075 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org From: David Hildenbrand ... used to be broken in TCG, so let's add a very simple test for SSKE and ISKE. In order to test RRBE as well, introduce a helper to call the machine instruction. Signed-off-by: David Hildenbrand Message-Id: <20210903162537.57178-1-david@redhat.com> Link: https://lore.kernel.org/kvm/20210903162537.57178-1-david@redhat.com/ Reviewed-by: Janosch Frank Signed-off-by: Janosch Frank --- lib/s390x/asm/mem.h | 12 ++++++++++++ s390x/skey.c | 28 ++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+) diff --git a/lib/s390x/asm/mem.h b/lib/s390x/asm/mem.h index 40b22b63..845c00cc 100644 --- a/lib/s390x/asm/mem.h +++ b/lib/s390x/asm/mem.h @@ -50,6 +50,18 @@ static inline unsigned char get_storage_key(void *addr) return skey; } +static inline unsigned char reset_reference_bit(void *addr) +{ + int cc; + + asm volatile( + "rrbe 0,%1\n" + "ipm %0\n" + "srl %0,28\n" + : "=d" (cc) : "a" (addr) : "cc"); + return cc; +} + #define PFMF_FSC_4K 0 #define PFMF_FSC_1M 1 #define PFMF_FSC_2G 2 diff --git a/s390x/skey.c b/s390x/skey.c index 25399443..58a55436 100644 --- a/s390x/skey.c +++ b/s390x/skey.c @@ -120,6 +120,33 @@ static void test_priv(void) report_prefix_pop(); } +static void test_invalid_address(void) +{ + void *inv_addr = (void *)-1ull; + + report_prefix_push("invalid address"); + + report_prefix_push("sske"); + expect_pgm_int(); + set_storage_key(inv_addr, 0, 0); + check_pgm_int_code(PGM_INT_CODE_ADDRESSING); + report_prefix_pop(); + + report_prefix_push("iske"); + expect_pgm_int(); + get_storage_key(inv_addr); + check_pgm_int_code(PGM_INT_CODE_ADDRESSING); + report_prefix_pop(); + + report_prefix_push("rrbe"); + expect_pgm_int(); + reset_reference_bit(inv_addr); + check_pgm_int_code(PGM_INT_CODE_ADDRESSING); + report_prefix_pop(); + + report_prefix_pop(); +} + int main(void) { report_prefix_push("skey"); @@ -128,6 +155,7 @@ int main(void) goto done; } test_priv(); + test_invalid_address(); test_set(); test_set_mb(); test_chg(); From patchwork Mon Oct 18 12:26:23 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Janosch Frank X-Patchwork-Id: 12566331 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0AE5CC4167E for ; Mon, 18 Oct 2021 12:38:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E978960FD9 for ; Mon, 18 Oct 2021 12:38:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231741AbhJRMkV (ORCPT ); Mon, 18 Oct 2021 08:40:21 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:4388 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231645AbhJRMkS (ORCPT ); Mon, 18 Oct 2021 08:40:18 -0400 Received: from pps.filterd (m0098409.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 19IBKYSL029683; Mon, 18 Oct 2021 08:38:07 -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 : content-transfer-encoding : mime-version; s=pp1; bh=k6bMroZ6gV/axiBUPhy7QmeuQnQJp4SvppQ/20GUXhQ=; b=hdxJ59IZjpCyxctHQAU6WthcRBppDKY1q22kcklHnZIefGy5HBff/XHSavov+GMqlAtV NxITzTziDRsyp8kQ0BTCZC0t7doQPLz1CNqHD2gOqYWUTiklq/HN5xKIn8vYxsl3BVGZ r+F8NT/1OlBOS3p7JGbE6IIlnwGwqGml6kFKOWBD/ALvInaVDkgD6d52UbsfzQazeJWB DYd2Cfe2FhUUW57yZDB3e6hW59LVzDnmoESA4x1pfSlQSfYgtZ4VtFgWryvIs48R4d/Y lQKGOrepCYukpcHhbMXkNR3LQmjz2mXlV9Mvgl/L/y2wcSa6FJIpNlKPo7AU+JrRQxwe Lg== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 3bs7yg1m8q-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 18 Oct 2021 08:38:07 -0400 Received: from m0098409.ppops.net (m0098409.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 19ICc6vm015870; Mon, 18 Oct 2021 08:38:06 -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 3bs7yg1m7h-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 18 Oct 2021 08:38:06 -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 19ICbJBe005210; Mon, 18 Oct 2021 12:38:04 GMT Received: from b06cxnps3074.portsmouth.uk.ibm.com (d06relay09.portsmouth.uk.ibm.com [9.149.109.194]) by ppma05fra.de.ibm.com with ESMTP id 3bqpc9cym1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 18 Oct 2021 12:38:03 +0000 Received: from d06av21.portsmouth.uk.ibm.com (d06av21.portsmouth.uk.ibm.com [9.149.105.232]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 19ICc0J146268844 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 18 Oct 2021 12:38:00 GMT Received: from d06av21.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 8493052054; Mon, 18 Oct 2021 12:38:00 +0000 (GMT) Received: from localhost.localdomain.com (unknown [9.145.80.123]) by d06av21.portsmouth.uk.ibm.com (Postfix) with ESMTP id 165EF52051; Mon, 18 Oct 2021 12:38:00 +0000 (GMT) From: Janosch Frank To: pbonzini@redhat.com Cc: kvm@vger.kernel.org, frankja@linux.ibm.com, david@redhat.com, borntraeger@de.ibm.com, linux-s390@vger.kernel.org, imbrenda@linux.ibm.com, thuth@redhat.com Subject: [kvm-unit-tests GIT PULL 05/17] s390x: mvpg-sie: Remove unused variable Date: Mon, 18 Oct 2021 14:26:23 +0200 Message-Id: <20211018122635.53614-6-frankja@linux.ibm.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211018122635.53614-1-frankja@linux.ibm.com> References: <20211018122635.53614-1-frankja@linux.ibm.com> X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: i8JbVhVFgpAZPNB4XJfiHbSQdohjpYup X-Proofpoint-GUID: fsNFotcfKm-6k9qEDWrrSw5Vo3lq5nfx X-Proofpoint-UnRewURL: 0 URL was un-rewritten MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.182.1,Aquarius:18.0.790,Hydra:6.0.425,FMLib:17.0.607.475 definitions=2021-10-18_05,2021-10-14_02,2020-04-07_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 mlxlogscore=999 mlxscore=0 suspectscore=0 lowpriorityscore=0 bulkscore=0 phishscore=0 impostorscore=0 priorityscore=1501 clxscore=1015 adultscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2109230001 definitions=main-2110180077 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org From: Thomas Huth The guest_instr variable is not used, which was likely a copy-n-paste issue from the s390x/sie.c test. Signed-off-by: Thomas Huth Reviewed-by: Claudio Imbrenda Reviewed-by: Janosch Frank Link: https://lore.kernel.org/kvm/6b4b6ae0-6cee-e435-189a-8657159de97f@linux.ibm.com/T/#m8390c674f1b6a9fdf8055189d039c60c99a6899a Message-Id: <20211007072136.768459-1-thuth@redhat.com> Signed-off-by: Janosch Frank --- s390x/mvpg-sie.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/s390x/mvpg-sie.c b/s390x/mvpg-sie.c index ccc273b4..5adcec1e 100644 --- a/s390x/mvpg-sie.c +++ b/s390x/mvpg-sie.c @@ -21,7 +21,6 @@ #include static u8 *guest; -static u8 *guest_instr; static struct vm vm; static uint8_t *src; @@ -94,8 +93,6 @@ static void setup_guest(void) /* Allocate 1MB as guest memory */ guest = alloc_pages(8); - /* The first two pages are the lowcore */ - guest_instr = guest + PAGE_SIZE * 2; sie_guest_create(&vm, (uint64_t)guest, HPAGE_SIZE); From patchwork Mon Oct 18 12:26:24 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Janosch Frank X-Patchwork-Id: 12566333 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 84660C433F5 for ; Mon, 18 Oct 2021 12:38:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6D89760FC3 for ; Mon, 18 Oct 2021 12:38:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231756AbhJRMkW (ORCPT ); Mon, 18 Oct 2021 08:40:22 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:63118 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231707AbhJRMkT (ORCPT ); Mon, 18 Oct 2021 08:40:19 -0400 Received: from pps.filterd (m0098399.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 19IBwEOx007216; Mon, 18 Oct 2021 08:38:08 -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=GCWDAo+2mYFqxOJX/JYVDPhcH0+vFG5rZzZzCoRfhgg=; b=mXjqUb5MBwNGLFizlKdMEFHeUMUEvZFhoajxCPkih0g0ltjskrJTWGlGqityE15c1TAz Z1gKYIBT6DvOK7sf870XF7DncwgN1Xwr4jnM87ocezcDiklRHk9FqB4cMGw9qXPKK9jo FIGquC3vtjWhUskdtUgb1YSz4yRuqD5wAibr6yz9iIU0gED5LZTJFfLYNnaGZSDEvyep WkmDOmqDKLZJkLDvj5xY2mnYnZ7wn65E95bKgmcVeczKAObTOVg0WskSirCA58f5gJSf wIc2SeXg9Tq+EMRpd1Z4pLRwrcxXxOmKZY3otvc98bX6XDTC72gUfh755O6pKwvL3q1T 5Q== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 3bs3gv7kb8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 18 Oct 2021 08:38:07 -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 19IBuNUa020517; Mon, 18 Oct 2021 08:38:07 -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 3bs3gv7ka9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 18 Oct 2021 08:38:07 -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 19ICbJP5005201; Mon, 18 Oct 2021 12:38:04 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 3bqpc9cym6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 18 Oct 2021 12:38:04 +0000 Received: from d06av21.portsmouth.uk.ibm.com (d06av21.portsmouth.uk.ibm.com [9.149.105.232]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 19ICc1O43801624 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 18 Oct 2021 12:38:01 GMT Received: from d06av21.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 17B3052052; Mon, 18 Oct 2021 12:38:01 +0000 (GMT) Received: from localhost.localdomain.com (unknown [9.145.80.123]) by d06av21.portsmouth.uk.ibm.com (Postfix) with ESMTP id 983825205A; Mon, 18 Oct 2021 12:38:00 +0000 (GMT) From: Janosch Frank To: pbonzini@redhat.com Cc: kvm@vger.kernel.org, frankja@linux.ibm.com, david@redhat.com, borntraeger@de.ibm.com, linux-s390@vger.kernel.org, imbrenda@linux.ibm.com, thuth@redhat.com Subject: [kvm-unit-tests GIT PULL 06/17] s390x: uv: Tolerate 0x100 query return code Date: Mon, 18 Oct 2021 14:26:24 +0200 Message-Id: <20211018122635.53614-7-frankja@linux.ibm.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211018122635.53614-1-frankja@linux.ibm.com> References: <20211018122635.53614-1-frankja@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: uv0RQNeuIX4VTee52y33X8hIj-GNjWGh X-Proofpoint-ORIG-GUID: zFLVaC2aCBy9IHyke-Wp6swWp0gGqyRu X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.182.1,Aquarius:18.0.790,Hydra:6.0.425,FMLib:17.0.607.475 definitions=2021-10-18_05,2021-10-14_02,2020-04-07_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 bulkscore=0 priorityscore=1501 impostorscore=0 phishscore=0 malwarescore=0 spamscore=0 adultscore=0 mlxscore=0 mlxlogscore=999 lowpriorityscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2109230001 definitions=main-2110180075 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org RC 0x100 is not an error but a notice that we could have gotten more data from the Ultravisor if we had asked for it. So let's tolerate them in our tests. Signed-off-by: Janosch Frank Acked-by: Thomas Huth --- s390x/uv-guest.c | 4 +++- s390x/uv-host.c | 8 +++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/s390x/uv-guest.c b/s390x/uv-guest.c index f05ae4c3..44ad2154 100644 --- a/s390x/uv-guest.c +++ b/s390x/uv-guest.c @@ -71,7 +71,9 @@ static void test_query(void) uvcb.header.len = sizeof(uvcb); cc = uv_call(0, (u64)&uvcb); - report(cc == 0 && uvcb.header.rc == UVC_RC_EXECUTED, "successful query"); + report((!cc && uvcb.header.rc == UVC_RC_EXECUTED) || + (cc == 1 && uvcb.header.rc == 0x100), + "successful query"); /* * These bits have been introduced with the very first diff --git a/s390x/uv-host.c b/s390x/uv-host.c index 28035707..4b72c24d 100644 --- a/s390x/uv-host.c +++ b/s390x/uv-host.c @@ -385,7 +385,7 @@ static void test_init(void) static void test_query(void) { - int i = 0; + int i = 0, cc; uvcb_qui.header.cmd = UVC_CMD_QUI; uvcb_qui.header.len = sizeof(uvcb_qui); @@ -400,8 +400,10 @@ static void test_query(void) report(uvcb_qui.header.rc == 0x100, "insf length"); uvcb_qui.header.len = sizeof(uvcb_qui); - uv_call(0, (uint64_t)&uvcb_qui); - report(uvcb_qui.header.rc == UVC_RC_EXECUTED, "successful query"); + cc = uv_call(0, (uint64_t)&uvcb_qui); + report((!cc && uvcb_qui.header.rc == UVC_RC_EXECUTED) || + (cc == 1 && uvcb_qui.header.rc == 0x100), + "successful query"); for (i = 0; cmds[i].name; i++) report(uv_query_test_call(cmds[i].call_bit), "%s", cmds[i].name); From patchwork Mon Oct 18 12:26:25 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Janosch Frank X-Patchwork-Id: 12566337 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2DAC8C433EF for ; Mon, 18 Oct 2021 12:38:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1BA4061077 for ; Mon, 18 Oct 2021 12:38:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231754AbhJRMkZ (ORCPT ); Mon, 18 Oct 2021 08:40:25 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:12836 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231466AbhJRMkT (ORCPT ); Mon, 18 Oct 2021 08:40:19 -0400 Received: from pps.filterd (m0098396.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 19ICUt6v020014; Mon, 18 Oct 2021 08:38:08 -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=ciRYMMAs4JIYwfPi9TRGmrGoNbz+hZRa8eXWDsQgHXc=; b=StM0KGE9qyX5uXcI4+0bfQTYSOHfhEz8BYHpc+ZqpJlT8nFxzdJEeawAPWQB9B21gprX r6RyUoJSaY2KLgsZh5C+7SADopYN10WKGP7LU/E54kIRDsVpcA9QTxA+4OD4TgNdINx9 iin1cMbNXn3aIOapPD5/W2Zct7nob6ch6SZM/JbkdoE42cIDkRaAZuGsaC+c0JeLAcN8 iKMbmWJ9j3R9q5zRF/sD7HjDXN5Jgd67R21OIrN6uTD+YPBdujECBjfBIgp2bFvTynF9 SU/yHgDD9kwxjyqLRG9Aw33AxG3znVKGbWDjemTqJEfVvNBL/+8ZNlFt4CQw1hOXZ1dG qw== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 3bs1cw9xuc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 18 Oct 2021 08:38:08 -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 19IBSdGU004575; Mon, 18 Oct 2021 08:38:07 -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 3bs1cw9xth-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 18 Oct 2021 08:38:07 -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 19ICbKmq031339; Mon, 18 Oct 2021 12:38:05 GMT Received: from b06cxnps4075.portsmouth.uk.ibm.com (d06relay12.portsmouth.uk.ibm.com [9.149.109.197]) by ppma03fra.de.ibm.com with ESMTP id 3bqpc9505n-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 18 Oct 2021 12:38:05 +0000 Received: from d06av21.portsmouth.uk.ibm.com (d06av21.portsmouth.uk.ibm.com [9.149.105.232]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 19ICc1C761080008 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 18 Oct 2021 12:38:01 GMT Received: from d06av21.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 930C85204F; Mon, 18 Oct 2021 12:38:01 +0000 (GMT) Received: from localhost.localdomain.com (unknown [9.145.80.123]) by d06av21.portsmouth.uk.ibm.com (Postfix) with ESMTP id 2352352054; Mon, 18 Oct 2021 12:38:01 +0000 (GMT) From: Janosch Frank To: pbonzini@redhat.com Cc: kvm@vger.kernel.org, frankja@linux.ibm.com, david@redhat.com, borntraeger@de.ibm.com, linux-s390@vger.kernel.org, imbrenda@linux.ibm.com, thuth@redhat.com Subject: [kvm-unit-tests GIT PULL 07/17] s390x: uv-host: Fence a destroy cpu test on z15 Date: Mon, 18 Oct 2021 14:26:25 +0200 Message-Id: <20211018122635.53614-8-frankja@linux.ibm.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211018122635.53614-1-frankja@linux.ibm.com> References: <20211018122635.53614-1-frankja@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: 0MOjy9C9MZACiG5K8u83dfBPzAaAK9c0 X-Proofpoint-ORIG-GUID: -OGSd03BIO5Yl696CkjOReje0hkBmnii X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.182.1,Aquarius:18.0.790,Hydra:6.0.425,FMLib:17.0.607.475 definitions=2021-10-18_05,2021-10-14_02,2020-04-07_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 adultscore=0 mlxscore=0 phishscore=0 lowpriorityscore=0 clxscore=1015 suspectscore=0 bulkscore=0 spamscore=0 mlxlogscore=999 impostorscore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2109230001 definitions=main-2110180075 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org Firmware will not give us the expected return code on z15 so let's fence it for the z15 machine generation. Signed-off-by: Janosch Frank Reviewed-by: Claudio Imbrenda Acked-by: Thomas Huth --- lib/s390x/asm/arch_def.h | 14 ++++++++++++++ s390x/uv-host.c | 11 +++++++---- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/lib/s390x/asm/arch_def.h b/lib/s390x/asm/arch_def.h index aa80d840..c8d2722a 100644 --- a/lib/s390x/asm/arch_def.h +++ b/lib/s390x/asm/arch_def.h @@ -219,6 +219,20 @@ static inline unsigned short stap(void) return cpu_address; } +#define MACHINE_Z15A 0x8561 +#define MACHINE_Z15B 0x8562 + +static inline uint16_t get_machine_id(void) +{ + uint64_t cpuid; + + asm volatile("stidp %0" : "=Q" (cpuid)); + cpuid = cpuid >> 16; + cpuid &= 0xffff; + + return cpuid; +} + static inline int tprot(unsigned long addr) { int cc; diff --git a/s390x/uv-host.c b/s390x/uv-host.c index 4b72c24d..92a41069 100644 --- a/s390x/uv-host.c +++ b/s390x/uv-host.c @@ -111,6 +111,7 @@ static void test_config_destroy(void) static void test_cpu_destroy(void) { int rc; + uint16_t machineid = get_machine_id(); struct uv_cb_nodata uvcb = { .header.len = sizeof(uvcb), .header.cmd = UVC_CMD_DESTROY_SEC_CPU, @@ -125,10 +126,12 @@ static void test_cpu_destroy(void) "hdr invalid length"); uvcb.header.len += 8; - uvcb.handle += 1; - rc = uv_call(0, (uint64_t)&uvcb); - report(rc == 1 && uvcb.header.rc == UVC_RC_INV_CHANDLE, "invalid handle"); - uvcb.handle -= 1; + if (machineid != MACHINE_Z15A && machineid != MACHINE_Z15B) { + uvcb.handle += 1; + rc = uv_call(0, (uint64_t)&uvcb); + report(rc == 1 && uvcb.header.rc == UVC_RC_INV_CHANDLE, "invalid handle"); + uvcb.handle -= 1; + } rc = uv_call(0, (uint64_t)&uvcb); report(rc == 0 && uvcb.header.rc == UVC_RC_EXECUTED, "success"); From patchwork Mon Oct 18 12:26:26 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Janosch Frank X-Patchwork-Id: 12566335 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0F26CC43217 for ; Mon, 18 Oct 2021 12:38:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id EE2C860FDA for ; Mon, 18 Oct 2021 12:38:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231773AbhJRMkX (ORCPT ); Mon, 18 Oct 2021 08:40:23 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:48054 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S231718AbhJRMkT (ORCPT ); Mon, 18 Oct 2021 08:40:19 -0400 Received: from pps.filterd (m0098414.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 19IBEL4r013559; Mon, 18 Oct 2021 08:38:08 -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=VqLHdyHlzclKoutF781izDj2tns4crN+xS+y7Y6/SuU=; b=pNvMgkjWcps1ETGEqpnnK62enMtPI1tYCl0Y+xBvR7qJOJHnVyP0+8AcN1LfH2ZWVwW/ lYLcy6+Stg7vh91odOqQuR74qv2ZmXNMdO4J1Kx8OECd1LaBgPfgwlTmAvh+pXhs9DOt OIMHRjpxygU1QCVLEsBK3BMmI9wHyJlGpM9Upwh1hgrlat0QhdoD90WYjgVfm0eTO5oH BjRa3kiWQarBopnJhun8UQOUblOYk2BxL9DedbxN1Jy10U/mIpt0TS/4gSFG3Veykjql YkWDtZIpj88Uq0cRWVj3f4CCtnJYhdzi8YyjRptFdDc2hcu/0nHSezCLBaCTz+ht/nJW Pw== Received: from pps.reinject (localhost [127.0.0.1]) by mx0b-001b2d01.pphosted.com with ESMTP id 3bs4f1xey4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 18 Oct 2021 08:38:07 -0400 Received: from m0098414.ppops.net (m0098414.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 19IBjhRu000759; Mon, 18 Oct 2021 08:38:07 -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 3bs4f1xexh-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 18 Oct 2021 08:38:07 -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 19ICbKms031339; Mon, 18 Oct 2021 12:38:05 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 3bqpc9505x-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 18 Oct 2021 12:38:05 +0000 Received: from d06av21.portsmouth.uk.ibm.com (d06av21.portsmouth.uk.ibm.com [9.149.105.232]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 19ICc2Br52494660 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 18 Oct 2021 12:38:02 GMT Received: from d06av21.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 22F4252054; Mon, 18 Oct 2021 12:38:02 +0000 (GMT) Received: from localhost.localdomain.com (unknown [9.145.80.123]) by d06av21.portsmouth.uk.ibm.com (Postfix) with ESMTP id 9CEAD5205F; Mon, 18 Oct 2021 12:38:01 +0000 (GMT) From: Janosch Frank To: pbonzini@redhat.com Cc: kvm@vger.kernel.org, frankja@linux.ibm.com, david@redhat.com, borntraeger@de.ibm.com, linux-s390@vger.kernel.org, imbrenda@linux.ibm.com, thuth@redhat.com Subject: [kvm-unit-tests GIT PULL 08/17] lib: s390x: uv: Fix share return value and print Date: Mon, 18 Oct 2021 14:26:26 +0200 Message-Id: <20211018122635.53614-9-frankja@linux.ibm.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211018122635.53614-1-frankja@linux.ibm.com> References: <20211018122635.53614-1-frankja@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: H6MwgCzXR_DHD2M3_4kCiyrVuLGofF44 X-Proofpoint-ORIG-GUID: jSygACKE3xPGfBcyj_BgyZkWcldgN6zZ X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.182.1,Aquarius:18.0.790,Hydra:6.0.425,FMLib:17.0.607.475 definitions=2021-10-18_05,2021-10-14_02,2020-04-07_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 malwarescore=0 priorityscore=1501 mlxscore=0 phishscore=0 bulkscore=0 impostorscore=0 clxscore=1015 spamscore=0 adultscore=0 lowpriorityscore=0 mlxlogscore=982 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2109230001 definitions=main-2110180075 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org Let's only return 0/1 for success/failure respectively. If needed we can later add rc/rrc pointers so we can check for the reasons of cc==1 cases like we do in the kernel. As share() might also be used in snippets it's best not to use prints to avoid linking problems so lets remove the report_info(). Signed-off-by: Janosch Frank Reviewed-by: Claudio Imbrenda Acked-by: Thomas Huth --- lib/s390x/asm/uv.h | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/lib/s390x/asm/uv.h b/lib/s390x/asm/uv.h index ec10d1c4..2f099553 100644 --- a/lib/s390x/asm/uv.h +++ b/lib/s390x/asm/uv.h @@ -219,15 +219,8 @@ static inline int share(unsigned long addr, u16 cmd) .header.len = sizeof(uvcb), .paddr = addr }; - int cc; - cc = uv_call(0, (u64)&uvcb); - if (!cc && uvcb.header.rc == UVC_RC_EXECUTED) - return 0; - - report_info("uv_call: cmd %04x cc %d response code: %04x", cc, cmd, - uvcb.header.rc); - return -1; + return uv_call(0, (u64)&uvcb); } /* From patchwork Mon Oct 18 12:26:27 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Janosch Frank X-Patchwork-Id: 12566339 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5B5BCC4321E for ; Mon, 18 Oct 2021 12:38:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4727160EE9 for ; Mon, 18 Oct 2021 12:38:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231718AbhJRMk0 (ORCPT ); Mon, 18 Oct 2021 08:40:26 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:37112 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S231724AbhJRMkT (ORCPT ); Mon, 18 Oct 2021 08:40:19 -0400 Received: from pps.filterd (m0098419.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 19ICc4wP008104; Mon, 18 Oct 2021 08:38:08 -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=oW6rIaYDmjmDQRciDukvgpOCsUnwIp81nrfWD9HbNYk=; b=JSgf9ZizlcmXbVyPIcqj/3z0pbIGq4jEyQFhx0mfVDUb6cgZMRGgDoLa/T8O3xtWpf1E MumEeW79y1AZsLyVrvul609b89m0olhO74z9Iyy+oyJTZHFTBAXwvADG7dknBP5cDL27 I5wRegf3EtAQe40pmtho4OjeCrO4E0t5iJoS75aGbAVdD8sPD4CvL0POmdhdTBLSHFnU 5vh9UliiIaMaGeY/I+j8p/Ppa2glAwIvSVgDEJYz//9Ua/4xfb30z+eGqc2S05KufaIg aseQtSO9bSDbqnC9XK0djL0mG6xOlMCF3NeD9EuMbBXe/HflODsjynTVD8mo55XbXe2k Gw== Received: from pps.reinject (localhost [127.0.0.1]) by mx0b-001b2d01.pphosted.com with ESMTP id 3bs419f0gy-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 18 Oct 2021 08:38:08 -0400 Received: from m0098419.ppops.net (m0098419.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 19ICQo4s016805; Mon, 18 Oct 2021 08:38:07 -0400 Received: from ppma04ams.nl.ibm.com (63.31.33a9.ip4.static.sl-reverse.com [169.51.49.99]) by mx0b-001b2d01.pphosted.com with ESMTP id 3bs419f0gd-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 18 Oct 2021 08:38:07 -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 19ICc4JI000967; Mon, 18 Oct 2021 12:38:05 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 3bqpca6704-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 18 Oct 2021 12:38:05 +0000 Received: from d06av21.portsmouth.uk.ibm.com (d06av21.portsmouth.uk.ibm.com [9.149.105.232]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 19ICc2RF62587172 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 18 Oct 2021 12:38:02 GMT Received: from d06av21.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id A1E005205A; Mon, 18 Oct 2021 12:38:02 +0000 (GMT) Received: from localhost.localdomain.com (unknown [9.145.80.123]) by d06av21.portsmouth.uk.ibm.com (Postfix) with ESMTP id 2D2735204F; Mon, 18 Oct 2021 12:38:02 +0000 (GMT) From: Janosch Frank To: pbonzini@redhat.com Cc: kvm@vger.kernel.org, frankja@linux.ibm.com, david@redhat.com, borntraeger@de.ibm.com, linux-s390@vger.kernel.org, imbrenda@linux.ibm.com, thuth@redhat.com Subject: [kvm-unit-tests GIT PULL 09/17] lib: s390x: uv: Add UVC_ERR_DEBUG switch Date: Mon, 18 Oct 2021 14:26:27 +0200 Message-Id: <20211018122635.53614-10-frankja@linux.ibm.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211018122635.53614-1-frankja@linux.ibm.com> References: <20211018122635.53614-1-frankja@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: dzIu4rE2x-2FZ82X2IhT7hnsG5pLFuuQ X-Proofpoint-ORIG-GUID: xQxjFurZfXdVCI-q-yXekkLx8dxauHLD X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.182.1,Aquarius:18.0.790,Hydra:6.0.425,FMLib:17.0.607.475 definitions=2021-10-18_05,2021-10-14_02,2020-04-07_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 impostorscore=0 bulkscore=0 adultscore=0 priorityscore=1501 mlxscore=0 mlxlogscore=999 suspectscore=0 phishscore=0 spamscore=0 lowpriorityscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2109230001 definitions=main-2110180077 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org Every time something goes wrong in a way we don't expect, we need to add debug prints to some UVC to get the unexpected return code. Let's just put the printing behind a macro so we can enable it if needed via a simple switch. Signed-off-by: Janosch Frank Reviewed-by: Claudio Imbrenda Reviewed-by: Thomas Huth --- lib/s390x/asm/uv.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/lib/s390x/asm/uv.h b/lib/s390x/asm/uv.h index 2f099553..8baf896f 100644 --- a/lib/s390x/asm/uv.h +++ b/lib/s390x/asm/uv.h @@ -12,6 +12,11 @@ #ifndef _ASMS390X_UV_H_ #define _ASMS390X_UV_H_ +/* Enables printing of command code and return codes for failed UVCs */ +#ifndef UVC_ERR_DEBUG +#define UVC_ERR_DEBUG 0 +#endif + #define UVC_RC_EXECUTED 0x0001 #define UVC_RC_INV_CMD 0x0002 #define UVC_RC_INV_STATE 0x0003 @@ -194,6 +199,13 @@ static inline int uv_call_once(unsigned long r1, unsigned long r2) : [cc] "=d" (cc) : [r1] "a" (r1), [r2] "a" (r2) : "memory", "cc"); + + if (UVC_ERR_DEBUG && cc == 1) + printf("UV call error: call %x rc %x rrc %x\n", + ((struct uv_cb_header *)r2)->cmd, + ((struct uv_cb_header *)r2)->rc, + ((struct uv_cb_header *)r2)->rrc); + return cc; } From patchwork Mon Oct 18 12:26:28 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Janosch Frank X-Patchwork-Id: 12566341 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4066FC433F5 for ; Mon, 18 Oct 2021 12:38:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2A9AA60EE9 for ; Mon, 18 Oct 2021 12:38:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231814AbhJRMk1 (ORCPT ); Mon, 18 Oct 2021 08:40:27 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:26826 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S231495AbhJRMkU (ORCPT ); Mon, 18 Oct 2021 08:40:20 -0400 Received: from pps.filterd (m0098419.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 19I9sjFA007914; Mon, 18 Oct 2021 08:38:09 -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 : content-transfer-encoding : mime-version; s=pp1; bh=x9m69RdPpWPWGJvkAYqD1Y8HmFfHfO8m+SdWOZdaUiQ=; b=dlKusC4sdtaNZI2UhMHTsyXqYQhDWCnqoCl0Q75/se6yJhQlA663kJE7Wdwlt6vHYCw1 lowSJk/oLthhMPJ+mKanqu9HXl/MY3ytFQze0cNn4gCDUX8qRWVacwTedf5r1D1jnJde LFbNGpOi/me6Di6cFCJeOq8yvQDhjBQUIkccUaUgqvBLeXF/aZ413QnXg/3tgKHx7e/j GRJxanOSNBL8QG4qe5K2/uFZ1aoikap1TuUUpi5d2D0mS4HehTmyvZxq3HkCehDTWsCE vTnGxqGhyUssNf35DXiYHN2xVH6l0+axBPngA910Hv4etGLS+6avXoZmZDiMJGsmhhae pg== Received: from pps.reinject (localhost [127.0.0.1]) by mx0b-001b2d01.pphosted.com with ESMTP id 3bs419f0hd-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 18 Oct 2021 08:38:09 -0400 Received: from m0098419.ppops.net (m0098419.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 19ICJtAY025314; Mon, 18 Oct 2021 08:38:08 -0400 Received: from ppma06ams.nl.ibm.com (66.31.33a9.ip4.static.sl-reverse.com [169.51.49.102]) by mx0b-001b2d01.pphosted.com with ESMTP id 3bs419f0gt-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 18 Oct 2021 08:38:08 -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 19ICbSvM021858; Mon, 18 Oct 2021 12:38:06 GMT Received: from b06avi18878370.portsmouth.uk.ibm.com (b06avi18878370.portsmouth.uk.ibm.com [9.149.26.194]) by ppma06ams.nl.ibm.com with ESMTP id 3bqp0je844-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 18 Oct 2021 12:38:06 +0000 Received: from d06av21.portsmouth.uk.ibm.com (d06av21.portsmouth.uk.ibm.com [9.149.105.232]) by b06avi18878370.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 19ICWEJH34931094 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 18 Oct 2021 12:32:14 GMT Received: from d06av21.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 260865204E; Mon, 18 Oct 2021 12:38:03 +0000 (GMT) Received: from localhost.localdomain.com (unknown [9.145.80.123]) by d06av21.portsmouth.uk.ibm.com (Postfix) with ESMTP id ABE1552063; Mon, 18 Oct 2021 12:38:02 +0000 (GMT) From: Janosch Frank To: pbonzini@redhat.com Cc: kvm@vger.kernel.org, frankja@linux.ibm.com, david@redhat.com, borntraeger@de.ibm.com, linux-s390@vger.kernel.org, imbrenda@linux.ibm.com, thuth@redhat.com Subject: [kvm-unit-tests GIT PULL 10/17] lib: s390x: Add access key argument to tprot Date: Mon, 18 Oct 2021 14:26:28 +0200 Message-Id: <20211018122635.53614-11-frankja@linux.ibm.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211018122635.53614-1-frankja@linux.ibm.com> References: <20211018122635.53614-1-frankja@linux.ibm.com> X-TM-AS-GCONF: 00 X-Proofpoint-GUID: rd2CX5PLFSHRTgxKtEkNHXgE2k8xz9gW X-Proofpoint-ORIG-GUID: NFLXvBgYdg5SPJB4zLT8yCs4HyjW22eA X-Proofpoint-UnRewURL: 0 URL was un-rewritten MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.182.1,Aquarius:18.0.790,Hydra:6.0.425,FMLib:17.0.607.475 definitions=2021-10-18_05,2021-10-14_02,2020-04-07_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 impostorscore=0 bulkscore=0 adultscore=0 priorityscore=1501 mlxscore=0 mlxlogscore=883 suspectscore=0 phishscore=0 spamscore=0 lowpriorityscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2109230001 definitions=main-2110180077 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org From: Janis Schoetterl-Glausch Currently there is only one callee passing a non zero key, but having the argument will be useful in the future. Signed-off-by: Janis Schoetterl-Glausch Reviewed-by: Thomas Huth Link: https://lore.kernel.org/kvm/20211007085027.13050-1-frankja@linux.ibm.com/T/#md3064e13e876e0418a16f0d5a5bd9a6f2adebfd9 Signed-off-by: Janosch Frank --- lib/s390x/asm/arch_def.h | 6 +++--- lib/s390x/sclp.c | 2 +- s390x/skrf.c | 3 +-- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/lib/s390x/asm/arch_def.h b/lib/s390x/asm/arch_def.h index c8d2722a..b34aa792 100644 --- a/lib/s390x/asm/arch_def.h +++ b/lib/s390x/asm/arch_def.h @@ -233,15 +233,15 @@ static inline uint16_t get_machine_id(void) return cpuid; } -static inline int tprot(unsigned long addr) +static inline int tprot(unsigned long addr, char access_key) { int cc; asm volatile( - " tprot 0(%1),0\n" + " tprot 0(%1),0(%2)\n" " ipm %0\n" " srl %0,28\n" - : "=d" (cc) : "a" (addr) : "cc"); + : "=d" (cc) : "a" (addr), "a" (access_key << 4) : "cc"); return cc; } diff --git a/lib/s390x/sclp.c b/lib/s390x/sclp.c index 9502d161..02722498 100644 --- a/lib/s390x/sclp.c +++ b/lib/s390x/sclp.c @@ -217,7 +217,7 @@ void sclp_memory_setup(void) /* probe for r/w memory up to max memory size */ while (ram_size < max_ram_size) { expect_pgm_int(); - cc = tprot(ram_size + storage_increment_size - 1); + cc = tprot(ram_size + storage_increment_size - 1, 0); /* stop once we receive an exception or have protected memory */ if (clear_pgm_int() || cc != 0) break; diff --git a/s390x/skrf.c b/s390x/skrf.c index 8ca7588c..ca4efbf1 100644 --- a/s390x/skrf.c +++ b/s390x/skrf.c @@ -103,8 +103,7 @@ static void test_tprot(void) { report_prefix_push("tprot"); expect_pgm_int(); - asm volatile("tprot %[addr],0xf0(0)\n" - : : [addr] "a" (pagebuf) : ); + tprot((unsigned long)pagebuf, 0xf); check_pgm_int_code(PGM_INT_CODE_SPECIAL_OPERATION); report_prefix_pop(); } From patchwork Mon Oct 18 12:26:29 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Janosch Frank X-Patchwork-Id: 12566343 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1F005C433FE for ; Mon, 18 Oct 2021 12:38:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 09C1A60FC3 for ; Mon, 18 Oct 2021 12:38:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231707AbhJRMk2 (ORCPT ); Mon, 18 Oct 2021 08:40:28 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:17366 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230005AbhJRMkV (ORCPT ); Mon, 18 Oct 2021 08:40:21 -0400 Received: from pps.filterd (m0187473.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 19IC4Ch2036401; Mon, 18 Oct 2021 08:38:10 -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=qnSFYnhApDvGyENxESacVm+B7w0dKNnHNHJV+5YEEwU=; b=bd9ZijvdNJJwyjDLZ/Hwr/lOdU/N5ddoPyzQ4/nG5j2EjXivfD4XeXt5aDeRX0+9oxpF rhWClJmbNQ9GpXVX5PbqbKPojuwf44rsF8Z5iYcesQ/lW8mpSyUEPlYKMrdBok/3l4P1 DdRNbc53hK6ZVq05YnkrPXgWqgFWt1u6L7U2/UC167xCW234PUDX7VSnz39KVBNS5PHX iOr+591d1+UrSLstlzjSh9PLi4Cl58xhpVFPQ0a5dggSDO1hUW++03yRxB+WkyNFMRm5 kiXFOLvTxgZrwWhXqLy3hmW1Xm3C7xMxRa/7EFWdlCKf1yg5arUhX5MYW6hb7TKrEQWS gQ== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 3bryn7uqj5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 18 Oct 2021 08:38:10 -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 19IBJevD035108; Mon, 18 Oct 2021 08:38:09 -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 3bryn7uqh3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 18 Oct 2021 08:38:09 -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 19ICbldW022587; Mon, 18 Oct 2021 12:38:07 GMT Received: from b06avi18878370.portsmouth.uk.ibm.com (b06avi18878370.portsmouth.uk.ibm.com [9.149.26.194]) by ppma03ams.nl.ibm.com with ESMTP id 3bqpc9e5v0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 18 Oct 2021 12:38:07 +0000 Received: from d06av21.portsmouth.uk.ibm.com (d06av21.portsmouth.uk.ibm.com [9.149.105.232]) by b06avi18878370.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 19ICWEHv61604234 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 18 Oct 2021 12:32:14 GMT Received: from d06av21.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B2AEC52051; Mon, 18 Oct 2021 12:38:03 +0000 (GMT) Received: from localhost.localdomain.com (unknown [9.145.80.123]) by d06av21.portsmouth.uk.ibm.com (Postfix) with ESMTP id 39B455204F; Mon, 18 Oct 2021 12:38:03 +0000 (GMT) From: Janosch Frank To: pbonzini@redhat.com Cc: kvm@vger.kernel.org, frankja@linux.ibm.com, david@redhat.com, borntraeger@de.ibm.com, linux-s390@vger.kernel.org, imbrenda@linux.ibm.com, thuth@redhat.com Subject: [kvm-unit-tests GIT PULL 11/17] lib: s390x: Print PGM code as hex Date: Mon, 18 Oct 2021 14:26:29 +0200 Message-Id: <20211018122635.53614-12-frankja@linux.ibm.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211018122635.53614-1-frankja@linux.ibm.com> References: <20211018122635.53614-1-frankja@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: 64sRrGax6vpwnG-ajrwrmhZHO1cpSidB X-Proofpoint-GUID: 4LBwL9rOKm53zum4tuqp1g5-Gcn4FJg1 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.182.1,Aquarius:18.0.790,Hydra:6.0.425,FMLib:17.0.607.475 definitions=2021-10-18_05,2021-10-14_02,2020-04-07_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 phishscore=0 clxscore=1015 impostorscore=0 suspectscore=0 bulkscore=0 mlxlogscore=999 adultscore=0 malwarescore=0 spamscore=0 mlxscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2109230001 definitions=main-2110180077 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org We have them defined as hex constants in lib/s390x/asm/arch_def.h so why not print them as hex values? Signed-off-by: Janosch Frank Reviewed-by: Claudio Imbrenda Reviewed-by: Thomas Huth --- lib/s390x/interrupt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/s390x/interrupt.c b/lib/s390x/interrupt.c index 126d4c0a..27d3b767 100644 --- a/lib/s390x/interrupt.c +++ b/lib/s390x/interrupt.c @@ -169,7 +169,7 @@ static void print_pgm_info(struct stack_frame_int *stack) lc->pgm_old_psw.addr <= (uintptr_t)sie_exit); printf("\n"); - printf("Unexpected program interrupt %s: %d on cpu %d at %#lx, ilen %d\n", + printf("Unexpected program interrupt %s: %#x on cpu %d at %#lx, ilen %d\n", in_sie ? "in SIE" : "", lc->pgm_int_code, stap(), lc->pgm_old_psw.addr, lc->pgm_int_id); print_int_regs(stack); From patchwork Mon Oct 18 12:26:30 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Janosch Frank X-Patchwork-Id: 12566345 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 47511C433EF for ; Mon, 18 Oct 2021 12:38:19 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 29C0F60FD9 for ; Mon, 18 Oct 2021 12:38:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231839AbhJRMk3 (ORCPT ); Mon, 18 Oct 2021 08:40:29 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:5326 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S231749AbhJRMkW (ORCPT ); Mon, 18 Oct 2021 08:40:22 -0400 Received: from pps.filterd (m0098419.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 19ICAUco020629; Mon, 18 Oct 2021 08:38:10 -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=rzmIAsRGWANLESeNOuqGr3vOeFcYlHGEruLEF2uciFM=; b=RVO5d29v2KHA7vcP35sZFrcVgrF95eZ9++tMzh5mIlTRevoUTPkZCheuK/QmbUkdkCcz bopQd1N0KG2X53KQ89HrturMWjfRSVuoonE34k1LP+d8W/VwXK7p3WZAgngbOrmcSHnM NhTeFGqPvkKB68bnblzG4HvCj7Tt3HbEdlj8SPAVbN5yk91BDVQq9wcYHn+KPoiARKza q2bn1cW5+fgvhMNY5a0LQuF4zY//6spucCbe4g4yu0g6ZH97QWEtbuBXa8Q7cOw1gYHE gIFG+k2VxoHo3sy6xG0YCNswECgTR811Xcqe1WGwgTbNFraupGk3Y72uoNm+kEaCpJsP wA== Received: from pps.reinject (localhost [127.0.0.1]) by mx0b-001b2d01.pphosted.com with ESMTP id 3bs419f0hu-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 18 Oct 2021 08:38:10 -0400 Received: from m0098419.ppops.net (m0098419.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 19IBiwnj024234; Mon, 18 Oct 2021 08:38:10 -0400 Received: from ppma04ams.nl.ibm.com (63.31.33a9.ip4.static.sl-reverse.com [169.51.49.99]) by mx0b-001b2d01.pphosted.com with ESMTP id 3bs419f0hc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 18 Oct 2021 08:38:09 -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 19ICc3NQ000901; Mon, 18 Oct 2021 12:38:08 GMT Received: from b06avi18626390.portsmouth.uk.ibm.com (b06avi18626390.portsmouth.uk.ibm.com [9.149.26.192]) by ppma04ams.nl.ibm.com with ESMTP id 3bqpca670m-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 18 Oct 2021 12:38:08 +0000 Received: from d06av21.portsmouth.uk.ibm.com (d06av21.portsmouth.uk.ibm.com [9.149.105.232]) by b06avi18626390.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 19ICWHp952756808 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 18 Oct 2021 12:32:17 GMT Received: from d06av21.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 35F5E52054; Mon, 18 Oct 2021 12:38:04 +0000 (GMT) Received: from localhost.localdomain.com (unknown [9.145.80.123]) by d06av21.portsmouth.uk.ibm.com (Postfix) with ESMTP id BA4455204E; Mon, 18 Oct 2021 12:38:03 +0000 (GMT) From: Janosch Frank To: pbonzini@redhat.com Cc: kvm@vger.kernel.org, frankja@linux.ibm.com, david@redhat.com, borntraeger@de.ibm.com, linux-s390@vger.kernel.org, imbrenda@linux.ibm.com, thuth@redhat.com Subject: [kvm-unit-tests GIT PULL 12/17] s390x: Add sthyi cc==0 r2+1 verification Date: Mon, 18 Oct 2021 14:26:30 +0200 Message-Id: <20211018122635.53614-13-frankja@linux.ibm.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211018122635.53614-1-frankja@linux.ibm.com> References: <20211018122635.53614-1-frankja@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: f9qORYkQfa9-X9M94t_keyeqhr5xS0Zm X-Proofpoint-ORIG-GUID: oxLltkpn1WHIWZyUvfgR5h5qzcZNQ9Y5 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.182.1,Aquarius:18.0.790,Hydra:6.0.425,FMLib:17.0.607.475 definitions=2021-10-18_05,2021-10-14_02,2020-04-07_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 impostorscore=0 bulkscore=0 adultscore=0 priorityscore=1501 mlxscore=0 mlxlogscore=999 suspectscore=0 phishscore=0 spamscore=0 lowpriorityscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2109230001 definitions=main-2110180077 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org On success r2 + 1 should be 0, let's also check for that. Signed-off-by: Janosch Frank Reviewed-by: Claudio Imbrenda Reviewed-by: Thomas Huth --- s390x/sthyi.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/s390x/sthyi.c b/s390x/sthyi.c index db90b56f..11487a0e 100644 --- a/s390x/sthyi.c +++ b/s390x/sthyi.c @@ -24,16 +24,16 @@ static inline int sthyi(uint64_t vaddr, uint64_t fcode, uint64_t *rc, { register uint64_t code asm("0") = fcode; register uint64_t addr asm("2") = vaddr; - register uint64_t rc3 asm("3") = 0; + register uint64_t rc3 asm("3") = 42; int cc = 0; - asm volatile(".insn rre,0xB2560000,%[r1],%[r2]\n" - "ipm %[cc]\n" - "srl %[cc],28\n" - : [cc] "=d" (cc) - : [code] "d" (code), [addr] "a" (addr), [r1] "i" (r1), - [r2] "i" (r2) - : "memory", "cc", "r3"); + asm volatile( + ".insn rre,0xB2560000,%[r1],%[r2]\n" + "ipm %[cc]\n" + "srl %[cc],28\n" + : [cc] "=d" (cc), "+d" (rc3) + : [code] "d" (code), [addr] "a" (addr), [r1] "i" (r1), [r2] "i" (r2) + : "memory", "cc"); if (rc) *rc = rc3; return cc; @@ -139,16 +139,19 @@ static void test_fcode0(void) struct sthyi_hdr_sctn *hdr; struct sthyi_mach_sctn *mach; struct sthyi_par_sctn *par; + uint64_t rc = 42; + int cc; /* Zero destination memory. */ memset(pagebuf, 0, PAGE_SIZE); report_prefix_push("fcode 0"); - sthyi((uint64_t)pagebuf, 0, NULL, 0, 2); + cc = sthyi((uint64_t)pagebuf, 0, &rc, 0, 2); hdr = (void *)pagebuf; mach = (void *)pagebuf + hdr->INFMOFF; par = (void *)pagebuf + hdr->INFPOFF; + report(cc == 0 && rc == CODE_SUCCES, "r2 + 1 == 0"); test_fcode0_hdr(hdr); test_fcode0_mach(mach); test_fcode0_par(par); From patchwork Mon Oct 18 12:26:31 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Janosch Frank X-Patchwork-Id: 12566347 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 20C30C433FE for ; Mon, 18 Oct 2021 12:38:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0E31160EE9 for ; Mon, 18 Oct 2021 12:38:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231846AbhJRMka (ORCPT ); Mon, 18 Oct 2021 08:40:30 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:37760 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231645AbhJRMkW (ORCPT ); Mon, 18 Oct 2021 08:40:22 -0400 Received: from pps.filterd (m0098393.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 19ICTspu017280; Mon, 18 Oct 2021 08:38:11 -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=IiS8SOT8NJ5OMIx6ImTwxwAuxVdhpzVgESECbuVx5K8=; b=lOHs+U7zXChPIeilXnzx9nms7iJDVOagNomptJZXVRI1xEckOrEp0alSuxXJUCAWTeoU JJo3u8R1An6vd+qJTQebddpaN7urQSKPBSluRryiJd0ly5hM8WVinoIAq9pSpsP2r5Ko USHqsMMo6m2ik0NhXWz3xZnWNArF5uGW3rq1G/pxeU0wKTGlvE0oiFwYBL43/+wsCraf IIDiRPLboQ5l9UdzxaGLZW4ZhnCJFZSJ2zIguSU6FWs3Q5o7ffni5hrniuGmndeJcK9r mhjGV8YkLN4hBy/ZxHzl2Ta11FThpG/1FbgRuu2T7giNss+dWaX97ZJZE2K4JwGcFZe2 iA== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 3bs6np3buf-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 18 Oct 2021 08:38:11 -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 19ICIXuK012173; Mon, 18 Oct 2021 08:38:10 -0400 Received: from ppma02fra.de.ibm.com (47.49.7a9f.ip4.static.sl-reverse.com [159.122.73.71]) by mx0a-001b2d01.pphosted.com with ESMTP id 3bs6np3btp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 18 Oct 2021 08:38:10 -0400 Received: from pps.filterd (ppma02fra.de.ibm.com [127.0.0.1]) by ppma02fra.de.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 19ICc0YY024823; Mon, 18 Oct 2021 12:38:08 GMT Received: from b06avi18626390.portsmouth.uk.ibm.com (b06avi18626390.portsmouth.uk.ibm.com [9.149.26.192]) by ppma02fra.de.ibm.com with ESMTP id 3bqpc9cx3w-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 18 Oct 2021 12:38:08 +0000 Received: from d06av21.portsmouth.uk.ibm.com (d06av21.portsmouth.uk.ibm.com [9.149.105.232]) by b06avi18626390.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 19ICWIaU59441542 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 18 Oct 2021 12:32:18 GMT Received: from d06av21.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B0B5152052; Mon, 18 Oct 2021 12:38:04 +0000 (GMT) Received: from localhost.localdomain.com (unknown [9.145.80.123]) by d06av21.portsmouth.uk.ibm.com (Postfix) with ESMTP id 3F9B65205F; Mon, 18 Oct 2021 12:38:04 +0000 (GMT) From: Janosch Frank To: pbonzini@redhat.com Cc: kvm@vger.kernel.org, frankja@linux.ibm.com, david@redhat.com, borntraeger@de.ibm.com, linux-s390@vger.kernel.org, imbrenda@linux.ibm.com, thuth@redhat.com Subject: [kvm-unit-tests GIT PULL 13/17] s390x: snippets: Set stackptr and stacktop in cstart.S Date: Mon, 18 Oct 2021 14:26:31 +0200 Message-Id: <20211018122635.53614-14-frankja@linux.ibm.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211018122635.53614-1-frankja@linux.ibm.com> References: <20211018122635.53614-1-frankja@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: CBr2GZ_TwOvd4vpC4WjrsdSn95ftC6BG X-Proofpoint-ORIG-GUID: YPWlQyNAhWtEJr1YbQqSO1aJ0p_nJOxc X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.182.1,Aquarius:18.0.790,Hydra:6.0.425,FMLib:17.0.607.475 definitions=2021-10-18_03,2021-10-14_02,2020-04-07_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 mlxlogscore=999 adultscore=0 bulkscore=0 lowpriorityscore=0 spamscore=0 phishscore=0 impostorscore=0 suspectscore=0 malwarescore=0 priorityscore=1501 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2109230001 definitions=main-2110180075 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org We have a stack, so why not define it and be a step closer to include the lib into the snippets. Signed-off-by: Janosch Frank Reviewed-by: Thomas Huth --- s390x/snippets/c/cstart.S | 2 +- s390x/snippets/c/flat.lds | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/s390x/snippets/c/cstart.S b/s390x/snippets/c/cstart.S index a1754808..031a6b83 100644 --- a/s390x/snippets/c/cstart.S +++ b/s390x/snippets/c/cstart.S @@ -17,7 +17,7 @@ start: xgr \i,\i .endr /* 0x3000 is the stack page for now */ - lghi %r15, 0x4000 - 160 + lghi %r15, stackptr sam64 brasl %r14, main /* For now let's only use cpu 0 in snippets so this will always work. */ diff --git a/s390x/snippets/c/flat.lds b/s390x/snippets/c/flat.lds index ce3bfd69..59974b38 100644 --- a/s390x/snippets/c/flat.lds +++ b/s390x/snippets/c/flat.lds @@ -15,6 +15,8 @@ SECTIONS QUAD(0x0000000000004000) } . = 0x4000; + stackptr = . - 160; + stacktop = .; .text : { *(.init) *(.text) From patchwork Mon Oct 18 12:26:32 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Janosch Frank X-Patchwork-Id: 12566355 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id AFC1BC433FE for ; Mon, 18 Oct 2021 12:38:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9C99560FD9 for ; Mon, 18 Oct 2021 12:38:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231495AbhJRMkg (ORCPT ); Mon, 18 Oct 2021 08:40:36 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:59300 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231771AbhJRMkZ (ORCPT ); Mon, 18 Oct 2021 08:40:25 -0400 Received: from pps.filterd (m0098409.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 19IBKZ3P029696; Mon, 18 Oct 2021 08:38:14 -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 : content-transfer-encoding : mime-version; s=pp1; bh=5w2/1GBoeDZXtFc3D2iqTwBu21W7bbsct6X61+eUiQk=; b=MfbJy4ZYUaf644edpeHSfemzz+BXEgyn/KD+iTOq0h8zv7Dw8IA9bWiMAz3g+cIMSkam 87J5wmSEWP1jEpGnlmFmkz9seihtW14YPtojE2Ck4HgvUEvy3bOl0RBXfrrL/fmA2fof vp8GSF7lut5iOjuEmiX8UDNYy6e0UISXPEZvHKhqlZy1wM1+yZKfudOUDV9nDCh8a/TB Me9mKa07cWaEIa3jVS+ujwfK2v6gzjw5rEL8ohFUatygybpfrOTHMVZqKprm7i7PLcfc ELJljbZIPXAVWXrKSdZqOF57x8Mj/IGOmUwu+SHGH1Y9JYXztHES+qoUfqcHUH+mvReV 5A== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 3bs7yg1mbq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 18 Oct 2021 08:38:14 -0400 Received: from m0098409.ppops.net (m0098409.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 19ICc6vo015870; Mon, 18 Oct 2021 08:38:13 -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 3bs7yg1ma1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 18 Oct 2021 08:38:13 -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 19ICbTIx021866; Mon, 18 Oct 2021 12:38:08 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 3bqp0je84k-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 18 Oct 2021 12:38:08 +0000 Received: from d06av21.portsmouth.uk.ibm.com (d06av21.portsmouth.uk.ibm.com [9.149.105.232]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 19ICc5kq45482338 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 18 Oct 2021 12:38:05 GMT Received: from d06av21.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 3BB3F5204E; Mon, 18 Oct 2021 12:38:05 +0000 (GMT) Received: from localhost.localdomain.com (unknown [9.145.80.123]) by d06av21.portsmouth.uk.ibm.com (Postfix) with ESMTP id C45B152067; Mon, 18 Oct 2021 12:38:04 +0000 (GMT) From: Janosch Frank To: pbonzini@redhat.com Cc: kvm@vger.kernel.org, frankja@linux.ibm.com, david@redhat.com, borntraeger@de.ibm.com, linux-s390@vger.kernel.org, imbrenda@linux.ibm.com, thuth@redhat.com Subject: [kvm-unit-tests GIT PULL 14/17] s390x: snippets: Define all things that are needed to link the libc Date: Mon, 18 Oct 2021 14:26:32 +0200 Message-Id: <20211018122635.53614-15-frankja@linux.ibm.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211018122635.53614-1-frankja@linux.ibm.com> References: <20211018122635.53614-1-frankja@linux.ibm.com> X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: -RanaH08MAqePzy9yWbxJiVQq5-e5hy5 X-Proofpoint-GUID: R48UtSlSW4jmcsZ_cP_hy7SV_7BIBAuL X-Proofpoint-UnRewURL: 0 URL was un-rewritten MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.182.1,Aquarius:18.0.790,Hydra:6.0.425,FMLib:17.0.607.475 definitions=2021-10-18_05,2021-10-14_02,2020-04-07_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 mlxlogscore=999 mlxscore=0 suspectscore=0 lowpriorityscore=0 bulkscore=0 phishscore=0 impostorscore=0 priorityscore=1501 clxscore=1015 adultscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2109230001 definitions=main-2110180077 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org From: Thomas Huth In the long run, we want to use parts of the libc like memset() etc., too. However, to be able to link it correctly, we have to provide some stub functions like puts() and exit() to avoid that too much other stuff from the lib folder gets pulled into the binaries, which we cannot provide in the snippets (like the sclp support). Signed-off-by: Thomas Huth Message-Id: <20211008092649.959956-1-thuth@redhat.com> Link: https://lore.kernel.org/kvm/20211008092649.959956-1-thuth@redhat.com/ Reviewed-by: Janosch Frank Signed-off-by: Janosch Frank --- s390x/Makefile | 2 +- s390x/snippets/c/cstart.S | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/s390x/Makefile b/s390x/Makefile index 5d1a33a0..d18b08b0 100644 --- a/s390x/Makefile +++ b/s390x/Makefile @@ -81,7 +81,7 @@ asmlib = $(TEST_DIR)/cstart64.o $(TEST_DIR)/cpu.o FLATLIBS = $(libcflat) SNIPPET_DIR = $(TEST_DIR)/snippets -snippet_asmlib = $(SNIPPET_DIR)/c/cstart.o +snippet_asmlib = $(SNIPPET_DIR)/c/cstart.o lib/auxinfo.o # perquisites (=guests) for the snippet hosts. # $(TEST_DIR)/.elf: snippets = $(SNIPPET_DIR)//.gbin diff --git a/s390x/snippets/c/cstart.S b/s390x/snippets/c/cstart.S index 031a6b83..aaa5380c 100644 --- a/s390x/snippets/c/cstart.S +++ b/s390x/snippets/c/cstart.S @@ -20,6 +20,17 @@ start: lghi %r15, stackptr sam64 brasl %r14, main + /* + * If main() returns, we stop the CPU with the code below. We also + * route some functions that are required by the libc (but not usable + * from snippets) to the CPU stop code below, so that snippets can + * still be linked against the libc code (to use non-related functions + * like memset() etc.) + */ +.global puts +.global exit +puts: +exit: /* For now let's only use cpu 0 in snippets so this will always work. */ xgr %r0, %r0 sigp %r2, %r0, SIGP_STOP From patchwork Mon Oct 18 12:26:33 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Janosch Frank X-Patchwork-Id: 12566349 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4AAC4C433EF for ; Mon, 18 Oct 2021 12:38:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 38B0060FD9 for ; Mon, 18 Oct 2021 12:38:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231761AbhJRMkb (ORCPT ); Mon, 18 Oct 2021 08:40:31 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:31206 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231768AbhJRMkX (ORCPT ); Mon, 18 Oct 2021 08:40:23 -0400 Received: from pps.filterd (m0098410.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 19ICMnXY000564; Mon, 18 Oct 2021 08:38:12 -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=4qwWhUj8XEFvOK3UOB/YNH34WGITsov9c7Vz2xEHNtk=; b=MC7L+9TI/rjGCSeNx5+i8TewRYLsMtngeUn+g+nnt7fduLBgdodgLirkgu6OAyof35dJ dWn38H2uBwKeepnv+To1RRN6RkEQ/kG3rsEx6aBiidAW5SUo2JH77uK/FrcDkFJe3yYp xe59CLKWGSdf2wRAIF3DUpddOHbwr7rKgt0UsAKwIEk84fCI+xeEmlb+UH/dXpBODeX0 P3yX6T7MbSfnosRU2bcNpygvDGrz33f9uw3P2UWEX5dpfRT01QkgOHjdF6yDym8Z/aw1 p5wpsFPeGrgD2Y7tZ5zehDWrMqH29CrFZGkRQjO5jx45awr6SsiQxdh5iuXPAOJITs9M gw== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 3bs8vkr9gj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 18 Oct 2021 08:38:11 -0400 Received: from m0098410.ppops.net (m0098410.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 19ICQXm0012132; Mon, 18 Oct 2021 08:38:11 -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 3bs8vkr9fs-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 18 Oct 2021 08:38:11 -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 19ICbmW9022613; Mon, 18 Oct 2021 12:38:09 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 3bqpc9e5vv-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 18 Oct 2021 12:38:09 +0000 Received: from d06av21.portsmouth.uk.ibm.com (d06av21.portsmouth.uk.ibm.com [9.149.105.232]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 19ICc5p240632588 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 18 Oct 2021 12:38:06 GMT Received: from d06av21.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id C684C5205A; Mon, 18 Oct 2021 12:38:05 +0000 (GMT) Received: from localhost.localdomain.com (unknown [9.145.80.123]) by d06av21.portsmouth.uk.ibm.com (Postfix) with ESMTP id 5022352077; Mon, 18 Oct 2021 12:38:05 +0000 (GMT) From: Janosch Frank To: pbonzini@redhat.com Cc: kvm@vger.kernel.org, frankja@linux.ibm.com, david@redhat.com, borntraeger@de.ibm.com, linux-s390@vger.kernel.org, imbrenda@linux.ibm.com, thuth@redhat.com Subject: [kvm-unit-tests GIT PULL 15/17] lib: s390x: Fix PSW constant Date: Mon, 18 Oct 2021 14:26:33 +0200 Message-Id: <20211018122635.53614-16-frankja@linux.ibm.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211018122635.53614-1-frankja@linux.ibm.com> References: <20211018122635.53614-1-frankja@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: grwO4XQf6u7GYGN5phwWU_1OyQz65SiC X-Proofpoint-ORIG-GUID: 8t_YEpITIOttbOKP2ECa_DaFOBHJxzIs X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.182.1,Aquarius:18.0.790,Hydra:6.0.425,FMLib:17.0.607.475 definitions=2021-10-18_05,2021-10-14_02,2020-04-07_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 mlxlogscore=867 bulkscore=0 clxscore=1015 suspectscore=0 adultscore=0 phishscore=0 mlxscore=0 spamscore=0 lowpriorityscore=0 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2109230001 definitions=main-2110180075 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org Somehow the ";" got into that patch and now complicates compilation. Let's remove it and put the constant in braces. Signed-off-by: Janosch Frank Reviewed-by: Claudio Imbrenda Reviewed-by: Thomas Huth --- lib/s390x/asm/arch_def.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/s390x/asm/arch_def.h b/lib/s390x/asm/arch_def.h index b34aa792..40626d72 100644 --- a/lib/s390x/asm/arch_def.h +++ b/lib/s390x/asm/arch_def.h @@ -53,7 +53,7 @@ struct psw { #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 PSW_MASK_64 (PSW_MASK_BA | PSW_MASK_EA) #define CTL0_LOW_ADDR_PROT (63 - 35) #define CTL0_EDAT (63 - 40) From patchwork Mon Oct 18 12:26:34 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Janosch Frank X-Patchwork-Id: 12566351 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 249A1C433FE for ; Mon, 18 Oct 2021 12:38:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0F2AC60FD9 for ; Mon, 18 Oct 2021 12:38:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231873AbhJRMkc (ORCPT ); Mon, 18 Oct 2021 08:40:32 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:7770 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231774AbhJRMkX (ORCPT ); Mon, 18 Oct 2021 08:40:23 -0400 Received: from pps.filterd (m0098394.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 19ICINTX005992; Mon, 18 Oct 2021 08:38:12 -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=rk3Dh9GVoFD6oyJPdjESikhaO1+FeVZe/Bo/O7xyBYA=; b=mzmE7WHOr34umRFpJG70jeYbKa8GN2A6tN0QvJm20lCF7LqA/nmUIQvNNWZvfsH1hFn6 iHdYCwME9kz6Heb9OHLb2knKynypdopX/pK4TfmB4zVCgiPEtvg3/yDUnn18oeoJpjef bZBQ4QLgsbOnIebD/vlSJKqfTsHpbez3es8KXwEmXLcbzlHX0cRf9/j9GbVcHjE2EAQ7 pxyIK4P2yBahNVMabzHSuZfMeJgmEe/6+ZucHlD6UuTTnXLgHyHQmloKRGsMmHE9k7Ej MjhnFKK+QRcAtrYkSBGNEEh0Ji3LiYZK/yx0LodNYGMrO/8GQJ+gh9uPNkbVNvICESdC vg== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 3bs2n8gj6v-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 18 Oct 2021 08:38:12 -0400 Received: from m0098394.ppops.net (m0098394.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 19IBvWdY003311; Mon, 18 Oct 2021 08:38:12 -0400 Received: from ppma02fra.de.ibm.com (47.49.7a9f.ip4.static.sl-reverse.com [159.122.73.71]) by mx0a-001b2d01.pphosted.com with ESMTP id 3bs2n8gj61-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 18 Oct 2021 08:38:11 -0400 Received: from pps.filterd (ppma02fra.de.ibm.com [127.0.0.1]) by ppma02fra.de.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 19ICc1LS024837; Mon, 18 Oct 2021 12:38:09 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 3bqpc9cx4g-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 18 Oct 2021 12:38:09 +0000 Received: from d06av21.portsmouth.uk.ibm.com (d06av21.portsmouth.uk.ibm.com [9.149.105.232]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 19ICc6WF5505654 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 18 Oct 2021 12:38:06 GMT Received: from d06av21.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 5392452057; Mon, 18 Oct 2021 12:38:06 +0000 (GMT) Received: from localhost.localdomain.com (unknown [9.145.80.123]) by d06av21.portsmouth.uk.ibm.com (Postfix) with ESMTP id D9BB652054; Mon, 18 Oct 2021 12:38:05 +0000 (GMT) From: Janosch Frank To: pbonzini@redhat.com Cc: kvm@vger.kernel.org, frankja@linux.ibm.com, david@redhat.com, borntraeger@de.ibm.com, linux-s390@vger.kernel.org, imbrenda@linux.ibm.com, thuth@redhat.com Subject: [kvm-unit-tests GIT PULL 16/17] lib: s390x: snippet.h: Add a few constants that will make our life easier Date: Mon, 18 Oct 2021 14:26:34 +0200 Message-Id: <20211018122635.53614-17-frankja@linux.ibm.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211018122635.53614-1-frankja@linux.ibm.com> References: <20211018122635.53614-1-frankja@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: GHw23U_S2Tn2DFykAA9bMAR4cz710ROm X-Proofpoint-ORIG-GUID: UBGVXfhsokF5Aqthy_D_R0D5OOVR-1Uh X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.182.1,Aquarius:18.0.790,Hydra:6.0.425,FMLib:17.0.607.475 definitions=2021-10-18_05,2021-10-14_02,2020-04-07_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 mlxlogscore=999 suspectscore=0 impostorscore=0 priorityscore=1501 spamscore=0 malwarescore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 adultscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2109230001 definitions=main-2110180077 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org The variable names for the snippet objects are of gigantic length so let's define a few macros to make them easier to read. Also add a standard PSW which should be used to start the snippet. Signed-off-by: Janosch Frank Reviewed-by: Claudio Imbrenda Reviewed-by: Thomas Huth --- lib/s390x/snippet.h | 34 ++++++++++++++++++++++++++++++++++ s390x/mvpg-sie.c | 13 ++++++------- 2 files changed, 40 insertions(+), 7 deletions(-) create mode 100644 lib/s390x/snippet.h diff --git a/lib/s390x/snippet.h b/lib/s390x/snippet.h new file mode 100644 index 00000000..8e4765f8 --- /dev/null +++ b/lib/s390x/snippet.h @@ -0,0 +1,34 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* + * Snippet definitions + * + * Copyright IBM Corp. 2021 + * Author: Janosch Frank + */ + +#ifndef _S390X_SNIPPET_H_ +#define _S390X_SNIPPET_H_ + +/* This macro cuts down the length of the pointers to snippets */ +#define SNIPPET_NAME_START(type, file) \ + _binary_s390x_snippets_##type##_##file##_gbin_start +#define SNIPPET_NAME_END(type, file) \ + _binary_s390x_snippets_##type##_##file##_gbin_end + +/* Returns the length of the snippet */ +#define SNIPPET_LEN(type, file) \ + ((uintptr_t)SNIPPET_NAME_END(type, file) - (uintptr_t)SNIPPET_NAME_START(type, file)) + +/* + * C snippet instructions start at 0x4000 due to the prefix and the + * stack being before that. ASM snippets don't strictly need a stack + * but keeping the starting address the same means less code. + */ +#define SNIPPET_ENTRY_ADDR 0x4000 + +/* Standard entry PSWs for snippets which can simply be copied into the guest PSW */ +static const struct psw snippet_psw = { + .mask = PSW_MASK_64, + .addr = SNIPPET_ENTRY_ADDR, +}; +#endif diff --git a/s390x/mvpg-sie.c b/s390x/mvpg-sie.c index 5adcec1e..d526069d 100644 --- a/s390x/mvpg-sie.c +++ b/s390x/mvpg-sie.c @@ -19,6 +19,7 @@ #include #include #include +#include static u8 *guest; static struct vm vm; @@ -27,8 +28,8 @@ static uint8_t *src; static uint8_t *dst; static uint8_t *cmp; -extern const char _binary_s390x_snippets_c_mvpg_snippet_gbin_start[]; -extern const char _binary_s390x_snippets_c_mvpg_snippet_gbin_end[]; +extern const char SNIPPET_NAME_START(c, mvpg_snippet)[]; +extern const char SNIPPET_NAME_END(c, mvpg_snippet)[]; int binary_size; static void test_mvpg_pei(void) @@ -77,10 +78,9 @@ static void test_mvpg_pei(void) static void test_mvpg(void) { - int binary_size = ((uintptr_t)_binary_s390x_snippets_c_mvpg_snippet_gbin_end - - (uintptr_t)_binary_s390x_snippets_c_mvpg_snippet_gbin_start); + int binary_size = SNIPPET_LEN(c, mvpg_snippet); - memcpy(guest, _binary_s390x_snippets_c_mvpg_snippet_gbin_start, binary_size); + memcpy(guest, SNIPPET_NAME_START(c, mvpg_snippet), binary_size); memset(src, 0x42, PAGE_SIZE); memset(dst, 0x43, PAGE_SIZE); sie(&vm); @@ -96,8 +96,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 = PSW_MASK_64; + vm.sblk->gpsw = snippet_psw; vm.sblk->ictl = ICTL_OPEREXC | ICTL_PINT; /* Enable MVPG interpretation as we want to test KVM and not ourselves */ vm.sblk->eca = ECA_MVPGI; From patchwork Mon Oct 18 12:26:35 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Janosch Frank X-Patchwork-Id: 12566353 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 60D2DC433EF for ; Mon, 18 Oct 2021 12:38:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 48FE860FDA for ; Mon, 18 Oct 2021 12:38:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231898AbhJRMke (ORCPT ); Mon, 18 Oct 2021 08:40:34 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:21110 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S231760AbhJRMkY (ORCPT ); Mon, 18 Oct 2021 08:40:24 -0400 Received: from pps.filterd (m0098420.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 19IBkbnk022925; Mon, 18 Oct 2021 08:38:12 -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=PelIzxrY05n41vhqsG9wQC1az5eex47tqnRbgFz0j0Y=; b=WeRlDWwjzmfvKVLldv4VhYifofnEzsfS2eJqUaPrYcveN2EjuemBivv39BkAHCPHG2K3 /86TA/zPNXR7T/iqZQnmQ9qRR2nLxuwQWjY2wi+PCxs9c0ZgASMW1oIJMV8Zlrmnrava K6dF4B3wc0JJa2Xpb91LUq7Ib7hs5XHsqPkU8a8Bw76U09kBILD6SxJyJ6F5mVhj85ok Dc+SBSTOOAhrFUmnQZ5s8ilYkcOgBWhaTcBZS3Q3rJ/KYByzj8pAK7B+RFQPoy1VcB39 K7EwKh3HBuZd7gHluaJz1qED0kI6OMePQ6SOAwfM05eJau0bmuWEhkPmmHtZh+/NDOmX Xw== Received: from pps.reinject (localhost [127.0.0.1]) by mx0b-001b2d01.pphosted.com with ESMTP id 3bs8bp92g0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 18 Oct 2021 08:38:12 -0400 Received: from m0098420.ppops.net (m0098420.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 19ICYVc2003775; Mon, 18 Oct 2021 08:38:12 -0400 Received: from ppma06fra.de.ibm.com (48.49.7a9f.ip4.static.sl-reverse.com [159.122.73.72]) by mx0b-001b2d01.pphosted.com with ESMTP id 3bs8bp92fj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 18 Oct 2021 08:38:12 -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 19ICc8TI022610; Mon, 18 Oct 2021 12:38:10 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 3bqp0jn114-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 18 Oct 2021 12:38:10 +0000 Received: from d06av21.portsmouth.uk.ibm.com (d06av21.portsmouth.uk.ibm.com [9.149.105.232]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 19ICc6SR65536306 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 18 Oct 2021 12:38:07 GMT Received: from d06av21.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id CC36752067; Mon, 18 Oct 2021 12:38:06 +0000 (GMT) Received: from localhost.localdomain.com (unknown [9.145.80.123]) by d06av21.portsmouth.uk.ibm.com (Postfix) with ESMTP id 5D83252052; Mon, 18 Oct 2021 12:38:06 +0000 (GMT) From: Janosch Frank To: pbonzini@redhat.com Cc: kvm@vger.kernel.org, frankja@linux.ibm.com, david@redhat.com, borntraeger@de.ibm.com, linux-s390@vger.kernel.org, imbrenda@linux.ibm.com, thuth@redhat.com Subject: [kvm-unit-tests GIT PULL 17/17] lib: s390x: Fix copyright message Date: Mon, 18 Oct 2021 14:26:35 +0200 Message-Id: <20211018122635.53614-18-frankja@linux.ibm.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211018122635.53614-1-frankja@linux.ibm.com> References: <20211018122635.53614-1-frankja@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: JBRfwqEOqELlWIzN2TuAj5rbRkTvi9-L X-Proofpoint-ORIG-GUID: bNU_D3sSUirU0V88LgYHI85vgIgVZOpU X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.182.1,Aquarius:18.0.790,Hydra:6.0.425,FMLib:17.0.607.475 definitions=2021-10-18_05,2021-10-14_02,2020-04-07_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 phishscore=0 malwarescore=0 spamscore=0 clxscore=1015 suspectscore=0 mlxscore=0 bulkscore=0 adultscore=0 impostorscore=0 priorityscore=1501 mlxlogscore=951 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2109230001 definitions=main-2110180075 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org The comma makes no sense, so let's remove it. Signed-off-by: Janosch Frank Reviewed-by: Claudio Imbrenda --- lib/s390x/css.h | 2 +- lib/s390x/sclp.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/s390x/css.h b/lib/s390x/css.h index d644971f..0db8a281 100644 --- a/lib/s390x/css.h +++ b/lib/s390x/css.h @@ -2,7 +2,7 @@ /* * CSS definitions * - * Copyright IBM, Corp. 2020 + * Copyright IBM Corp. 2020 * Author: Pierre Morel */ diff --git a/lib/s390x/sclp.h b/lib/s390x/sclp.h index 28e526e2..61e9cf51 100644 --- a/lib/s390x/sclp.h +++ b/lib/s390x/sclp.h @@ -6,7 +6,7 @@ * Copyright (c) 2013 Alexander Graf * * and based on the file include/hw/s390x/sclp.h from QEMU - * Copyright IBM, Corp. 2012 + * Copyright IBM Corp. 2012 * Author: Christian Borntraeger */