From patchwork Tue Jun 22 08:20:31 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Janosch Frank X-Patchwork-Id: 12336581 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2AA4EC49EA5 for ; Tue, 22 Jun 2021 08:21:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0FB6460C3E for ; Tue, 22 Jun 2021 08:21:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230331AbhFVIXy (ORCPT ); Tue, 22 Jun 2021 04:23:54 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:32650 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229954AbhFVIXv (ORCPT ); Tue, 22 Jun 2021 04:23:51 -0400 Received: from pps.filterd (m0098396.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 15M83Uck020691; Tue, 22 Jun 2021 04:21:36 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=pp1; bh=17/ky+kFRnDh8Wevz9eO3A82JHOeyzzotomVJe+ma5o=; b=srCsGaiDZOGPnpKIbKM1+i1ecJM7jS2ozohWyPgc27010s5qq+54zjahiWI8/zAnYFuU po4v+ba9ImGAZOnfFgsC7pRdbgtDI0jxtAbLwn+t8oMSIqqYddAXzc3DLhbgzU6zK6JU qXued9HT29ezFNvU2W4OCw4IQE4rIuUJuOU4Bq0UhGMJTClmJGX+bSX4/GfuvzajXPro T6WAq7VlX13Gqgw9/odOz4BYvdiaG4jDRqi80Aj3BamFdoLQ8fYA0Qmnf5ZZV8kRPp3C lIqQqErLG83SFEM03k+y/z1hZpb6fz8l6/l+wjAxM2DpC1ZxQ0569RUer2vNyR5LMtWQ Dg== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 39b8ng5ugh-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 22 Jun 2021 04:21:35 -0400 Received: from m0098396.ppops.net (m0098396.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 15M83ova022033; Tue, 22 Jun 2021 04:21:35 -0400 Received: from ppma03ams.nl.ibm.com (62.31.33a9.ip4.static.sl-reverse.com [169.51.49.98]) by mx0a-001b2d01.pphosted.com with ESMTP id 39b8ng5ufy-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 22 Jun 2021 04:21:35 -0400 Received: from pps.filterd (ppma03ams.nl.ibm.com [127.0.0.1]) by ppma03ams.nl.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 15M8DWpt003018; Tue, 22 Jun 2021 08:21:33 GMT Received: from b06cxnps3075.portsmouth.uk.ibm.com (d06relay10.portsmouth.uk.ibm.com [9.149.109.195]) by ppma03ams.nl.ibm.com with ESMTP id 3998789a7d-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 22 Jun 2021 08:21:33 +0000 Received: from d06av26.portsmouth.uk.ibm.com (d06av26.portsmouth.uk.ibm.com [9.149.105.62]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 15M8LUoM31129968 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 22 Jun 2021 08:21:30 GMT Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 0AAB3AE055; Tue, 22 Jun 2021 08:21:30 +0000 (GMT) Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 71EE5AE053; Tue, 22 Jun 2021 08:21:29 +0000 (GMT) Received: from localhost.localdomain.com (unknown [9.145.182.30]) by d06av26.portsmouth.uk.ibm.com (Postfix) with ESMTP; Tue, 22 Jun 2021 08:21:29 +0000 (GMT) From: Janosch Frank To: pbonzini@redhat.com Cc: kvm@vger.kernel.org, frankja@linux.ibm.com, david@redhat.com, borntraeger@de.ibm.com, cohuck@redhat.com, linux-s390@vger.kernel.org, imbrenda@linux.ibm.com, thuth@redhat.com Subject: [kvm-unit-tests GIT PULL 01/12] s390x: sie: Only overwrite r3 if it isn't needed anymore Date: Tue, 22 Jun 2021 10:20:31 +0200 Message-Id: <20210622082042.13831-2-frankja@linux.ibm.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210622082042.13831-1-frankja@linux.ibm.com> References: <20210622082042.13831-1-frankja@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: b1_VbLabQqJ5IGC4lYjac4cj0iZgTts0 X-Proofpoint-ORIG-GUID: 3KdcAlejPgQQi8xRxodIHxsOMZld0A4J X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.391,18.0.790 definitions=2021-06-22_04:2021-06-21,2021-06-22 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 mlxlogscore=958 priorityscore=1501 malwarescore=0 bulkscore=0 impostorscore=0 lowpriorityscore=0 clxscore=1015 phishscore=0 suspectscore=0 spamscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104190000 definitions=main-2106220050 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org The lmg overwrites r3 which we later use to reference the fprs and fpc. Let's do the lmg at the end where overwriting is fine. Signed-off-by: Janosch Frank Reviewed-by: David Hildenbrand Reviewed-by: Claudio Imbrenda Reviewed-by: Cornelia Huck --- s390x/cpu.S | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/s390x/cpu.S b/s390x/cpu.S index e2ad56c8..82b5e25d 100644 --- a/s390x/cpu.S +++ b/s390x/cpu.S @@ -81,11 +81,11 @@ sie64a: stg %r3,__SF_SIE_SAVEAREA(%r15) # save guest register save area # Load guest's gprs, fprs and fpc - lmg %r0,%r13,SIE_SAVEAREA_GUEST_GRS(%r3) .irp i, 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15 ld \i, \i * 8 + SIE_SAVEAREA_GUEST_FPRS(%r3) .endr lfpc SIE_SAVEAREA_GUEST_FPC(%r3) + lmg %r0,%r13,SIE_SAVEAREA_GUEST_GRS(%r3) # Move scb ptr into r14 for the sie instruction lg %r14,__SF_SIE_CONTROL(%r15) From patchwork Tue Jun 22 08:20:32 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Janosch Frank X-Patchwork-Id: 12336583 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0C532C49EA7 for ; Tue, 22 Jun 2021 08:21:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id EFAE460C3E for ; Tue, 22 Jun 2021 08:21:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230415AbhFVIXz (ORCPT ); Tue, 22 Jun 2021 04:23:55 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:17352 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230298AbhFVIXx (ORCPT ); Tue, 22 Jun 2021 04:23:53 -0400 Received: from pps.filterd (m0098404.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 15M8Esl2023927; Tue, 22 Jun 2021 04:21:37 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=pp1; bh=yolfqXsSRROPjoxHzVs4uFNfRvvy1PgequUTAwAHZK8=; b=hGbiyEMX5DSasw7zTbcFd2KnRYfVSpIUGzcAoTznwurV0Sio9UJcYN0XwkxLXXSTtzal mkQg5Mm+RxkxLEy/dXv/swDtbmUVFFSQZn/ujd4PvMNtAJ9ZUJdywZOLVIwLq17yPAGN kT6QCCmEAlYIQfyphzoxnGl6OsF+DLmupj///N7cQd3YQ2jcsZXlKUNjX2LUrn8tEXLE Qr1VzhTIFNXk5bNIxqQNPeD5cDMinQnRfHKCO6dUd9MR/1kPVVpIHWsYFCFt1KKigaVP mHI7A5CG/TahXDQhX3coYxP72rAqkrwFxN/tN3erwetvtkJjiG7obOCNzwxdm7WauWG6 pg== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 39bc6ar5nu-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 22 Jun 2021 04:21:36 -0400 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 15M8G0Js030547; Tue, 22 Jun 2021 04:21:36 -0400 Received: from ppma03fra.de.ibm.com (6b.4a.5195.ip4.static.sl-reverse.com [149.81.74.107]) by mx0a-001b2d01.pphosted.com with ESMTP id 39bc6ar5n5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 22 Jun 2021 04:21:36 -0400 Received: from pps.filterd (ppma03fra.de.ibm.com [127.0.0.1]) by ppma03fra.de.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 15M8F5BY000874; Tue, 22 Jun 2021 08:21:33 GMT Received: from b06cxnps3075.portsmouth.uk.ibm.com (d06relay10.portsmouth.uk.ibm.com [9.149.109.195]) by ppma03fra.de.ibm.com with ESMTP id 3998788q37-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 22 Jun 2021 08:21:33 +0000 Received: from d06av26.portsmouth.uk.ibm.com (d06av26.portsmouth.uk.ibm.com [9.149.105.62]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 15M8LUqO31129970 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 22 Jun 2021 08:21:30 GMT Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id AA4EEAE053; Tue, 22 Jun 2021 08:21:30 +0000 (GMT) Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 2BE20AE051; Tue, 22 Jun 2021 08:21:30 +0000 (GMT) Received: from localhost.localdomain.com (unknown [9.145.182.30]) by d06av26.portsmouth.uk.ibm.com (Postfix) with ESMTP; Tue, 22 Jun 2021 08:21:30 +0000 (GMT) From: Janosch Frank To: pbonzini@redhat.com Cc: kvm@vger.kernel.org, frankja@linux.ibm.com, david@redhat.com, borntraeger@de.ibm.com, cohuck@redhat.com, linux-s390@vger.kernel.org, imbrenda@linux.ibm.com, thuth@redhat.com Subject: [kvm-unit-tests GIT PULL 02/12] s390x: selftest: Add prefixes to fix report output Date: Tue, 22 Jun 2021 10:20:32 +0200 Message-Id: <20210622082042.13831-3-frankja@linux.ibm.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210622082042.13831-1-frankja@linux.ibm.com> References: <20210622082042.13831-1-frankja@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: TsmFsf6KOfgIRcCCdxGOymlYxTyuF88y X-Proofpoint-ORIG-GUID: -Op6_UvHxfywlQJQGCXAC7n1VFRp-Pd9 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.391,18.0.790 definitions=2021-06-22_04:2021-06-21,2021-06-22 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 priorityscore=1501 spamscore=0 lowpriorityscore=0 impostorscore=0 suspectscore=0 bulkscore=0 adultscore=0 phishscore=0 malwarescore=0 mlxlogscore=999 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104190000 definitions=main-2106220050 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org To make our TAP parser (and me) happy we don't want to have two reports with exactly the same wording so I added in two new prefix pushes. Also moving the code inside of the region of a prefix will give us more data when a problem arises. Signed-off-by: Janosch Frank Reviewed-by: Claudio Imbrenda Reviewed-by: Thomas Huth Reviewed-by: Cornelia Huck --- s390x/selftest.c | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/s390x/selftest.c b/s390x/selftest.c index b2fe2e7b..0f099ca0 100644 --- a/s390x/selftest.c +++ b/s390x/selftest.c @@ -40,19 +40,28 @@ static void test_pgm_int(void) static void test_malloc(void) { - int *tmp = malloc(sizeof(int)); - int *tmp2 = malloc(sizeof(int)); + int *tmp, *tmp2; + report_prefix_push("malloc"); + + report_prefix_push("ptr_0"); + tmp = malloc(sizeof(int)); + report((uintptr_t)tmp & 0xf000000000000000ul, "allocated memory"); *tmp = 123456789; + mb(); + report(*tmp == 123456789, "wrote allocated memory"); + report_prefix_pop(); + + report_prefix_push("ptr_1"); + tmp2 = malloc(sizeof(int)); + report((uintptr_t)tmp2 & 0xf000000000000000ul, + "allocated memory"); *tmp2 = 123456789; mb(); + report((*tmp2 == 123456789), "wrote allocated memory"); + report_prefix_pop(); - report((uintptr_t)tmp & 0xf000000000000000ul, "malloc: got vaddr"); - report(*tmp == 123456789, "malloc: access works"); - report((uintptr_t)tmp2 & 0xf000000000000000ul, - "malloc: got 2nd vaddr"); - report((*tmp2 == 123456789), "malloc: access works"); - report(tmp != tmp2, "malloc: addresses differ"); + report(tmp != tmp2, "allocated memory addresses differ"); expect_pgm_int(); configure_dat(0); @@ -62,6 +71,7 @@ static void test_malloc(void) free(tmp); free(tmp2); + report_prefix_pop(); } int main(int argc, char**argv) From patchwork Tue Jun 22 08:20:33 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Janosch Frank X-Patchwork-Id: 12336585 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 303A0C2B9F4 for ; Tue, 22 Jun 2021 08:21:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1C8156128C for ; Tue, 22 Jun 2021 08:21:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230450AbhFVIX4 (ORCPT ); Tue, 22 Jun 2021 04:23:56 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:27270 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S230292AbhFVIXx (ORCPT ); Tue, 22 Jun 2021 04:23:53 -0400 Received: from pps.filterd (m0098414.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 15M8GK5p149605; Tue, 22 Jun 2021 04:21:37 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=pp1; bh=mUwu5Hwfg8YNjJdZg0rCZn1gdQlpqnVVruI2qKf2rZY=; b=Vz7XDWeKHPcnGRymluD70r8vkFPaNCnhqEmU34SgRUPsuhuqI473m9X14U/oKimHZtyM AwF1+FtxO5z4AFV50VBKlz1VRL8t+8ajL9aeYoWHYA4ies6vyf2TSx/soXfehC1HyGcY s4UB+fu5tM7kqM48VD360/fdIaitBiRbq6M/C3j/TOGfkbXG2yjk9kp6mcldJG+XW4OU SaVZxdc6ySkxJx4UbcQ63DBF+acFEcNh70CWv6lRfJX6fPtSs3HAMsZRswR25We6hHU8 6kaNSP5RFqafHUO1wEsffNbhjY2Bf8pHGiS5IkapZkUPpUoXuP/aXw9AHF+J4vWkrl3X gg== Received: from pps.reinject (localhost [127.0.0.1]) by mx0b-001b2d01.pphosted.com with ESMTP id 39bc73r2h8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 22 Jun 2021 04:21:36 -0400 Received: from m0098414.ppops.net (m0098414.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 15M8Iq5h159398; Tue, 22 Jun 2021 04:21:36 -0400 Received: from ppma04ams.nl.ibm.com (63.31.33a9.ip4.static.sl-reverse.com [169.51.49.99]) by mx0b-001b2d01.pphosted.com with ESMTP id 39bc73r2gp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 22 Jun 2021 04:21:36 -0400 Received: from pps.filterd (ppma04ams.nl.ibm.com [127.0.0.1]) by ppma04ams.nl.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 15M8BqU5018907; Tue, 22 Jun 2021 08:21:34 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 3998789abt-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 22 Jun 2021 08:21:34 +0000 Received: from d06av26.portsmouth.uk.ibm.com (d06av26.portsmouth.uk.ibm.com [9.149.105.62]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 15M8LVH730605730 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 22 Jun 2021 08:21:31 GMT Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 5BABAAE04D; Tue, 22 Jun 2021 08:21:31 +0000 (GMT) Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id CA324AE051; Tue, 22 Jun 2021 08:21:30 +0000 (GMT) Received: from localhost.localdomain.com (unknown [9.145.182.30]) by d06av26.portsmouth.uk.ibm.com (Postfix) with ESMTP; Tue, 22 Jun 2021 08:21:30 +0000 (GMT) From: Janosch Frank To: pbonzini@redhat.com Cc: kvm@vger.kernel.org, frankja@linux.ibm.com, david@redhat.com, borntraeger@de.ibm.com, cohuck@redhat.com, linux-s390@vger.kernel.org, imbrenda@linux.ibm.com, thuth@redhat.com Subject: [kvm-unit-tests GIT PULL 03/12] s390x: Don't run PV testcases under tcg Date: Tue, 22 Jun 2021 10:20:33 +0200 Message-Id: <20210622082042.13831-4-frankja@linux.ibm.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210622082042.13831-1-frankja@linux.ibm.com> References: <20210622082042.13831-1-frankja@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: 7smuBCg0XzUU1StzsT5nXglHqVqRpTs- X-Proofpoint-GUID: 4VOZu6XFCbA-Gx6DE4u0KXCqXLCNBqiz X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.391,18.0.790 definitions=2021-06-22_04:2021-06-21,2021-06-22 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 spamscore=0 clxscore=1015 adultscore=0 lowpriorityscore=0 phishscore=0 priorityscore=1501 mlxscore=0 bulkscore=0 malwarescore=0 impostorscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104190000 definitions=main-2106220050 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org The UV call facility is only available on hardware. Signed-off-by: Janosch Frank Reviewed-by: David Hildenbrand Reviewed-by: Thomas Huth --- scripts/s390x/func.bash | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scripts/s390x/func.bash b/scripts/s390x/func.bash index b3912081..bf799a56 100644 --- a/scripts/s390x/func.bash +++ b/scripts/s390x/func.bash @@ -21,6 +21,9 @@ function arch_cmd_s390x() "$cmd" "$testname" "$groups" "$smp" "$kernel" "$opts" "$arch" "$check" "$accel" "$timeout" # run PV test case + if [ "$ACCEL" = 'tcg' ]; then + return + fi kernel=${kernel%.elf}.pv.bin testname=${testname}_PV if [ ! -f "${kernel}" ]; then From patchwork Tue Jun 22 08:20:34 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Janosch Frank X-Patchwork-Id: 12336587 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CA250C49EA5 for ; Tue, 22 Jun 2021 08:21:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B7B166134F for ; Tue, 22 Jun 2021 08:21:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230498AbhFVIX6 (ORCPT ); Tue, 22 Jun 2021 04:23:58 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:23842 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S230312AbhFVIXx (ORCPT ); Tue, 22 Jun 2021 04:23:53 -0400 Received: from pps.filterd (m0098413.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 15M8BgYJ086540; Tue, 22 Jun 2021 04:21:38 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=pp1; bh=9ejHKvv8rT4b6NpinOQzw3f66b/0Az5ildR5JWwkwKE=; b=HAMsxfIBZvXzG1kcyDxbaqKlgMbRR3MjTHTqjiN82XQo9E7fwTlHPdNF+q6+i9+NaVVI IOzWBEH/dvbewhVo9it3AKLGdcWKqgn2Rxw72nfz2p383Nr7PyOeYEzEF/b0JbEzJMcT wXXbYPuoy/tHXy3D9uZbVYAx3kfFIfYIdpJcBV+m0V7ZXP6BW7Wq5TCercey5qzyKici FR7uJX2XGmk+yHapi99Hxz2iSiUtSI62IQlWf3YPBOkoUhzbtGLQjGz/aQrKpuFCwnU/ OnB5Ifx6jcwq5uOJ73IRW17mDh2iTO3+tNgwUAiFjlH45kZJoTE0Bfn1xQw41HrRt3f1 GA== Received: from pps.reinject (localhost [127.0.0.1]) by mx0b-001b2d01.pphosted.com with ESMTP id 39b94q4h5c-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 22 Jun 2021 04:21:37 -0400 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 15M8DElp089676; Tue, 22 Jun 2021 04:21:37 -0400 Received: from ppma03fra.de.ibm.com (6b.4a.5195.ip4.static.sl-reverse.com [149.81.74.107]) by mx0b-001b2d01.pphosted.com with ESMTP id 39b94q4h4u-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 22 Jun 2021 04:21:37 -0400 Received: from pps.filterd (ppma03fra.de.ibm.com [127.0.0.1]) by ppma03fra.de.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 15M8EB7g031963; Tue, 22 Jun 2021 08:21:35 GMT Received: from b06cxnps4075.portsmouth.uk.ibm.com (d06relay12.portsmouth.uk.ibm.com [9.149.109.197]) by ppma03fra.de.ibm.com with ESMTP id 3998788q38-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 22 Jun 2021 08:21:35 +0000 Received: from d06av26.portsmouth.uk.ibm.com (d06av26.portsmouth.uk.ibm.com [9.149.105.62]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 15M8LWFV33423792 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 22 Jun 2021 08:21:32 GMT Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 4B510AE04D; Tue, 22 Jun 2021 08:21:32 +0000 (GMT) Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 7BF2BAE051; Tue, 22 Jun 2021 08:21:31 +0000 (GMT) Received: from localhost.localdomain.com (unknown [9.145.182.30]) by d06av26.portsmouth.uk.ibm.com (Postfix) with ESMTP; Tue, 22 Jun 2021 08:21:31 +0000 (GMT) From: Janosch Frank To: pbonzini@redhat.com Cc: kvm@vger.kernel.org, frankja@linux.ibm.com, david@redhat.com, borntraeger@de.ibm.com, cohuck@redhat.com, linux-s390@vger.kernel.org, imbrenda@linux.ibm.com, thuth@redhat.com Subject: [kvm-unit-tests GIT PULL 04/12] configure: s390x: Check if the host key document exists Date: Tue, 22 Jun 2021 10:20:34 +0200 Message-Id: <20210622082042.13831-5-frankja@linux.ibm.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210622082042.13831-1-frankja@linux.ibm.com> References: <20210622082042.13831-1-frankja@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: rh3I-tGj4vZ62a_X344KhG4SU-3HOIod X-Proofpoint-ORIG-GUID: b4MBaw0X97AUeTNFSDxGRnpRLXwhvFWp X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.391,18.0.790 definitions=2021-06-22_04:2021-06-21,2021-06-22 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 bulkscore=0 mlxscore=0 suspectscore=0 phishscore=0 adultscore=0 clxscore=1015 mlxlogscore=999 spamscore=0 priorityscore=1501 lowpriorityscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104190000 definitions=main-2106220050 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org I'd rather have a readable error message than make failing the build with cryptic errors. Signed-off-by: Janosch Frank Reviewed-by: Thomas Huth --- configure | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/configure b/configure index b8442d61..71aaad43 100755 --- a/configure +++ b/configure @@ -137,6 +137,11 @@ while [[ "$1" = -* ]]; do esac done +if [ -n "$host_key_document" ] && [ ! -f "$host_key_document" ]; then + echo "Host key document doesn't exist at the specified location." + exit 1 +fi + if [ "$erratatxt" ] && [ ! -f "$erratatxt" ]; then echo "erratatxt: $erratatxt does not exist or is not a regular file" exit 1 From patchwork Tue Jun 22 08:20:35 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Janosch Frank X-Patchwork-Id: 12336589 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D975DC49EB9 for ; Tue, 22 Jun 2021 08:21:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B915D6128C for ; Tue, 22 Jun 2021 08:21:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230521AbhFVIYA (ORCPT ); Tue, 22 Jun 2021 04:24:00 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:15318 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230419AbhFVIXz (ORCPT ); Tue, 22 Jun 2021 04:23:55 -0400 Received: from pps.filterd (m0098394.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 15M84rPG035834; Tue, 22 Jun 2021 04:21:40 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=pp1; bh=oz+devSGVPEgUp75BPoF4Yuo++P4Pd3iqxvbll7dtvI=; b=p83ZN7R3am5/zF2askEsXbGzl9o1cqsdwGf9Abkd1pTdQAhvMv0OgROQMJFw9C9HzlcI kBSR9oxq1QgKdy/bWkrIbgoHnJ9UYEHRsxvb5OWCc5hOJM4n0LNmNfGiTsjapUXby7Fh JfwvgU7gQ2BPbTS97OJxPN7l1mji9eBe8WMJ6SqKBPo5vvpQzzpcW0E82Y8UDqjZsVkt IAGfGoh6lch007ZeNilWGgB74MN291CSKb4lUYOOSQfEpjjJN80WB73om+vRZ09k1ozX /X6VURppHixq2rewEo94IXoZSkYwNF36mA0otSK1+QwhJ3vc6HXfqqeXE3sHv1ZPCon/ fw== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 39b8dcp4gx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 22 Jun 2021 04:21:39 -0400 Received: from m0098394.ppops.net (m0098394.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 15M85Hch038146; Tue, 22 Jun 2021 04:21:39 -0400 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 39b8dcp4g0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 22 Jun 2021 04:21:39 -0400 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 15M8DCrn011269; Tue, 22 Jun 2021 08:21:37 GMT Received: from b06cxnps3074.portsmouth.uk.ibm.com (d06relay09.portsmouth.uk.ibm.com [9.149.109.194]) by ppma04fra.de.ibm.com with ESMTP id 399878rqgf-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 22 Jun 2021 08:21:36 +0000 Received: from d06av26.portsmouth.uk.ibm.com (d06av26.portsmouth.uk.ibm.com [9.149.105.62]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 15M8LXEi17039646 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 22 Jun 2021 08:21:33 GMT Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 9E5BBAE058; Tue, 22 Jun 2021 08:21:33 +0000 (GMT) Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 83593AE04D; Tue, 22 Jun 2021 08:21:32 +0000 (GMT) Received: from localhost.localdomain.com (unknown [9.145.182.30]) by d06av26.portsmouth.uk.ibm.com (Postfix) with ESMTP; Tue, 22 Jun 2021 08:21:32 +0000 (GMT) From: Janosch Frank To: pbonzini@redhat.com Cc: kvm@vger.kernel.org, frankja@linux.ibm.com, david@redhat.com, borntraeger@de.ibm.com, cohuck@redhat.com, linux-s390@vger.kernel.org, imbrenda@linux.ibm.com, thuth@redhat.com Subject: [kvm-unit-tests GIT PULL 05/12] s390x: run: Skip PV tests when tcg is the accelerator Date: Tue, 22 Jun 2021 10:20:35 +0200 Message-Id: <20210622082042.13831-6-frankja@linux.ibm.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210622082042.13831-1-frankja@linux.ibm.com> References: <20210622082042.13831-1-frankja@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: jIhQHs_ZLG6HRMdJI5Ot_095H50Ju5p_ X-Proofpoint-GUID: DhXRlYbi_BBU7A5kg_54cFyX5Bi4RfQ7 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.391,18.0.790 definitions=2021-06-22_04:2021-06-21,2021-06-22 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 mlxlogscore=999 priorityscore=1501 malwarescore=0 bulkscore=0 adultscore=0 spamscore=0 mlxscore=0 suspectscore=0 clxscore=1015 impostorscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104190000 definitions=main-2106220050 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org TCG doesn't support PV. Signed-off-by: Janosch Frank Reviewed-by: Thomas Huth --- s390x/run | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/s390x/run b/s390x/run index 09805044..c615caa1 100755 --- a/s390x/run +++ b/s390x/run @@ -15,6 +15,11 @@ ACCEL=$(get_qemu_accelerator) || qemu=$(search_qemu_binary) || exit $? +if [ "${1: -7}" = ".pv.bin" ] || [ "${TESTNAME: -3}" = "_PV" ] && [ "$ACCEL" = "tcg" ]; then + echo "Protected Virtualization isn't supported under TCG" + exit 2 +fi + M='-machine s390-ccw-virtio' M+=",accel=$ACCEL" command="$qemu -nodefaults -nographic $M" From patchwork Tue Jun 22 08:20:36 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Janosch Frank X-Patchwork-Id: 12336591 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DE154C49EA7 for ; Tue, 22 Jun 2021 08:21:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C45B261351 for ; Tue, 22 Jun 2021 08:21:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230380AbhFVIYA (ORCPT ); Tue, 22 Jun 2021 04:24:00 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:15104 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S230409AbhFVIXz (ORCPT ); Tue, 22 Jun 2021 04:23:55 -0400 Received: from pps.filterd (m0098419.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 15M84j19186641; Tue, 22 Jun 2021 04:21:39 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=pp1; bh=UguGSuackUq1ddI7nszFID1pnGVrW6KOAa6WLVgo0m4=; b=K5xWN8YtsIp/EzZm7s9DlBms7X6LzfSSnRzXmI9TxlAqjxknzTjC0bjPSKvHUmEPJ94b ZhANW1yvDQbO2gLYRs3mAc2qdLQ3caeFrSgKEAIAB3VAYsjUPIWaxwe4Ve7iaZanaceP wdQkUePmE/l8ekF8TLgumvfcwirYRxY1amlC80DQhgnqs1OGpe1gyrx3tNMXLcTkizBW iD7rvyKQIPwhhKA6HCboY1zsViKX+WS0Hw8f80cMB3ugdDQeeolvVNMJ5PP5tVvFUriJ pmKlqau2N2/pcah+kGRv23RfmmYBv9e9lW+TXCeIf0sd4MEFsO2DugEe+0R3AuPxu44v 1Q== Received: from pps.reinject (localhost [127.0.0.1]) by mx0b-001b2d01.pphosted.com with ESMTP id 39b87nx6gt-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 22 Jun 2021 04:21:39 -0400 Received: from m0098419.ppops.net (m0098419.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 15M850sN188320; Tue, 22 Jun 2021 04:21:39 -0400 Received: from ppma04fra.de.ibm.com (6a.4a.5195.ip4.static.sl-reverse.com [149.81.74.106]) by mx0b-001b2d01.pphosted.com with ESMTP id 39b87nx6g8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 22 Jun 2021 04:21:39 -0400 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 15M8BxTI010120; Tue, 22 Jun 2021 08:21:37 GMT Received: from b06cxnps4076.portsmouth.uk.ibm.com (d06relay13.portsmouth.uk.ibm.com [9.149.109.198]) by ppma04fra.de.ibm.com with ESMTP id 399878rqgg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 22 Jun 2021 08:21:37 +0000 Received: from d06av26.portsmouth.uk.ibm.com (d06av26.portsmouth.uk.ibm.com [9.149.105.62]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 15M8LY8715860196 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 22 Jun 2021 08:21:34 GMT Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 48ACEAE058; Tue, 22 Jun 2021 08:21:34 +0000 (GMT) Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id BF0B2AE051; Tue, 22 Jun 2021 08:21:33 +0000 (GMT) Received: from localhost.localdomain.com (unknown [9.145.182.30]) by d06av26.portsmouth.uk.ibm.com (Postfix) with ESMTP; Tue, 22 Jun 2021 08:21:33 +0000 (GMT) From: Janosch Frank To: pbonzini@redhat.com Cc: kvm@vger.kernel.org, frankja@linux.ibm.com, david@redhat.com, borntraeger@de.ibm.com, cohuck@redhat.com, linux-s390@vger.kernel.org, imbrenda@linux.ibm.com, thuth@redhat.com Subject: [kvm-unit-tests GIT PULL 06/12] s390x: lib: add and use macros for control register bits Date: Tue, 22 Jun 2021 10:20:36 +0200 Message-Id: <20210622082042.13831-7-frankja@linux.ibm.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210622082042.13831-1-frankja@linux.ibm.com> References: <20210622082042.13831-1-frankja@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: Rp9pyikg04zGZZy_FFrFxLC3LsUqxcXD X-Proofpoint-GUID: QA-es1aa-jkdhwFcFlTPFiOAHLqc2SyI X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.391,18.0.790 definitions=2021-06-22_04:2021-06-21,2021-06-22 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 adultscore=0 impostorscore=0 malwarescore=0 suspectscore=0 spamscore=0 phishscore=0 clxscore=1015 mlxscore=0 lowpriorityscore=0 priorityscore=1501 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104190000 definitions=main-2106220050 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org From: Claudio Imbrenda Add CTL0_* and CTL2_* macros for specific control register bits. Replace all hardcoded values in the library and in the existing testcases so that they use the new macros. Signed-off-by: Claudio Imbrenda Reviewed-by: Janosch Frank Message-Id: <20210611140705.553307-2-imbrenda@linux.ibm.com> Signed-off-by: Janosch Frank --- lib/s390x/asm/arch_def.h | 12 ++++++++++++ lib/s390x/asm/float.h | 4 ++-- lib/s390x/asm/interrupt.h | 4 ++-- lib/s390x/sclp.c | 4 ++-- s390x/diag288.c | 2 +- s390x/gs.c | 2 +- s390x/iep.c | 4 ++-- s390x/skrf.c | 2 +- s390x/smp.c | 8 ++++---- s390x/vector.c | 2 +- 10 files changed, 28 insertions(+), 16 deletions(-) diff --git a/lib/s390x/asm/arch_def.h b/lib/s390x/asm/arch_def.h index 76f9e386..3aa5da9c 100644 --- a/lib/s390x/asm/arch_def.h +++ b/lib/s390x/asm/arch_def.h @@ -229,6 +229,18 @@ static inline uint64_t stctg(int cr) return value; } +#define CTL0_LOW_ADDR_PROT (63 - 35) +#define CTL0_EDAT (63 - 40) +#define CTL0_IEP (63 - 43) +#define CTL0_AFP (63 - 45) +#define CTL0_VECTOR (63 - 46) +#define CTL0_EMERGENCY_SIGNAL (63 - 49) +#define CTL0_EXTERNAL_CALL (63 - 50) +#define CTL0_CLOCK_COMPARATOR (63 - 52) +#define CTL0_SERVICE_SIGNAL (63 - 54) + +#define CTL2_GUARDED_STORAGE (63 - 59) + static inline void ctl_set_bit(int cr, unsigned int bit) { uint64_t reg; diff --git a/lib/s390x/asm/float.h b/lib/s390x/asm/float.h index eb752050..73c642d4 100644 --- a/lib/s390x/asm/float.h +++ b/lib/s390x/asm/float.h @@ -38,12 +38,12 @@ static inline void set_fpc_dxc(uint8_t dxc) static inline void afp_enable(void) { - ctl_set_bit(0, 63 - 45); + ctl_set_bit(0, CTL0_AFP); } static inline void afp_disable(void) { - ctl_clear_bit(0, 63 - 45); + ctl_clear_bit(0, CTL0_AFP); } #endif diff --git a/lib/s390x/asm/interrupt.h b/lib/s390x/asm/interrupt.h index 31e4766d..bf0eb40d 100644 --- a/lib/s390x/asm/interrupt.h +++ b/lib/s390x/asm/interrupt.h @@ -27,13 +27,13 @@ void check_pgm_int_code(uint16_t code); /* Activate low-address protection */ static inline void low_prot_enable(void) { - ctl_set_bit(0, 63 - 35); + ctl_set_bit(0, CTL0_LOW_ADDR_PROT); } /* Disable low-address protection */ static inline void low_prot_disable(void) { - ctl_clear_bit(0, 63 - 35); + ctl_clear_bit(0, CTL0_LOW_ADDR_PROT); } #endif diff --git a/lib/s390x/sclp.c b/lib/s390x/sclp.c index 291924b0..9502d161 100644 --- a/lib/s390x/sclp.c +++ b/lib/s390x/sclp.c @@ -50,7 +50,7 @@ void sclp_setup_int(void) { uint64_t mask; - ctl_set_bit(0, 9); + ctl_set_bit(0, CTL0_SERVICE_SIGNAL); mask = extract_psw_mask(); mask |= PSW_MASK_EXT; @@ -59,7 +59,7 @@ void sclp_setup_int(void) void sclp_handle_ext(void) { - ctl_clear_bit(0, 9); + ctl_clear_bit(0, CTL0_SERVICE_SIGNAL); spin_lock(&sclp_lock); sclp_busy = false; spin_unlock(&sclp_lock); diff --git a/s390x/diag288.c b/s390x/diag288.c index e132ff04..82b6ec17 100644 --- a/s390x/diag288.c +++ b/s390x/diag288.c @@ -86,7 +86,7 @@ static void test_bite(void) asm volatile("stck %0" : "=Q" (time) : : "cc"); time += (uint64_t)(16000 * 1000) << 12; asm volatile("sckc %0" : : "Q" (time)); - ctl_set_bit(0, 11); + ctl_set_bit(0, CTL0_CLOCK_COMPARATOR); mask = extract_psw_mask(); mask |= PSW_MASK_EXT; load_psw_mask(mask); diff --git a/s390x/gs.c b/s390x/gs.c index 1376d0e6..a017a97d 100644 --- a/s390x/gs.c +++ b/s390x/gs.c @@ -145,7 +145,7 @@ static void test_special(void) static void init(void) { /* Enable control bit for gs */ - ctl_set_bit(2, 4); + ctl_set_bit(2, CTL2_GUARDED_STORAGE); /* Setup gs registers to guard the gs_area */ gs_cb.gsd = gs_area | 25; diff --git a/s390x/iep.c b/s390x/iep.c index fe167ef0..906c77b3 100644 --- a/s390x/iep.c +++ b/s390x/iep.c @@ -22,7 +22,7 @@ static void test_iep(void) void (*fn)(void); /* Enable IEP */ - ctl_set_bit(0, 20); + ctl_set_bit(0, CTL0_IEP); /* Get and protect a page with the IEP bit */ iepbuf = alloc_page(); @@ -40,7 +40,7 @@ static void test_iep(void) check_pgm_int_code(PGM_INT_CODE_PROTECTION); report_prefix_pop(); unprotect_page(iepbuf, PAGE_ENTRY_IEP); - ctl_clear_bit(0, 20); + ctl_clear_bit(0, CTL0_IEP); free_page(iepbuf); } diff --git a/s390x/skrf.c b/s390x/skrf.c index 57524ba8..94e906a6 100644 --- a/s390x/skrf.c +++ b/s390x/skrf.c @@ -150,7 +150,7 @@ static void ecall_setup(void) /* Put a skey into the ext new psw */ lc->ext_new_psw.mask = 0x00F0000180000000UL; /* Open up ext masks */ - ctl_set_bit(0, 13); + ctl_set_bit(0, CTL0_EXTERNAL_CALL); mask = extract_psw_mask(); mask |= PSW_MASK_EXT; load_psw_mask(mask); diff --git a/s390x/smp.c b/s390x/smp.c index b0ece491..f25ec769 100644 --- a/s390x/smp.c +++ b/s390x/smp.c @@ -154,7 +154,7 @@ static void ecall(void) struct lowcore *lc = (void *)0x0; expect_ext_int(); - ctl_set_bit(0, 13); + ctl_set_bit(0, CTL0_EXTERNAL_CALL); mask = extract_psw_mask(); mask |= PSW_MASK_EXT; load_psw_mask(mask); @@ -188,7 +188,7 @@ static void emcall(void) struct lowcore *lc = (void *)0x0; expect_ext_int(); - ctl_set_bit(0, 14); + ctl_set_bit(0, CTL0_EMERGENCY_SIGNAL); mask = extract_psw_mask(); mask |= PSW_MASK_EXT; load_psw_mask(mask); @@ -283,8 +283,8 @@ static void test_local_ints(void) unsigned long mask; /* Open masks for ecall and emcall */ - ctl_set_bit(0, 13); - ctl_set_bit(0, 14); + ctl_set_bit(0, CTL0_EXTERNAL_CALL); + ctl_set_bit(0, CTL0_EMERGENCY_SIGNAL); mask = extract_psw_mask(); mask |= PSW_MASK_EXT; load_psw_mask(mask); diff --git a/s390x/vector.c b/s390x/vector.c index b052de55..fdb0eee2 100644 --- a/s390x/vector.c +++ b/s390x/vector.c @@ -106,7 +106,7 @@ static void test_bcd_add(void) static void init(void) { /* Enable vector instructions */ - ctl_set_bit(0, 17); + ctl_set_bit(0, CTL0_VECTOR); /* Preset vector registers to 0xff */ memset(pagebuf, 0xff, PAGE_SIZE); From patchwork Tue Jun 22 08:20:37 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Janosch Frank X-Patchwork-Id: 12336593 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 83DBBC49EA4 for ; Tue, 22 Jun 2021 08:21:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 607E460C3E for ; Tue, 22 Jun 2021 08:21:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230456AbhFVIYB (ORCPT ); Tue, 22 Jun 2021 04:24:01 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:16400 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S230298AbhFVIX4 (ORCPT ); Tue, 22 Jun 2021 04:23:56 -0400 Received: from pps.filterd (m0098413.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 15M8BRnV085765; Tue, 22 Jun 2021 04:21:40 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=pp1; bh=GZ9ZNBNDRoxkGuYCDzKekCbpUsLjg6qP6i97ByaDwvY=; b=USpPLT+kEYrEH4yvr2oVkbA7qJDZEnKV9fXBykJ7W+lWhTQbZ1Ujb6IAO2nZ+zdVjxHF kW0W9JajffOtq/rskv01GkqugKONGSv6sh9oBDvXdqGA6nZ4D0tNjCADIIz6v83fyuO2 eGoZU3ci0x7j1/RxO93bKFWx6vqlhJzEtOyBHSQjq7WwvoyX37mRjZeJW2jfN5aFOAbL tw5nF5yEipwla/fyNA9hvTkqv2FdsZGsb57VpWBsFju5XHxYAJ+QOt9yj5u2u475TgmP /BuH3GtacmxQHO841l/njbgDBBgwVkHQlCO6qkdR8OgI4uklGs38xv8BomXNvkUfmMk1 9A== Received: from pps.reinject (localhost [127.0.0.1]) by mx0b-001b2d01.pphosted.com with ESMTP id 39b94q4h6g-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 22 Jun 2021 04:21:39 -0400 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 15M8Cl2E089006; Tue, 22 Jun 2021 04:21:39 -0400 Received: from ppma04ams.nl.ibm.com (63.31.33a9.ip4.static.sl-reverse.com [169.51.49.99]) by mx0b-001b2d01.pphosted.com with ESMTP id 39b94q4h5v-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 22 Jun 2021 04:21:39 -0400 Received: from pps.filterd (ppma04ams.nl.ibm.com [127.0.0.1]) by ppma04ams.nl.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 15M8CJ8P020377; Tue, 22 Jun 2021 08:21:37 GMT Received: from b06avi18878370.portsmouth.uk.ibm.com (b06avi18878370.portsmouth.uk.ibm.com [9.149.26.194]) by ppma04ams.nl.ibm.com with ESMTP id 3998789abv-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 22 Jun 2021 08:21:37 +0000 Received: from d06av26.portsmouth.uk.ibm.com (d06av26.portsmouth.uk.ibm.com [9.149.105.62]) by b06avi18878370.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 15M8KFME36438456 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 22 Jun 2021 08:20:15 GMT Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id ED2C5AE055; Tue, 22 Jun 2021 08:21:34 +0000 (GMT) Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 688BFAE051; Tue, 22 Jun 2021 08:21:34 +0000 (GMT) Received: from localhost.localdomain.com (unknown [9.145.182.30]) by d06av26.portsmouth.uk.ibm.com (Postfix) with ESMTP; Tue, 22 Jun 2021 08:21:34 +0000 (GMT) From: Janosch Frank To: pbonzini@redhat.com Cc: kvm@vger.kernel.org, frankja@linux.ibm.com, david@redhat.com, borntraeger@de.ibm.com, cohuck@redhat.com, linux-s390@vger.kernel.org, imbrenda@linux.ibm.com, thuth@redhat.com Subject: [kvm-unit-tests GIT PULL 07/12] libcflat: add SZ_1M and SZ_2G Date: Tue, 22 Jun 2021 10:20:37 +0200 Message-Id: <20210622082042.13831-8-frankja@linux.ibm.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210622082042.13831-1-frankja@linux.ibm.com> References: <20210622082042.13831-1-frankja@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: 77I5ctji8SwLV1WxGqTVo27jGlXGyQeC X-Proofpoint-ORIG-GUID: CuxOpzwMZ6v-aJ9xKuR-pfDu37fkZMtH X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.391,18.0.790 definitions=2021-06-22_04:2021-06-21,2021-06-22 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 bulkscore=0 mlxscore=0 suspectscore=0 phishscore=0 adultscore=0 clxscore=1015 mlxlogscore=999 spamscore=0 priorityscore=1501 lowpriorityscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104190000 definitions=main-2106220050 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org From: Claudio Imbrenda Add SZ_1M and SZ_2G to libcflat.h s390x needs those for large/huge pages Signed-off-by: Claudio Imbrenda Reviewed-by: Thomas Huth Message-Id: <20210611140705.553307-3-imbrenda@linux.ibm.com> Signed-off-by: Janosch Frank --- lib/libcflat.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/libcflat.h b/lib/libcflat.h index f40b431d..97db9e38 100644 --- a/lib/libcflat.h +++ b/lib/libcflat.h @@ -157,7 +157,9 @@ extern void setup_vm(void); #define SZ_8K (1 << 13) #define SZ_16K (1 << 14) #define SZ_64K (1 << 16) +#define SZ_1M (1 << 20) #define SZ_2M (1 << 21) #define SZ_1G (1 << 30) +#define SZ_2G (1ul << 31) #endif From patchwork Tue Jun 22 08:20:38 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Janosch Frank X-Patchwork-Id: 12336595 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8FD51C49EAF for ; Tue, 22 Jun 2021 08:21:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 76F0A6128C for ; Tue, 22 Jun 2021 08:21:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230402AbhFVIYC (ORCPT ); Tue, 22 Jun 2021 04:24:02 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:25788 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230445AbhFVIX4 (ORCPT ); Tue, 22 Jun 2021 04:23:56 -0400 Received: from pps.filterd (m0098396.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 15M83UZg020751; Tue, 22 Jun 2021 04:21:41 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=pp1; bh=QwKP8xw/psgaMga/txQ+lAjNisspP9u4tRIx9LvZikg=; b=X6+0cFUdS9YGFwvu3OKN+58i3rZal0c41w9yDCNbx0KqOtgvPxFGSqHgKiVzcf9RZksM e8IdaarhA9w9T/uM9MpkCepRkUD1ePga39ImXrpFKSXX8pVYl4d0IjpDh5V9B5ufKv0+ PtCJQD974rUSjfBPdSFGu3/aWSPgyK3XbUzwhsTezRcsc13y0VH2aPzLmQ4mJvEQhF0i DbdA2UVjiXwVMrQm5MmaLsX2UNLyaJgAha7rRSC1eXqEKEPrDCwa/BTfR5KBmsNJSYCw 4q7bzFrk8DtL7YtlC9DPpxMCL5IDOBAkbKdgU5iGDMCO6IgglQDbYAM5E1a2kHStTgR4 Yg== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 39b8ng5ujx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 22 Jun 2021 04:21:41 -0400 Received: from m0098396.ppops.net (m0098396.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 15M83lJS021935; Tue, 22 Jun 2021 04:21:41 -0400 Received: from ppma05fra.de.ibm.com (6c.4a.5195.ip4.static.sl-reverse.com [149.81.74.108]) by mx0a-001b2d01.pphosted.com with ESMTP id 39b8ng5uj1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 22 Jun 2021 04:21:40 -0400 Received: from pps.filterd (ppma05fra.de.ibm.com [127.0.0.1]) by ppma05fra.de.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 15M8D9SQ016038; Tue, 22 Jun 2021 08:21:38 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 3998788q7a-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 22 Jun 2021 08:21:38 +0000 Received: from d06av26.portsmouth.uk.ibm.com (d06av26.portsmouth.uk.ibm.com [9.149.105.62]) by b06avi18878370.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 15M8KFRo36438464 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 22 Jun 2021 08:20:15 GMT Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 978D9AE051; Tue, 22 Jun 2021 08:21:35 +0000 (GMT) Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 1932DAE04D; Tue, 22 Jun 2021 08:21:35 +0000 (GMT) Received: from localhost.localdomain.com (unknown [9.145.182.30]) by d06av26.portsmouth.uk.ibm.com (Postfix) with ESMTP; Tue, 22 Jun 2021 08:21:35 +0000 (GMT) From: Janosch Frank To: pbonzini@redhat.com Cc: kvm@vger.kernel.org, frankja@linux.ibm.com, david@redhat.com, borntraeger@de.ibm.com, cohuck@redhat.com, linux-s390@vger.kernel.org, imbrenda@linux.ibm.com, thuth@redhat.com Subject: [kvm-unit-tests GIT PULL 08/12] s390x: lib: fix pgtable.h Date: Tue, 22 Jun 2021 10:20:38 +0200 Message-Id: <20210622082042.13831-9-frankja@linux.ibm.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210622082042.13831-1-frankja@linux.ibm.com> References: <20210622082042.13831-1-frankja@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: r7knnnYoLsU0y9GvEAg1lNwXSN8qOTHG X-Proofpoint-ORIG-GUID: YuDjjdtmRdtw8tb5axryxHGYFO1NdaGo X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.391,18.0.790 definitions=2021-06-22_04:2021-06-21,2021-06-22 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 mlxlogscore=999 priorityscore=1501 malwarescore=0 bulkscore=0 impostorscore=0 lowpriorityscore=0 clxscore=1015 phishscore=0 suspectscore=0 spamscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104190000 definitions=main-2106220050 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org From: Claudio Imbrenda Fix pgtable.h: * SEGMENT_ENTRY_SFAA had one extra bit set * pmd entries don't have a length field * ipte does not need to clear the lower bits - clearing the 12 lower bits is technically incorrect, as page tables are architecturally aligned to 11 bit addresses (even though the unit tests allocate always one full page) * region table entries should use REGION_ENTRY_TL instead of *_TABLE_LENGTH - *_TABLE_LENGTH need to stay, because they should be used for ASCEs Signed-off-by: Claudio Imbrenda Reviewed-by: Janosch Frank Message-Id: <20210611140705.553307-4-imbrenda@linux.ibm.com> Signed-off-by: Janosch Frank --- lib/s390x/asm/pgtable.h | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/lib/s390x/asm/pgtable.h b/lib/s390x/asm/pgtable.h index 277f3480..1a21f175 100644 --- a/lib/s390x/asm/pgtable.h +++ b/lib/s390x/asm/pgtable.h @@ -60,7 +60,7 @@ #define SEGMENT_SHIFT 20 #define SEGMENT_ENTRY_ORIGIN 0xfffffffffffff800UL -#define SEGMENT_ENTRY_SFAA 0xfffffffffff80000UL +#define SEGMENT_ENTRY_SFAA 0xfffffffffff00000UL #define SEGMENT_ENTRY_AV 0x0000000000010000UL #define SEGMENT_ENTRY_ACC 0x000000000000f000UL #define SEGMENT_ENTRY_F 0x0000000000000800UL @@ -143,7 +143,7 @@ static inline p4d_t *p4d_alloc(pgd_t *pgd, unsigned long addr) if (pgd_none(*pgd)) { p4d_t *p4d = p4d_alloc_one(); pgd_val(*pgd) = __pa(p4d) | REGION_ENTRY_TT_REGION1 | - REGION_TABLE_LENGTH; + REGION_ENTRY_TL; } return p4d_offset(pgd, addr); } @@ -163,7 +163,7 @@ static inline pud_t *pud_alloc(p4d_t *p4d, unsigned long addr) if (p4d_none(*p4d)) { pud_t *pud = pud_alloc_one(); p4d_val(*p4d) = __pa(pud) | REGION_ENTRY_TT_REGION2 | - REGION_TABLE_LENGTH; + REGION_ENTRY_TL; } return pud_offset(p4d, addr); } @@ -183,7 +183,7 @@ static inline pmd_t *pmd_alloc(pud_t *pud, unsigned long addr) if (pud_none(*pud)) { pmd_t *pmd = pmd_alloc_one(); pud_val(*pud) = __pa(pmd) | REGION_ENTRY_TT_REGION3 | - REGION_TABLE_LENGTH; + REGION_ENTRY_TL; } return pmd_offset(pud, addr); } @@ -202,15 +202,14 @@ static inline pte_t *pte_alloc(pmd_t *pmd, unsigned long addr) { if (pmd_none(*pmd)) { pte_t *pte = pte_alloc_one(); - pmd_val(*pmd) = __pa(pte) | SEGMENT_ENTRY_TT_SEGMENT | - SEGMENT_TABLE_LENGTH; + pmd_val(*pmd) = __pa(pte) | SEGMENT_ENTRY_TT_SEGMENT; } return pte_offset(pmd, addr); } static inline void ipte(unsigned long vaddr, pteval_t *p_pte) { - unsigned long table_origin = (unsigned long)p_pte & PAGE_MASK; + unsigned long table_origin = (unsigned long)p_pte; asm volatile( " ipte %0,%1\n" From patchwork Tue Jun 22 08:20:39 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Janosch Frank X-Patchwork-Id: 12336597 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 21795C2B9F4 for ; Tue, 22 Jun 2021 08:21:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 05D916134F for ; Tue, 22 Jun 2021 08:21:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230496AbhFVIYD (ORCPT ); Tue, 22 Jun 2021 04:24:03 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:52846 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S230451AbhFVIX5 (ORCPT ); Tue, 22 Jun 2021 04:23:57 -0400 Received: from pps.filterd (m0098419.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 15M84i69186634; Tue, 22 Jun 2021 04:21:41 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=pp1; bh=yRfoz3zOv3ka43RXEbJOHIE9lJsY2QdkvnGIALqTI/c=; b=sY1Wqa2UEdaXaaFEDx9IFp6Imr94rjQGcgJJ348bOFtnFSGMgDZmPmdn0ZNka3LWNX9C zrpszGoevbOWF12Mk0bimn4wuKxqnt0jII9fA2ARsRfo5Sso9sAdcALnSsD0rOd0cdsy +Fha/KXBsoXlKrwVWJ8lpChjKcCHvLFXmHrup+XhRQW76cxAvKK/a7eniVLOS0KTjLoL fvcQJW5Sp9XHV6A+weLdbEJYp9IM0JbwbL29rn5aZVLme2Yg8MMUlvsxlKg6knsc3Yzz RNR7G9rPyeb/Cuk3HgfAFZEWqd3orXw1rThHR0YQz3DEprcMBCzQLI61aRw/P+9pD6Vl sA== Received: from pps.reinject (localhost [127.0.0.1]) by mx0b-001b2d01.pphosted.com with ESMTP id 39b87nx6hp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 22 Jun 2021 04:21:41 -0400 Received: from m0098419.ppops.net (m0098419.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 15M854Zx188786; Tue, 22 Jun 2021 04:21:41 -0400 Received: from ppma03fra.de.ibm.com (6b.4a.5195.ip4.static.sl-reverse.com [149.81.74.107]) by mx0b-001b2d01.pphosted.com with ESMTP id 39b87nx6h0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 22 Jun 2021 04:21:41 -0400 Received: from pps.filterd (ppma03fra.de.ibm.com [127.0.0.1]) by ppma03fra.de.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 15M8F5BZ000874; Tue, 22 Jun 2021 08:21:39 GMT Received: from b06avi18626390.portsmouth.uk.ibm.com (b06avi18626390.portsmouth.uk.ibm.com [9.149.26.192]) by ppma03fra.de.ibm.com with ESMTP id 3998788q39-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 22 Jun 2021 08:21:39 +0000 Received: from d06av26.portsmouth.uk.ibm.com (d06av26.portsmouth.uk.ibm.com [9.149.105.62]) by b06avi18626390.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 15M8KJBi33358206 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 22 Jun 2021 08:20:19 GMT Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 3E732AE055; Tue, 22 Jun 2021 08:21:36 +0000 (GMT) Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B7659AE04D; Tue, 22 Jun 2021 08:21:35 +0000 (GMT) Received: from localhost.localdomain.com (unknown [9.145.182.30]) by d06av26.portsmouth.uk.ibm.com (Postfix) with ESMTP; Tue, 22 Jun 2021 08:21:35 +0000 (GMT) From: Janosch Frank To: pbonzini@redhat.com Cc: kvm@vger.kernel.org, frankja@linux.ibm.com, david@redhat.com, borntraeger@de.ibm.com, cohuck@redhat.com, linux-s390@vger.kernel.org, imbrenda@linux.ibm.com, thuth@redhat.com Subject: [kvm-unit-tests GIT PULL 09/12] s390x: lib: Add idte and other huge pages functions/macros Date: Tue, 22 Jun 2021 10:20:39 +0200 Message-Id: <20210622082042.13831-10-frankja@linux.ibm.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210622082042.13831-1-frankja@linux.ibm.com> References: <20210622082042.13831-1-frankja@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: C5xreZ1dbubWOz4ya_Wphzc0rpqL43Bu X-Proofpoint-GUID: GGxnkcwkezmr9EViU2AFcR06K6dQLhx3 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.391,18.0.790 definitions=2021-06-22_04:2021-06-21,2021-06-22 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 adultscore=0 impostorscore=0 malwarescore=0 suspectscore=0 spamscore=0 phishscore=0 clxscore=1015 mlxscore=0 lowpriorityscore=0 priorityscore=1501 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104190000 definitions=main-2106220050 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org From: Claudio Imbrenda Improve pgtable.h: * add macros to check whether a pmd or a pud are large / huge * add idte functions for pmd, pud, p4d and pgd Signed-off-by: Claudio Imbrenda Acked-by: Janosch Frank Message-Id: <20210611140705.553307-5-imbrenda@linux.ibm.com> Signed-off-by: Janosch Frank --- lib/s390x/asm/pgtable.h | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/lib/s390x/asm/pgtable.h b/lib/s390x/asm/pgtable.h index 1a21f175..f166dcc6 100644 --- a/lib/s390x/asm/pgtable.h +++ b/lib/s390x/asm/pgtable.h @@ -100,6 +100,9 @@ #define pmd_none(entry) (pmd_val(entry) & SEGMENT_ENTRY_I) #define pte_none(entry) (pte_val(entry) & PAGE_ENTRY_I) +#define pud_huge(entry) (pud_val(entry) & REGION3_ENTRY_FC) +#define pmd_large(entry) (pmd_val(entry) & SEGMENT_ENTRY_FC) + #define pgd_addr(entry) __va(pgd_val(entry) & REGION_ENTRY_ORIGIN) #define p4d_addr(entry) __va(p4d_val(entry) & REGION_ENTRY_ORIGIN) #define pud_addr(entry) __va(pud_val(entry) & REGION_ENTRY_ORIGIN) @@ -216,6 +219,34 @@ static inline void ipte(unsigned long vaddr, pteval_t *p_pte) : : "a" (table_origin), "a" (vaddr) : "memory"); } +static inline void idte(unsigned long table_origin, unsigned long vaddr) +{ + vaddr &= SEGMENT_ENTRY_SFAA; + asm volatile( + " idte %0,0,%1\n" + : : "a" (table_origin), "a" (vaddr) : "memory"); +} + +static inline void idte_pmdp(unsigned long vaddr, pmdval_t *pmdp) +{ + idte((unsigned long)(pmdp - pmd_index(vaddr)) | ASCE_DT_SEGMENT, vaddr); +} + +static inline void idte_pudp(unsigned long vaddr, pudval_t *pudp) +{ + idte((unsigned long)(pudp - pud_index(vaddr)) | ASCE_DT_REGION3, vaddr); +} + +static inline void idte_p4dp(unsigned long vaddr, p4dval_t *p4dp) +{ + idte((unsigned long)(p4dp - p4d_index(vaddr)) | ASCE_DT_REGION2, vaddr); +} + +static inline void idte_pgdp(unsigned long vaddr, pgdval_t *pgdp) +{ + idte((unsigned long)(pgdp - pgd_index(vaddr)) | ASCE_DT_REGION1, vaddr); +} + void configure_dat(int enable); #endif /* _ASMS390X_PGTABLE_H_ */ From patchwork Tue Jun 22 08:20:40 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Janosch Frank X-Patchwork-Id: 12336599 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B591FC49EA4 for ; Tue, 22 Jun 2021 08:21:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 96D966134F for ; Tue, 22 Jun 2021 08:21:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231209AbhFVIYF (ORCPT ); Tue, 22 Jun 2021 04:24:05 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:7564 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S230463AbhFVIX6 (ORCPT ); Tue, 22 Jun 2021 04:23:58 -0400 Received: from pps.filterd (m0098414.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 15M8GK5t149605; Tue, 22 Jun 2021 04:21:42 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=pp1; bh=BbI/Rv0rcuu/SGurOdnX50suG9KrngbmPn/m0bNMIxE=; b=g7TNfWg6dTc1e2+4uA0uE8SdpF+LzupXMz5JkYK+LLMMC3KzvBTTPneQ5Rh4AENOorWL 1lem2kYm81HAwqiNefP5tVBV37L7WcRQpmaO4BpBmB676bzir2NJwNixtItTeAp6lQoz msxM15gcMPbjvaUtewVcoYFFgzKE1kPgU1dYg6/CGdfF2aUVe0ZVejsPFB6lo2Lxox6R IcWTs9n5iU3Jovy3FqaZLM3P/ui2nFxUP/KPw8IdsqNq/bhz1yRZzXvWCsygsK6uxVuT SN7FGLGY9L1s8Ox7SRLx8L+CladFumhDaQYHAqE5Arc0Qx/E8BfmvPv9pOE/d3RveBjO DQ== Received: from pps.reinject (localhost [127.0.0.1]) by mx0b-001b2d01.pphosted.com with ESMTP id 39bc73r2m0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 22 Jun 2021 04:21:42 -0400 Received: from m0098414.ppops.net (m0098414.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 15M8LfPe168633; Tue, 22 Jun 2021 04:21:41 -0400 Received: from ppma03ams.nl.ibm.com (62.31.33a9.ip4.static.sl-reverse.com [169.51.49.98]) by mx0b-001b2d01.pphosted.com with ESMTP id 39bc73r2kc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 22 Jun 2021 04:21:41 -0400 Received: from pps.filterd (ppma03ams.nl.ibm.com [127.0.0.1]) by ppma03ams.nl.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 15M8DDnd002855; Tue, 22 Jun 2021 08:21:39 GMT Received: from b06cxnps3075.portsmouth.uk.ibm.com (d06relay10.portsmouth.uk.ibm.com [9.149.109.195]) by ppma03ams.nl.ibm.com with ESMTP id 3998789a7f-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 22 Jun 2021 08:21:39 +0000 Received: from d06av26.portsmouth.uk.ibm.com (d06av26.portsmouth.uk.ibm.com [9.149.105.62]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 15M8Lbdv31654282 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 22 Jun 2021 08:21:37 GMT Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E3345AE051; Tue, 22 Jun 2021 08:21:36 +0000 (GMT) Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 5EC39AE04D; Tue, 22 Jun 2021 08:21:36 +0000 (GMT) Received: from localhost.localdomain.com (unknown [9.145.182.30]) by d06av26.portsmouth.uk.ibm.com (Postfix) with ESMTP; Tue, 22 Jun 2021 08:21:36 +0000 (GMT) From: Janosch Frank To: pbonzini@redhat.com Cc: kvm@vger.kernel.org, frankja@linux.ibm.com, david@redhat.com, borntraeger@de.ibm.com, cohuck@redhat.com, linux-s390@vger.kernel.org, imbrenda@linux.ibm.com, thuth@redhat.com Subject: [kvm-unit-tests GIT PULL 10/12] s390x: lib: add teid union and clear teid from lowcore Date: Tue, 22 Jun 2021 10:20:40 +0200 Message-Id: <20210622082042.13831-11-frankja@linux.ibm.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210622082042.13831-1-frankja@linux.ibm.com> References: <20210622082042.13831-1-frankja@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: fXwCdxWEhly9pe09NLJd2Cv26OS7z4Z- X-Proofpoint-GUID: CzDE4b4nxqjFrFV5BSt86zqjhwLNobBZ X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.391,18.0.790 definitions=2021-06-22_04:2021-06-21,2021-06-22 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 spamscore=0 clxscore=1015 adultscore=0 lowpriorityscore=0 phishscore=0 priorityscore=1501 mlxscore=0 bulkscore=0 malwarescore=0 impostorscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104190000 definitions=main-2106220050 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org From: Claudio Imbrenda Add a union to represent Translation-Exception Identification (TEID). Clear the TEID in expect_pgm_int clear_pgm_int. Signed-off-by: Claudio Imbrenda Reviewed-by: Janosch Frank Message-Id: <20210611140705.553307-6-imbrenda@linux.ibm.com> Signed-off-by: Janosch Frank --- lib/s390x/asm/interrupt.h | 24 ++++++++++++++++++++++++ lib/s390x/interrupt.c | 2 ++ 2 files changed, 26 insertions(+) diff --git a/lib/s390x/asm/interrupt.h b/lib/s390x/asm/interrupt.h index bf0eb40d..d9ab0bd7 100644 --- a/lib/s390x/asm/interrupt.h +++ b/lib/s390x/asm/interrupt.h @@ -13,6 +13,30 @@ #define EXT_IRQ_EXTERNAL_CALL 0x1202 #define EXT_IRQ_SERVICE_SIG 0x2401 +#define TEID_ASCE_PRIMARY 0 +#define TEID_ASCE_AR 1 +#define TEID_ASCE_SECONDARY 2 +#define TEID_ASCE_HOME 3 + +union teid { + unsigned long val; + struct { + unsigned long addr:52; + unsigned long fetch:1; + unsigned long store:1; + unsigned long reserved:6; + unsigned long acc_list_prot:1; + /* + * depending on the exception and the installed facilities, + * the m field can indicate several different things, + * including whether the exception was triggered by a MVPG + * instruction, or whether the addr field is meaningful + */ + unsigned long m:1; + unsigned long asce_id:2; + }; +}; + void register_pgm_cleanup_func(void (*f)(void)); void handle_pgm_int(struct stack_frame_int *stack); void handle_ext_int(struct stack_frame_int *stack); diff --git a/lib/s390x/interrupt.c b/lib/s390x/interrupt.c index ce0003de..b627942f 100644 --- a/lib/s390x/interrupt.c +++ b/lib/s390x/interrupt.c @@ -22,6 +22,7 @@ void expect_pgm_int(void) { pgm_int_expected = true; lc->pgm_int_code = 0; + lc->trans_exc_id = 0; mb(); } @@ -39,6 +40,7 @@ uint16_t clear_pgm_int(void) mb(); code = lc->pgm_int_code; lc->pgm_int_code = 0; + lc->trans_exc_id = 0; pgm_int_expected = false; return code; } From patchwork Tue Jun 22 08:20:41 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Janosch Frank X-Patchwork-Id: 12336601 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E4DFEC49EA2 for ; Tue, 22 Jun 2021 08:21:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id BBC4E6134F for ; Tue, 22 Jun 2021 08:21:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231169AbhFVIYE (ORCPT ); Tue, 22 Jun 2021 04:24:04 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:10914 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230505AbhFVIX7 (ORCPT ); Tue, 22 Jun 2021 04:23:59 -0400 Received: from pps.filterd (m0098396.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 15M83VZb020870; Tue, 22 Jun 2021 04:21:43 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=pp1; bh=VbgoqI8xf5FF04ubf+nNB2NABedf5yP5YcO7TRDVgGE=; b=KnzNyyn6FHHsGgdMh2Rn5Ty/HzhoECVK1B4CGovyNoVgOennvYeJrnBDOAV38AStNls+ fji3lavNGoWGobmcn32RmurpmWpsAjAM69TAytZmN82wD2zyp97a32SwSdaGIewNyYVa HM5tt6e2KdFPwiL7Hwwuc3lja0rWmebbwnuwl8CPwJmJIXsXs+LPbjhKFdqDMaXin7Z3 zP45a9Qpy1ylkKE+CCIdppoPdeV7PoF6W6L+2DfZK5dTwbGMU4Vrv2tTn6NqbJsHitYQ cuvDNa5wjnUezZza9XBV2th4RE6ZQdDF9o0KDqqiSAqSqFPrXN/1LYe5VmcwLsuEsQe7 gg== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 39b8ng5ukk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 22 Jun 2021 04:21:43 -0400 Received: from m0098396.ppops.net (m0098396.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 15M83ovj022033; Tue, 22 Jun 2021 04:21:43 -0400 Received: from ppma06fra.de.ibm.com (48.49.7a9f.ip4.static.sl-reverse.com [159.122.73.72]) by mx0a-001b2d01.pphosted.com with ESMTP id 39b8ng5uk0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 22 Jun 2021 04:21:42 -0400 Received: from pps.filterd (ppma06fra.de.ibm.com [127.0.0.1]) by ppma06fra.de.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 15M8Ex2V004795; Tue, 22 Jun 2021 08:21:40 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 3997uhgqg7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 22 Jun 2021 08:21:40 +0000 Received: from d06av26.portsmouth.uk.ibm.com (d06av26.portsmouth.uk.ibm.com [9.149.105.62]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 15M8Lbpj31654288 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 22 Jun 2021 08:21:37 GMT Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id A2284AE053; Tue, 22 Jun 2021 08:21:37 +0000 (GMT) Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 0F8C3AE04D; Tue, 22 Jun 2021 08:21:37 +0000 (GMT) Received: from localhost.localdomain.com (unknown [9.145.182.30]) by d06av26.portsmouth.uk.ibm.com (Postfix) with ESMTP; Tue, 22 Jun 2021 08:21:36 +0000 (GMT) From: Janosch Frank To: pbonzini@redhat.com Cc: kvm@vger.kernel.org, frankja@linux.ibm.com, david@redhat.com, borntraeger@de.ibm.com, cohuck@redhat.com, linux-s390@vger.kernel.org, imbrenda@linux.ibm.com, thuth@redhat.com Subject: [kvm-unit-tests GIT PULL 11/12] s390x: mmu: add support for large pages Date: Tue, 22 Jun 2021 10:20:41 +0200 Message-Id: <20210622082042.13831-12-frankja@linux.ibm.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210622082042.13831-1-frankja@linux.ibm.com> References: <20210622082042.13831-1-frankja@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: M5sPKiCkNu46-BO3LCbdrmo9zdGVv92R X-Proofpoint-ORIG-GUID: -mqYF1Wr8Bj5_Ha8yP1lr4VXDKZSCiM3 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.391,18.0.790 definitions=2021-06-22_04:2021-06-21,2021-06-22 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 mlxlogscore=999 priorityscore=1501 malwarescore=0 bulkscore=0 impostorscore=0 lowpriorityscore=0 clxscore=1015 phishscore=0 suspectscore=0 spamscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104190000 definitions=main-2106220050 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org From: Claudio Imbrenda Add support for 1M and 2G pages. Signed-off-by: Claudio Imbrenda Acked-by: Janosch Frank Message-Id: <20210611140705.553307-7-imbrenda@linux.ibm.com> Signed-off-by: Janosch Frank --- lib/s390x/mmu.c | 264 +++++++++++++++++++++++++++++++++++++++++++----- lib/s390x/mmu.h | 84 ++++++++++++++- 2 files changed, 321 insertions(+), 27 deletions(-) diff --git a/lib/s390x/mmu.c b/lib/s390x/mmu.c index 5c517366..c973443b 100644 --- a/lib/s390x/mmu.c +++ b/lib/s390x/mmu.c @@ -15,6 +15,18 @@ #include #include "mmu.h" +/* + * The naming convention used here is the same as used in the Linux kernel; + * this is the correspondence between the s390x architectural names and the + * Linux ones: + * + * pgd - region 1 table entry + * p4d - region 2 table entry + * pud - region 3 table entry + * pmd - segment table entry + * pte - page table entry + */ + static pgd_t *table_root; void configure_dat(int enable) @@ -46,54 +58,256 @@ static void mmu_enable(pgd_t *pgtable) lc->pgm_new_psw.mask |= PSW_MASK_DAT; } -static pteval_t *get_pte(pgd_t *pgtable, uintptr_t vaddr) +/* + * Get the pud (region 3) DAT table entry for the given address and root, + * allocating it if necessary + */ +static inline pud_t *get_pud(pgd_t *pgtable, uintptr_t vaddr) { pgd_t *pgd = pgd_offset(pgtable, vaddr); p4d_t *p4d = p4d_alloc(pgd, vaddr); pud_t *pud = pud_alloc(p4d, vaddr); - pmd_t *pmd = pmd_alloc(pud, vaddr); - pte_t *pte = pte_alloc(pmd, vaddr); - return &pte_val(*pte); + return pud; +} + +/* + * Get the pmd (segment) DAT table entry for the given address and pud, + * allocating it if necessary. + * The pud must not be huge. + */ +static inline pmd_t *get_pmd(pud_t *pud, uintptr_t vaddr) +{ + pmd_t *pmd; + + assert(!pud_huge(*pud)); + pmd = pmd_alloc(pud, vaddr); + return pmd; +} + +/* + * Get the pte (page) DAT table entry for the given address and pmd, + * allocating it if necessary. + * The pmd must not be large. + */ +static inline pte_t *get_pte(pmd_t *pmd, uintptr_t vaddr) +{ + pte_t *pte; + + assert(!pmd_large(*pmd)); + pte = pte_alloc(pmd, vaddr); + return pte; +} + +/* + * Splits a large pmd (segment) DAT table entry into equivalent 4kB small + * pages. + * @pmd The pmd to split, it must be large. + * @va the virtual address corresponding to this pmd. + */ +static void split_pmd(pmd_t *pmd, uintptr_t va) +{ + phys_addr_t pa = pmd_val(*pmd) & SEGMENT_ENTRY_SFAA; + unsigned long i, prot; + pte_t *pte; + + assert(pmd_large(*pmd)); + pte = alloc_pages(PAGE_TABLE_ORDER); + prot = pmd_val(*pmd) & (SEGMENT_ENTRY_IEP | SEGMENT_ENTRY_P); + for (i = 0; i < PAGE_TABLE_ENTRIES; i++) + pte_val(pte[i]) = pa | PAGE_SIZE * i | prot; + idte_pmdp(va, &pmd_val(*pmd)); + pmd_val(*pmd) = __pa(pte) | SEGMENT_ENTRY_TT_SEGMENT; + +} + +/* + * Splits a huge pud (region 3) DAT table entry into equivalent 1MB large + * pages. + * @pud The pud to split, it must be huge. + * @va the virtual address corresponding to this pud. + */ +static void split_pud(pud_t *pud, uintptr_t va) +{ + phys_addr_t pa = pud_val(*pud) & REGION3_ENTRY_RFAA; + unsigned long i, prot; + pmd_t *pmd; + + assert(pud_huge(*pud)); + pmd = alloc_pages(SEGMENT_TABLE_ORDER); + prot = pud_val(*pud) & (REGION3_ENTRY_IEP | REGION_ENTRY_P); + for (i = 0; i < SEGMENT_TABLE_ENTRIES; i++) + pmd_val(pmd[i]) = pa | SZ_1M * i | prot | SEGMENT_ENTRY_FC | SEGMENT_ENTRY_TT_SEGMENT; + idte_pudp(va, &pud_val(*pud)); + pud_val(*pud) = __pa(pmd) | REGION_ENTRY_TT_REGION3 | REGION_TABLE_LENGTH; +} + +void *get_dat_entry(pgd_t *pgtable, void *vaddr, enum pgt_level level) +{ + uintptr_t va = (uintptr_t)vaddr; + pgd_t *pgd; + p4d_t *p4d; + pud_t *pud; + pmd_t *pmd; + + assert(level && (level <= 5)); + pgd = pgd_offset(pgtable, va); + if (level == pgtable_level_pgd) + return pgd; + p4d = p4d_alloc(pgd, va); + if (level == pgtable_level_p4d) + return p4d; + pud = pud_alloc(p4d, va); + + if (level == pgtable_level_pud) + return pud; + if (!pud_none(*pud) && pud_huge(*pud)) + split_pud(pud, va); + pmd = get_pmd(pud, va); + if (level == pgtable_level_pmd) + return pmd; + if (!pmd_none(*pmd) && pmd_large(*pmd)) + split_pmd(pmd, va); + return get_pte(pmd, va); +} + +void *split_page(pgd_t *pgtable, void *vaddr, enum pgt_level level) +{ + assert((level >= 3) && (level <= 5)); + return get_dat_entry(pgtable ? pgtable : table_root, vaddr, level); } phys_addr_t virt_to_pte_phys(pgd_t *pgtable, void *vaddr) { - return (*get_pte(pgtable, (uintptr_t)vaddr) & PAGE_MASK) + - ((unsigned long)vaddr & ~PAGE_MASK); + uintptr_t va = (uintptr_t)vaddr; + pud_t *pud; + pmd_t *pmd; + pte_t *pte; + + pud = get_pud(pgtable, va); + if (pud_huge(*pud)) + return (pud_val(*pud) & REGION3_ENTRY_RFAA) | (va & ~REGION3_ENTRY_RFAA); + pmd = get_pmd(pud, va); + if (pmd_large(*pmd)) + return (pmd_val(*pmd) & SEGMENT_ENTRY_SFAA) | (va & ~SEGMENT_ENTRY_SFAA); + pte = get_pte(pmd, va); + return (pte_val(*pte) & PAGE_MASK) | (va & ~PAGE_MASK); } -static pteval_t *set_pte(pgd_t *pgtable, pteval_t val, void *vaddr) +/* + * Get the DAT table entry of the given level for the given address, + * splitting if necessary. If the entry was not invalid, invalidate it, and + * return the pointer to the entry and, if requested, its old value. + * @pgtable root of the page tables + * @vaddr virtual address + * @level 3 (for 2GB pud), 4 (for 1MB pmd) or 5 (for 4kB pages) + * @old if not NULL, will be written with the old value of the DAT table + * entry before invalidation + */ +static void *dat_get_and_invalidate(pgd_t *pgtable, void *vaddr, enum pgt_level level, unsigned long *old) { - pteval_t *p_pte = get_pte(pgtable, (uintptr_t)vaddr); + unsigned long va = (unsigned long)vaddr; + void *ptr; - /* first flush the old entry (if we're replacing anything) */ - if (!(*p_pte & PAGE_ENTRY_I)) - ipte((uintptr_t)vaddr, p_pte); + ptr = get_dat_entry(pgtable, vaddr, level); + if (old) + *old = *(unsigned long *)ptr; + if ((level == pgtable_level_pgd) && !pgd_none(*(pgd_t *)ptr)) + idte_pgdp(va, ptr); + else if ((level == pgtable_level_p4d) && !p4d_none(*(p4d_t *)ptr)) + idte_p4dp(va, ptr); + else if ((level == pgtable_level_pud) && !pud_none(*(pud_t *)ptr)) + idte_pudp(va, ptr); + else if ((level == pgtable_level_pmd) && !pmd_none(*(pmd_t *)ptr)) + idte_pmdp(va, ptr); + else if (!pte_none(*(pte_t *)ptr)) + ipte(va, ptr); + return ptr; +} - *p_pte = val; - return p_pte; +static void cleanup_pmd(pmd_t *pmd) +{ + /* was invalid or large, nothing to do */ + if (pmd_none(*pmd) || pmd_large(*pmd)) + return; + /* was not large, free the corresponding page table */ + free_pages((void *)(pmd_val(*pmd) & PAGE_MASK)); +} + +static void cleanup_pud(pud_t *pud) +{ + unsigned long i; + pmd_t *pmd; + + /* was invalid or large, nothing to do */ + if (pud_none(*pud) || pud_huge(*pud)) + return; + /* recursively clean up all pmds if needed */ + pmd = (pmd_t *)(pud_val(*pud) & PAGE_MASK); + for (i = 0; i < SEGMENT_TABLE_ENTRIES; i++) + cleanup_pmd(pmd + i); + /* free the corresponding segment table */ + free_pages(pmd); +} + +/* + * Set the DAT entry for the given level of the given virtual address. If a + * mapping already existed, it is overwritten. If an existing mapping with + * smaller pages existed, all the lower tables are freed. + * Returns the pointer to the DAT table entry. + * @pgtable root of the page tables + * @val the new value for the DAT table entry + * @vaddr the virtual address + * @level 3 for pud (region 3), 4 for pmd (segment) and 5 for pte (pages) + */ +static void *set_dat_entry(pgd_t *pgtable, unsigned long val, void *vaddr, enum pgt_level level) +{ + unsigned long old, *res; + + res = dat_get_and_invalidate(pgtable, vaddr, level, &old); + if (level == pgtable_level_pmd) + cleanup_pmd((pmd_t *)&old); + if (level == pgtable_level_pud) + cleanup_pud((pud_t *)&old); + *res = val; + return res; } pteval_t *install_page(pgd_t *pgtable, phys_addr_t phys, void *vaddr) { - return set_pte(pgtable, __pa(phys), vaddr); + assert(IS_ALIGNED(phys, PAGE_SIZE)); + assert(IS_ALIGNED((uintptr_t)vaddr, PAGE_SIZE)); + return set_dat_entry(pgtable, phys, vaddr, pgtable_level_pte); } -void protect_page(void *vaddr, unsigned long prot) +pmdval_t *install_large_page(pgd_t *pgtable, phys_addr_t phys, void *vaddr) { - pteval_t *p_pte = get_pte(table_root, (uintptr_t)vaddr); - pteval_t n_pte = *p_pte | prot; - - set_pte(table_root, n_pte, vaddr); + assert(IS_ALIGNED(phys, SZ_1M)); + assert(IS_ALIGNED((uintptr_t)vaddr, SZ_1M)); + return set_dat_entry(pgtable, phys | SEGMENT_ENTRY_FC, vaddr, pgtable_level_pmd); } -void unprotect_page(void *vaddr, unsigned long prot) +pudval_t *install_huge_page(pgd_t *pgtable, phys_addr_t phys, void *vaddr) { - pteval_t *p_pte = get_pte(table_root, (uintptr_t)vaddr); - pteval_t n_pte = *p_pte & ~prot; + assert(IS_ALIGNED(phys, SZ_2G)); + assert(IS_ALIGNED((uintptr_t)vaddr, SZ_2G)); + return set_dat_entry(pgtable, phys | REGION3_ENTRY_FC | REGION_ENTRY_TT_REGION3, vaddr, pgtable_level_pud); +} - set_pte(table_root, n_pte, vaddr); +void protect_dat_entry(void *vaddr, unsigned long prot, enum pgt_level level) +{ + unsigned long old, *ptr; + + ptr = dat_get_and_invalidate(table_root, vaddr, level, &old); + *ptr = old | prot; +} + +void unprotect_dat_entry(void *vaddr, unsigned long prot, enum pgt_level level) +{ + unsigned long old, *ptr; + + ptr = dat_get_and_invalidate(table_root, vaddr, level, &old); + *ptr = old & ~prot; } void protect_range(void *start, unsigned long len, unsigned long prot) @@ -102,7 +316,7 @@ void protect_range(void *start, unsigned long len, unsigned long prot) len &= PAGE_MASK; for (; len; len -= PAGE_SIZE, curr += PAGE_SIZE) - protect_page((void *)curr, prot); + protect_dat_entry((void *)curr, prot, 5); } void unprotect_range(void *start, unsigned long len, unsigned long prot) @@ -111,7 +325,7 @@ void unprotect_range(void *start, unsigned long len, unsigned long prot) len &= PAGE_MASK; for (; len; len -= PAGE_SIZE, curr += PAGE_SIZE) - unprotect_page((void *)curr, prot); + unprotect_dat_entry((void *)curr, prot, 5); } static void setup_identity(pgd_t *pgtable, phys_addr_t start_addr, diff --git a/lib/s390x/mmu.h b/lib/s390x/mmu.h index b995f85b..ab35d782 100644 --- a/lib/s390x/mmu.h +++ b/lib/s390x/mmu.h @@ -10,9 +10,89 @@ #ifndef _S390X_MMU_H_ #define _S390X_MMU_H_ -void protect_page(void *vaddr, unsigned long prot); +enum pgt_level { + pgtable_level_pgd = 1, + pgtable_level_p4d, + pgtable_level_pud, + pgtable_level_pmd, + pgtable_level_pte, +}; + +/* + * Splits the pagetables down to the given DAT tables level. + * Returns a pointer to the DAT table entry of the given level. + * @pgtable root of the page table tree + * @vaddr address whose page tables are to split + * @level 3 (for 2GB pud), 4 (for 1 MB pmd) or 5 (for 4KB pages) + */ +void *split_page(pgd_t *pgtable, void *vaddr, enum pgt_level level); + +/* + * Applies the given protection bits to the given DAT tables level, + * splitting if necessary. + * @pgtable root of the page table tree + * @vaddr address whose protection bits are to be changed + * @prot the protection bits to set + * @level 3 (for 2GB pud), 4 (for 1MB pmd) or 5 (for 4KB pages) + */ +void protect_dat_entry(void *vaddr, unsigned long prot, enum pgt_level level); + +/* + * Clears the given protection bits from the given DAT tables level, + * splitting if necessary. + * @pgtable root of the page table tree + * @vaddr address whose protection bits are to be changed + * @prot the protection bits to clear + * @level 3 (for 2GB pud), 4 (for 1MB pmd) or 5 (for 4kB pages) + */ +void unprotect_dat_entry(void *vaddr, unsigned long prot, enum pgt_level level); + +/* + * Applies the given protection bits to the given 4kB pages range, + * splitting if necessary. + * @start starting address whose protection bits are to be changed + * @len size in bytes + * @prot the protection bits to set + */ void protect_range(void *start, unsigned long len, unsigned long prot); -void unprotect_page(void *vaddr, unsigned long prot); + +/* + * Clears the given protection bits from the given 4kB pages range, + * splitting if necessary. + * @start starting address whose protection bits are to be changed + * @len size in bytes + * @prot the protection bits to set + */ void unprotect_range(void *start, unsigned long len, unsigned long prot); +/* Similar to install_page, maps the virtual address to the physical address + * for the given page tables, using 1MB large pages. + * Returns a pointer to the DAT table entry. + * @pgtable root of the page table tree + * @phys physical address to map, must be 1MB aligned! + * @vaddr virtual address to map, must be 1MB aligned! + */ +pmdval_t *install_large_page(pgd_t *pgtable, phys_addr_t phys, void *vaddr); + +/* Similar to install_page, maps the virtual address to the physical address + * for the given page tables, using 2GB huge pages. + * Returns a pointer to the DAT table entry. + * @pgtable root of the page table tree + * @phys physical address to map, must be 2GB aligned! + * @vaddr virtual address to map, must be 2GB aligned! + */ +pudval_t *install_huge_page(pgd_t *pgtable, phys_addr_t phys, void *vaddr); + +static inline void protect_page(void *vaddr, unsigned long prot) +{ + protect_dat_entry(vaddr, prot, pgtable_level_pte); +} + +static inline void unprotect_page(void *vaddr, unsigned long prot) +{ + unprotect_dat_entry(vaddr, prot, pgtable_level_pte); +} + +void *get_dat_entry(pgd_t *pgtable, void *vaddr, unsigned int level); + #endif /* _ASMS390X_MMU_H_ */ From patchwork Tue Jun 22 08:20:42 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Janosch Frank X-Patchwork-Id: 12336603 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6F410C48BE5 for ; Tue, 22 Jun 2021 08:21:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4693E6134F for ; Tue, 22 Jun 2021 08:21:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231134AbhFVIYG (ORCPT ); Tue, 22 Jun 2021 04:24:06 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:22146 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230503AbhFVIYA (ORCPT ); Tue, 22 Jun 2021 04:24:00 -0400 Received: from pps.filterd (m0098404.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 15M8Epqm023643; Tue, 22 Jun 2021 04:21:45 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=pp1; bh=n1yjs9Odiq28YRk/MzSWSbGdVE7KrlteniojPryE4rY=; b=rpmkpmNY91obY8tbHoJw+QvniupR9VTwWTUSPL1jq1hpTTWO3AoBSNoIO+YENttcNXAw 2/z6RKu/uFkCsUCT/1DA6Tma/EKdmi4p9jtSNfNe1mwXreYStCIM2dbXWhivaV4tbPdW tHelBmEHLnS00aR+cRF3OPyJAC/gNnhPhMPxJNjyKGwpnkogMDVBB9YqrSfglUWWwnKh pDAm1Lz5wxcDPpdnSpqLNKz32QPEcxiHiFcFuQRrTxHnjjSXABHNciNhooEn7lxWvnOH z6N4w33q/Uc+NlraIJuPws4C/6Dt71jotN5ckMFYLZ5aUr28D8gWzGG+QMsdkVeHtmjv xQ== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 39bc6ar5t3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 22 Jun 2021 04:21:45 -0400 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 15M8F3pd024878; Tue, 22 Jun 2021 04:21:44 -0400 Received: from ppma03fra.de.ibm.com (6b.4a.5195.ip4.static.sl-reverse.com [149.81.74.107]) by mx0a-001b2d01.pphosted.com with ESMTP id 39bc6ar5s3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 22 Jun 2021 04:21:44 -0400 Received: from pps.filterd (ppma03fra.de.ibm.com [127.0.0.1]) by ppma03fra.de.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 15M8EBDU031960; Tue, 22 Jun 2021 08:21:41 GMT Received: from b06cxnps4074.portsmouth.uk.ibm.com (d06relay11.portsmouth.uk.ibm.com [9.149.109.196]) by ppma03fra.de.ibm.com with ESMTP id 3998788q3a-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 22 Jun 2021 08:21:41 +0000 Received: from d06av26.portsmouth.uk.ibm.com (d06av26.portsmouth.uk.ibm.com [9.149.105.62]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 15M8Lc1U32244028 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 22 Jun 2021 08:21:38 GMT Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 4C6C8AE053; Tue, 22 Jun 2021 08:21:38 +0000 (GMT) Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id C2FD6AE04D; Tue, 22 Jun 2021 08:21:37 +0000 (GMT) Received: from localhost.localdomain.com (unknown [9.145.182.30]) by d06av26.portsmouth.uk.ibm.com (Postfix) with ESMTP; Tue, 22 Jun 2021 08:21:37 +0000 (GMT) From: Janosch Frank To: pbonzini@redhat.com Cc: kvm@vger.kernel.org, frankja@linux.ibm.com, david@redhat.com, borntraeger@de.ibm.com, cohuck@redhat.com, linux-s390@vger.kernel.org, imbrenda@linux.ibm.com, thuth@redhat.com Subject: [kvm-unit-tests GIT PULL 12/12] s390x: edat test Date: Tue, 22 Jun 2021 10:20:42 +0200 Message-Id: <20210622082042.13831-13-frankja@linux.ibm.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210622082042.13831-1-frankja@linux.ibm.com> References: <20210622082042.13831-1-frankja@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: KxOG93nzaHKJJ7LhlZm4nxUuS01LZfL1 X-Proofpoint-ORIG-GUID: Ly6h-yFt5lkZ9irp1MMT96lbe43VNoBO X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.391,18.0.790 definitions=2021-06-22_04:2021-06-21,2021-06-22 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 priorityscore=1501 spamscore=0 lowpriorityscore=0 impostorscore=0 suspectscore=0 bulkscore=0 adultscore=0 phishscore=0 malwarescore=0 mlxlogscore=999 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104190000 definitions=main-2106220050 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org From: Claudio Imbrenda Simple EDAT test. Signed-off-by: Claudio Imbrenda Acked-by: Janosch Frank Message-Id: <20210611140705.553307-8-imbrenda@linux.ibm.com> Signed-off-by: Janosch Frank --- s390x/Makefile | 1 + s390x/edat.c | 274 ++++++++++++++++++++++++++++++++++++++++++++ s390x/unittests.cfg | 3 + 3 files changed, 278 insertions(+) create mode 100644 s390x/edat.c diff --git a/s390x/Makefile b/s390x/Makefile index 8de926ab..8820e998 100644 --- a/s390x/Makefile +++ b/s390x/Makefile @@ -22,6 +22,7 @@ tests += $(TEST_DIR)/uv-guest.elf tests += $(TEST_DIR)/sie.elf tests += $(TEST_DIR)/mvpg.elf tests += $(TEST_DIR)/uv-host.elf +tests += $(TEST_DIR)/edat.elf tests_binary = $(patsubst %.elf,%.bin,$(tests)) ifneq ($(HOST_KEY_DOCUMENT),) diff --git a/s390x/edat.c b/s390x/edat.c new file mode 100644 index 00000000..c3bee0c8 --- /dev/null +++ b/s390x/edat.c @@ -0,0 +1,274 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* + * EDAT test. + * + * Copyright (c) 2021 IBM Corp + * + * Authors: + * Claudio Imbrenda + */ +#include +#include +#include +#include +#include +#include +#include + +#define PGD_PAGE_SHIFT (REGION1_SHIFT - PAGE_SHIFT) + +#define LC_SIZE (2 * PAGE_SIZE) +#define VIRT(x) ((void *)((unsigned long)(x) + (unsigned long)mem)) + +static uint8_t prefix_buf[LC_SIZE] __attribute__((aligned(LC_SIZE))); +static unsigned int tmp[1024] __attribute__((aligned(PAGE_SIZE))); +static void *root, *mem, *m; +static struct lowcore *lc; +volatile unsigned int *p; + +/* + * Check if a non-access-list protection exception happened for the given + * address, in the primary address space. + */ +static bool check_pgm_prot(void *ptr) +{ + union teid teid; + + if (lc->pgm_int_code != PGM_INT_CODE_PROTECTION) + return false; + + teid.val = lc->trans_exc_id; + + /* + * depending on the presence of the ESOP feature, the rest of the + * field might or might not be meaningful when the m field is 0. + */ + if (!teid.m) + return true; + return (!teid.acc_list_prot && !teid.asce_id && + (teid.addr == ((unsigned long)ptr >> PAGE_SHIFT))); +} + +static void test_dat(void) +{ + report_prefix_push("edat off"); + /* disable EDAT */ + ctl_clear_bit(0, CTL0_EDAT); + + /* Check some basics */ + p[0] = 42; + report(p[0] == 42, "pte, r/w"); + p[0] = 0; + + /* Write protect the page and try to write, expect a fault */ + protect_page(m, PAGE_ENTRY_P); + expect_pgm_int(); + p[0] = 42; + unprotect_page(m, PAGE_ENTRY_P); + report(!p[0] && check_pgm_prot(m), "pte, ro"); + + /* + * The FC bit (for large pages) should be ignored because EDAT is + * off. We set a value and then we try to read it back again after + * setting the FC bit. This way we can check if large pages were + * erroneously enabled despite EDAT being off. + */ + p[0] = 42; + protect_dat_entry(m, SEGMENT_ENTRY_FC, pgtable_level_pmd); + report(p[0] == 42, "pmd, fc=1, r/w"); + unprotect_dat_entry(m, SEGMENT_ENTRY_FC, pgtable_level_pmd); + p[0] = 0; + + /* + * Segment protection should work even with EDAT off, try to write + * anyway and expect a fault + */ + protect_dat_entry(m, SEGMENT_ENTRY_P, pgtable_level_pmd); + expect_pgm_int(); + p[0] = 42; + report(!p[0] && check_pgm_prot(m), "pmd, ro"); + unprotect_dat_entry(m, SEGMENT_ENTRY_P, pgtable_level_pmd); + + /* The FC bit should be ignored because EDAT is off, like above */ + p[0] = 42; + protect_dat_entry(m, REGION3_ENTRY_FC, pgtable_level_pud); + report(p[0] == 42, "pud, fc=1, r/w"); + unprotect_dat_entry(m, REGION3_ENTRY_FC, pgtable_level_pud); + p[0] = 0; + + /* + * Region1/2/3 protection should not work, because EDAT is off. + * Protect the various region1/2/3 entries and write, expect the + * write to be successful. + */ + protect_dat_entry(m, REGION_ENTRY_P, pgtable_level_pud); + p[0] = 42; + report(p[0] == 42, "pud, ro"); + unprotect_dat_entry(m, REGION_ENTRY_P, pgtable_level_pud); + p[0] = 0; + + protect_dat_entry(m, REGION_ENTRY_P, pgtable_level_p4d); + p[0] = 42; + report(p[0] == 42, "p4d, ro"); + unprotect_dat_entry(m, REGION_ENTRY_P, pgtable_level_p4d); + p[0] = 0; + + protect_dat_entry(m, REGION_ENTRY_P, pgtable_level_pgd); + p[0] = 42; + report(p[0] == 42, "pgd, ro"); + unprotect_dat_entry(m, REGION_ENTRY_P, pgtable_level_pgd); + p[0] = 0; + + report_prefix_pop(); +} + +static void test_edat1(void) +{ + report_prefix_push("edat1"); + /* Enable EDAT */ + ctl_set_bit(0, CTL0_EDAT); + p[0] = 0; + + /* + * Segment protection should work normally, try to write and expect + * a fault. + */ + expect_pgm_int(); + protect_dat_entry(m, SEGMENT_ENTRY_P, pgtable_level_pmd); + p[0] = 42; + report(!p[0] && check_pgm_prot(m), "pmd, ro"); + unprotect_dat_entry(m, SEGMENT_ENTRY_P, pgtable_level_pmd); + + /* + * Region1/2/3 protection should work now, because EDAT is on. Try + * to write anyway and expect a fault. + */ + expect_pgm_int(); + protect_dat_entry(m, REGION_ENTRY_P, pgtable_level_pud); + p[0] = 42; + report(!p[0] && check_pgm_prot(m), "pud, ro"); + unprotect_dat_entry(m, REGION_ENTRY_P, pgtable_level_pud); + + expect_pgm_int(); + protect_dat_entry(m, REGION_ENTRY_P, pgtable_level_p4d); + p[0] = 42; + report(!p[0] && check_pgm_prot(m), "p4d, ro"); + unprotect_dat_entry(m, REGION_ENTRY_P, pgtable_level_p4d); + + expect_pgm_int(); + protect_dat_entry(m, REGION_ENTRY_P, pgtable_level_pgd); + p[0] = 42; + report(!p[0] && check_pgm_prot(m), "pgd, ro"); + unprotect_dat_entry(m, REGION_ENTRY_P, pgtable_level_pgd); + + /* Large pages should work */ + p[0] = 42; + install_large_page(root, 0, mem); + report(p[0] == 42, "pmd, large"); + + /* + * Prefixing should not work with large pages. Since the lower + * addresses are mapped with small pages, which are subject to + * prefixing, and the pages mapped with large pages are not subject + * to prefixing, this is the resulting scenario: + * + * virtual 0 = real 0 -> absolute prefix_buf + * virtual prefix_buf = real prefix_buf -> absolute 0 + * VIRT(0) -> absolute 0 + * VIRT(prefix_buf) -> absolute prefix_buf + * + * The testcase checks if the memory at virtual 0 has the same + * content as the memory at VIRT(prefix_buf) and the memory at + * VIRT(0) has the same content as the memory at virtual prefix_buf. + * If prefixing is erroneously applied for large pages, the testcase + * will therefore fail. + */ + report(!memcmp(0, VIRT(prefix_buf), LC_SIZE) && + !memcmp(prefix_buf, VIRT(0), LC_SIZE), + "pmd, large, prefixing"); + + report_prefix_pop(); +} + +static void test_edat2(void) +{ + report_prefix_push("edat2"); + p[0] = 42; + + /* Huge pages should work */ + install_huge_page(root, 0, mem); + report(p[0] == 42, "pud, huge"); + + /* Prefixing should not work with huge pages, just like large pages */ + report(!memcmp(0, VIRT(prefix_buf), LC_SIZE) && + !memcmp(prefix_buf, VIRT(0), LC_SIZE), + "pmd, large, prefixing"); + + report_prefix_pop(); +} + +static unsigned int setup(void) +{ + bool has_edat1 = test_facility(8); + bool has_edat2 = test_facility(78); + unsigned long pa, va; + + if (has_edat2 && !has_edat1) + report_abort("EDAT2 available, but EDAT1 not available"); + + /* Setup DAT 1:1 mapping and memory management */ + setup_vm(); + root = (void *)(stctg(1) & PAGE_MASK); + + /* + * Get a pgd worth of virtual memory, so we can test things later + * without interfering with the test code or the interrupt handler + */ + mem = alloc_vpages_aligned(BIT_ULL(PGD_PAGE_SHIFT), PGD_PAGE_SHIFT); + assert(mem); + va = (unsigned long)mem; + + /* Map the first 1GB of real memory */ + for (pa = 0; pa < SZ_1G; pa += PAGE_SIZE, va += PAGE_SIZE) + install_page(root, pa, (void *)va); + + /* + * Move the lowcore to a known non-zero location. This is needed + * later to check whether prefixing is working with large pages. + */ + assert((unsigned long)&prefix_buf < SZ_2G); + memcpy(prefix_buf, 0, LC_SIZE); + set_prefix((uint32_t)(uintptr_t)prefix_buf); + /* Clear the old copy */ + memset(prefix_buf, 0, LC_SIZE); + + /* m will point to tmp through the new virtual mapping */ + m = VIRT(&tmp); + /* p is the same as m but volatile */ + p = (volatile unsigned int *)m; + + return has_edat1 + has_edat2; +} + +int main(void) +{ + unsigned int edat; + + report_prefix_push("edat"); + edat = setup(); + + test_dat(); + + if (edat) + test_edat1(); + else + report_skip("EDAT not available"); + + if (edat >= 2) + test_edat2(); + else + report_skip("EDAT2 not available"); + + report_prefix_pop(); + return report_summary(); +} diff --git a/s390x/unittests.cfg b/s390x/unittests.cfg index 9f81a608..a0ec8864 100644 --- a/s390x/unittests.cfg +++ b/s390x/unittests.cfg @@ -103,3 +103,6 @@ file = sie.elf [mvpg] file = mvpg.elf timeout = 10 + +[edat] +file = edat.elf