From patchwork Mon Jan 17 16:59:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Claudio Imbrenda X-Patchwork-Id: 12715588 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 142C8C4332F for ; Mon, 17 Jan 2022 17:00:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241612AbiAQRAU (ORCPT ); Mon, 17 Jan 2022 12:00:20 -0500 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:56638 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241396AbiAQQ75 (ORCPT ); Mon, 17 Jan 2022 11:59:57 -0500 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 20HEEgKf026360 for ; Mon, 17 Jan 2022 16:59:56 GMT 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=08OqX5JAsl6KsSDhDqaMqy3/GIC/UZUUksNTo2A8JzM=; b=WByRXgFqrhFubjE6PyfYprfUcpRFNpTWz2AQ2MytmtTDYldc3JjDzYc/xRNA8BiZu4wC 7gk7jRz5prY+OBI3+o7h881K4GwdRvo4VMQHbQ5jHgO+o+9Msj1tURLfrNSb6ilGv4FD SMgzt30iGVZv0j30cSqi739iwH/fQxp+xv5excFbwkVUfRFhPVvysqrAcdIOjpjZbNj8 HkoA8osEIPc4li7cvJ5c7gLJOiqPxPHGbnEwiYheMNdO6IpWkOpxz1czUgKCuALMu/U/ 7pejtqsvQJz6I7ZzP2FhyCx+Jsg9trIlFTSatOE35m/OnDvh1x0kb//ysOBxldCr5qVZ xw== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 3dn7kcqdbs-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 17 Jan 2022 16:59:56 +0000 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 20HGvPWw009792 for ; Mon, 17 Jan 2022 16:59:56 GMT 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 3dn7kcqdb0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 17 Jan 2022 16:59:56 +0000 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 20HGlC81023004; Mon, 17 Jan 2022 16:59:54 GMT Received: from b06cxnps4075.portsmouth.uk.ibm.com (d06relay12.portsmouth.uk.ibm.com [9.149.109.197]) by ppma06ams.nl.ibm.com with ESMTP id 3dknhj64wa-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 17 Jan 2022 16:59:53 +0000 Received: from b06wcsmtp001.portsmouth.uk.ibm.com (b06wcsmtp001.portsmouth.uk.ibm.com [9.149.105.160]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 20HGxpwi26477002 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 17 Jan 2022 16:59:51 GMT Received: from b06wcsmtp001.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id F238FA4054; Mon, 17 Jan 2022 16:59:50 +0000 (GMT) Received: from b06wcsmtp001.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 9E77DA405F; Mon, 17 Jan 2022 16:59:50 +0000 (GMT) Received: from p-imbrenda.ibmuc.com (unknown [9.145.3.16]) by b06wcsmtp001.portsmouth.uk.ibm.com (Postfix) with ESMTP; Mon, 17 Jan 2022 16:59:50 +0000 (GMT) From: Claudio Imbrenda To: pbonzini@redhat.com Cc: kvm@vger.kernel.org, borntraeger@de.ibm.com, frankja@linux.ibm.com Subject: [kvm-unit-tests GIT PULL 01/13] s390x: snippets: mvpg-snippet: Remove unneeded includes Date: Mon, 17 Jan 2022 17:59:37 +0100 Message-Id: <20220117165949.75964-2-imbrenda@linux.ibm.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220117165949.75964-1-imbrenda@linux.ibm.com> References: <20220117165949.75964-1-imbrenda@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: 0StFmzTck1Iiu53mcHERPq7aZjdrM10I X-Proofpoint-GUID: 5pb0y9arZ7exzjes_1u3XKnBPjUHx2BG X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.816,Hydra:6.0.425,FMLib:17.11.62.513 definitions=2022-01-17_07,2022-01-14_01,2021-12-02_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 priorityscore=1501 mlxscore=0 impostorscore=0 spamscore=0 lowpriorityscore=0 suspectscore=0 clxscore=1015 mlxlogscore=808 adultscore=0 bulkscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2110150000 definitions=main-2201170104 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org From: Janosch Frank None of those headers is used, let's remove them. Signed-off-by: Janosch Frank Signed-off-by: Claudio Imbrenda --- s390x/snippets/c/mvpg-snippet.c | 1 - 1 file changed, 1 deletion(-) diff --git a/s390x/snippets/c/mvpg-snippet.c b/s390x/snippets/c/mvpg-snippet.c index e55caab4..42e74da5 100644 --- a/s390x/snippets/c/mvpg-snippet.c +++ b/s390x/snippets/c/mvpg-snippet.c @@ -7,7 +7,6 @@ * Authors: * Janosch Frank */ -#include static inline void force_exit(void) { From patchwork Mon Jan 17 16:59:38 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Claudio Imbrenda X-Patchwork-Id: 12715589 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2974EC43219 for ; Mon, 17 Jan 2022 17:00:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241652AbiAQRA1 (ORCPT ); Mon, 17 Jan 2022 12:00:27 -0500 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:16402 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241452AbiAQQ75 (ORCPT ); Mon, 17 Jan 2022 11:59:57 -0500 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 20HFRnV6012283 for ; Mon, 17 Jan 2022 16:59:57 GMT 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=quHvre/C7THZuHLZUH655juP4QVuPMDj/Mv7IIkVQ8I=; b=QkmkU2mveN404DzrBxUcNiJOXNzK/NVa0JZWM87piO+FYy7alj7ucoSxJfkJY5JTCZCD ohB7s9E7If788wPzJPGSu8hTJ1wItQZZQLHvPy4ZePfQ0JjSJ02ydnoxn0ePJ/+XQdUg E0a0hamlBQpQ+ZTWRaUah2ure6fKd1KB08a5BlBt/NLqljj2DJFSrwHXkXqlqj2t6MX4 XY+nJfi+8/SI3YTjlaS0uvllfWOo6xmRNqLUHs17A01ntuf2Z1sSWsx3NtOQ+Wfl/3Z+ QQcQFA4qq8g1mQn7zt+Pgh+EQD21V62+Swy4zZR61GUVTi0C7jwjPkNk5opfKjF6Omfj BA== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 3dnb4bjj8w-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 17 Jan 2022 16:59:57 +0000 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 20HFhNid003396 for ; Mon, 17 Jan 2022 16:59:56 GMT 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 3dnb4bjj88-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 17 Jan 2022 16:59:56 +0000 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 20HGl8th019697; Mon, 17 Jan 2022 16:59:54 GMT Received: from b06cxnps4075.portsmouth.uk.ibm.com (d06relay12.portsmouth.uk.ibm.com [9.149.109.197]) by ppma03ams.nl.ibm.com with ESMTP id 3dknw9e2th-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 17 Jan 2022 16:59:54 +0000 Received: from b06wcsmtp001.portsmouth.uk.ibm.com (b06wcsmtp001.portsmouth.uk.ibm.com [9.149.105.160]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 20HGxpcU26477004 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 17 Jan 2022 16:59:51 GMT Received: from b06wcsmtp001.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 5D0BEA405F; Mon, 17 Jan 2022 16:59:51 +0000 (GMT) Received: from b06wcsmtp001.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 12E2EA405C; Mon, 17 Jan 2022 16:59:51 +0000 (GMT) Received: from p-imbrenda.ibmuc.com (unknown [9.145.3.16]) by b06wcsmtp001.portsmouth.uk.ibm.com (Postfix) with ESMTP; Mon, 17 Jan 2022 16:59:50 +0000 (GMT) From: Claudio Imbrenda To: pbonzini@redhat.com Cc: kvm@vger.kernel.org, borntraeger@de.ibm.com, frankja@linux.ibm.com Subject: [kvm-unit-tests GIT PULL 02/13] lib: s390x: sie: Add sca allocation and freeing Date: Mon, 17 Jan 2022 17:59:38 +0100 Message-Id: <20220117165949.75964-3-imbrenda@linux.ibm.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220117165949.75964-1-imbrenda@linux.ibm.com> References: <20220117165949.75964-1-imbrenda@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: R3GgKAuHDWTuha67OCvLTcFXIekUyqI_ X-Proofpoint-ORIG-GUID: qy_mNy-4sblz551A5tb0yYBiSO5vFoNe X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.816,Hydra:6.0.425,FMLib:17.11.62.513 definitions=2022-01-17_07,2022-01-14_01,2021-12-02_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 mlxlogscore=848 spamscore=0 priorityscore=1501 suspectscore=0 lowpriorityscore=0 phishscore=0 clxscore=1015 malwarescore=0 mlxscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2110150000 definitions=main-2201170104 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org From: Janosch Frank For protected guests we always need a ESCA so let's add functions to create and destroy SCAs on demand. We don't have scheduling and I don't expect multiple VCPU SIE in the next few months so SCA content handling is not added. Signed-off-by: Janosch Frank Reviewed-by: Claudio Imbrenda Signed-off-by: Claudio Imbrenda --- lib/s390x/sie.h | 2 ++ lib/s390x/sie.c | 12 ++++++++++++ 2 files changed, 14 insertions(+) diff --git a/lib/s390x/sie.h b/lib/s390x/sie.h index 7ef7251b..f34e3c80 100644 --- a/lib/s390x/sie.h +++ b/lib/s390x/sie.h @@ -191,6 +191,7 @@ struct vm_save_area { struct vm { struct kvm_s390_sie_block *sblk; struct vm_save_area save_area; + void *sca; /* System Control Area */ uint8_t *crycb; /* Crypto Control Block */ /* Ptr to first guest page */ uint8_t *guest_mem; @@ -203,6 +204,7 @@ void sie(struct vm *vm); void sie_expect_validity(void); void sie_check_validity(uint16_t vir_exp); void sie_handle_validity(struct vm *vm); +void sie_guest_sca_create(struct vm *vm); void sie_guest_create(struct vm *vm, uint64_t guest_mem, uint64_t guest_mem_len); void sie_guest_destroy(struct vm *vm); diff --git a/lib/s390x/sie.c b/lib/s390x/sie.c index b965b314..51d3b94e 100644 --- a/lib/s390x/sie.c +++ b/lib/s390x/sie.c @@ -55,6 +55,16 @@ void sie(struct vm *vm) vm->save_area.guest.grs[15] = vm->sblk->gg15; } +void sie_guest_sca_create(struct vm *vm) +{ + vm->sca = (struct esca_block *)alloc_page(); + + /* Let's start out with one page of ESCA for now */ + vm->sblk->scaoh = ((uint64_t)vm->sca >> 32); + vm->sblk->scaol = (uint64_t)vm->sca & ~0x3fU; + vm->sblk->ecb2 |= ECB2_ESCA; +} + /* Initializes the struct vm members like the SIE control block. */ void sie_guest_create(struct vm *vm, uint64_t guest_mem, uint64_t guest_mem_len) { @@ -80,4 +90,6 @@ void sie_guest_destroy(struct vm *vm) { free_page(vm->crycb); free_page(vm->sblk); + if (vm->sblk->ecb2 & ECB2_ESCA) + free_page(vm->sca); } From patchwork Mon Jan 17 16:59:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Claudio Imbrenda X-Patchwork-Id: 12715596 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DFA37C433FE for ; Mon, 17 Jan 2022 17:00:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241456AbiAQRAi (ORCPT ); Mon, 17 Jan 2022 12:00:38 -0500 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:42944 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S241464AbiAQQ76 (ORCPT ); Mon, 17 Jan 2022 11:59:58 -0500 Received: from pps.filterd (m0098413.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 20HGX2oK015010 for ; Mon, 17 Jan 2022 16:59:58 GMT 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=P/H0MyIfIVUpdvmbF1HicsT4XWPNWrQ+7U3v/fJi0iI=; b=VBf0pylh5nXld7tm/C3q0Bq9KDGbF8MrjXiupgVzYO5w4rgZpvbAzQO1G5jdPCgCnOTy +6zTNjgJt4q+XlXUxUAl2Xl4KcMQmnDFkYSFGyZgfPAu88brtTheT6FIrwjILAIPsz8G I2tPKerdiJBUqBtdAElQQn8v8Tbhycu1940DRYflxaKrPCrInGO8GW+JwW7CdX6xruiT KJ93dazbSkeV3zmy983AqpOpaS+WZU5WNVVwmmuf/BTvGEPnaAHlaAEwypWh925WYCme 3rwSlpK4aRvnnSH7HurPeq1fXirfw39XX/oEssQEXGmXs1794cj3pB8P039aHSJldKr3 vg== Received: from pps.reinject (localhost [127.0.0.1]) by mx0b-001b2d01.pphosted.com with ESMTP id 3dnbjghjr1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 17 Jan 2022 16:59:58 +0000 Received: from m0098413.ppops.net (m0098413.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 20HFx5HJ017600 for ; Mon, 17 Jan 2022 16:59:57 GMT Received: from ppma01fra.de.ibm.com (46.49.7a9f.ip4.static.sl-reverse.com [159.122.73.70]) by mx0b-001b2d01.pphosted.com with ESMTP id 3dnbjghjqg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 17 Jan 2022 16:59:57 +0000 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 20HGkvWX019640; Mon, 17 Jan 2022 16:59:56 GMT Received: from b06cxnps4075.portsmouth.uk.ibm.com (d06relay12.portsmouth.uk.ibm.com [9.149.109.197]) by ppma01fra.de.ibm.com with ESMTP id 3dknw956y5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 17 Jan 2022 16:59:56 +0000 Received: from b06wcsmtp001.portsmouth.uk.ibm.com (b06wcsmtp001.portsmouth.uk.ibm.com [9.149.105.160]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 20HGxp4H26477010 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 17 Jan 2022 16:59:51 GMT Received: from b06wcsmtp001.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id BD4BCA405B; Mon, 17 Jan 2022 16:59:51 +0000 (GMT) Received: from b06wcsmtp001.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 71A4AA405C; Mon, 17 Jan 2022 16:59:51 +0000 (GMT) Received: from p-imbrenda.ibmuc.com (unknown [9.145.3.16]) by b06wcsmtp001.portsmouth.uk.ibm.com (Postfix) with ESMTP; Mon, 17 Jan 2022 16:59:51 +0000 (GMT) From: Claudio Imbrenda To: pbonzini@redhat.com Cc: kvm@vger.kernel.org, borntraeger@de.ibm.com, frankja@linux.ibm.com Subject: [kvm-unit-tests GIT PULL 03/13] s390x: sie: Add PV fields to SIE control block Date: Mon, 17 Jan 2022 17:59:39 +0100 Message-Id: <20220117165949.75964-4-imbrenda@linux.ibm.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220117165949.75964-1-imbrenda@linux.ibm.com> References: <20220117165949.75964-1-imbrenda@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: 1tOYNtEqBBDmoxacGGxDQyHVKxp4S1ms X-Proofpoint-ORIG-GUID: 3ZZ08TL4EcCqswNJWOFGD2AzYAJjAs6L X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.816,Hydra:6.0.425,FMLib:17.11.62.513 definitions=2022-01-17_07,2022-01-14_01,2021-12-02_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxlogscore=999 malwarescore=0 adultscore=0 mlxscore=0 suspectscore=0 bulkscore=0 phishscore=0 priorityscore=1501 impostorscore=0 spamscore=0 lowpriorityscore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2110150000 definitions=main-2201170104 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org From: Janosch Frank We need those fields for format 4 SIE tests (protected VMs). Signed-off-by: Janosch Frank Reviewed-by: Claudio Imbrenda Signed-off-by: Claudio Imbrenda --- lib/s390x/sie.h | 41 ++++++++++++++++++++++++++++++++++------- 1 file changed, 34 insertions(+), 7 deletions(-) diff --git a/lib/s390x/sie.h b/lib/s390x/sie.h index f34e3c80..c6eb6441 100644 --- a/lib/s390x/sie.h +++ b/lib/s390x/sie.h @@ -38,7 +38,13 @@ struct kvm_s390_sie_block { uint8_t reserved08[4]; /* 0x0008 */ #define PROG_IN_SIE (1<<0) uint32_t prog0c; /* 0x000c */ - uint8_t reserved10[16]; /* 0x0010 */ +union { + uint8_t reserved10[16]; /* 0x0010 */ + struct { + uint64_t pv_handle_cpu; + uint64_t pv_handle_config; + }; + }; #define PROG_BLOCK_SIE (1<<0) #define PROG_REQUEST (1<<1) uint32_t prog20; /* 0x0020 */ @@ -87,10 +93,22 @@ struct kvm_s390_sie_block { #define ICPT_PARTEXEC 0x38 #define ICPT_IOINST 0x40 #define ICPT_KSS 0x5c +#define ICPT_INT_ENABLE 0x64 +#define ICPT_PV_INSTR 0x68 +#define ICPT_PV_NOTIFY 0x6c +#define ICPT_PV_PREF 0x70 uint8_t icptcode; /* 0x0050 */ uint8_t icptstatus; /* 0x0051 */ uint16_t ihcpu; /* 0x0052 */ - uint8_t reserved54[2]; /* 0x0054 */ + uint8_t reserved54; /* 0x0054 */ +#define IICTL_CODE_NONE 0x00 +#define IICTL_CODE_MCHK 0x01 +#define IICTL_CODE_EXT 0x02 +#define IICTL_CODE_IO 0x03 +#define IICTL_CODE_RESTART 0x04 +#define IICTL_CODE_SPECIFICATION 0x10 +#define IICTL_CODE_OPERAND 0x11 + uint8_t iictl; /* 0x0055 */ uint16_t ipa; /* 0x0056 */ uint32_t ipb; /* 0x0058 */ uint32_t scaoh; /* 0x005c */ @@ -112,7 +130,7 @@ struct kvm_s390_sie_block { #define ECB3_RI 0x01 uint8_t ecb3; /* 0x0063 */ uint32_t scaol; /* 0x0064 */ - uint8_t reserved68; /* 0x0068 */ + uint8_t sdf; /* 0x0068 */ uint8_t epdx; /* 0x0069 */ uint8_t reserved6a[2]; /* 0x006a */ uint32_t todpr; /* 0x006c */ @@ -128,9 +146,15 @@ struct kvm_s390_sie_block { #define HPID_KVM 0x4 #define HPID_VSIE 0x5 uint8_t hpid; /* 0x00b8 */ - uint8_t reservedb9[11]; /* 0x00b9 */ - uint16_t extcpuaddr; /* 0x00c4 */ - uint16_t eic; /* 0x00c6 */ + uint8_t reservedb9[7]; /* 0x00b9 */ + union { + struct { + uint32_t eiparams; /* 0x00c0 */ + uint16_t extcpuaddr; /* 0x00c4 */ + uint16_t eic; /* 0x00c6 */ + }; + uint64_t mcic; /* 0x00c0 */ + } __attribute__ ((__packed__)); uint32_t reservedc8; /* 0x00c8 */ uint16_t pgmilc; /* 0x00cc */ uint16_t iprcc; /* 0x00ce */ @@ -152,7 +176,10 @@ struct kvm_s390_sie_block { #define CRYCB_FORMAT2 0x00000003 uint32_t crycbd; /* 0x00fc */ uint64_t gcr[16]; /* 0x0100 */ - uint64_t gbea; /* 0x0180 */ + union { + uint64_t gbea; /* 0x0180 */ + uint64_t sidad; + }; uint8_t reserved188[8]; /* 0x0188 */ uint64_t sdnxo; /* 0x0190 */ uint8_t reserved198[8]; /* 0x0198 */ From patchwork Mon Jan 17 16:59:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Claudio Imbrenda X-Patchwork-Id: 12715593 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 50821C4167D for ; Mon, 17 Jan 2022 17:00:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241710AbiAQRAe (ORCPT ); Mon, 17 Jan 2022 12:00:34 -0500 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:34554 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S241413AbiAQRAB (ORCPT ); Mon, 17 Jan 2022 12:00:01 -0500 Received: from pps.filterd (m0098413.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 20HFwNnt016933 for ; Mon, 17 Jan 2022 17:00:00 GMT 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=DuqlgOjS0gZfrbaoK+mNPGKl+6kkIyJpTmBc0wrMlmw=; b=NXo4F3ZrltFdoystL1L36D8oxVcyjC8J4O8wkxyJCmq9Ifj0TqOFfny7rq2G8HVqLlue CcXSylD6ATNCk4mKug44YWuHtx/bWd3d0upUTAos0GU8blm7T7dWWbyWxF9C48FGZVA4 B2xwEKWwICwnzUfh2hj6VZDmGBRW0bnNf4JmOQrr/BzfpnWPoCQDJeBDh+T9g54BiBiH gmpqHrxShbyf/R4dZtdx7PTQESuWiPXw3ofZ/Wn5Wnz6xYVxVjo8f58xEkiE5uYCqAy6 C7oDkaRhxKYapv3nrR6eZxkeF46KXRiR+6bzDe+SH7NfDoH/ifBi2FFQEkUQy9qEbZiC PA== Received: from pps.reinject (localhost [127.0.0.1]) by mx0b-001b2d01.pphosted.com with ESMTP id 3dnbjghjrt-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 17 Jan 2022 17:00:00 +0000 Received: from m0098413.ppops.net (m0098413.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 20HGYa8Z021926 for ; Mon, 17 Jan 2022 16:59:59 GMT Received: from ppma05fra.de.ibm.com (6c.4a.5195.ip4.static.sl-reverse.com [149.81.74.108]) by mx0b-001b2d01.pphosted.com with ESMTP id 3dnbjghjr8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 17 Jan 2022 16:59:59 +0000 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 20HGl7Cx023316; Mon, 17 Jan 2022 16:59:58 GMT Received: from b06cxnps4076.portsmouth.uk.ibm.com (d06relay13.portsmouth.uk.ibm.com [9.149.109.198]) by ppma05fra.de.ibm.com with ESMTP id 3dknw8n5wa-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 17 Jan 2022 16:59:57 +0000 Received: from b06wcsmtp001.portsmouth.uk.ibm.com (b06wcsmtp001.portsmouth.uk.ibm.com [9.149.105.160]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 20HGxqV238076836 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 17 Jan 2022 16:59:52 GMT Received: from b06wcsmtp001.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 3A026A4054; Mon, 17 Jan 2022 16:59:52 +0000 (GMT) Received: from b06wcsmtp001.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id D4416A405C; Mon, 17 Jan 2022 16:59:51 +0000 (GMT) Received: from p-imbrenda.ibmuc.com (unknown [9.145.3.16]) by b06wcsmtp001.portsmouth.uk.ibm.com (Postfix) with ESMTP; Mon, 17 Jan 2022 16:59:51 +0000 (GMT) From: Claudio Imbrenda To: pbonzini@redhat.com Cc: kvm@vger.kernel.org, borntraeger@de.ibm.com, frankja@linux.ibm.com Subject: [kvm-unit-tests GIT PULL 04/13] s390x: sie: Add UV information into VM struct Date: Mon, 17 Jan 2022 17:59:40 +0100 Message-Id: <20220117165949.75964-5-imbrenda@linux.ibm.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220117165949.75964-1-imbrenda@linux.ibm.com> References: <20220117165949.75964-1-imbrenda@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: utUL-GPc5_G7CUZAUlahono2HptSCWS7 X-Proofpoint-ORIG-GUID: rig1cHH9Ihx-Rs5S6J8qz0YcdP0DxvFR X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.816,Hydra:6.0.425,FMLib:17.11.62.513 definitions=2022-01-17_07,2022-01-14_01,2021-12-02_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxlogscore=956 malwarescore=0 adultscore=0 mlxscore=0 suspectscore=0 bulkscore=0 phishscore=0 priorityscore=1501 impostorscore=0 spamscore=0 lowpriorityscore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2110150000 definitions=main-2201170104 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org From: Janosch Frank We need to save the handles for the VM and the VCPU so we can retrieve them easily after their creation. Since the SIE lib is single guest cpu only we only save one vcpu handle. Signed-off-by: Janosch Frank Reviewed-by: Claudio Imbrenda Signed-off-by: Claudio Imbrenda --- lib/s390x/sie.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/s390x/sie.h b/lib/s390x/sie.h index c6eb6441..1a12faa7 100644 --- a/lib/s390x/sie.h +++ b/lib/s390x/sie.h @@ -200,6 +200,11 @@ union { uint64_t gvrd; /* 0x01f8 */ } __attribute__((packed)); +struct vm_uv { + uint64_t vm_handle; + uint64_t vcpu_handle; +}; + struct vm_save_regs { uint64_t grs[16]; uint64_t fprs[16]; @@ -220,6 +225,7 @@ struct vm { struct vm_save_area save_area; void *sca; /* System Control Area */ uint8_t *crycb; /* Crypto Control Block */ + struct vm_uv uv; /* PV UV information */ /* Ptr to first guest page */ uint8_t *guest_mem; }; From patchwork Mon Jan 17 16:59:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Claudio Imbrenda X-Patchwork-Id: 12715601 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 67987C433F5 for ; Mon, 17 Jan 2022 17:00:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241767AbiAQRAv (ORCPT ); Mon, 17 Jan 2022 12:00:51 -0500 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:18994 "EHLO mx0b-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241463AbiAQQ76 (ORCPT ); Mon, 17 Jan 2022 11:59:58 -0500 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 20HFT5X2029911 for ; Mon, 17 Jan 2022 16:59:58 GMT 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=HNPJ0cEXEKQQ2Yy8+LJfAs/CmkeI/X44h6StSg7urEc=; b=Odbx8RVqYgdutLWzdndUg+rnAqVc8mJNEeINcEE8oUP+RcmJs1QkoK5oVQckgNMh8Qqh 9Rs/5J1Pws8WCHXgokfqnnhEbeSKK4b47Ejdf5Uy0j2ILW5nTl0GkxBSEoSqRiLHq20C gsti59P/61/pYtIlOw5X4oMUb1um4IXrj0Vx+YccS/q4wCg/xJLx8sP5XwpnqiAskFq/ Rc6QI5z45Kn0iERq4p+uszaLWnOyOD0oYKQYQdfFuY5ddCmMVAGLTE/fmMRt5KOd+nzf DmTjOb0Hm9KyNlTEGtySC3yLtix/p01HAACjAqK6m9UZsvkNJg44ZsD4GtK7NP38Zuca gQ== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 3dnb4t2emm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 17 Jan 2022 16:59:57 +0000 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 20HGnlI1018076 for ; Mon, 17 Jan 2022 16:59:57 GMT 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 3dnb4t2em0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 17 Jan 2022 16:59:57 +0000 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 20HGkuO5019623; Mon, 17 Jan 2022 16:59:56 GMT Received: from b06cxnps4076.portsmouth.uk.ibm.com (d06relay13.portsmouth.uk.ibm.com [9.149.109.198]) by ppma01fra.de.ibm.com with ESMTP id 3dknw956y2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 17 Jan 2022 16:59:55 +0000 Received: from b06wcsmtp001.portsmouth.uk.ibm.com (b06wcsmtp001.portsmouth.uk.ibm.com [9.149.105.160]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 20HGxqJP37880224 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 17 Jan 2022 16:59:52 GMT Received: from b06wcsmtp001.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 9F333A4062; Mon, 17 Jan 2022 16:59:52 +0000 (GMT) Received: from b06wcsmtp001.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 506A6A405C; Mon, 17 Jan 2022 16:59:52 +0000 (GMT) Received: from p-imbrenda.ibmuc.com (unknown [9.145.3.16]) by b06wcsmtp001.portsmouth.uk.ibm.com (Postfix) with ESMTP; Mon, 17 Jan 2022 16:59:52 +0000 (GMT) From: Claudio Imbrenda To: pbonzini@redhat.com Cc: kvm@vger.kernel.org, borntraeger@de.ibm.com, frankja@linux.ibm.com Subject: [kvm-unit-tests GIT PULL 05/13] s390x: uv: Add more UV call functions Date: Mon, 17 Jan 2022 17:59:41 +0100 Message-Id: <20220117165949.75964-6-imbrenda@linux.ibm.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220117165949.75964-1-imbrenda@linux.ibm.com> References: <20220117165949.75964-1-imbrenda@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: zCYbc41kobIKJzqBy1PM35LfSd2DRL31 X-Proofpoint-ORIG-GUID: _D9i8jwWDg1cqp1sh_VO5dwNL3j_YFz6 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.816,Hydra:6.0.425,FMLib:17.11.62.513 definitions=2022-01-17_07,2022-01-14_01,2021-12-02_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 bulkscore=0 clxscore=1015 suspectscore=0 adultscore=0 phishscore=0 lowpriorityscore=0 mlxscore=0 spamscore=0 impostorscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2110150000 definitions=main-2201170104 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org From: Janosch Frank To manage protected guests we need a few more UV calls: * import / export * destroy page * set SE header * set cpu state Signed-off-by: Janosch Frank Reviewed-by: Claudio Imbrenda Signed-off-by: Claudio Imbrenda --- lib/s390x/asm/uv.h | 85 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/lib/s390x/asm/uv.h b/lib/s390x/asm/uv.h index 8baf896f..6e331211 100644 --- a/lib/s390x/asm/uv.h +++ b/lib/s390x/asm/uv.h @@ -33,6 +33,7 @@ #define UVC_CMD_DESTROY_SEC_CPU 0x0121 #define UVC_CMD_CONV_TO_SEC_STOR 0x0200 #define UVC_CMD_CONV_FROM_SEC_STOR 0x0201 +#define UVC_CMD_DESTR_SEC_STOR 0x0202 #define UVC_CMD_SET_SEC_CONF_PARAMS 0x0300 #define UVC_CMD_UNPACK_IMG 0x0301 #define UVC_CMD_VERIFY_IMG 0x0302 @@ -256,6 +257,63 @@ static inline int uv_remove_shared(unsigned long addr) return share(addr, UVC_CMD_REMOVE_SHARED_ACCESS); } +static inline int uv_cmd_nodata(uint64_t handle, uint16_t cmd, uint16_t *rc, uint16_t *rrc) +{ + struct uv_cb_nodata uvcb = { + .header.cmd = cmd, + .header.len = sizeof(uvcb), + .handle = handle, + }; + int cc; + + assert(handle); + cc = uv_call(0, (uint64_t)&uvcb); + *rc = uvcb.header.rc; + *rrc = uvcb.header.rrc; + return cc; +} + +static inline int uv_import(uint64_t handle, unsigned long gaddr) +{ + struct uv_cb_cts uvcb = { + .header.cmd = UVC_CMD_CONV_TO_SEC_STOR, + .header.len = sizeof(uvcb), + .guest_handle = handle, + .gaddr = gaddr, + }; + + return uv_call(0, (uint64_t)&uvcb); +} + +static inline int uv_export(unsigned long paddr) +{ + struct uv_cb_cfs uvcb = { + .header.cmd = UVC_CMD_CONV_FROM_SEC_STOR, + .header.len = sizeof(uvcb), + .paddr = paddr + }; + + return uv_call(0, (u64)&uvcb); +} + +/* + * Requests the Ultravisor to destroy a guest page and make it + * accessible to the host. The destroy clears the page instead of + * exporting. + * + * @paddr: Absolute host address of page to be destroyed + */ +static inline int uv_destroy_page(unsigned long paddr) +{ + struct uv_cb_cfs uvcb = { + .header.cmd = UVC_CMD_DESTR_SEC_STOR, + .header.len = sizeof(uvcb), + .paddr = paddr + }; + + return uv_call(0, (uint64_t)&uvcb); +} + struct uv_cb_cpu_set_state { struct uv_cb_header header; u64 reserved08[2]; @@ -270,4 +328,31 @@ struct uv_cb_cpu_set_state { #define PV_CPU_STATE_CHKSTP 3 #define PV_CPU_STATE_OPR_LOAD 5 +static inline int uv_set_cpu_state(uint64_t handle, uint8_t state) +{ + struct uv_cb_cpu_set_state uvcb = { + .header.cmd = UVC_CMD_CPU_SET_STATE, + .header.len = sizeof(uvcb), + .cpu_handle = handle, + .state = state, + }; + + assert(handle); + return uv_call(0, (uint64_t)&uvcb); +} + +static inline int uv_set_se_hdr(uint64_t handle, void *hdr, size_t len) +{ + struct uv_cb_ssc uvcb = { + .header.cmd = UVC_CMD_SET_SEC_CONF_PARAMS, + .header.len = sizeof(uvcb), + .sec_header_origin = (uint64_t)hdr, + .sec_header_len = len, + .guest_handle = handle, + }; + + assert(handle); + return uv_call(0, (uint64_t)&uvcb); +} + #endif From patchwork Mon Jan 17 16:59:42 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Claudio Imbrenda X-Patchwork-Id: 12715595 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C2E43C433EF for ; Mon, 17 Jan 2022 17:00:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241305AbiAQRAh (ORCPT ); Mon, 17 Jan 2022 12:00:37 -0500 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:64186 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241477AbiAQQ77 (ORCPT ); Mon, 17 Jan 2022 11:59:59 -0500 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 20HGkjM4025462 for ; Mon, 17 Jan 2022 16:59:59 GMT 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=6RW0aN/NjXb5k/nJ1sqYiCUI/pvsKwTgjj7Sde7sGfE=; b=WOYlILyQPo4+Z200XJ8Y3lKvr0fX87pwk3l9n9sHhrJ6sZv+oODl5wBJ9JcKf8sGYSdq lV+LvooKP8vjbWMl/s6+q59d88MxaqAg9LhnYwQD4AYvv0ozNf++rS7gJ2WJ/aGjvVqd IYeYEEqDFNQSMLCJjfeoxgviPlhiGmpL9jxYVJnKqT1goY6Lj95ZkO4+LLpHYxCpvKdN dXjq0+a7cpx0ySG5vNd1IculHqlbytibqwUYbaPBGd6UIaH1f8kGd5SX3X/CJTQqBptF 9OsYcO/m6YOk3K2mONNuDToeNKsv/kTLfNugQIvec2Bl1Uzb5Qv6PcLPPNZlAmhToD2w 0g== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 3dn7kcqdd5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 17 Jan 2022 16:59:59 +0000 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 20HGmJmG008273 for ; Mon, 17 Jan 2022 16:59:59 GMT 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 3dn7kcqdc5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 17 Jan 2022 16:59:58 +0000 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 20HGmoGB000733; Mon, 17 Jan 2022 16:59:56 GMT Received: from b06cxnps3075.portsmouth.uk.ibm.com (d06relay10.portsmouth.uk.ibm.com [9.149.109.195]) by ppma02fra.de.ibm.com with ESMTP id 3dknw8w7ay-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 17 Jan 2022 16:59:56 +0000 Received: from b06wcsmtp001.portsmouth.uk.ibm.com (b06wcsmtp001.portsmouth.uk.ibm.com [9.149.105.160]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 20HGxrYH41877812 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 17 Jan 2022 16:59:53 GMT Received: from b06wcsmtp001.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 01733A405F; Mon, 17 Jan 2022 16:59:53 +0000 (GMT) Received: from b06wcsmtp001.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B448BA405C; Mon, 17 Jan 2022 16:59:52 +0000 (GMT) Received: from p-imbrenda.ibmuc.com (unknown [9.145.3.16]) by b06wcsmtp001.portsmouth.uk.ibm.com (Postfix) with ESMTP; Mon, 17 Jan 2022 16:59:52 +0000 (GMT) From: Claudio Imbrenda To: pbonzini@redhat.com Cc: kvm@vger.kernel.org, borntraeger@de.ibm.com, frankja@linux.ibm.com Subject: [kvm-unit-tests GIT PULL 06/13] s390x: lib: Extend UV library with PV guest management Date: Mon, 17 Jan 2022 17:59:42 +0100 Message-Id: <20220117165949.75964-7-imbrenda@linux.ibm.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220117165949.75964-1-imbrenda@linux.ibm.com> References: <20220117165949.75964-1-imbrenda@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: 8hZzzyNYt0rGeXQCLgMx-pKmdRyRPBIm X-Proofpoint-GUID: iRqRcmjEJqp3Kwe7QazjLl0TS9rC6fm0 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.816,Hydra:6.0.425,FMLib:17.11.62.513 definitions=2022-01-17_07,2022-01-14_01,2021-12-02_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 priorityscore=1501 mlxscore=0 impostorscore=0 spamscore=0 lowpriorityscore=0 suspectscore=0 clxscore=1015 mlxlogscore=999 adultscore=0 bulkscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2110150000 definitions=main-2201170104 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org From: Janosch Frank Let's extend the UV lib with guest 1 code to be able to manage protected VMs in the future. Signed-off-by: Janosch Frank Reviewed-by: Claudio Imbrenda Signed-off-by: Claudio Imbrenda --- lib/s390x/asm/uv.h | 14 +++++ lib/s390x/sie.h | 3 ++ lib/s390x/uv.h | 7 +++ lib/s390x/uv.c | 128 +++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 152 insertions(+) diff --git a/lib/s390x/asm/uv.h b/lib/s390x/asm/uv.h index 6e331211..97c90e81 100644 --- a/lib/s390x/asm/uv.h +++ b/lib/s390x/asm/uv.h @@ -355,4 +355,18 @@ static inline int uv_set_se_hdr(uint64_t handle, void *hdr, size_t len) return uv_call(0, (uint64_t)&uvcb); } +static inline int uv_unp_page(uint64_t handle, uint64_t gaddr, uint64_t tweak1, uint64_t tweak2) +{ + struct uv_cb_unp uvcb = { + .header.cmd = UVC_CMD_UNPACK_IMG, + .header.len = sizeof(uvcb), + .guest_handle = handle, + .gaddr = gaddr, + .tweak[0] = tweak1, + .tweak[1] = tweak2, + }; + + return uv_call(0, (uint64_t)&uvcb); +} + #endif diff --git a/lib/s390x/sie.h b/lib/s390x/sie.h index 1a12faa7..6d209793 100644 --- a/lib/s390x/sie.h +++ b/lib/s390x/sie.h @@ -203,6 +203,9 @@ union { struct vm_uv { uint64_t vm_handle; uint64_t vcpu_handle; + void *conf_base_stor; + void *conf_var_stor; + void *cpu_stor; }; struct vm_save_regs { diff --git a/lib/s390x/uv.h b/lib/s390x/uv.h index 2b23407a..6ffe537a 100644 --- a/lib/s390x/uv.h +++ b/lib/s390x/uv.h @@ -2,9 +2,16 @@ #ifndef _S390X_UV_H_ #define _S390X_UV_H_ +#include + bool uv_os_is_guest(void); bool uv_os_is_host(void); bool uv_query_test_call(unsigned int nr); +void uv_init(void); int uv_setup(void); +void uv_create_guest(struct vm *vm); +void uv_destroy_guest(struct vm *vm); +int uv_unpack(struct vm *vm, uint64_t addr, uint64_t len, uint64_t tweak); +void uv_verify_load(struct vm *vm); #endif /* UV_H */ diff --git a/lib/s390x/uv.c b/lib/s390x/uv.c index c5c69c47..6fe11dff 100644 --- a/lib/s390x/uv.c +++ b/lib/s390x/uv.c @@ -17,11 +17,14 @@ #include #include #include +#include static struct uv_cb_qui uvcb_qui = { .header.cmd = UVC_CMD_QUI, .header.len = sizeof(uvcb_qui), }; +static uint64_t uv_init_mem; + bool uv_os_is_guest(void) { @@ -54,3 +57,128 @@ int uv_setup(void) assert(uvcb_qui.header.rc == 1 || uvcb_qui.header.rc == 0x100); return 1; } + +void uv_init(void) +{ + struct uv_cb_init uvcb_init = { + .header.len = sizeof(uvcb_init), + .header.cmd = UVC_CMD_INIT_UV, + }; + static bool initialized; + int cc; + + /* Let's not do this twice */ + assert(!initialized); + /* Query is done on initialization but let's check anyway */ + assert(uvcb_qui.header.rc == 1 || uvcb_qui.header.rc == 0x100); + + /* Donated storage needs to be over 2GB aligned to 1MB */ + uv_init_mem = (uint64_t)memalign_pages_flags(HPAGE_SIZE, uvcb_qui.uv_base_stor_len, AREA_NORMAL); + uvcb_init.stor_origin = uv_init_mem; + uvcb_init.stor_len = uvcb_qui.uv_base_stor_len; + + cc = uv_call(0, (uint64_t)&uvcb_init); + assert(cc == 0); + initialized = true; +} + +void uv_create_guest(struct vm *vm) +{ + struct uv_cb_cgc uvcb_cgc = { + .header.cmd = UVC_CMD_CREATE_SEC_CONF, + .header.len = sizeof(uvcb_cgc), + }; + struct uv_cb_csc uvcb_csc = { + .header.len = sizeof(uvcb_csc), + .header.cmd = UVC_CMD_CREATE_SEC_CPU, + .state_origin = (uint64_t)vm->sblk, + .num = 0, + }; + unsigned long vsize; + int cc; + + uvcb_cgc.guest_stor_origin = vm->sblk->mso; + uvcb_cgc.guest_stor_len = vm->sblk->msl; + + /* Config allocation */ + vsize = uvcb_qui.conf_base_virt_stor_len + + ((uvcb_cgc.guest_stor_len / HPAGE_SIZE) * uvcb_qui.conf_virt_var_stor_len); + + vm->uv.conf_base_stor = memalign_pages_flags(PAGE_SIZE * 4, uvcb_qui.conf_base_phys_stor_len, 0); + /* + * This allocation needs to be below the max guest storage + * address so let's simply put it into the physical memory + */ + vm->uv.conf_var_stor = memalign_pages_flags(PAGE_SIZE, vsize,0); + uvcb_cgc.conf_base_stor_origin = (uint64_t)vm->uv.conf_base_stor; + uvcb_cgc.conf_var_stor_origin = (uint64_t)vm->uv.conf_var_stor; + + /* CPU allocation */ + vm->uv.cpu_stor = memalign_pages_flags(PAGE_SIZE, uvcb_qui.cpu_stor_len, 0); + uvcb_csc.stor_origin = (uint64_t)vm->uv.cpu_stor; + + uvcb_cgc.guest_asce = (uint64_t)stctg(1); + uvcb_cgc.guest_sca = (uint64_t)vm->sca; + + cc = uv_call(0, (uint64_t)&uvcb_cgc); + assert(!cc); + + vm->uv.vm_handle = uvcb_cgc.guest_handle; + uvcb_csc.guest_handle = uvcb_cgc.guest_handle; + cc = uv_call(0, (uint64_t)&uvcb_csc); + vm->uv.vcpu_handle = uvcb_csc.cpu_handle; + assert(!cc); + + /* + * Convert guest to format 4: + * + * - Set format 4 + * - Write UV handles into sblk + * - Allocate and set SIDA + */ + vm->sblk->sdf = 2; + vm->sblk->sidad = (uint64_t)alloc_page(); + vm->sblk->pv_handle_cpu = uvcb_csc.cpu_handle; + vm->sblk->pv_handle_config = uvcb_cgc.guest_handle; +} + +void uv_destroy_guest(struct vm *vm) +{ + int cc; + u16 rc, rrc; + + cc = uv_cmd_nodata(vm->sblk->pv_handle_cpu, + UVC_CMD_DESTROY_SEC_CPU, &rc, &rrc); + assert(cc == 0); + free_page((void *)vm->sblk->sidad); + free_pages(vm->uv.cpu_stor); + + cc = uv_cmd_nodata(vm->sblk->pv_handle_config, + UVC_CMD_DESTROY_SEC_CONF, &rc, &rrc); + assert(cc == 0); + free_pages(vm->uv.conf_base_stor); + free_pages(vm->uv.conf_var_stor); +} + +int uv_unpack(struct vm *vm, uint64_t addr, uint64_t len, uint64_t tweak) +{ + int i, cc; + + for (i = 0; i < len / PAGE_SIZE; i++) { + cc = uv_unp_page(vm->uv.vm_handle, addr, tweak, i * PAGE_SIZE); + assert(!cc); + addr += PAGE_SIZE; + } + return cc; +} + +void uv_verify_load(struct vm *vm) +{ + uint16_t rc, rrc; + int cc; + + cc = uv_cmd_nodata(vm->uv.vm_handle, UVC_CMD_VERIFY_IMG, &rc, &rrc); + assert(!cc); + cc = uv_set_cpu_state(vm->uv.vcpu_handle, PV_CPU_STATE_OPR_LOAD); + assert(!cc); +} From patchwork Mon Jan 17 16:59:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Claudio Imbrenda X-Patchwork-Id: 12715590 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1F79DC4332F for ; Mon, 17 Jan 2022 17:00:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241663AbiAQRA2 (ORCPT ); Mon, 17 Jan 2022 12:00:28 -0500 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:35854 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237864AbiAQRAA (ORCPT ); Mon, 17 Jan 2022 12:00:00 -0500 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 20HGSe2S004826 for ; Mon, 17 Jan 2022 17:00:00 GMT 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=+CaEIQOp877DEr3QIrVgFZDfNht0hqb7CQvVfN2fjc8=; b=XJBy5L4d1x0phL2GPWfVDNcTODwerINfjiswBDCUqNV48voD551/VWWGKNc6rkSiYLy9 SlgEShockhPrp+JmD6OHA5RklqNV8uIreROFl+giR51UUB2UFH+Hx7MxPvXaQeMDcn80 /yv/shnlr6d+Edl1Uj4SvUlJ4jfsPN22Q++WRg2aRyqGv4iCJbi44UP2hO6/pz4UVx4a o+2mPxSm5cAuSEPds0jcObLVwq0SQjc2nLr3zq26ci+jMy4EHy2fEgSqop7gXY/9cLru 8vjTjG94Z2IoEnmZZ6JydOJaeF4h616wNAB20KI+04iq9M6tfDaNY5tZt2i4XRojo6zA kQ== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 3dnc0v0ppn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 17 Jan 2022 16:59:59 +0000 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 20HGVZoU013745 for ; Mon, 17 Jan 2022 16:59:59 GMT Received: from ppma06fra.de.ibm.com (48.49.7a9f.ip4.static.sl-reverse.com [159.122.73.72]) by mx0a-001b2d01.pphosted.com with ESMTP id 3dnc0v0pnh-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 17 Jan 2022 16:59:58 +0000 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 20HGkwmD018875; Mon, 17 Jan 2022 16:59:56 GMT Received: from b06cxnps3075.portsmouth.uk.ibm.com (d06relay10.portsmouth.uk.ibm.com [9.149.109.195]) by ppma06fra.de.ibm.com with ESMTP id 3dknhhw8w9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 17 Jan 2022 16:59:56 +0000 Received: from b06wcsmtp001.portsmouth.uk.ibm.com (b06wcsmtp001.portsmouth.uk.ibm.com [9.149.105.160]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 20HGxrxk38928882 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 17 Jan 2022 16:59:53 GMT Received: from b06wcsmtp001.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 6977EA405F; Mon, 17 Jan 2022 16:59:53 +0000 (GMT) Received: from b06wcsmtp001.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 20112A4054; Mon, 17 Jan 2022 16:59:53 +0000 (GMT) Received: from p-imbrenda.ibmuc.com (unknown [9.145.3.16]) by b06wcsmtp001.portsmouth.uk.ibm.com (Postfix) with ESMTP; Mon, 17 Jan 2022 16:59:53 +0000 (GMT) From: Claudio Imbrenda To: pbonzini@redhat.com Cc: kvm@vger.kernel.org, borntraeger@de.ibm.com, frankja@linux.ibm.com Subject: [kvm-unit-tests GIT PULL 07/13] lib: s390: sie: Add PV guest register handling Date: Mon, 17 Jan 2022 17:59:43 +0100 Message-Id: <20220117165949.75964-8-imbrenda@linux.ibm.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220117165949.75964-1-imbrenda@linux.ibm.com> References: <20220117165949.75964-1-imbrenda@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: 56cEC9iZlKSkXeTihlli6RcUdsVX_Xuz X-Proofpoint-ORIG-GUID: kLlDyHg2kiPa7oTVZvQ6snYHhn-HM-DE X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.816,Hydra:6.0.425,FMLib:17.11.62.513 definitions=2022-01-17_07,2022-01-14_01,2021-12-02_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 phishscore=0 mlxscore=0 suspectscore=0 impostorscore=0 spamscore=0 adultscore=0 lowpriorityscore=0 clxscore=1015 mlxlogscore=999 malwarescore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2110150000 definitions=main-2201170104 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org From: Janosch Frank Protected guests have their registers stored to / loaded from offset 0x380 of the sie control block. So we need to copy over the GRs to/from that offset for format 4 (PV) guests before and after we enter SIE. Signed-off-by: Janosch Frank Reviewed-by: Claudio Imbrenda Signed-off-by: Claudio Imbrenda --- lib/s390x/sie.h | 2 ++ lib/s390x/sie.c | 8 ++++++++ 2 files changed, 10 insertions(+) diff --git a/lib/s390x/sie.h b/lib/s390x/sie.h index 6d209793..de91ea5a 100644 --- a/lib/s390x/sie.h +++ b/lib/s390x/sie.h @@ -198,6 +198,8 @@ union { uint64_t itdba; /* 0x01e8 */ uint64_t riccbd; /* 0x01f0 */ uint64_t gvrd; /* 0x01f8 */ + uint64_t reserved200[48]; /* 0x0200 */ + uint64_t pv_grregs[16]; /* 0x0380 */ } __attribute__((packed)); struct vm_uv { diff --git a/lib/s390x/sie.c b/lib/s390x/sie.c index 51d3b94e..00aff713 100644 --- a/lib/s390x/sie.c +++ b/lib/s390x/sie.c @@ -44,6 +44,10 @@ void sie_handle_validity(struct vm *vm) void sie(struct vm *vm) { + if (vm->sblk->sdf == 2) + memcpy(vm->sblk->pv_grregs, vm->save_area.guest.grs, + sizeof(vm->save_area.guest.grs)); + /* Reset icptcode so we don't trip over it below */ vm->sblk->icptcode = 0; @@ -53,6 +57,10 @@ void sie(struct vm *vm) } vm->save_area.guest.grs[14] = vm->sblk->gg14; vm->save_area.guest.grs[15] = vm->sblk->gg15; + + if (vm->sblk->sdf == 2) + memcpy(vm->save_area.guest.grs, vm->sblk->pv_grregs, + sizeof(vm->save_area.guest.grs)); } void sie_guest_sca_create(struct vm *vm) From patchwork Mon Jan 17 16:59:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Claudio Imbrenda X-Patchwork-Id: 12715591 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 22649C43219 for ; Mon, 17 Jan 2022 17:00:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241690AbiAQRAc (ORCPT ); Mon, 17 Jan 2022 12:00:32 -0500 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:3830 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241483AbiAQRAA (ORCPT ); Mon, 17 Jan 2022 12:00:00 -0500 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 20HGiDAS008671 for ; Mon, 17 Jan 2022 17:00:00 GMT 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=sJuMZtPIAvjXt95JIykD8lMjN5BDAG8bLrxNC6i/MYg=; b=hroIhaVAuNxrfdNQ5mp1/bRhRvwmKSS6BNdQt9++yEJm0pMgDg6m/U+BCCU5W/HKuo3O lkV93bsFpg4sIv1LHFIAwNtwoAio4603F8XPXFUMZAsriurry+0XCLDP+otvnFoBvI5h eLDXmwTcSSr81eH5nLcSLTaNyDtRZKYqUv74ibk7jrjbuSKcdTFdJMR+6t2KyCqqqaRd fPJEz10zrW1AyMLmQZ90tVyYp0A/WlkQAtIsaR1EoXs/NoU9T5soNR+M3ABxg7hu1LU9 ETXQMN+QGLcmpEawzjeDLleeIc43z/1o4clWRuCrS+NNUDb0IRBoii1qWKUH/MEcu64J Fg== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 3dn7kryaqr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 17 Jan 2022 16:59:59 +0000 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 20HGsEKh031189 for ; Mon, 17 Jan 2022 16:59:59 GMT Received: from ppma04fra.de.ibm.com (6a.4a.5195.ip4.static.sl-reverse.com [149.81.74.106]) by mx0a-001b2d01.pphosted.com with ESMTP id 3dn7kryapy-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 17 Jan 2022 16:59:59 +0000 Received: from pps.filterd (ppma04fra.de.ibm.com [127.0.0.1]) by ppma04fra.de.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 20HGloLE030084; Mon, 17 Jan 2022 16:59:57 GMT Received: from b06cxnps3075.portsmouth.uk.ibm.com (d06relay10.portsmouth.uk.ibm.com [9.149.109.195]) by ppma04fra.de.ibm.com with ESMTP id 3dknw955ny-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 17 Jan 2022 16:59:56 +0000 Received: from b06wcsmtp001.portsmouth.uk.ibm.com (b06wcsmtp001.portsmouth.uk.ibm.com [9.149.105.160]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 20HGxrJG38928886 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 17 Jan 2022 16:59:54 GMT Received: from b06wcsmtp001.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id DA0B1A405B; Mon, 17 Jan 2022 16:59:53 +0000 (GMT) Received: from b06wcsmtp001.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 7E51AA4054; Mon, 17 Jan 2022 16:59:53 +0000 (GMT) Received: from p-imbrenda.ibmuc.com (unknown [9.145.3.16]) by b06wcsmtp001.portsmouth.uk.ibm.com (Postfix) with ESMTP; Mon, 17 Jan 2022 16:59:53 +0000 (GMT) From: Claudio Imbrenda To: pbonzini@redhat.com Cc: kvm@vger.kernel.org, borntraeger@de.ibm.com, frankja@linux.ibm.com, Steffen Eiden Subject: [kvm-unit-tests GIT PULL 08/13] s390x: snippets: Add PV support Date: Mon, 17 Jan 2022 17:59:44 +0100 Message-Id: <20220117165949.75964-9-imbrenda@linux.ibm.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220117165949.75964-1-imbrenda@linux.ibm.com> References: <20220117165949.75964-1-imbrenda@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: 77qIitdHea6U34_2mIoWYRsXshgClwpI X-Proofpoint-GUID: jGmQAiMn-TekjEdcq_pgzTtdlypki6AN X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.816,Hydra:6.0.425,FMLib:17.11.62.513 definitions=2022-01-17_07,2022-01-14_01,2021-12-02_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 adultscore=0 spamscore=0 impostorscore=0 bulkscore=0 mlxscore=0 clxscore=1015 lowpriorityscore=0 malwarescore=0 mlxlogscore=999 phishscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2110150000 definitions=main-2201170104 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org From: Janosch Frank To create a pv-snippet we need to generate an se-header. This can be done using a currently not released tool. This tool creates a se-header similar to `genprotimg` with the difference that the image itself will not be encrypted. The image for which we want to create a header must be a binary and padded to 4k. Therefore, we convert the compiled snippet to a binary, padd it to 4k, generate the header and convert it back to s390-64bit elf. The name of the tool can be specified using the config argument `--gen-se-header=`. The pv-snipptes will only be built when this option is specified. Furthermore, the Hostkey-Document must be specified. If not the build will be skipped. The host-snippet relation can be specified using the `pv-snippets` variable in s390x/Makefile, similar to the non-pv-snippets in 2f6fdb4a (s390x: snippets: Add snippet compilation, 2021-06-22) Signed-off-by: Steffen Eiden Acked-by: Claudio Imbrenda Signed-off-by: Claudio Imbrenda --- configure | 8 ++++++ s390x/Makefile | 67 +++++++++++++++++++++++++++++++++++++-------- lib/s390x/snippet.h | 7 +++++ .gitignore | 2 ++ 4 files changed, 73 insertions(+), 11 deletions(-) diff --git a/configure b/configure index 1d4d855e..9210912f 100755 --- a/configure +++ b/configure @@ -26,6 +26,7 @@ target= errata_force=0 erratatxt="$srcdir/errata.txt" host_key_document= +gen_se_header= page_size= earlycon= @@ -54,6 +55,9 @@ usage() { --host-key-document=HOST_KEY_DOCUMENT Specify the machine-specific host-key document for creating a PVM image with 'genprotimg' (s390x only) + --gen-se-header=GEN_SE_HEADER + Provide an executable to generate a PV header + requires --host-key-document. (s390x-snippets only) --page-size=PAGE_SIZE Specify the page size (translation granule) (4k, 16k or 64k, default is 64k, arm64 only) @@ -127,6 +131,9 @@ while [[ "$1" = -* ]]; do --host-key-document) host_key_document="$arg" ;; + --gen-se-header) + gen_se_header="$arg" + ;; --page-size) page_size="$arg" ;; @@ -341,6 +348,7 @@ U32_LONG_FMT=$u32_long WA_DIVIDE=$wa_divide GENPROTIMG=${GENPROTIMG-genprotimg} HOST_KEY_DOCUMENT=$host_key_document +GEN_SE_HEADER=$gen_se_header EOF if [ "$arch" = "arm" ] || [ "$arch" = "arm64" ]; then echo "TARGET=$target" >> config.mak diff --git a/s390x/Makefile b/s390x/Makefile index 1e567c11..59afc1cd 100644 --- a/s390x/Makefile +++ b/s390x/Makefile @@ -27,12 +27,20 @@ tests += $(TEST_DIR)/mvpg-sie.elf tests += $(TEST_DIR)/spec_ex-sie.elf tests += $(TEST_DIR)/firq.elf +ifneq ($(HOST_KEY_DOCUMENT),) +ifneq ($(GEN_SE_HEADER),) +tests += $(pv-tests) +endif +endif + tests_binary = $(patsubst %.elf,%.bin,$(tests)) ifneq ($(HOST_KEY_DOCUMENT),) tests_pv_binary = $(patsubst %.bin,%.pv.bin,$(tests_binary)) else tests_pv_binary = +GEN_SE_HEADER = endif +snippets-obj = $(patsubst %.gbin,%.gobj,$(snippets)) all: directories test_cases test_cases_binary test_cases_pv @@ -83,26 +91,59 @@ asmlib = $(TEST_DIR)/cstart64.o $(TEST_DIR)/cpu.o FLATLIBS = $(libcflat) SNIPPET_DIR = $(TEST_DIR)/snippets -snippet_asmlib = $(SNIPPET_DIR)/c/cstart.o lib/auxinfo.o +snippet_asmlib = $(SNIPPET_DIR)/c/cstart.o +snippet_lib = $(snippet_asmlib) lib/auxinfo.o # perquisites (=guests) for the snippet hosts. # $(TEST_DIR)/.elf: snippets = $(SNIPPET_DIR)//.gbin $(TEST_DIR)/mvpg-sie.elf: snippets = $(SNIPPET_DIR)/c/mvpg-snippet.gbin $(TEST_DIR)/spec_ex-sie.elf: snippets = $(SNIPPET_DIR)/c/spec_ex.gbin -$(SNIPPET_DIR)/asm/%.gbin: $(SNIPPET_DIR)/asm/%.o $(FLATLIBS) - $(OBJCOPY) -O binary $(patsubst %.gbin,%.o,$@) $@ - $(OBJCOPY) -I binary -O elf64-s390 -B "s390:64-bit" $@ $@ +ifneq ($(GEN_SE_HEADER),) +snippets += $(pv-snippets) +tests += $(pv-tests) +snippet-hdr-obj = $(patsubst %.gbin,%.hdr.obj,$(pv-snippets)) +else +snippet-hdr-obj = +endif + +# the asm/c snippets %.o have additional generated files as dependencies +$(SNIPPET_DIR)/asm/%.o: $(SNIPPET_DIR)/asm/%.S $(asm-offsets) + $(CC) $(CFLAGS) -c -nostdlib -o $@ $< + +$(SNIPPET_DIR)/c/%.o: $(SNIPPET_DIR)/c/%.c $(asm-offsets) + $(CC) $(CFLAGS) -c -nostdlib -o $@ $< + +$(SNIPPET_DIR)/asm/%.gbin: $(SNIPPET_DIR)/asm/%.o + $(OBJCOPY) -O binary -j ".rodata" -j ".text" -j ".data" -j ".bss" --set-section-flags .bss=alloc,load,contents $(patsubst %.gbin,%.o,$@) $@ + truncate -s '%4096' $@ + +$(SNIPPET_DIR)/c/%.gbin: $(SNIPPET_DIR)/c/%.o $(snippet_lib) $(FLATLIBS) + $(CC) $(LDFLAGS) -o $@ -T $(SRCDIR)/s390x/snippets/c/flat.lds $(patsubst %.gbin,%.o,$@) $(snippet_lib) $(FLATLIBS) + $(OBJCOPY) -O binary -j ".rodata" -j ".lowcore" -j ".text" -j ".data" -j ".bss" --set-section-flags .bss=alloc,load,contents $@ $@ + truncate -s '%4096' $@ + +$(SNIPPET_DIR)/asm/%.hdr: $(SNIPPET_DIR)/asm/%.gbin $(HOST_KEY_DOCUMENT) + $(GEN_SE_HEADER) -k $(HOST_KEY_DOCUMENT) -c $<,0x4000,0x00000000000000420000000000000000 --psw-addr 0x4000 -o $@ + +$(SNIPPET_DIR)/c/%.hdr: $(SNIPPET_DIR)/c/%.gbin $(HOST_KEY_DOCUMENT) + $(GEN_SE_HEADER) -k $(HOST_KEY_DOCUMENT) -c $<,0x0,0x00000000000000420000000000000000 --psw-addr 0x4000 -o $@ + +.SECONDARY: +%.gobj: %.gbin + $(OBJCOPY) -I binary -O elf64-s390 -B "s390:64-bit" $< $@ + +.SECONDARY: +%.hdr.obj: %.hdr + $(OBJCOPY) -I binary -O elf64-s390 -B "s390:64-bit" $< $@ -$(SNIPPET_DIR)/c/%.gbin: $(SNIPPET_DIR)/c/%.o $(snippet_asmlib) $(FLATLIBS) - $(CC) $(LDFLAGS) -o $@ -T $(SRCDIR)/s390x/snippets/c/flat.lds $(patsubst %.gbin,%.o,$@) $(snippet_asmlib) $(FLATLIBS) - $(OBJCOPY) -O binary $@ $@ - $(OBJCOPY) -I binary -O elf64-s390 -B "s390:64-bit" $@ $@ .SECONDEXPANSION: -%.elf: $$(snippets) %.o $(FLATLIBS) $(SRCDIR)/s390x/flat.lds $(asmlib) +%.elf: $(FLATLIBS) $(asmlib) $(SRCDIR)/s390x/flat.lds $$(snippets-obj) $$(snippet-hdr-obj) %.o $(CC) $(CFLAGS) -c -o $(@:.elf=.aux.o) $(SRCDIR)/lib/auxinfo.c -DPROGNAME=\"$@\" - $(CC) $(LDFLAGS) -o $@ -T $(SRCDIR)/s390x/flat.lds $(filter %.o, $^) $(FLATLIBS) $(snippets) $(@:.elf=.aux.o) + @$(CC) $(LDFLAGS) -o $@ -T $(SRCDIR)/s390x/flat.lds \ + $(filter %.o, $^) $(FLATLIBS) $(snippets-obj) $(snippet-hdr-obj) $(@:.elf=.aux.o) || \ + { echo "Failure probably caused by missing definition of gen-se-header executable"; exit 1; } $(RM) $(@:.elf=.aux.o) @chmod a-x $@ @@ -115,8 +156,12 @@ $(SNIPPET_DIR)/c/%.gbin: $(SNIPPET_DIR)/c/%.o $(snippet_asmlib) $(FLATLIBS) %.pv.bin: %.bin $(HOST_KEY_DOCUMENT) $(GENPROTIMG) --host-key-document $(HOST_KEY_DOCUMENT) --no-verify --image $< -o $@ +$(snippet_asmlib): $$(patsubst %.o,%.S,$$@) $(asm-offsets) + $(CC) $(CFLAGS) -c -nostdlib -o $@ $< + + arch_clean: asm_offsets_clean - $(RM) $(TEST_DIR)/*.{o,elf,bin} $(TEST_DIR)/.*.d $(SNIPPET_DIR)/c/*.{o,gbin} $(SNIPPET_DIR)/c/.*.d lib/s390x/.*.d + $(RM) $(TEST_DIR)/*.{o,elf,bin} $(SNIPPET_DIR)/*/*.{o,elf,*bin,*obj,hdr} $(SNIPPET_DIR)/asm/.*.d $(TEST_DIR)/.*.d lib/s390x/.*.d generated-files = $(asm-offsets) $(tests:.elf=.o) $(asmlib) $(cflatobjs): $(generated-files) diff --git a/lib/s390x/snippet.h b/lib/s390x/snippet.h index 8e4765f8..6b77a8a9 100644 --- a/lib/s390x/snippet.h +++ b/lib/s390x/snippet.h @@ -14,10 +14,17 @@ _binary_s390x_snippets_##type##_##file##_gbin_start #define SNIPPET_NAME_END(type, file) \ _binary_s390x_snippets_##type##_##file##_gbin_end +#define SNIPPET_HDR_START(type, file) \ + _binary_s390x_snippets_##type##_##file##_hdr_start +#define SNIPPET_HDR_END(type, file) \ + _binary_s390x_snippets_##type##_##file##_hdr_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)) +#define SNIPPET_HDR_LEN(type, file) \ + ((uintptr_t)SNIPPET_HDR_END(type, file) - (uintptr_t)SNIPPET_HDR_START(type, file)) /* * C snippet instructions start at 0x4000 due to the prefix and the diff --git a/.gitignore b/.gitignore index 3d5be622..28a197bf 100644 --- a/.gitignore +++ b/.gitignore @@ -25,3 +25,5 @@ cscope.* /api/dirty-log-perf /s390x/*.bin /s390x/snippets/*/*.gbin +/s390x/snippets/*/*.hdr +/s390x/snippets/*/*.*obj \ No newline at end of file From patchwork Mon Jan 17 16:59:45 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Claudio Imbrenda X-Patchwork-Id: 12715592 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D9FAAC4321E for ; Mon, 17 Jan 2022 17:00:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241704AbiAQRAe (ORCPT ); Mon, 17 Jan 2022 12:00:34 -0500 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:35092 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241482AbiAQRAA (ORCPT ); Mon, 17 Jan 2022 12:00:00 -0500 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 20HGSZSZ019375 for ; Mon, 17 Jan 2022 17:00:00 GMT 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=Yvi04KhZKJGYQHLju03aVpn1GsiPFe6gJudAQU3fLFA=; b=j76KN/CC1qsYCfOZjYEkvdhTsTyf+9SUWraph+EZmjfymT7QWVNmEasW1A9Wb6aS3dQU UodGCjTETY97M+iZ4CSe3lfqI9dI8pHxU89+saL5ZtQ8rFNHkj+tP8dFS55ywI7/M7Ha AxPtxSfrcamnxNrN9Vfhyps+MWVrLwB7MmKh65x0eTjkqDVNyA8gGQFM82Y2tBdt2IYd gFKN99i1Mrzqr20GGlOwM7ldnx+UQXYPDwn6q4LA7FEOVeaPRpFH+YyR5l38Yy1raKLU NVq8UBbMkRIgbbXlrxsPMW3P1ShBqauzhhqL9/Jm8OFcTtsJbDWXBpA/9jTc48SSJu8G sA== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 3dnc0u8pp0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 17 Jan 2022 16:59:59 +0000 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 20HGh4PR003887 for ; Mon, 17 Jan 2022 16:59:59 GMT 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 3dnc0u8pnf-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 17 Jan 2022 16:59:59 +0000 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 20HGlCpl030693; Mon, 17 Jan 2022 16:59:57 GMT Received: from b06cxnps4074.portsmouth.uk.ibm.com (d06relay11.portsmouth.uk.ibm.com [9.149.109.196]) by ppma04ams.nl.ibm.com with ESMTP id 3dknw8x2f8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 17 Jan 2022 16:59:57 +0000 Received: from b06wcsmtp001.portsmouth.uk.ibm.com (b06wcsmtp001.portsmouth.uk.ibm.com [9.149.105.160]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 20HGxs7D24969508 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 17 Jan 2022 16:59:54 GMT Received: from b06wcsmtp001.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 45D42A405F; Mon, 17 Jan 2022 16:59:54 +0000 (GMT) Received: from b06wcsmtp001.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id EED8BA4054; Mon, 17 Jan 2022 16:59:53 +0000 (GMT) Received: from p-imbrenda.ibmuc.com (unknown [9.145.3.16]) by b06wcsmtp001.portsmouth.uk.ibm.com (Postfix) with ESMTP; Mon, 17 Jan 2022 16:59:53 +0000 (GMT) From: Claudio Imbrenda To: pbonzini@redhat.com Cc: kvm@vger.kernel.org, borntraeger@de.ibm.com, frankja@linux.ibm.com Subject: [kvm-unit-tests GIT PULL 09/13] lib: s390x: Introduce snippet helpers Date: Mon, 17 Jan 2022 17:59:45 +0100 Message-Id: <20220117165949.75964-10-imbrenda@linux.ibm.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220117165949.75964-1-imbrenda@linux.ibm.com> References: <20220117165949.75964-1-imbrenda@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: rlsZD-a61qJnz9ylD8AvB6YAEAhpxOrj X-Proofpoint-ORIG-GUID: Qi-mfr-zNKOpJtw0bEeTcO1QC-bMYUBL X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.816,Hydra:6.0.425,FMLib:17.11.62.513 definitions=2022-01-17_07,2022-01-14_01,2021-12-02_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 suspectscore=0 spamscore=0 impostorscore=0 clxscore=1015 priorityscore=1501 adultscore=0 malwarescore=0 bulkscore=0 mlxlogscore=999 phishscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2110150000 definitions=main-2201170104 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org From: Janosch Frank These helpers reduce code duplication for PV snippet tests. Signed-off-by: Janosch Frank Reviewed-by: Claudio Imbrenda Signed-off-by: Claudio Imbrenda --- lib/s390x/snippet.h | 103 ++++++++++++++++++++++++++++++++++++++++++++ lib/s390x/uv.h | 21 +++++++++ 2 files changed, 124 insertions(+) diff --git a/lib/s390x/snippet.h b/lib/s390x/snippet.h index 6b77a8a9..b17b2a4c 100644 --- a/lib/s390x/snippet.h +++ b/lib/s390x/snippet.h @@ -9,6 +9,10 @@ #ifndef _S390X_SNIPPET_H_ #define _S390X_SNIPPET_H_ +#include +#include +#include + /* This macro cuts down the length of the pointers to snippets */ #define SNIPPET_NAME_START(type, file) \ _binary_s390x_snippets_##type##_##file##_gbin_start @@ -26,6 +30,12 @@ #define SNIPPET_HDR_LEN(type, file) \ ((uintptr_t)SNIPPET_HDR_END(type, file) - (uintptr_t)SNIPPET_HDR_START(type, file)) +#define SNIPPET_PV_TWEAK0 0x42UL +#define SNIPPET_PV_TWEAK1 0UL +#define SNIPPET_OFF_C 0 +#define SNIPPET_OFF_ASM 0x4000 + + /* * C snippet instructions start at 0x4000 due to the prefix and the * stack being before that. ASM snippets don't strictly need a stack @@ -38,4 +48,97 @@ static const struct psw snippet_psw = { .mask = PSW_MASK_64, .addr = SNIPPET_ENTRY_ADDR, }; + +/* + * Sets up a snippet guest on top of an existing and initialized SIE + * vm struct. + * Once this function has finished without errors the guest can be started. + * + * @vm: VM that this function will populated, has to be initialized already + * @gbin: Snippet gbin data pointer + * @gbin_len: Length of the gbin data + * @off: Offset from guest absolute 0x0 where snippet is copied to + */ +static inline void snippet_init(struct vm *vm, const char *gbin, + uint64_t gbin_len, uint64_t off) +{ + uint64_t mso = vm->sblk->mso; + + /* Copy test image to guest memory */ + memcpy((void *)mso + off, gbin, gbin_len); + + /* Setup guest PSW */ + vm->sblk->gpsw = snippet_psw; + + /* + * We want to exit on PGM exceptions so we don't need + * exception handlers in the guest. + */ + vm->sblk->ictl = ICTL_OPEREXC | ICTL_PINT; +} + +/* + * Sets up a snippet UV/PV guest on top of an existing and initialized + * SIE vm struct. + * Once this function has finished without errors the guest can be started. + * + * @vm: VM that this function will populated, has to be initialized already + * @gbin: Snippet gbin data pointer + * @hdr: Snippet SE header data pointer + * @gbin_len: Length of the gbin data + * @hdr_len: Length of the hdr data + * @off: Offset from guest absolute 0x0 where snippet is copied to + */ +static inline void snippet_pv_init(struct vm *vm, const char *gbin, + const char *hdr, uint64_t gbin_len, + uint64_t hdr_len, uint64_t off) +{ + uint64_t tweak[2] = {SNIPPET_PV_TWEAK0, SNIPPET_PV_TWEAK1}; + uint64_t mso = vm->sblk->mso; + int i; + + snippet_init(vm, gbin, gbin_len, off); + + uv_create_guest(vm); + uv_set_se_hdr(vm->uv.vm_handle, (void *)hdr, hdr_len); + + /* Unpack works on guest addresses so we only need off */ + uv_unpack(vm, off, gbin_len, tweak[0]); + uv_verify_load(vm); + + /* + * Manually import: + * - lowcore 0x0 - 0x1000 (asm) + * - stack 0x3000 (C) + */ + for (i = 0; i < 4; i++) { + uv_import(vm->uv.vm_handle, mso + PAGE_SIZE * i); + } +} + +/* Allocates and sets up a snippet based guest */ +static inline void snippet_setup_guest(struct vm *vm, bool is_pv) +{ + u8 *guest; + + /* Allocate 1MB as guest memory */ + guest = alloc_pages(8); + memset(guest, 0, HPAGE_SIZE); + + /* Initialize the vm struct and allocate control blocks */ + sie_guest_create(vm, (uint64_t)guest, HPAGE_SIZE); + + if (is_pv) { + /* FMT4 needs a ESCA */ + sie_guest_sca_create(vm); + + /* + * Initialize UV and setup the address spaces needed + * to run a PV guest. + */ + uv_init(); + uv_setup_asces(); + } +} + #endif diff --git a/lib/s390x/uv.h b/lib/s390x/uv.h index 6ffe537a..8175d9c6 100644 --- a/lib/s390x/uv.h +++ b/lib/s390x/uv.h @@ -3,6 +3,7 @@ #define _S390X_UV_H_ #include +#include bool uv_os_is_guest(void); bool uv_os_is_host(void); @@ -14,4 +15,24 @@ void uv_destroy_guest(struct vm *vm); int uv_unpack(struct vm *vm, uint64_t addr, uint64_t len, uint64_t tweak); void uv_verify_load(struct vm *vm); +/* + * To run PV guests we need to setup a few things: + * - A valid primary ASCE that contains the guest memory and has the P bit set. + * - A valid home space ASCE for the UV calls that use home space addresses. + */ +static inline void uv_setup_asces(void) +{ + uint64_t asce; + + /* We need to have a valid primary ASCE to run guests. */ + setup_vm(); + + /* Set P bit in ASCE as it is required for PV guests */ + asce = stctg(1) | ASCE_P; + lctlg(1, asce); + + /* Copy ASCE into home space CR */ + lctlg(13, asce); +} + #endif /* UV_H */ From patchwork Mon Jan 17 16:59:46 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Claudio Imbrenda X-Patchwork-Id: 12715597 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B007BC433EF for ; Mon, 17 Jan 2022 17:00:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241731AbiAQRAk (ORCPT ); Mon, 17 Jan 2022 12:00:40 -0500 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:56012 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241371AbiAQRAB (ORCPT ); Mon, 17 Jan 2022 12:00:01 -0500 Received: from pps.filterd (m0098404.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 20HGSdkt028902 for ; Mon, 17 Jan 2022 17:00:00 GMT 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=oOpitOAsYhRPOBoYbyPcHJixHjNV9LwJM+mTa56AieY=; b=RGgE2fH0+1uOJFcLznHh3nzDo0G6XkN2sc2UmOjORC6rzOBWYaO+nNOnn8zeS8TfoBjM tOMVYJuP9egA6i0WAVESnsDHD+fpX+DxwVw86c26LL2vOsK9cbOL+D4aiilPtLINcsqk +xiby2dx3OcfMOtVEjMFgLHUStV4a03tYHRoF1Xk2c203aWRahOyIrQj2P4ZCmlEHecm M0WMcG93PCt7XU2EwOs5PzXmjnpZSgQw08vZjMZkQaDPqW9PNN7g7bU1SqDAW/8/aI5k 5VL4NOGh0KhDzhN1Fch+A6RavQz8qZyLqVGEfMFEIkwsIOi7iyTnep9pZ67a5mgWM807 /w== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 3dnc0trpk5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 17 Jan 2022 17:00:00 +0000 Received: from m0098404.ppops.net (m0098404.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 20HH00Yb012850 for ; Mon, 17 Jan 2022 17:00:00 GMT Received: from ppma04fra.de.ibm.com (6a.4a.5195.ip4.static.sl-reverse.com [149.81.74.106]) by mx0a-001b2d01.pphosted.com with ESMTP id 3dnc0trpje-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 17 Jan 2022 17:00:00 +0000 Received: from pps.filterd (ppma04fra.de.ibm.com [127.0.0.1]) by ppma04fra.de.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 20HGlsfM030109; Mon, 17 Jan 2022 16:59:58 GMT Received: from b06cxnps4074.portsmouth.uk.ibm.com (d06relay11.portsmouth.uk.ibm.com [9.149.109.196]) by ppma04fra.de.ibm.com with ESMTP id 3dknw955p2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 17 Jan 2022 16:59:57 +0000 Received: from b06wcsmtp001.portsmouth.uk.ibm.com (b06wcsmtp001.portsmouth.uk.ibm.com [9.149.105.160]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 20HGxsME37945652 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 17 Jan 2022 16:59:54 GMT Received: from b06wcsmtp001.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id A3946A405C; Mon, 17 Jan 2022 16:59:54 +0000 (GMT) Received: from b06wcsmtp001.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 5A58AA4054; Mon, 17 Jan 2022 16:59:54 +0000 (GMT) Received: from p-imbrenda.ibmuc.com (unknown [9.145.3.16]) by b06wcsmtp001.portsmouth.uk.ibm.com (Postfix) with ESMTP; Mon, 17 Jan 2022 16:59:54 +0000 (GMT) From: Claudio Imbrenda To: pbonzini@redhat.com Cc: kvm@vger.kernel.org, borntraeger@de.ibm.com, frankja@linux.ibm.com Subject: [kvm-unit-tests GIT PULL 10/13] s390x: mvpg-sie: Use snippet helpers Date: Mon, 17 Jan 2022 17:59:46 +0100 Message-Id: <20220117165949.75964-11-imbrenda@linux.ibm.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220117165949.75964-1-imbrenda@linux.ibm.com> References: <20220117165949.75964-1-imbrenda@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: z7HHrfbQ-NY3JWJIIgQzPwkAbVvzuw4_ X-Proofpoint-ORIG-GUID: X-eLfKrbIQKRO4OFp-Fbt0l0IVt-G6aW X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.816,Hydra:6.0.425,FMLib:17.11.62.513 definitions=2022-01-17_07,2022-01-14_01,2021-12-02_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 bulkscore=0 suspectscore=0 priorityscore=1501 adultscore=0 malwarescore=0 clxscore=1015 mlxlogscore=999 phishscore=0 impostorscore=0 spamscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2110150000 definitions=main-2201170104 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org From: Janosch Frank Time to use our shiny new snippet helpers. Signed-off-by: Janosch Frank Reviewed-by: Claudio Imbrenda Signed-off-by: Claudio Imbrenda --- s390x/mvpg-sie.c | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-) diff --git a/s390x/mvpg-sie.c b/s390x/mvpg-sie.c index d526069d..8ae9a52a 100644 --- a/s390x/mvpg-sie.c +++ b/s390x/mvpg-sie.c @@ -21,17 +21,12 @@ #include #include -static u8 *guest; static struct vm vm; static uint8_t *src; static uint8_t *dst; static uint8_t *cmp; -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) { uint64_t **pei_dst = (uint64_t **)((uintptr_t) vm.sblk + 0xc0); @@ -78,9 +73,6 @@ static void test_mvpg_pei(void) static void test_mvpg(void) { - int binary_size = SNIPPET_LEN(c, mvpg_snippet); - - memcpy(guest, SNIPPET_NAME_START(c, mvpg_snippet), binary_size); memset(src, 0x42, PAGE_SIZE); memset(dst, 0x43, PAGE_SIZE); sie(&vm); @@ -89,20 +81,20 @@ static void test_mvpg(void) static void setup_guest(void) { - setup_vm(); + extern const char SNIPPET_NAME_START(c, mvpg_snippet)[]; + extern const char SNIPPET_NAME_END(c, mvpg_snippet)[]; - /* Allocate 1MB as guest memory */ - guest = alloc_pages(8); + setup_vm(); - sie_guest_create(&vm, (uint64_t)guest, HPAGE_SIZE); + snippet_setup_guest(&vm, false); + snippet_init(&vm, SNIPPET_NAME_START(c, mvpg_snippet), + SNIPPET_LEN(c, mvpg_snippet), SNIPPET_OFF_C); - 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; - src = guest + PAGE_SIZE * 6; - dst = guest + PAGE_SIZE * 5; + src = (uint8_t *) vm.sblk->mso + PAGE_SIZE * 6; + dst = (uint8_t *) vm.sblk->mso + PAGE_SIZE * 5; cmp = alloc_page(); memset(cmp, 0, PAGE_SIZE); } From patchwork Mon Jan 17 16:59:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Claudio Imbrenda X-Patchwork-Id: 12715598 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 28056C433F5 for ; Mon, 17 Jan 2022 17:00:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241750AbiAQRAo (ORCPT ); Mon, 17 Jan 2022 12:00:44 -0500 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:54996 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S241510AbiAQRAE (ORCPT ); Mon, 17 Jan 2022 12:00:04 -0500 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 20HERK55029258 for ; Mon, 17 Jan 2022 17:00:03 GMT 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=nBgblX5gzPePnbIX2UeuXmPBNfqMKt/5Up/R5nUS4oE=; b=tJMbuhpQ7dji0AQETBlJG0X625t3DGRxbAqebrWhR2vh2InON0kZgQ9ubcn7V1oYzrTT jCVpgFmReYzfRbo+7SqF3bOzeHwBdlrPO4+JAlJBIAIh6xdlgRnKIwy19tHEnqRYfaJb 6SkslJdkGBFGDIfRnAozhXNSA2BUHRlQlNDILE/szNbmLdfpMvRjjXQe6Nye63Cea3ro igR68RD6CEYA+zPDRKa9vpLGaBgWPJcSv8yZwBCKyuWWHKXW9QXthV+B5Ml1a3yINd7E qW8dZ0v6r+ysfSvx67XBDu0RQ9G2LZSVpS7Q5QkkqegzGVBrF2ZGDgDBb99dW93vEvPR rg== Received: from pps.reinject (localhost [127.0.0.1]) by mx0b-001b2d01.pphosted.com with ESMTP id 3dna813xu0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 17 Jan 2022 17:00:03 +0000 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 20HGcxHj023681 for ; Mon, 17 Jan 2022 17:00:02 GMT Received: from ppma05fra.de.ibm.com (6c.4a.5195.ip4.static.sl-reverse.com [149.81.74.108]) by mx0b-001b2d01.pphosted.com with ESMTP id 3dna813xst-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 17 Jan 2022 17:00:02 +0000 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 20HGl8ai023331; Mon, 17 Jan 2022 17:00:01 GMT Received: from b06avi18878370.portsmouth.uk.ibm.com (b06avi18878370.portsmouth.uk.ibm.com [9.149.26.194]) by ppma05fra.de.ibm.com with ESMTP id 3dknw8n5wj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 17 Jan 2022 17:00:00 +0000 Received: from b06wcsmtp001.portsmouth.uk.ibm.com (b06wcsmtp001.portsmouth.uk.ibm.com [9.149.105.160]) by b06avi18878370.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 20HGxtPu47055132 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 17 Jan 2022 16:59:55 GMT Received: from b06wcsmtp001.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 16F3DA4062; Mon, 17 Jan 2022 16:59:55 +0000 (GMT) Received: from b06wcsmtp001.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B9323A4054; Mon, 17 Jan 2022 16:59:54 +0000 (GMT) Received: from p-imbrenda.ibmuc.com (unknown [9.145.3.16]) by b06wcsmtp001.portsmouth.uk.ibm.com (Postfix) with ESMTP; Mon, 17 Jan 2022 16:59:54 +0000 (GMT) From: Claudio Imbrenda To: pbonzini@redhat.com Cc: kvm@vger.kernel.org, borntraeger@de.ibm.com, frankja@linux.ibm.com Subject: [kvm-unit-tests GIT PULL 11/13] s390x: sie: Add PV diag test Date: Mon, 17 Jan 2022 17:59:47 +0100 Message-Id: <20220117165949.75964-12-imbrenda@linux.ibm.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220117165949.75964-1-imbrenda@linux.ibm.com> References: <20220117165949.75964-1-imbrenda@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: fAsT4zh52vb4MThh3fmW4Z7JtQBMRG_A X-Proofpoint-ORIG-GUID: C0ZvYe6IrBVhTeiTjn6DZ_of45XUG-R8 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.816,Hydra:6.0.425,FMLib:17.11.62.513 definitions=2022-01-17_07,2022-01-14_01,2021-12-02_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 bulkscore=0 mlxlogscore=999 clxscore=1015 impostorscore=0 suspectscore=0 adultscore=0 spamscore=0 malwarescore=0 lowpriorityscore=0 priorityscore=1501 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2110150000 definitions=main-2201170104 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org From: Janosch Frank Let's start testing the format 4 (PV) SIE via the diagnose instructions since most of them are pretty simple to handle. The tests check for the intercept values like ipa/ipb and icptcode as well as the values in the registers and handling of the exception injection. Signed-off-by: Janosch Frank Reviewed-by: Claudio Imbrenda Signed-off-by: Claudio Imbrenda --- s390x/Makefile | 6 + s390x/snippets/asm/snippet-pv-diag-288.S | 25 +++ s390x/snippets/asm/snippet-pv-diag-500.S | 39 +++++ s390x/snippets/asm/snippet-pv-diag-yield.S | 7 + s390x/pv-diags.c | 187 +++++++++++++++++++++ 5 files changed, 264 insertions(+) create mode 100644 s390x/snippets/asm/snippet-pv-diag-288.S create mode 100644 s390x/snippets/asm/snippet-pv-diag-500.S create mode 100644 s390x/snippets/asm/snippet-pv-diag-yield.S create mode 100644 s390x/pv-diags.c diff --git a/s390x/Makefile b/s390x/Makefile index 59afc1cd..53b0fe04 100644 --- a/s390x/Makefile +++ b/s390x/Makefile @@ -27,6 +27,8 @@ tests += $(TEST_DIR)/mvpg-sie.elf tests += $(TEST_DIR)/spec_ex-sie.elf tests += $(TEST_DIR)/firq.elf +pv-tests += $(TEST_DIR)/pv-diags.elf + ifneq ($(HOST_KEY_DOCUMENT),) ifneq ($(GEN_SE_HEADER),) tests += $(pv-tests) @@ -99,6 +101,10 @@ snippet_lib = $(snippet_asmlib) lib/auxinfo.o $(TEST_DIR)/mvpg-sie.elf: snippets = $(SNIPPET_DIR)/c/mvpg-snippet.gbin $(TEST_DIR)/spec_ex-sie.elf: snippets = $(SNIPPET_DIR)/c/spec_ex.gbin +$(TEST_DIR)/pv-diags.elf: pv-snippets += $(SNIPPET_DIR)/asm/snippet-pv-diag-yield.gbin +$(TEST_DIR)/pv-diags.elf: pv-snippets += $(SNIPPET_DIR)/asm/snippet-pv-diag-288.gbin +$(TEST_DIR)/pv-diags.elf: pv-snippets += $(SNIPPET_DIR)/asm/snippet-pv-diag-500.gbin + ifneq ($(GEN_SE_HEADER),) snippets += $(pv-snippets) tests += $(pv-tests) diff --git a/s390x/snippets/asm/snippet-pv-diag-288.S b/s390x/snippets/asm/snippet-pv-diag-288.S new file mode 100644 index 00000000..e3e63121 --- /dev/null +++ b/s390x/snippets/asm/snippet-pv-diag-288.S @@ -0,0 +1,25 @@ +#include +.section .text + +/* Clean and pre-load registers that are used for diag 288 */ +xgr %r0, %r0 +xgr %r1, %r1 +xgr %r3, %r3 +lghi %r0, 1 +lghi %r1, 2 +lghi %r2, 3 + +/* Let's jump to the pgm exit label on a PGM */ +larl %r4, exit_pgm +stg %r4, GEN_LC_PGM_NEW_PSW + 8 + +/* Execute the diag288 */ +diag %r0, %r2, 0x288 + +/* Force exit if we don't get a PGM */ +diag 0, 0, 0x44 + +/* Communicate the PGM code via diag9c(easiest) */ +exit_pgm: +lh %r1, GEN_LC_PGM_INT_CODE +diag %r1, 0, 0x9c diff --git a/s390x/snippets/asm/snippet-pv-diag-500.S b/s390x/snippets/asm/snippet-pv-diag-500.S new file mode 100644 index 00000000..50c06779 --- /dev/null +++ b/s390x/snippets/asm/snippet-pv-diag-500.S @@ -0,0 +1,39 @@ +#include +.section .text + +/* Clean and pre-load registers that are used for diag 500 */ +xgr %r1, %r1 +xgr %r2, %r2 +xgr %r3, %r3 +xgr %r4, %r4 +lghi %r1, 1 +lghi %r2, 2 +lghi %r3, 3 +lghi %r4, 4 + +/* Let's jump to the next label on a PGM */ +xgr %r5, %r5 +stg %r5, GEN_LC_PGM_NEW_PSW +larl %r5, next +stg %r5, GEN_LC_PGM_NEW_PSW + 8 + +/* Execute the diag500 */ +diag 0, 0, 0x500 + +/* Should never be executed because of the PGM */ +diag 0, 0, 0x44 + +/* Execute again to test spec PGM injection*/ +next: +lh %r1, GEN_LC_PGM_INT_CODE +diag %r1, 0, 0x9c +larl %r5, done +stg %r5, GEN_LC_PGM_NEW_PSW + 8 +diag 0, 0, 0x500 + +/* Should never be executed because of the PGM */ +diag 0, 0, 0x44 + +done: +lh %r1, GEN_LC_PGM_INT_CODE +diag %r1, 0, 0x9c diff --git a/s390x/snippets/asm/snippet-pv-diag-yield.S b/s390x/snippets/asm/snippet-pv-diag-yield.S new file mode 100644 index 00000000..5795cf0f --- /dev/null +++ b/s390x/snippets/asm/snippet-pv-diag-yield.S @@ -0,0 +1,7 @@ +.section .text + +xgr %r0, %r0 +xgr %r1, %r1 +diag 0,0,0x44 +lghi %r1, 42 +diag 1,0,0x9c diff --git a/s390x/pv-diags.c b/s390x/pv-diags.c new file mode 100644 index 00000000..110547ad --- /dev/null +++ b/s390x/pv-diags.c @@ -0,0 +1,187 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* + * PV virtualization interception tests for diagnose instructions. + * + * Copyright (c) 2021 IBM Corp + * + * Authors: + * Janosch Frank + */ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static struct vm vm; + +static void test_diag_500(void) +{ + extern const char SNIPPET_NAME_START(asm, snippet_pv_diag_500)[]; + extern const char SNIPPET_NAME_END(asm, snippet_pv_diag_500)[]; + extern const char SNIPPET_HDR_START(asm, snippet_pv_diag_500)[]; + extern const char SNIPPET_HDR_END(asm, snippet_pv_diag_500)[]; + int size_hdr = SNIPPET_HDR_LEN(asm, snippet_pv_diag_500); + int size_gbin = SNIPPET_LEN(asm, snippet_pv_diag_500); + + report_prefix_push("diag 0x500"); + + snippet_pv_init(&vm, SNIPPET_NAME_START(asm, snippet_pv_diag_500), + SNIPPET_HDR_START(asm, snippet_pv_diag_500), + size_gbin, size_hdr, SNIPPET_OFF_ASM); + + sie(&vm); + report(vm.sblk->icptcode == ICPT_PV_INSTR && vm.sblk->ipa == 0x8302 && + vm.sblk->ipb == 0x50000000 && vm.save_area.guest.grs[5] == 0x500, + "intercept values"); + report(vm.save_area.guest.grs[1] == 1 && + vm.save_area.guest.grs[2] == 2 && + vm.save_area.guest.grs[3] == 3 && + vm.save_area.guest.grs[4] == 4, + "register values"); + /* + * Check if we can inject a PGM operand which we are always + * allowed to do after a diag500 exit. + */ + vm.sblk->iictl = IICTL_CODE_OPERAND; + sie(&vm); + report(vm.sblk->icptcode == ICPT_PV_NOTIFY && vm.sblk->ipa == 0x8302 && + vm.sblk->ipb == 0x50000000 && vm.save_area.guest.grs[5] == 0x9c + && vm.save_area.guest.grs[0] == PGM_INT_CODE_OPERAND, + "operand exception"); + + /* + * Check if we can inject a PGM specification which we are always + * allowed to do after a diag500 exit. + */ + sie(&vm); + vm.sblk->iictl = IICTL_CODE_SPECIFICATION; + /* Inject PGM, next exit should be 9c */ + sie(&vm); + report(vm.sblk->icptcode == ICPT_PV_NOTIFY && vm.sblk->ipa == 0x8302 && + vm.sblk->ipb == 0x50000000 && vm.save_area.guest.grs[5] == 0x9c + && vm.save_area.guest.grs[0] == PGM_INT_CODE_SPECIFICATION, + "specification exception"); + + /* No need for cleanup, just tear down the VM */ + uv_destroy_guest(&vm); + + report_prefix_pop(); +} + + +static void test_diag_288(void) +{ + extern const char SNIPPET_NAME_START(asm, snippet_pv_diag_288)[]; + extern const char SNIPPET_NAME_END(asm, snippet_pv_diag_288)[]; + extern const char SNIPPET_HDR_START(asm, snippet_pv_diag_288)[]; + extern const char SNIPPET_HDR_END(asm, snippet_pv_diag_288)[]; + int size_hdr = SNIPPET_HDR_LEN(asm, snippet_pv_diag_288); + int size_gbin = SNIPPET_LEN(asm, snippet_pv_diag_288); + + report_prefix_push("diag 0x288"); + + snippet_pv_init(&vm, SNIPPET_NAME_START(asm, snippet_pv_diag_288), + SNIPPET_HDR_START(asm, snippet_pv_diag_288), + size_gbin, size_hdr, SNIPPET_OFF_ASM); + + sie(&vm); + report(vm.sblk->icptcode == ICPT_PV_INSTR && vm.sblk->ipa == 0x8302 && + vm.sblk->ipb == 0x50000000 && vm.save_area.guest.grs[5] == 0x288, + "intercept values"); + report(vm.save_area.guest.grs[0] == 1 && + vm.save_area.guest.grs[1] == 2 && + vm.save_area.guest.grs[2] == 3, + "register values"); + + /* + * Check if we can inject a PGM spec which we are always + * allowed to do after a diag288 exit. + */ + vm.sblk->iictl = IICTL_CODE_SPECIFICATION; + sie(&vm); + report(vm.sblk->icptcode == ICPT_PV_NOTIFY && vm.sblk->ipa == 0x8302 && + vm.sblk->ipb == 0x50000000 && vm.save_area.guest.grs[5] == 0x9c + && vm.save_area.guest.grs[0] == PGM_INT_CODE_SPECIFICATION, + "specification exception"); + + /* No need for cleanup, just tear down the VM */ + uv_destroy_guest(&vm); + + report_prefix_pop(); +} + +static void test_diag_yield(void) +{ + extern const char SNIPPET_NAME_START(asm, snippet_pv_diag_yield)[]; + extern const char SNIPPET_NAME_END(asm, snippet_pv_diag_yield)[]; + extern const char SNIPPET_HDR_START(asm, snippet_pv_diag_yield)[]; + extern const char SNIPPET_HDR_END(asm, snippet_pv_diag_yield)[]; + int size_hdr = SNIPPET_HDR_LEN(asm, snippet_pv_diag_yield); + int size_gbin = SNIPPET_LEN(asm, snippet_pv_diag_yield); + + report_prefix_push("diag yield"); + + snippet_pv_init(&vm, SNIPPET_NAME_START(asm, snippet_pv_diag_yield), + SNIPPET_HDR_START(asm, snippet_pv_diag_yield), + size_gbin, size_hdr, SNIPPET_OFF_ASM); + + /* 0x44 */ + report_prefix_push("0x44"); + sie(&vm); + report(vm.sblk->icptcode == ICPT_PV_NOTIFY && vm.sblk->ipa == 0x8302 && + vm.sblk->ipb == 0x50000000 && vm.save_area.guest.grs[5] == 0x44, + "intercept values"); + report_prefix_pop(); + + /* 0x9c */ + report_prefix_push("0x9c"); + sie(&vm); + report(vm.sblk->icptcode == ICPT_PV_NOTIFY && vm.sblk->ipa == 0x8302 && + vm.sblk->ipb == 0x50000000 && vm.save_area.guest.grs[5] == 0x9c, + "intercept values"); + report(vm.save_area.guest.grs[0] == 42, "r1 correct"); + report_prefix_pop(); + + uv_destroy_guest(&vm); + report_prefix_pop(); +} + + +int main(void) +{ + report_prefix_push("pv-diags"); + if (!test_facility(158)) { + report_skip("UV Call facility unavailable"); + goto done; + } + if (!sclp_facilities.has_sief2) { + report_skip("SIEF2 facility unavailable"); + goto done; + } + + uv_setup_asces(); + snippet_setup_guest(&vm, true); + test_diag_yield(); + test_diag_288(); + test_diag_500(); + sie_guest_destroy(&vm); + +done: + report_prefix_pop(); + return report_summary(); +} From patchwork Mon Jan 17 16:59:48 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Claudio Imbrenda X-Patchwork-Id: 12715599 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 68A5BC433EF for ; Mon, 17 Jan 2022 17:00:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241324AbiAQRAs (ORCPT ); Mon, 17 Jan 2022 12:00:48 -0500 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:19884 "EHLO mx0b-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241511AbiAQRAE (ORCPT ); Mon, 17 Jan 2022 12:00:04 -0500 Received: from pps.filterd (m0127361.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 20HGvdn3023393 for ; Mon, 17 Jan 2022 17:00:03 GMT 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=GXB9TRB7x1l7/Lz63hixRqlO9EDs8Rv0JXVsBTk3suw=; b=nQFEwSqwyCX799+s7E8clqxGzg1suHKFDif/a9pCw74CgO82/jX6dr6zLUbudLv0Weuz VrI7lgzOqy+lGzM02j9tMj9vciIXmR2G1eLXZk2REyqqZwdWxjv394Rj82uhwez2CD0j kYUgd9oKQBSOCu8zg0jAj4ONDIL/5LrX01onQo01fd25AyELM7tTDSF4XUL0dpXRKmu0 1Mq6HY62VrTQ6tApdE1rOc41o4N4ApBgi/0uB94YjLYkYa4V2NfV57LikBfg7E4V6AzQ yUrFsnb6sgfBAH1p/88aj24uyyBiCmSKnuduRbKqKnzzXzWS4yu8YwITYFq3xk+M3aUS Jw== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 3dncefr167-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 17 Jan 2022 17:00:03 +0000 Received: from m0127361.ppops.net (m0127361.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 20HH038Z032148 for ; Mon, 17 Jan 2022 17:00:03 GMT 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 3dncefr15j-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 17 Jan 2022 17:00:02 +0000 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 20HGl5Od005197; Mon, 17 Jan 2022 17:00:01 GMT Received: from b06avi18878370.portsmouth.uk.ibm.com (b06avi18878370.portsmouth.uk.ibm.com [9.149.26.194]) by ppma03fra.de.ibm.com with ESMTP id 3dknwa56y4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 17 Jan 2022 17:00:01 +0000 Received: from b06wcsmtp001.portsmouth.uk.ibm.com (b06wcsmtp001.portsmouth.uk.ibm.com [9.149.105.160]) by b06avi18878370.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 20HGxteq39256546 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 17 Jan 2022 16:59:55 GMT Received: from b06wcsmtp001.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 816C1A405F; Mon, 17 Jan 2022 16:59:55 +0000 (GMT) Received: from b06wcsmtp001.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 2B8ACA4054; Mon, 17 Jan 2022 16:59:55 +0000 (GMT) Received: from p-imbrenda.ibmuc.com (unknown [9.145.3.16]) by b06wcsmtp001.portsmouth.uk.ibm.com (Postfix) with ESMTP; Mon, 17 Jan 2022 16:59:55 +0000 (GMT) From: Claudio Imbrenda To: pbonzini@redhat.com Cc: kvm@vger.kernel.org, borntraeger@de.ibm.com, frankja@linux.ibm.com Subject: [kvm-unit-tests GIT PULL 12/13] s390x: smp: Allocate memory in DMA31 space Date: Mon, 17 Jan 2022 17:59:48 +0100 Message-Id: <20220117165949.75964-13-imbrenda@linux.ibm.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220117165949.75964-1-imbrenda@linux.ibm.com> References: <20220117165949.75964-1-imbrenda@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: pJYc82byQjLA8RJx_O-3OnKqSEuRkPkp X-Proofpoint-ORIG-GUID: 82qsMGksdkK87APLF1UVCxZZwHlq8FS6 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.816,Hydra:6.0.425,FMLib:17.11.62.513 definitions=2022-01-17_07,2022-01-14_01,2021-12-02_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 impostorscore=0 clxscore=1015 mlxscore=0 phishscore=0 bulkscore=0 suspectscore=0 mlxlogscore=999 lowpriorityscore=0 priorityscore=1501 spamscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2110150000 definitions=main-2201170104 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org From: Janosch Frank The store status at address order works with 31 bit addresses so let's use them. Signed-off-by: Janosch Frank Reviewed-by: Claudio Imbrenda [Fix order number - found by Nico Boehr] Signed-off-by: Claudio Imbrenda --- s390x/smp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/s390x/smp.c b/s390x/smp.c index 329ca92d..1bbe4c31 100644 --- a/s390x/smp.c +++ b/s390x/smp.c @@ -121,7 +121,7 @@ static void test_stop_store_status(void) static void test_store_status(void) { - struct cpu_status *status = alloc_pages(1); + struct cpu_status *status = alloc_pages_flags(1, AREA_DMA31); uint32_t r; report_prefix_push("store status at address"); @@ -241,7 +241,7 @@ static void test_func_initial(void) static void test_reset_initial(void) { - struct cpu_status *status = alloc_pages(0); + struct cpu_status *status = alloc_pages_flags(0, AREA_DMA31); struct psw psw; int i; From patchwork Mon Jan 17 16:59:49 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Claudio Imbrenda X-Patchwork-Id: 12715600 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5EE59C4332F for ; Mon, 17 Jan 2022 17:00:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241542AbiAQRAt (ORCPT ); Mon, 17 Jan 2022 12:00:49 -0500 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:44562 "EHLO mx0b-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241492AbiAQRAC (ORCPT ); Mon, 17 Jan 2022 12:00:02 -0500 Received: from pps.filterd (m0127361.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 20HGveD2023477 for ; Mon, 17 Jan 2022 17:00:01 GMT 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=D5FvXFkE7Q6a1GtjVrzY1q2EZsqIgl4ob6uLH39pQ60=; b=qzfHXwFYqlMcMc41jsGbstVKdN5+Qd15xPy38iMp3hEuhYTSjQKCk6OpcmweUUn+blJ8 T2uNzApSvnM1mMcpf6TeYy61IgykM/or4kStTPF+mj+MTq274M3mhGWTdJHxgu2d2/65 C7oHYXwHV8Hdk4QvUflSKO1EU2iCHORgADjuhrFiqvhzS3mHjHA2hqY0riIiz4On8X2d MC7PxuWq5nrCDD6bKC6rpRtTsiADR+ufdudLWALUybV5d+nwW1boOwi+bTgWbfXsE+Ya nTAin7fV4RFZ+xDKzyfxb+gwflrBPlzhH+SZbUX7IspbU4/rebU6qFw22k73DDc8qdWe nA== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 3dncefr156-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 17 Jan 2022 17:00:01 +0000 Received: from m0127361.ppops.net (m0127361.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 20HGx5Eu027676 for ; Mon, 17 Jan 2022 17:00:00 GMT 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 3dncefr14u-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 17 Jan 2022 17:00:00 +0000 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 20HGl7D0019653; Mon, 17 Jan 2022 16:59:59 GMT Received: from b06avi18626390.portsmouth.uk.ibm.com (b06avi18626390.portsmouth.uk.ibm.com [9.149.26.192]) by ppma03ams.nl.ibm.com with ESMTP id 3dknw9e2u0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 17 Jan 2022 16:59:59 +0000 Received: from b06wcsmtp001.portsmouth.uk.ibm.com (b06wcsmtp001.portsmouth.uk.ibm.com [9.149.105.160]) by b06avi18626390.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 20HGofTm41877956 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 17 Jan 2022 16:50:41 GMT Received: from b06wcsmtp001.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id EAE60A4060; Mon, 17 Jan 2022 16:59:55 +0000 (GMT) Received: from b06wcsmtp001.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 95A72A4054; Mon, 17 Jan 2022 16:59:55 +0000 (GMT) Received: from p-imbrenda.ibmuc.com (unknown [9.145.3.16]) by b06wcsmtp001.portsmouth.uk.ibm.com (Postfix) with ESMTP; Mon, 17 Jan 2022 16:59:55 +0000 (GMT) From: Claudio Imbrenda To: pbonzini@redhat.com Cc: kvm@vger.kernel.org, borntraeger@de.ibm.com, frankja@linux.ibm.com Subject: [kvm-unit-tests GIT PULL 13/13] s390x: firq: Fix sclp buffer allocation Date: Mon, 17 Jan 2022 17:59:49 +0100 Message-Id: <20220117165949.75964-14-imbrenda@linux.ibm.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220117165949.75964-1-imbrenda@linux.ibm.com> References: <20220117165949.75964-1-imbrenda@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: jl3rqJ6g2c8fmcSgj3hJVqmJ2reg2zoL X-Proofpoint-ORIG-GUID: oTq6CX0G1zcmSZ1pf0ugO1BckbZY0iyt X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.816,Hydra:6.0.425,FMLib:17.11.62.513 definitions=2022-01-17_07,2022-01-14_01,2021-12-02_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 impostorscore=0 clxscore=1015 mlxscore=0 phishscore=0 bulkscore=0 suspectscore=0 mlxlogscore=773 lowpriorityscore=0 priorityscore=1501 spamscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2110150000 definitions=main-2201170104 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org From: Janosch Frank We need a 32 bit address for the sclp buffer so let's use a page from the first 31 bits. Signed-off-by: Janosch Frank Reviewed-by: Claudio Imbrenda Signed-off-by: Claudio Imbrenda --- s390x/firq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/s390x/firq.c b/s390x/firq.c index 1f877183..fb9a2906 100644 --- a/s390x/firq.c +++ b/s390x/firq.c @@ -87,7 +87,7 @@ static void test_wait_state_delivery(void) */ while(smp_sense_running_status(1)); - h = alloc_page(); + h = alloc_pages_flags(0, AREA_DMA31); h->length = 4096; ret = servc(SCLP_CMDW_READ_CPU_INFO, __pa(h)); if (ret) {