From patchwork Wed Apr 5 08:45:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nico Boehr X-Patchwork-Id: 13201367 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2766DC77B62 for ; Wed, 5 Apr 2023 08:45:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237489AbjDEIpm (ORCPT ); Wed, 5 Apr 2023 04:45:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38704 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236989AbjDEIpl (ORCPT ); Wed, 5 Apr 2023 04:45:41 -0400 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 797F02727 for ; Wed, 5 Apr 2023 01:45:40 -0700 (PDT) Received: from pps.filterd (m0187473.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 33566Lcl036046; Wed, 5 Apr 2023 08:45:38 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : mime-version; s=pp1; bh=jE3XAsRL4apKqIgk4wKSWm8Bj8iNCgxeTkbraJKcpeU=; b=OubHJ5jips7qXKHrtTnKP/Euz/ERqCVqY9M0fez2Tm/v06WuA5CSYSwXyxZUSQczn3tE FLeFSyyfIoEFBE4BmPKALZ64dByDM5Dldejx62phCTGa5eND+DUY1T0vllv2hC5iaFIL 2303OnAEox2YRp/QOyLpDUXXHnIg3Yk3z0NBaxXlZ/gsS22QAdnhcrUO4AEf8CTChzzf 4ndOjd8MIAojz49TlhloiFC6Ce4+l7oVD+kiZF6FYEvAE7BS6dasOCT399j3MWOE2OWZ ZsjsMJgwNuNgXmKUCQkJGzR8QVeDIXAi68KpZzneS7SkP1Yj+goAKce+OPFdbCQ9nujA pA== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3ps2p1vs2k-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 05 Apr 2023 08:45:37 +0000 Received: from m0187473.ppops.net (m0187473.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 3358EgB2008782; Wed, 5 Apr 2023 08:45:37 GMT Received: from ppma03ams.nl.ibm.com (62.31.33a9.ip4.static.sl-reverse.com [169.51.49.98]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3ps2p1vs1w-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 05 Apr 2023 08:45:37 +0000 Received: from pps.filterd (ppma03ams.nl.ibm.com [127.0.0.1]) by ppma03ams.nl.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 33549O9V018593; Wed, 5 Apr 2023 08:45:35 GMT Received: from smtprelay03.fra02v.mail.ibm.com ([9.218.2.224]) by ppma03ams.nl.ibm.com (PPS) with ESMTPS id 3ppc8735n9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 05 Apr 2023 08:45:34 +0000 Received: from smtpav05.fra02v.mail.ibm.com (smtpav05.fra02v.mail.ibm.com [10.20.54.104]) by smtprelay03.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 3358jVCk31326850 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 5 Apr 2023 08:45:31 GMT Received: from smtpav05.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 576B82004B; Wed, 5 Apr 2023 08:45:31 +0000 (GMT) Received: from smtpav05.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id D473A20040; Wed, 5 Apr 2023 08:45:30 +0000 (GMT) Received: from t14-nrb.ibmuc.com (unknown [9.171.30.226]) by smtpav05.fra02v.mail.ibm.com (Postfix) with ESMTP; Wed, 5 Apr 2023 08:45:30 +0000 (GMT) From: Nico Boehr To: thuth@redhat.com, pbonzini@redhat.com, andrew.jones@linux.dev Cc: kvm@vger.kernel.org, frankja@linux.ibm.com, imbrenda@linux.ibm.com, Marc Hartmayer Subject: [kvm-unit-tests GIT PULL v3 01/14] .gitignore: ignore `s390x/comm.key` file Date: Wed, 5 Apr 2023 10:45:15 +0200 Message-Id: <20230405084528.16027-2-nrb@linux.ibm.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230405084528.16027-1-nrb@linux.ibm.com> References: <20230405084528.16027-1-nrb@linux.ibm.com> X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: ZmGUqGkLREodc_ZdRyc80Gsk1Mr_8D6w X-Proofpoint-GUID: ZVPD8oIIDbxn4oDi6PvY_Lxq8oVwa4Zj X-Proofpoint-UnRewURL: 0 URL was un-rewritten MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-04-05_04,2023-04-04_05,2023-02-09_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 malwarescore=0 adultscore=0 impostorscore=0 bulkscore=0 priorityscore=1501 mlxlogscore=999 suspectscore=0 phishscore=0 spamscore=0 lowpriorityscore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2303200000 definitions=main-2304050079 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org From: Marc Hartmayer Ignore the Secure Execution Customer Communication Key file. Signed-off-by: Marc Hartmayer Reviewed-by: Janosch Frank Reviewed-by: Nico Boehr Link: https://lore.kernel.org/r/20230307091051.13945-2-mhartmay@linux.ibm.com Signed-off-by: Nico Boehr --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 33529b6..601822d 100644 --- a/.gitignore +++ b/.gitignore @@ -28,5 +28,6 @@ cscope.* /s390x/*.bin /s390x/snippets/*/*.gbin /efi-tests/* +/s390x/comm.key /s390x/snippets/*/*.hdr /s390x/snippets/*/*.*obj From patchwork Wed Apr 5 08:45:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nico Boehr X-Patchwork-Id: 13201369 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 630CDC77B6E for ; Wed, 5 Apr 2023 08:45:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237557AbjDEIpo (ORCPT ); Wed, 5 Apr 2023 04:45:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38714 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237079AbjDEIpl (ORCPT ); Wed, 5 Apr 2023 04:45:41 -0400 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A50E9273D for ; Wed, 5 Apr 2023 01:45:40 -0700 (PDT) Received: from pps.filterd (m0098396.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3358fqLI016607; Wed, 5 Apr 2023 08:45:38 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : mime-version; s=pp1; bh=aanmbrJYv3OIXlGSQQoRHZ9MgLHCYPpj4c0GGSrYoeA=; b=Puyu2vFPJhOKyeEYWxNDWIikGWQ02t9AxQeImof/nvbGOVvwCYNKI8omiSGO5OVebtjJ 8Ggv0TNnSGm38CK63ES0Vvl/QE0qQmrJIMgiiaJxEt2hnTxLbQb4egyixafRqhFPpwfg W8dVZ4N7uOlun5aPxFV1qeexWqMyzhwqkwl6I4ThzwC5ByFi2s2NHbWiV9xAEdU74KHK Sdy4ADky6isWNcaRVPrGjfBPcMRu8vgnOTiC5OFpkjamVEkh3dzZbx/8f1sejOpP2hnl ZcVy5qPeVXKDieKeh+hftPH98cEKxVGYiofhfPbwtAhLVlqroKCEfG6PQ2TTZ6w8SjQG cA== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3ps5q082ev-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 05 Apr 2023 08:45:38 +0000 Received: from m0098396.ppops.net (m0098396.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 3358g9hT017269; Wed, 5 Apr 2023 08:45:37 GMT Received: from ppma04ams.nl.ibm.com (63.31.33a9.ip4.static.sl-reverse.com [169.51.49.99]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3ps5q082dw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 05 Apr 2023 08:45:37 +0000 Received: from pps.filterd (ppma04ams.nl.ibm.com [127.0.0.1]) by ppma04ams.nl.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 334Nt5ua014578; Wed, 5 Apr 2023 08:45:35 GMT Received: from smtprelay03.fra02v.mail.ibm.com ([9.218.2.224]) by ppma04ams.nl.ibm.com (PPS) with ESMTPS id 3ppc87b69d-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 05 Apr 2023 08:45:35 +0000 Received: from smtpav05.fra02v.mail.ibm.com (smtpav05.fra02v.mail.ibm.com [10.20.54.104]) by smtprelay03.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 3358jV5v33358294 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 5 Apr 2023 08:45:32 GMT Received: from smtpav05.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id D873D2004B; Wed, 5 Apr 2023 08:45:31 +0000 (GMT) Received: from smtpav05.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 6E29920040; Wed, 5 Apr 2023 08:45:31 +0000 (GMT) Received: from t14-nrb.ibmuc.com (unknown [9.171.30.226]) by smtpav05.fra02v.mail.ibm.com (Postfix) with ESMTP; Wed, 5 Apr 2023 08:45:31 +0000 (GMT) From: Nico Boehr To: thuth@redhat.com, pbonzini@redhat.com, andrew.jones@linux.dev Cc: kvm@vger.kernel.org, frankja@linux.ibm.com, imbrenda@linux.ibm.com, Marc Hartmayer Subject: [kvm-unit-tests GIT PULL v3 02/14] s390x/Makefile: simplify `%.hdr` target rules Date: Wed, 5 Apr 2023 10:45:16 +0200 Message-Id: <20230405084528.16027-3-nrb@linux.ibm.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230405084528.16027-1-nrb@linux.ibm.com> References: <20230405084528.16027-1-nrb@linux.ibm.com> X-TM-AS-GCONF: 00 X-Proofpoint-GUID: kjR8MzlP1T6iZxoMnS_3Im8uyxXYF4US X-Proofpoint-ORIG-GUID: lk78tVAkWXV3HojcEGjyPp-9fTdKF0V7 X-Proofpoint-UnRewURL: 0 URL was un-rewritten MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-04-05_04,2023-04-04_05,2023-02-09_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 phishscore=0 adultscore=0 priorityscore=1501 mlxlogscore=999 spamscore=0 mlxscore=0 clxscore=1015 impostorscore=0 malwarescore=0 bulkscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2303200000 definitions=main-2304050079 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org From: Marc Hartmayer Merge the two Makefile target rules `$(SNIPPET_DIR)/asm/%.hdr` and `$(SNIPPET_DIR)/c/%.hdr` into one target rule. Signed-off-by: Marc Hartmayer Reviewed-by: Janosch Frank Link: https://lore.kernel.org/r/20230307091051.13945-3-mhartmay@linux.ibm.com Signed-off-by: Nico Boehr --- s390x/Makefile | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/s390x/Makefile b/s390x/Makefile index 97a6161..660ff06 100644 --- a/s390x/Makefile +++ b/s390x/Makefile @@ -145,10 +145,7 @@ $(SNIPPET_DIR)/c/%.gbin: $(SNIPPET_DIR)/c/%.o $(snippet_lib) $(FLATLIBS) $(OBJCOPY) -O binary -j ".rodata" -j ".lowcore" -j ".text" -j ".data" -j ".bss" --set-section-flags .bss=alloc,load,contents $@ $@ truncate -s '%4096' $@ -$(SNIPPET_DIR)/asm/%.hdr: $(SNIPPET_DIR)/asm/%.gbin $(HOST_KEY_DOCUMENT) - $(GEN_SE_HEADER) -k $(HOST_KEY_DOCUMENT) -c $<,0x0,0x00000000000000420000000000000000 --psw-addr 0x4000 -o $@ - -$(SNIPPET_DIR)/c/%.hdr: $(SNIPPET_DIR)/c/%.gbin $(HOST_KEY_DOCUMENT) +%.hdr: %.gbin $(HOST_KEY_DOCUMENT) $(GEN_SE_HEADER) -k $(HOST_KEY_DOCUMENT) -c $<,0x0,0x00000000000000420000000000000000 --psw-addr 0x4000 -o $@ .SECONDARY: From patchwork Wed Apr 5 08:45:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nico Boehr X-Patchwork-Id: 13201370 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4142FC7619A for ; Wed, 5 Apr 2023 08:45:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237572AbjDEIpp (ORCPT ); Wed, 5 Apr 2023 04:45:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38730 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237334AbjDEIpm (ORCPT ); Wed, 5 Apr 2023 04:45:42 -0400 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 98BA1271C for ; Wed, 5 Apr 2023 01:45:41 -0700 (PDT) Received: from pps.filterd (m0187473.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 33566Ntf036386; Wed, 5 Apr 2023 08:45:39 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : mime-version; s=pp1; bh=TjfFo4xmo0DzslTSyxbkiwnNOCoceQDllmcY9S6/NuA=; b=gofyyi6c7F77UZKJ/s1tpGGIm0ykgLnXew3FGmJX7a9KdSkHk0Lh7G1GLcmK9kXMUk0Q w3APJ7hD+ULwZ5kZR+i2kLccQHueLq9agp+s5POujrjqA1666EEYcA55TPxdqI7KHmZF 4UhP26QptaRZ3B9iJoL/lykOJwxcD1X1IJ9tTk2Jf8puoyiEatrSLxzOBEGPhq6nd8OM C6iPKRLDXEx4wdwTdqqalH56yIeTZ700WwrS4Lg3I7SOY4cBaC63dMrxHu5zHlIN6tHX 2jFv7Tztl8O4N3ngbigosIaKG6+nhZVyPRoboGMJiwaOZViFWh8iNZ/vAnSFRfOgNavn XQ== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3ps2p1vs38-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 05 Apr 2023 08:45:39 +0000 Received: from m0187473.ppops.net (m0187473.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 3358WR3J031839; Wed, 5 Apr 2023 08:45:38 GMT Received: from ppma05fra.de.ibm.com (6c.4a.5195.ip4.static.sl-reverse.com [149.81.74.108]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3ps2p1vs2c-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 05 Apr 2023 08:45:38 +0000 Received: from pps.filterd (ppma05fra.de.ibm.com [127.0.0.1]) by ppma05fra.de.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 3342FJ2v015573; Wed, 5 Apr 2023 08:45:36 GMT Received: from smtprelay04.fra02v.mail.ibm.com ([9.218.2.228]) by ppma05fra.de.ibm.com (PPS) with ESMTPS id 3ppc86td3q-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 05 Apr 2023 08:45:35 +0000 Received: from smtpav05.fra02v.mail.ibm.com (smtpav05.fra02v.mail.ibm.com [10.20.54.104]) by smtprelay04.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 3358jWRm47448326 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 5 Apr 2023 08:45:32 GMT Received: from smtpav05.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 635C920049; Wed, 5 Apr 2023 08:45:32 +0000 (GMT) Received: from smtpav05.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id ECAA520040; Wed, 5 Apr 2023 08:45:31 +0000 (GMT) Received: from t14-nrb.ibmuc.com (unknown [9.171.30.226]) by smtpav05.fra02v.mail.ibm.com (Postfix) with ESMTP; Wed, 5 Apr 2023 08:45:31 +0000 (GMT) From: Nico Boehr To: thuth@redhat.com, pbonzini@redhat.com, andrew.jones@linux.dev Cc: kvm@vger.kernel.org, frankja@linux.ibm.com, imbrenda@linux.ibm.com, Marc Hartmayer Subject: [kvm-unit-tests GIT PULL v3 03/14] s390x/Makefile: fix `*.gbin` target dependencies Date: Wed, 5 Apr 2023 10:45:17 +0200 Message-Id: <20230405084528.16027-4-nrb@linux.ibm.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230405084528.16027-1-nrb@linux.ibm.com> References: <20230405084528.16027-1-nrb@linux.ibm.com> X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: v7SB_D5bQxXuIJaoSuXKTK34zTKeFhS0 X-Proofpoint-GUID: 3qxxUXP78AHJ25FrRvyzXmKEbvQf2Vjv X-Proofpoint-UnRewURL: 0 URL was un-rewritten MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-04-05_04,2023-04-04_05,2023-02-09_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 malwarescore=0 adultscore=0 impostorscore=0 bulkscore=0 priorityscore=1501 mlxlogscore=999 suspectscore=0 phishscore=0 spamscore=0 lowpriorityscore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2303200000 definitions=main-2304050079 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org From: Marc Hartmayer If the linker scripts change, then the .gbin binaries must be rebuilt. While at it, replace `$(SRCDIR)/s390x/snippets` with `$(SNIPPET_DIR)` for these Makefile rules. Signed-off-by: Marc Hartmayer Reviewed-by: Janosch Frank Link: https://lore.kernel.org/r/20230307091051.13945-4-mhartmay@linux.ibm.com Signed-off-by: Nico Boehr --- s390x/Makefile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/s390x/Makefile b/s390x/Makefile index 660ff06..71e6563 100644 --- a/s390x/Makefile +++ b/s390x/Makefile @@ -135,13 +135,13 @@ $(SNIPPET_DIR)/asm/%.o: $(SNIPPET_DIR)/asm/%.S $(asm-offsets) $(SNIPPET_DIR)/c/%.o: $(SNIPPET_DIR)/c/%.c $(asm-offsets) $(CC) $(CFLAGS) -c -nostdlib -o $@ $< -$(SNIPPET_DIR)/asm/%.gbin: $(SNIPPET_DIR)/asm/%.o - $(CC) $(LDFLAGS) -o $@ -T $(SRCDIR)/s390x/snippets/asm/flat.lds $< +$(SNIPPET_DIR)/asm/%.gbin: $(SNIPPET_DIR)/asm/%.o $(SNIPPET_DIR)/asm/flat.lds + $(CC) $(LDFLAGS) -o $@ -T $(SNIPPET_DIR)/asm/flat.lds $< $(OBJCOPY) -O binary -j ".rodata" -j ".lowcore" -j ".text" -j ".data" -j ".bss" --set-section-flags .bss=alloc,load,contents $@ $@ truncate -s '%4096' $@ -$(SNIPPET_DIR)/c/%.gbin: $(SNIPPET_DIR)/c/%.o $(snippet_lib) $(FLATLIBS) - $(CC) $(LDFLAGS) -o $@ -T $(SRCDIR)/s390x/snippets/c/flat.lds $< $(snippet_lib) $(FLATLIBS) +$(SNIPPET_DIR)/c/%.gbin: $(SNIPPET_DIR)/c/%.o $(snippet_lib) $(FLATLIBS) $(SNIPPET_DIR)/c/flat.lds + $(CC) $(LDFLAGS) -o $@ -T $(SNIPPET_DIR)/c/flat.lds $< $(snippet_lib) $(FLATLIBS) $(OBJCOPY) -O binary -j ".rodata" -j ".lowcore" -j ".text" -j ".data" -j ".bss" --set-section-flags .bss=alloc,load,contents $@ $@ truncate -s '%4096' $@ From patchwork Wed Apr 5 08:45:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nico Boehr X-Patchwork-Id: 13201371 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 86C3AC76188 for ; Wed, 5 Apr 2023 08:45:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236987AbjDEIpr (ORCPT ); Wed, 5 Apr 2023 04:45:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38734 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237538AbjDEIpm (ORCPT ); Wed, 5 Apr 2023 04:45:42 -0400 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AE23E2727 for ; Wed, 5 Apr 2023 01:45:41 -0700 (PDT) Received: from pps.filterd (m0187473.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 33566R05037062; Wed, 5 Apr 2023 08:45:39 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : mime-version; s=pp1; bh=WnXWZAqIQ2A/wQiQEx4XIntIlOdTAaGggtEddE9W7bY=; b=j/RIF9eLmfnL4TxA9SGzkdgfauxjSs0LDLKxBP5zguV0TWC73F8KayT24bjbwEACfZRC iNBf3VPn4LydtpHQezPSxoseUxThgBjqaaQGhVGkrlOw07WljppiNsKfdiShFw4Ztd/S XsSqxE45Pa3X9inFZwCy91FT5FaKTpVb4tvrsTgPrg58op9Z4C3fECP6DZGZAPjAb6us 7Wx+PwG0H1qVBqDCF6VIjQFcWS4WXCBUj4GsyMs/Lp7+lMhEDmyCKjBevHByIYwjHqN+ VycdO3DNjzhhumhnyteO7mZY/jvID0pLnlyiSMyJdQWvjG7RLO3h2svfOULRL0pa85M+ sw== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3ps2p1vs37-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 05 Apr 2023 08:45:39 +0000 Received: from m0187473.ppops.net (m0187473.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 3358UVxx026998; Wed, 5 Apr 2023 08:45:38 GMT Received: from ppma04ams.nl.ibm.com (63.31.33a9.ip4.static.sl-reverse.com [169.51.49.99]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3ps2p1vs2e-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 05 Apr 2023 08:45:38 +0000 Received: from pps.filterd (ppma04ams.nl.ibm.com [127.0.0.1]) by ppma04ams.nl.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 3350uPcg031750; Wed, 5 Apr 2023 08:45:36 GMT Received: from smtprelay02.fra02v.mail.ibm.com ([9.218.2.226]) by ppma04ams.nl.ibm.com (PPS) with ESMTPS id 3ppc87b69e-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 05 Apr 2023 08:45:36 +0000 Received: from smtpav05.fra02v.mail.ibm.com (smtpav05.fra02v.mail.ibm.com [10.20.54.104]) by smtprelay02.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 3358jX2b64553334 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 5 Apr 2023 08:45:33 GMT Received: from smtpav05.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id ED05D20043; Wed, 5 Apr 2023 08:45:32 +0000 (GMT) Received: from smtpav05.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 78E5020040; Wed, 5 Apr 2023 08:45:32 +0000 (GMT) Received: from t14-nrb.ibmuc.com (unknown [9.171.30.226]) by smtpav05.fra02v.mail.ibm.com (Postfix) with ESMTP; Wed, 5 Apr 2023 08:45:32 +0000 (GMT) From: Nico Boehr To: thuth@redhat.com, pbonzini@redhat.com, andrew.jones@linux.dev Cc: kvm@vger.kernel.org, frankja@linux.ibm.com, imbrenda@linux.ibm.com, Marc Hartmayer Subject: [kvm-unit-tests GIT PULL v3 04/14] s390x/Makefile: refactor CPPFLAGS Date: Wed, 5 Apr 2023 10:45:18 +0200 Message-Id: <20230405084528.16027-5-nrb@linux.ibm.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230405084528.16027-1-nrb@linux.ibm.com> References: <20230405084528.16027-1-nrb@linux.ibm.com> X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: qpl4pc4gginbDVcZgWwsS7GAja-04zJm X-Proofpoint-GUID: eXP2kqkvfae8dcRLmjQbH_GiNk8K-8sp X-Proofpoint-UnRewURL: 0 URL was un-rewritten MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-04-05_04,2023-04-04_05,2023-02-09_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 malwarescore=0 adultscore=0 impostorscore=0 bulkscore=0 priorityscore=1501 mlxlogscore=999 suspectscore=0 phishscore=0 spamscore=0 lowpriorityscore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2303200000 definitions=main-2304050079 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org From: Marc Hartmayer This change makes it easier to reuse them. While at it, add a comment why the `lib` include path is required. Signed-off-by: Marc Hartmayer Reviewed-by: Nico Boehr Tested-by: Nico Boehr Link: https://lore.kernel.org/r/20230331082709.35955-1-mhartmay@linux.ibm.com [ nrb: remove trailing whitespace after INCLUDE_PATH ] Signed-off-by: Nico Boehr --- s390x/Makefile | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/s390x/Makefile b/s390x/Makefile index 71e6563..50171f3 100644 --- a/s390x/Makefile +++ b/s390x/Makefile @@ -63,9 +63,14 @@ test_cases: $(tests) test_cases_binary: $(tests_binary) test_cases_pv: $(tests_pv_binary) +INCLUDE_PATHS = $(SRCDIR)/lib $(SRCDIR)/lib/s390x +# Include generated header files (e.g. in case of out-of-source builds) +INCLUDE_PATHS += lib +CPPFLAGS = $(addprefix -I,$(INCLUDE_PATHS)) + CFLAGS += -std=gnu99 CFLAGS += -ffreestanding -CFLAGS += -I $(SRCDIR)/lib -I $(SRCDIR)/lib/s390x -I lib +CFLAGS += $(CPPFLAGS) CFLAGS += -O2 CFLAGS += -march=zEC12 CFLAGS += -mbackchain From patchwork Wed Apr 5 08:45:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nico Boehr X-Patchwork-Id: 13201375 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CFD54C76188 for ; Wed, 5 Apr 2023 08:45:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237566AbjDEIpw (ORCPT ); Wed, 5 Apr 2023 04:45:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38888 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237334AbjDEIpq (ORCPT ); Wed, 5 Apr 2023 04:45:46 -0400 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 38BED30FF for ; Wed, 5 Apr 2023 01:45:45 -0700 (PDT) Received: from pps.filterd (m0098410.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3358c7uF001669; Wed, 5 Apr 2023 08:45:42 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : mime-version; s=pp1; bh=CirDOu72pqhfGVinfulpnXVBLKQVBeyS7mRU+bp/Ado=; b=lGI6ZaId2/KkUUiNFqAtboqK6GMXp8qUwMSe+N0EBeX2M6a/WRGKuXhIVY5idTtFlr3p q5FcYURU03ZTnYT7U4HJp/dmLqRSsBz18J9GK1+Ve3kb2n/iyrBYZSJdeNYSiughIe3v ObhAw4hQNDJ5Li4IPpCBl3PcY83j9l84hDodW+EJuCT7dC3HAFbjF8yKYXzmvqGoRDWd 4ajIVQ3n5vnTbEqEkOPWp2VHIwrI3Hxob2C6szoG6w8tbILhM5yfe5YkVCzic+epIAHu ooOz9/Yv38tiIhQqbAeBkjIUWxl2TRaLjOxHx6wh+LIX8EviUhu79yPfg7OHNLRkUvqG sA== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3ps5be0p5m-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 05 Apr 2023 08:45:42 +0000 Received: from m0098410.ppops.net (m0098410.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 3358Huc0014456; Wed, 5 Apr 2023 08:45:41 GMT Received: from ppma04fra.de.ibm.com (6a.4a.5195.ip4.static.sl-reverse.com [149.81.74.106]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3ps5be0p55-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 05 Apr 2023 08:45:41 +0000 Received: from pps.filterd (ppma04fra.de.ibm.com [127.0.0.1]) by ppma04fra.de.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 3350xQkZ025195; Wed, 5 Apr 2023 08:45:39 GMT Received: from smtprelay02.fra02v.mail.ibm.com ([9.218.2.226]) by ppma04fra.de.ibm.com (PPS) with ESMTPS id 3ppc86td6n-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 05 Apr 2023 08:45:39 +0000 Received: from smtpav05.fra02v.mail.ibm.com (smtpav05.fra02v.mail.ibm.com [10.20.54.104]) by smtprelay02.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 3358jXjN23528050 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 5 Apr 2023 08:45:33 GMT Received: from smtpav05.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 88AFC20043; Wed, 5 Apr 2023 08:45:33 +0000 (GMT) Received: from smtpav05.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 0FAFC20040; Wed, 5 Apr 2023 08:45:33 +0000 (GMT) Received: from t14-nrb.ibmuc.com (unknown [9.171.30.226]) by smtpav05.fra02v.mail.ibm.com (Postfix) with ESMTP; Wed, 5 Apr 2023 08:45:32 +0000 (GMT) From: Nico Boehr To: thuth@redhat.com, pbonzini@redhat.com, andrew.jones@linux.dev Cc: kvm@vger.kernel.org, frankja@linux.ibm.com, imbrenda@linux.ibm.com, Marc Hartmayer , Nina Schoetterl-Glausch Subject: [kvm-unit-tests GIT PULL v3 05/14] s390x: use preprocessor for linker script generation Date: Wed, 5 Apr 2023 10:45:19 +0200 Message-Id: <20230405084528.16027-6-nrb@linux.ibm.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230405084528.16027-1-nrb@linux.ibm.com> References: <20230405084528.16027-1-nrb@linux.ibm.com> X-TM-AS-GCONF: 00 X-Proofpoint-GUID: zDfAnE1lqhEwcMzxbrxjulDCW-kwcNgn X-Proofpoint-ORIG-GUID: eBD_AeFytV2WaD_r824paZ8jtZ5tqdyi X-Proofpoint-UnRewURL: 0 URL was un-rewritten MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-04-05_04,2023-04-04_05,2023-02-09_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 phishscore=0 mlxlogscore=939 impostorscore=0 lowpriorityscore=0 priorityscore=1501 bulkscore=0 spamscore=0 clxscore=1015 adultscore=0 mlxscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2303200000 definitions=main-2304050079 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org From: Marc Hartmayer The old `.lds` scripts are being renamed to `.lds.S` and the actual `.lds` scripts are being generated by the assembler preprocessor. This change allows us to use constants defined by macros in the `.lds.S` files. Signed-off-by: Marc Hartmayer Reviewed-by: Nina Schoetterl-Glausch Reviewed-by: Claudio Imbrenda Link: https://lore.kernel.org/r/20230307091051.13945-6-mhartmay@linux.ibm.com Signed-off-by: Nico Boehr --- s390x/Makefile | 7 +++++-- s390x/{flat.lds => flat.lds.S} | 0 s390x/snippets/asm/{flat.lds => flat.lds.S} | 0 s390x/snippets/c/{flat.lds => flat.lds.S} | 0 .gitignore | 1 + 5 files changed, 6 insertions(+), 2 deletions(-) rename s390x/{flat.lds => flat.lds.S} (100%) rename s390x/snippets/asm/{flat.lds => flat.lds.S} (100%) rename s390x/snippets/c/{flat.lds => flat.lds.S} (100%) diff --git a/s390x/Makefile b/s390x/Makefile index 50171f3..6732b48 100644 --- a/s390x/Makefile +++ b/s390x/Makefile @@ -78,7 +78,7 @@ CFLAGS += -fno-delete-null-pointer-checks LDFLAGS += -nostdlib -Wl,--build-id=none # We want to keep intermediate files -.PRECIOUS: %.o +.PRECIOUS: %.o %.lds asm-offsets = lib/$(ARCH)/asm-offsets.h include $(SRCDIR)/scripts/asm-offsets.mak @@ -161,6 +161,9 @@ $(SNIPPET_DIR)/c/%.gbin: $(SNIPPET_DIR)/c/%.o $(snippet_lib) $(FLATLIBS) $(SNIPP %.hdr.obj: %.hdr $(OBJCOPY) -I binary -O elf64-s390 -B "s390:64-bit" $< $@ +lds-autodepend-flags = -MMD -MF $(dir $*).$(notdir $*).d -MT $@ +%.lds: %.lds.S + $(CPP) $(lds-autodepend-flags) $(CPPFLAGS) -P -C -o $@ $< .SECONDEXPANSION: %.elf: $(FLATLIBS) $(asmlib) $(SRCDIR)/s390x/flat.lds $$(snippets-obj) $$(snippet-hdr-obj) %.o @@ -213,7 +216,7 @@ $(snippet_asmlib): $$(patsubst %.o,%.S,$$@) $(asm-offsets) arch_clean: asm_offsets_clean - $(RM) $(TEST_DIR)/*.{o,elf,bin} $(SNIPPET_DIR)/*/*.{o,elf,*bin,*obj,hdr} $(SNIPPET_DIR)/asm/.*.d $(TEST_DIR)/.*.d lib/s390x/.*.d $(comm-key) + $(RM) $(TEST_DIR)/*.{o,elf,bin,lds} $(SNIPPET_DIR)/*/*.{o,elf,*bin,*obj,hdr,lds} $(SNIPPET_DIR)/asm/.*.d $(TEST_DIR)/.*.d lib/s390x/.*.d $(comm-key) generated-files = $(asm-offsets) $(tests:.elf=.o) $(asmlib) $(cflatobjs): $(generated-files) diff --git a/s390x/flat.lds b/s390x/flat.lds.S similarity index 100% rename from s390x/flat.lds rename to s390x/flat.lds.S diff --git a/s390x/snippets/asm/flat.lds b/s390x/snippets/asm/flat.lds.S similarity index 100% rename from s390x/snippets/asm/flat.lds rename to s390x/snippets/asm/flat.lds.S diff --git a/s390x/snippets/c/flat.lds b/s390x/snippets/c/flat.lds.S similarity index 100% rename from s390x/snippets/c/flat.lds rename to s390x/snippets/c/flat.lds.S diff --git a/.gitignore b/.gitignore index 601822d..29f352c 100644 --- a/.gitignore +++ b/.gitignore @@ -31,3 +31,4 @@ cscope.* /s390x/comm.key /s390x/snippets/*/*.hdr /s390x/snippets/*/*.*obj +/s390x/**/*.lds From patchwork Wed Apr 5 08:45:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nico Boehr X-Patchwork-Id: 13201374 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 43C3CC761AF for ; Wed, 5 Apr 2023 08:45:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237601AbjDEIpv (ORCPT ); Wed, 5 Apr 2023 04:45:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38848 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237575AbjDEIpp (ORCPT ); Wed, 5 Apr 2023 04:45:45 -0400 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3FBBD422E for ; Wed, 5 Apr 2023 01:45:44 -0700 (PDT) Received: from pps.filterd (m0098396.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3358g4F0016974; Wed, 5 Apr 2023 08:45:42 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : mime-version; s=pp1; bh=YeidoZ6UYcu5yanv23XQkMVHFykVjJlMLJoGb5DTzy4=; b=I9OFVwQcXIhq+Sq81pv5DJwdysCRx2ra5X1sEt0RW0mBYg4m4OC7uTavxlYFbTKoxCDA AlW5TtKRT/DdXz4o5/LjRkJ8hsBcLsmrBCGbhJTVSiOFbyQVjJqex4KDUbbwfF/bMULe 2i1FkHAo17GaGmjIA1kUUnTF2DTttqLB7CLzwQsKOmaeL5Yz08YxBoPWwmv6g9WhV7p3 qCDTD3heA4ZAjhWTyvLbTc920O/k8aF6VuYANrAvJfsHlKOlm7w0vIJ8+d1RaYnNkh7Q f22Cufux9xCPZtjgw4Km6a9wgKn3SwRBum5YqFojd0qGe4SaegzLY0pVBefTZY0aGgxQ NA== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3ps5q082g8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 05 Apr 2023 08:45:41 +0000 Received: from m0098396.ppops.net (m0098396.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 3358jfgP028584; Wed, 5 Apr 2023 08:45:41 GMT Received: from ppma03ams.nl.ibm.com (62.31.33a9.ip4.static.sl-reverse.com [169.51.49.98]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3ps5q082fh-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 05 Apr 2023 08:45:41 +0000 Received: from pps.filterd (ppma03ams.nl.ibm.com [127.0.0.1]) by ppma03ams.nl.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 334NupGn003364; Wed, 5 Apr 2023 08:45:39 GMT Received: from smtprelay07.fra02v.mail.ibm.com ([9.218.2.229]) by ppma03ams.nl.ibm.com (PPS) with ESMTPS id 3ppc8735nb-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 05 Apr 2023 08:45:38 +0000 Received: from smtpav05.fra02v.mail.ibm.com (smtpav05.fra02v.mail.ibm.com [10.20.54.104]) by smtprelay07.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 3358jYbN28836496 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 5 Apr 2023 08:45:34 GMT Received: from smtpav05.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 2273A20049; Wed, 5 Apr 2023 08:45:34 +0000 (GMT) Received: from smtpav05.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id A071920040; Wed, 5 Apr 2023 08:45:33 +0000 (GMT) Received: from t14-nrb.ibmuc.com (unknown [9.171.30.226]) by smtpav05.fra02v.mail.ibm.com (Postfix) with ESMTP; Wed, 5 Apr 2023 08:45:33 +0000 (GMT) From: Nico Boehr To: thuth@redhat.com, pbonzini@redhat.com, andrew.jones@linux.dev Cc: kvm@vger.kernel.org, frankja@linux.ibm.com, imbrenda@linux.ibm.com, Marc Hartmayer , Nina Schoetterl-Glausch Subject: [kvm-unit-tests GIT PULL v3 06/14] s390x: define a macro for the stack frame size Date: Wed, 5 Apr 2023 10:45:20 +0200 Message-Id: <20230405084528.16027-7-nrb@linux.ibm.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230405084528.16027-1-nrb@linux.ibm.com> References: <20230405084528.16027-1-nrb@linux.ibm.com> X-TM-AS-GCONF: 00 X-Proofpoint-GUID: NV8bdooW1u8LR-rqeXJdCuJ2lfoDGnWk X-Proofpoint-ORIG-GUID: illDhqEkzQ6LXZMc8_19a0UN5s8UadKb X-Proofpoint-UnRewURL: 0 URL was un-rewritten MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-04-05_04,2023-04-04_05,2023-02-09_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 phishscore=0 adultscore=0 priorityscore=1501 mlxlogscore=999 spamscore=0 mlxscore=0 clxscore=1015 impostorscore=0 malwarescore=0 bulkscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2303200000 definitions=main-2304050079 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org From: Marc Hartmayer Define and use a macro for the stack frame size. While at it, fix whitespace in the `gs_handler_asm` block. Signed-off-by: Marc Hartmayer Co-developed-by: Nina Schoetterl-Glausch Reviewed-by: Nina Schoetterl-Glausch Reviewed-by: Claudio Imbrenda Link: https://lore.kernel.org/r/20230307091051.13945-7-mhartmay@linux.ibm.com Signed-off-by: Nico Boehr --- s390x/Makefile | 2 +- lib/s390x/asm-offsets.c | 1 + s390x/cstart64.S | 2 +- s390x/flat.lds.S | 4 +++- s390x/macros.S | 4 ++-- s390x/snippets/c/flat.lds.S | 6 ++++-- s390x/gs.c | 38 +++++++++++++++++++++---------------- 7 files changed, 34 insertions(+), 23 deletions(-) diff --git a/s390x/Makefile b/s390x/Makefile index 6732b48..ab146eb 100644 --- a/s390x/Makefile +++ b/s390x/Makefile @@ -162,7 +162,7 @@ $(SNIPPET_DIR)/c/%.gbin: $(SNIPPET_DIR)/c/%.o $(snippet_lib) $(FLATLIBS) $(SNIPP $(OBJCOPY) -I binary -O elf64-s390 -B "s390:64-bit" $< $@ lds-autodepend-flags = -MMD -MF $(dir $*).$(notdir $*).d -MT $@ -%.lds: %.lds.S +%.lds: %.lds.S $(asm-offsets) $(CPP) $(lds-autodepend-flags) $(CPPFLAGS) -P -C -o $@ $< .SECONDEXPANSION: diff --git a/lib/s390x/asm-offsets.c b/lib/s390x/asm-offsets.c index f612f32..188dd2e 100644 --- a/lib/s390x/asm-offsets.c +++ b/lib/s390x/asm-offsets.c @@ -87,6 +87,7 @@ int main(void) OFFSET(STACK_FRAME_INT_GRS0, stack_frame_int, grs0); OFFSET(STACK_FRAME_INT_GRS1, stack_frame_int, grs1); DEFINE(STACK_FRAME_INT_SIZE, sizeof(struct stack_frame_int)); + DEFINE(STACK_FRAME_SIZE, sizeof(struct stack_frame)); return 0; } diff --git a/s390x/cstart64.S b/s390x/cstart64.S index 6f83da2..468ace3 100644 --- a/s390x/cstart64.S +++ b/s390x/cstart64.S @@ -38,7 +38,7 @@ start: /* setup stack */ larl %r15, stackptr /* Clear first stack frame */ - xc 0(160,%r15), 0(%r15) + xc 0(STACK_FRAME_SIZE,%r15), 0(%r15) /* setup initial PSW mask + control registers*/ larl %r1, initial_psw lpswe 0(%r1) diff --git a/s390x/flat.lds.S b/s390x/flat.lds.S index 952f6cd..0cb7e38 100644 --- a/s390x/flat.lds.S +++ b/s390x/flat.lds.S @@ -1,3 +1,5 @@ +#include + SECTIONS { .lowcore : { @@ -44,6 +46,6 @@ SECTIONS /* * stackptr set with initial stack frame preallocated */ - stackptr = . - 160; + stackptr = . - STACK_FRAME_SIZE; stacktop = .; } diff --git a/s390x/macros.S b/s390x/macros.S index 13cff29..e2a56a3 100644 --- a/s390x/macros.S +++ b/s390x/macros.S @@ -21,14 +21,14 @@ /* Save the stack address in GR2 which is the first function argument */ lgr %r2, %r15 /* Allocate stack space for called C function, as specified in s390 ELF ABI */ - slgfi %r15, 160 + slgfi %r15, STACK_FRAME_SIZE /* * Save the address of the interrupt stack into the back chain * of the called function. */ stg %r2, STACK_FRAME_INT_BACKCHAIN(%r15) brasl %r14, \c_func - algfi %r15, 160 + algfi %r15, STACK_FRAME_SIZE RESTORE_REGS_STACK lpswe \old_psw .endm diff --git a/s390x/snippets/c/flat.lds.S b/s390x/snippets/c/flat.lds.S index 9e5eb66..468b5f1 100644 --- a/s390x/snippets/c/flat.lds.S +++ b/s390x/snippets/c/flat.lds.S @@ -1,3 +1,5 @@ +#include + SECTIONS { .lowcore : { @@ -18,9 +20,9 @@ SECTIONS . = 0x4000; /* * The stack grows down from 0x4000 to 0x2000, we pre-allocoate - * a frame via the -160. + * a frame via the -STACK_FRAME_SIZE. */ - stackptr = . - 160; + stackptr = . - STACK_FRAME_SIZE; stacktop = .; /* Start text 0x4000 */ .text : { diff --git a/s390x/gs.c b/s390x/gs.c index 4993eb8..9ae893e 100644 --- a/s390x/gs.c +++ b/s390x/gs.c @@ -9,6 +9,7 @@ * Janosch Frank */ #include +#include #include #include #include @@ -35,22 +36,27 @@ static inline unsigned long load_guarded(unsigned long *p) /* guarded-storage event handler and finally it calls gs_handler */ extern void gs_handler_asm(void); - asm(".globl gs_handler_asm\n" - "gs_handler_asm:\n" - " lgr %r14,%r15\n" /* Save current stack address in r14 */ - " aghi %r15,-320\n" /* Allocate stack frame */ - " stmg %r0,%r13,192(%r15)\n" /* Store regs to save area */ - " stg %r14,312(%r15)\n" - " la %r2,160(%r15)\n" /* Store gscb address in this_cb */ - " .insn rxy,0xe30000000049,0,160(%r15)\n" /* stgsc */ - " lg %r14,24(%r2)\n" /* Get GSEPLA from GSCB*/ - " lg %r14,40(%r14)\n" /* Get GSERA from GSEPL*/ - " stg %r14,304(%r15)\n" /* Store GSERA in r14 of reg save area */ - " brasl %r14,gs_handler\n" /* Jump to gs_handler */ - " lmg %r0,%r15,192(%r15)\n" /* Restore regs */ - " aghi %r14, 6\n" /* Add lgg instr len to GSERA */ - " br %r14\n" /* Jump to next instruction after lgg */ - " .size gs_handler_asm,.-gs_handler_asm\n"); + asm ( ".macro STGSC args:vararg\n" + " .insn rxy,0xe30000000049,\\args\n" + " .endm\n" + " .globl gs_handler_asm\n" + "gs_handler_asm:\n" + " lgr %r14,%r15\n" /* Save current stack address in r14 */ + ".Lgs_handler_frame = 16*8+32+" xstr(STACK_FRAME_SIZE) "\n" + " aghi %r15,-(.Lgs_handler_frame)\n" /* Allocate stack frame */ + " stmg %r0,%r13,192(%r15)\n" /* Store regs to save area */ + " stg %r14,312(%r15)\n" + " la %r2," xstr(STACK_FRAME_SIZE) "(%r15)\n" /* Store gscb address in this_cb */ + " STGSC %r0," xstr(STACK_FRAME_SIZE) "(%r15)\n" + " lg %r14,24(%r2)\n" /* Get GSEPLA from GSCB*/ + " lg %r14,40(%r14)\n" /* Get GSERA from GSEPL*/ + " stg %r14,304(%r15)\n" /* Store GSERA in r14 of reg save area */ + " brasl %r14,gs_handler\n" /* Jump to gs_handler */ + " lmg %r0,%r15,192(%r15)\n" /* Restore regs */ + " aghi %r14, 6\n" /* Add lgg instr len to GSERA */ + " br %r14\n" /* Jump to next instruction after lgg */ + ".size gs_handler_asm,.-gs_handler_asm\n" + ); void gs_handler(struct gs_cb *this_cb) { From patchwork Wed Apr 5 08:45:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nico Boehr X-Patchwork-Id: 13201372 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DC8F9C7619A for ; Wed, 5 Apr 2023 08:45:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237585AbjDEIps (ORCPT ); Wed, 5 Apr 2023 04:45:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38770 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231742AbjDEIpn (ORCPT ); Wed, 5 Apr 2023 04:45:43 -0400 Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1716A2727 for ; Wed, 5 Apr 2023 01:45:42 -0700 (PDT) Received: from pps.filterd (m0098419.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3357VdvF014022; Wed, 5 Apr 2023 08:45:40 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : mime-version; s=pp1; bh=eooVMNY12d4PIRdlfRREXKlBB/c6LetaDTS5O1I3m78=; b=ldSTaOeNx9Qg6jrmPNPpVj9JMiAk0ahwsBELkr7RFeOKZ3II7eo891nkBIIwdqVVZiQV 87E5gZ83HQMa3CX/DFcbfvYJND3Vbd7bMn7QxKJGKpojfz+davBS9LJqgKx4zaTe4u3G 42FuPAfafgdzEuEGvoY5rQbq5oyCwnDkJc8tpmPgVyZ69w3OAkQjU1SYVYD+iGgHZpQC td+3Oez2uc2CO6gYfOGV5KbrSX/blZ+DG5/IbkpzGAbJt3GkiDYTwljee98G8Im4SLqK SdIOjRZxrHHDr16wpFKgS1J+5DZR6du/SBRsyryTVcDldgzf92NEWpkJCyjNumUF7aMv LQ== Received: from pps.reinject (localhost [127.0.0.1]) by mx0b-001b2d01.pphosted.com (PPS) with ESMTPS id 3ps4p5hsxv-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 05 Apr 2023 08:45:40 +0000 Received: from m0098419.ppops.net (m0098419.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 3358HCDP028057; Wed, 5 Apr 2023 08:45:40 GMT Received: from ppma04ams.nl.ibm.com (63.31.33a9.ip4.static.sl-reverse.com [169.51.49.99]) by mx0b-001b2d01.pphosted.com (PPS) with ESMTPS id 3ps4p5hsxb-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 05 Apr 2023 08:45:40 +0000 Received: from pps.filterd (ppma04ams.nl.ibm.com [127.0.0.1]) by ppma04ams.nl.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 334HPHp0024391; Wed, 5 Apr 2023 08:45:38 GMT Received: from smtprelay07.fra02v.mail.ibm.com ([9.218.2.229]) by ppma04ams.nl.ibm.com (PPS) with ESMTPS id 3ppc87b69g-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 05 Apr 2023 08:45:38 +0000 Received: from smtpav05.fra02v.mail.ibm.com (smtpav05.fra02v.mail.ibm.com [10.20.54.104]) by smtprelay07.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 3358jY5b28836498 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 5 Apr 2023 08:45:35 GMT Received: from smtpav05.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id DE1FA20043; Wed, 5 Apr 2023 08:45:34 +0000 (GMT) Received: from smtpav05.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 37F7120040; Wed, 5 Apr 2023 08:45:34 +0000 (GMT) Received: from t14-nrb.ibmuc.com (unknown [9.171.30.226]) by smtpav05.fra02v.mail.ibm.com (Postfix) with ESMTP; Wed, 5 Apr 2023 08:45:34 +0000 (GMT) From: Nico Boehr To: thuth@redhat.com, pbonzini@redhat.com, andrew.jones@linux.dev Cc: kvm@vger.kernel.org, frankja@linux.ibm.com, imbrenda@linux.ibm.com, Marc Hartmayer Subject: [kvm-unit-tests GIT PULL v3 07/14] lib/linux/const.h: test for `__ASSEMBLER__` as well Date: Wed, 5 Apr 2023 10:45:21 +0200 Message-Id: <20230405084528.16027-8-nrb@linux.ibm.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230405084528.16027-1-nrb@linux.ibm.com> References: <20230405084528.16027-1-nrb@linux.ibm.com> X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: zdS5LalBiNhWclwL5ZkXvvbiNLwQ6zWB X-Proofpoint-GUID: zz7KTLBb1oUetAk6MzidgcZ_cydakfZz X-Proofpoint-UnRewURL: 0 URL was un-rewritten MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-04-05_04,2023-04-04_05,2023-02-09_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 adultscore=0 phishscore=0 lowpriorityscore=0 bulkscore=0 mlxlogscore=999 clxscore=1015 priorityscore=1501 spamscore=0 malwarescore=0 impostorscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2303200000 definitions=main-2304050079 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org From: Marc Hartmayer On s390x we're using the preprocessor for generating our linker scripts out of assembly files. The macro `__ASSEMBLER__` is defined with value 1 when preprocessing assembly language using gcc. [1] Therefore, let's check for the macro `__ASSEMBLER__` in `lib/linux/const.h` as well. Thus we can use macros that makes use of the `_AC` or `_AT` macro in the "linker scripts". [1] https://gcc.gnu.org/onlinedocs/cpp/Standard-Predefined-Macros.html Signed-off-by: Marc Hartmayer Reviewed-by: Janosch Frank Link: https://lore.kernel.org/r/20230307091051.13945-8-mhartmay@linux.ibm.com Signed-off-by: Nico Boehr --- lib/linux/const.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/linux/const.h b/lib/linux/const.h index c872bfd..be114dc 100644 --- a/lib/linux/const.h +++ b/lib/linux/const.h @@ -12,7 +12,7 @@ * leave it unchanged in asm. */ -#ifdef __ASSEMBLY__ +#if defined(__ASSEMBLY__) || defined(__ASSEMBLER__) #define _AC(X,Y) X #define _AT(T,X) X #else From patchwork Wed Apr 5 08:45:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nico Boehr X-Patchwork-Id: 13201373 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 47A03C76188 for ; Wed, 5 Apr 2023 08:45:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237594AbjDEIpu (ORCPT ); Wed, 5 Apr 2023 04:45:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38822 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237566AbjDEIpp (ORCPT ); Wed, 5 Apr 2023 04:45:45 -0400 Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6BDD2468F for ; Wed, 5 Apr 2023 01:45:44 -0700 (PDT) Received: from pps.filterd (m0098420.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3358Remp025000; Wed, 5 Apr 2023 08:45:42 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : mime-version; s=pp1; bh=XoGhQ+IhWWkgbg5ayNE4GSkQkWFRBC9dgLYY+SD7ir0=; b=JkxbChyonpijp6iPicDehcPvq/e1Y1Lp9J5aY4gTamgekjd6ZsKl2uPmqnyh2n+8S9mb Ay46SKCgBWO9jvZN68i4a00q+haHt7f5Rj2jcjArr9w9z2sznp7H0sj2h56uNl5xlo2q t/9UvEBL0vHli2x1ho3zoWWeJ7clG8Sfq2+XSjiQVOiYFhHFi77uZjnDLNj6cuGm5OqW Cjp5yduDkqpxcgw5dIbGFEhd6IKrQVCYu6ks/Tt++3PzZ8tv3Doq0cPJWb0e4gdDUV+H qiL7NM1iyECgQHAa9kl0PZXAxFQEsM9nkd5UD3Jlo32gPgzYnF0m0PV+G8C7vdFYALQ4 dg== Received: from pps.reinject (localhost [127.0.0.1]) by mx0b-001b2d01.pphosted.com (PPS) with ESMTPS id 3ps5gdrba0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 05 Apr 2023 08:45:41 +0000 Received: from m0098420.ppops.net (m0098420.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 3358V1Rx003080; Wed, 5 Apr 2023 08:45:41 GMT Received: from ppma03fra.de.ibm.com (6b.4a.5195.ip4.static.sl-reverse.com [149.81.74.107]) by mx0b-001b2d01.pphosted.com (PPS) with ESMTPS id 3ps5gdrb9e-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 05 Apr 2023 08:45:41 +0000 Received: from pps.filterd (ppma03fra.de.ibm.com [127.0.0.1]) by ppma03fra.de.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 3350q97n015178; Wed, 5 Apr 2023 08:45:39 GMT Received: from smtprelay05.fra02v.mail.ibm.com ([9.218.2.225]) by ppma03fra.de.ibm.com (PPS) with ESMTPS id 3ppc872css-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 05 Apr 2023 08:45:39 +0000 Received: from smtpav05.fra02v.mail.ibm.com (smtpav05.fra02v.mail.ibm.com [10.20.54.104]) by smtprelay05.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 3358jZbV17957488 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 5 Apr 2023 08:45:35 GMT Received: from smtpav05.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B463F20043; Wed, 5 Apr 2023 08:45:35 +0000 (GMT) Received: from smtpav05.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 4007D20040; Wed, 5 Apr 2023 08:45:35 +0000 (GMT) Received: from t14-nrb.ibmuc.com (unknown [9.171.30.226]) by smtpav05.fra02v.mail.ibm.com (Postfix) with ESMTP; Wed, 5 Apr 2023 08:45:35 +0000 (GMT) From: Nico Boehr To: thuth@redhat.com, pbonzini@redhat.com, andrew.jones@linux.dev Cc: kvm@vger.kernel.org, frankja@linux.ibm.com, imbrenda@linux.ibm.com, Nina Schoetterl-Glausch Subject: [kvm-unit-tests GIT PULL v3 08/14] s390x/spec_ex: Use PSW macro Date: Wed, 5 Apr 2023 10:45:22 +0200 Message-Id: <20230405084528.16027-9-nrb@linux.ibm.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230405084528.16027-1-nrb@linux.ibm.com> References: <20230405084528.16027-1-nrb@linux.ibm.com> X-TM-AS-GCONF: 00 X-Proofpoint-GUID: nMnly7j2vj8YmPAmPa14PotYIyt2QmWI X-Proofpoint-ORIG-GUID: VGmRiVm4oaUXpmCgCCPgNGafAeFmVGds X-Proofpoint-UnRewURL: 0 URL was un-rewritten MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-04-05_04,2023-04-04_05,2023-02-09_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 bulkscore=0 adultscore=0 phishscore=0 impostorscore=0 mlxscore=0 lowpriorityscore=0 mlxlogscore=999 priorityscore=1501 clxscore=1015 spamscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2303200000 definitions=main-2304050079 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org From: Nina Schoetterl-Glausch Replace explicit psw definition by PSW macro. No functional change intended. Reviewed-by: Janosch Frank Reviewed-by: Claudio Imbrenda Signed-off-by: Nina Schoetterl-Glausch Reviewed-by: Nico Boehr Link: https://lore.kernel.org/r/20230404085454.2709061-2-nsg@linux.ibm.com Signed-off-by: Nico Boehr --- s390x/spec_ex.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/s390x/spec_ex.c b/s390x/spec_ex.c index 42ecaed..2adc599 100644 --- a/s390x/spec_ex.c +++ b/s390x/spec_ex.c @@ -105,10 +105,7 @@ static int check_invalid_psw(void) /* For normal PSWs bit 12 has to be 0 to be a valid PSW*/ static int psw_bit_12_is_1(void) { - struct psw invalid = { - .mask = BIT(63 - 12), - .addr = 0x00000000deadbeee - }; + struct psw invalid = PSW(BIT(63 - 12), 0x00000000deadbeee); expect_invalid_psw(invalid); load_psw(invalid); @@ -118,10 +115,7 @@ static int psw_bit_12_is_1(void) /* A short PSW needs to have bit 12 set to be valid. */ static int short_psw_bit_12_is_0(void) { - struct psw invalid = { - .mask = BIT(63 - 12), - .addr = 0x00000000deadbeee - }; + struct psw invalid = PSW(BIT(63 - 12), 0x00000000deadbeee); struct short_psw short_invalid = { .mask = 0x0, .addr = 0xdeadbeee From patchwork Wed Apr 5 08:45:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nico Boehr X-Patchwork-Id: 13201376 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EC129C761AF for ; Wed, 5 Apr 2023 08:45:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237580AbjDEIpy (ORCPT ); Wed, 5 Apr 2023 04:45:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38928 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237578AbjDEIpq (ORCPT ); Wed, 5 Apr 2023 04:45:46 -0400 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8556130F8 for ; Wed, 5 Apr 2023 01:45:45 -0700 (PDT) Received: from pps.filterd (m0098396.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3358fu0J016685; Wed, 5 Apr 2023 08:45:43 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : mime-version; s=pp1; bh=DyLaT5b/+GlO0ikmCQ3sWB5KNGOdam2qcWkiaZiHA8A=; b=M8sLD6NiHKxl7+SichKuIYcXpSW/7YTwIX8haeX4mrThWmFiz/N/PyIp+Wv06S+quPAl d9NvzHDUPhuKwt09mv++vrBSBqVlrpmCgQ+InlAsXk3URLCAUjl4q1oITNqWS8dzq/xw zcQ6ZXZ7TTZj75KjMCpe1M1fPgd0WPoU5DEIcV2aBDfPmzOQD1/HNIy3S2MugMTNx++0 +45MGHchy3LC4YIYu8/EBe9R1L9tQTzR9P6kAGLOrDBTgETd0kVToPw+9yHEgyHIDFZS CtnuvVh3et049RUXnrpy/wX6786b0bx2AIuU17lHwLnhp10nYRPFjl0/p+4voDtBwahd 5w== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3ps5q082gh-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 05 Apr 2023 08:45:43 +0000 Received: from m0098396.ppops.net (m0098396.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 3358grwH018929; Wed, 5 Apr 2023 08:45:42 GMT Received: from ppma03ams.nl.ibm.com (62.31.33a9.ip4.static.sl-reverse.com [169.51.49.98]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3ps5q082fu-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 05 Apr 2023 08:45:42 +0000 Received: from pps.filterd (ppma03ams.nl.ibm.com [127.0.0.1]) by ppma03ams.nl.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 3355SQot015821; Wed, 5 Apr 2023 08:45:39 GMT Received: from smtprelay06.fra02v.mail.ibm.com ([9.218.2.230]) by ppma03ams.nl.ibm.com (PPS) with ESMTPS id 3ppc8735nc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 05 Apr 2023 08:45:39 +0000 Received: from smtpav05.fra02v.mail.ibm.com (smtpav05.fra02v.mail.ibm.com [10.20.54.104]) by smtprelay06.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 3358jag141484560 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 5 Apr 2023 08:45:36 GMT Received: from smtpav05.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 42E3A20049; Wed, 5 Apr 2023 08:45:36 +0000 (GMT) Received: from smtpav05.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id CA32B20040; Wed, 5 Apr 2023 08:45:35 +0000 (GMT) Received: from t14-nrb.ibmuc.com (unknown [9.171.30.226]) by smtpav05.fra02v.mail.ibm.com (Postfix) with ESMTP; Wed, 5 Apr 2023 08:45:35 +0000 (GMT) From: Nico Boehr To: thuth@redhat.com, pbonzini@redhat.com, andrew.jones@linux.dev Cc: kvm@vger.kernel.org, frankja@linux.ibm.com, imbrenda@linux.ibm.com, Nina Schoetterl-Glausch Subject: [kvm-unit-tests GIT PULL v3 09/14] s390x/spec_ex: Add test introducing odd address into PSW Date: Wed, 5 Apr 2023 10:45:23 +0200 Message-Id: <20230405084528.16027-10-nrb@linux.ibm.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230405084528.16027-1-nrb@linux.ibm.com> References: <20230405084528.16027-1-nrb@linux.ibm.com> X-TM-AS-GCONF: 00 X-Proofpoint-GUID: vMJBi0ijQHXTknQNB9aJVPFXj4Y6GhLD X-Proofpoint-ORIG-GUID: PsEfwI-N-_w2TITYbzSyL3Qx9JZAl7Pl X-Proofpoint-UnRewURL: 0 URL was un-rewritten MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-04-05_04,2023-04-04_05,2023-02-09_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 phishscore=0 adultscore=0 priorityscore=1501 mlxlogscore=999 spamscore=0 mlxscore=0 clxscore=1015 impostorscore=0 malwarescore=0 bulkscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2303200000 definitions=main-2304050079 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org From: Nina Schoetterl-Glausch Instructions on s390 must be halfword aligned. Introducing an odd instruction address into the PSW leads to a specification exception when attempting to execute the instruction at the odd address. Add a test for this. Acked-by: Janosch Frank Reviewed-by: Claudio Imbrenda Signed-off-by: Nina Schoetterl-Glausch Reviewed-by: Nico Boehr Tested-by: Nico Boehr Link: https://lore.kernel.org/r/20230404085454.2709061-3-nsg@linux.ibm.com Signed-off-by: Nico Boehr --- s390x/spec_ex.c | 50 ++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 49 insertions(+), 1 deletion(-) diff --git a/s390x/spec_ex.c b/s390x/spec_ex.c index 2adc599..494d94c 100644 --- a/s390x/spec_ex.c +++ b/s390x/spec_ex.c @@ -88,12 +88,23 @@ static void expect_invalid_psw(struct psw psw) invalid_psw_expected = true; } +static void clear_invalid_psw(void) +{ + expected_psw = PSW(0, 0); + invalid_psw_expected = false; +} + static int check_invalid_psw(void) { /* Since the fixup sets this to false we check for false here. */ if (!invalid_psw_expected) { + /* + * Early exception recognition: pgm_int_id == 0. + * Late exception recognition: psw address has been + * incremented by pgm_int_id (unpredictable value) + */ if (expected_psw.mask == invalid_psw.mask && - expected_psw.addr == invalid_psw.addr) + expected_psw.addr == invalid_psw.addr - lowcore.pgm_int_id) return 0; report_fail("Wrong invalid PSW"); } else { @@ -112,6 +123,42 @@ static int psw_bit_12_is_1(void) return check_invalid_psw(); } +extern char misaligned_code_pre[]; +asm ( ".balign 2\n" +"misaligned_code_pre:\n" +" . = . + 1\n" +" larl %r0,0\n" +" br %r1\n" +); + +static int psw_odd_address(void) +{ + struct psw odd = PSW_WITH_CUR_MASK(((uint64_t)&misaligned_code_pre) + 1); + uint64_t executed_addr; + + expect_invalid_psw(odd); + fixup_psw.mask = extract_psw_mask(); + asm volatile ( "xgr %%r0,%%r0\n" + " larl %%r1,0f\n" + " stg %%r1,%[fixup_addr]\n" + " lpswe %[odd_psw]\n" + "0: lr %[executed_addr],%%r0\n" + : [fixup_addr] "=&T" (fixup_psw.addr), + [executed_addr] "=d" (executed_addr) + : [odd_psw] "Q" (odd) + : "cc", "%r0", "%r1", "memory" /* Compiler barrier like in load_psw */ + ); + + if (!executed_addr) { + return check_invalid_psw(); + } else { + assert(executed_addr == odd.addr); + clear_invalid_psw(); + report_fail("did not execute unaligned instructions"); + return 1; + } +} + /* A short PSW needs to have bit 12 set to be valid. */ static int short_psw_bit_12_is_0(void) { @@ -170,6 +217,7 @@ struct spec_ex_trigger { static const struct spec_ex_trigger spec_ex_triggers[] = { { "psw_bit_12_is_1", &psw_bit_12_is_1, false, &fixup_invalid_psw }, { "short_psw_bit_12_is_0", &short_psw_bit_12_is_0, false, &fixup_invalid_psw }, + { "psw_odd_address", &psw_odd_address, false, &fixup_invalid_psw }, { "bad_alignment", &bad_alignment, true, NULL }, { "not_even", ¬_even, true, NULL }, { NULL, NULL, false, NULL }, From patchwork Wed Apr 5 08:45:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nico Boehr X-Patchwork-Id: 13201377 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F3B5CC77B62 for ; Wed, 5 Apr 2023 08:45:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237613AbjDEIp4 (ORCPT ); Wed, 5 Apr 2023 04:45:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38906 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237581AbjDEIpr (ORCPT ); Wed, 5 Apr 2023 04:45:47 -0400 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A29BF4EFD for ; Wed, 5 Apr 2023 01:45:45 -0700 (PDT) Received: from pps.filterd (m0098399.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3358VmRj011325; Wed, 5 Apr 2023 08:45:43 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : mime-version; s=pp1; bh=YO5vLxDtMTr2UchCfOgJkBy6P80UFwqn8LwQTwOT8VY=; b=evBMnjMscJERgE74pi5sj332hYbG25Vha3BH7Oj0TioiiIcaPuQQ653ROSMyybmeBKwE VKHScKsyX+gmiF1IXV3Teks8GKqbJuoFY1ALuC405RgytxBCUBQHMGNNJIMqarwF76fI rGDhsKE4d/edpZa+VCzGI3kgeON6A0EFwnWAwTOOI7R+OQHzku6ozy+t4WdfnapKP6ht 2b0gg8cQ5qEFkQIN5GSKY1xxcpY+pRqfGFws4JY22Yr9Ny0B2XdT6aCWaT58tV1NMu5R x8N4lHW9T7EzlEaUSiBKBjYBTGuzMDI59/JfzrwCeg6k6uHH7kGifpNYcRfHbXh3ROn5 lA== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3ps5jcgcqu-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 05 Apr 2023 08:45:43 +0000 Received: from m0098399.ppops.net (m0098399.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 3358Wsh8018569; Wed, 5 Apr 2023 08:45:42 GMT Received: from ppma02fra.de.ibm.com (47.49.7a9f.ip4.static.sl-reverse.com [159.122.73.71]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3ps5jcgcq8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 05 Apr 2023 08:45:42 +0000 Received: from pps.filterd (ppma02fra.de.ibm.com [127.0.0.1]) by ppma02fra.de.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 3353pmWa020082; Wed, 5 Apr 2023 08:45:40 GMT Received: from smtprelay06.fra02v.mail.ibm.com ([9.218.2.230]) by ppma02fra.de.ibm.com (PPS) with ESMTPS id 3ppc86td26-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 05 Apr 2023 08:45:40 +0000 Received: from smtpav05.fra02v.mail.ibm.com (smtpav05.fra02v.mail.ibm.com [10.20.54.104]) by smtprelay06.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 3358jaEN43975352 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 5 Apr 2023 08:45:36 GMT Received: from smtpav05.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id C43E120043; Wed, 5 Apr 2023 08:45:36 +0000 (GMT) Received: from smtpav05.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 5848E20040; Wed, 5 Apr 2023 08:45:36 +0000 (GMT) Received: from t14-nrb.ibmuc.com (unknown [9.171.30.226]) by smtpav05.fra02v.mail.ibm.com (Postfix) with ESMTP; Wed, 5 Apr 2023 08:45:36 +0000 (GMT) From: Nico Boehr To: thuth@redhat.com, pbonzini@redhat.com, andrew.jones@linux.dev Cc: kvm@vger.kernel.org, frankja@linux.ibm.com, imbrenda@linux.ibm.com, Nina Schoetterl-Glausch Subject: [kvm-unit-tests GIT PULL v3 10/14] s390x/spec_ex: Add test of EXECUTE with odd target address Date: Wed, 5 Apr 2023 10:45:24 +0200 Message-Id: <20230405084528.16027-11-nrb@linux.ibm.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230405084528.16027-1-nrb@linux.ibm.com> References: <20230405084528.16027-1-nrb@linux.ibm.com> X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: 6HAdMhT5JQgJUEPDudjYb1E9HLg-sYED X-Proofpoint-GUID: Tx9PC8srxQK-68POKGbpG13akzpaLNgU X-Proofpoint-UnRewURL: 0 URL was un-rewritten MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-04-05_04,2023-04-04_05,2023-02-09_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 spamscore=0 suspectscore=0 adultscore=0 impostorscore=0 bulkscore=0 mlxlogscore=999 phishscore=0 lowpriorityscore=0 mlxscore=0 malwarescore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2303200000 definitions=main-2304050079 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org From: Nina Schoetterl-Glausch The EXECUTE instruction executes the instruction at the given target address. This address must be halfword aligned, otherwise a specification exception occurs. Add a test for this. Reviewed-by: Janosch Frank Reviewed-by: Claudio Imbrenda Signed-off-by: Nina Schoetterl-Glausch Reviewed-by: Nico Boehr Link: https://lore.kernel.org/r/20230404085454.2709061-4-nsg@linux.ibm.com Signed-off-by: Nico Boehr --- s390x/spec_ex.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/s390x/spec_ex.c b/s390x/spec_ex.c index 494d94c..e5f7b12 100644 --- a/s390x/spec_ex.c +++ b/s390x/spec_ex.c @@ -177,6 +177,30 @@ static int short_psw_bit_12_is_0(void) return 0; } +static int odd_ex_target(void) +{ + uint64_t pre_target_addr; + int to = 0, from = 0x0dd; + + asm volatile ( ".pushsection .text.ex_odd\n" + " .balign 2\n" + "pre_odd_ex_target%=:\n" + " . = . + 1\n" + " lr %[to],%[from]\n" + " .popsection\n" + + " larl %[pre_target_addr],pre_odd_ex_target%=\n" + " ex 0,1(%[pre_target_addr])\n" + : [pre_target_addr] "=&a" (pre_target_addr), + [to] "+d" (to) + : [from] "d" (from) + ); + + assert((pre_target_addr + 1) & 1); + report(to != from, "did not perform ex with odd target"); + return 0; +} + static int bad_alignment(void) { uint32_t words[5] __attribute__((aligned(16))); @@ -218,6 +242,7 @@ static const struct spec_ex_trigger spec_ex_triggers[] = { { "psw_bit_12_is_1", &psw_bit_12_is_1, false, &fixup_invalid_psw }, { "short_psw_bit_12_is_0", &short_psw_bit_12_is_0, false, &fixup_invalid_psw }, { "psw_odd_address", &psw_odd_address, false, &fixup_invalid_psw }, + { "odd_ex_target", &odd_ex_target, true, NULL }, { "bad_alignment", &bad_alignment, true, NULL }, { "not_even", ¬_even, true, NULL }, { NULL, NULL, false, NULL }, From patchwork Wed Apr 5 08:45:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nico Boehr X-Patchwork-Id: 13201378 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EAC94C7619A for ; Wed, 5 Apr 2023 08:45:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237618AbjDEIp5 (ORCPT ); Wed, 5 Apr 2023 04:45:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39098 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237586AbjDEIpt (ORCPT ); Wed, 5 Apr 2023 04:45:49 -0400 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 60B7930EB for ; Wed, 5 Apr 2023 01:45:46 -0700 (PDT) Received: from pps.filterd (m0098410.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3358GwbX010324; Wed, 5 Apr 2023 08:45:44 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : mime-version; s=pp1; bh=6vQIEc45YjyGTXCb/xEzWj/VP3kupG9LnmmYxwBfKp0=; b=pFWEf/xzaBqryQaZX30vtUr/YWg0S7DE6SbtzfZ5c3KYxtIIpCxbwNag2ysQGPEhJKG8 P3XNUrwstePAD9bVSPcg8OS9OBH7YoVOEAoqRtQK9U++0sFYu7B4F33FEUtIfeuSUZNu wwGgykaBh9ZmBmnT7eyZPbs4l2u3um/uzW1/as/ul1hnu2keCB+hiCnR+YXbTQjZg38W dLiVoXlVLvO/d6SFcKgLCYEyk3gxGeg5LGb9eY97p13PjxQnVdoQ6gJfnkmn2KUf0rdW 9d1f+zi+07bpscnk7Ircp6teGw3JA7TBrvHnsfezQlJvV/+CL8g2GpnJtzVIXx7WD1Aw 1A== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3ps5be0p69-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 05 Apr 2023 08:45:43 +0000 Received: from m0098410.ppops.net (m0098410.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 3358XBXg009649; Wed, 5 Apr 2023 08:45:43 GMT Received: from ppma05fra.de.ibm.com (6c.4a.5195.ip4.static.sl-reverse.com [149.81.74.108]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3ps5be0p5f-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 05 Apr 2023 08:45:43 +0000 Received: from pps.filterd (ppma05fra.de.ibm.com [127.0.0.1]) by ppma05fra.de.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 3342FJ2w015573; Wed, 5 Apr 2023 08:45:41 GMT Received: from smtprelay01.fra02v.mail.ibm.com ([9.218.2.227]) by ppma05fra.de.ibm.com (PPS) with ESMTPS id 3ppc86td3s-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 05 Apr 2023 08:45:40 +0000 Received: from smtpav05.fra02v.mail.ibm.com (smtpav05.fra02v.mail.ibm.com [10.20.54.104]) by smtprelay01.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 3358jb4O17105592 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 5 Apr 2023 08:45:37 GMT Received: from smtpav05.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 655E020043; Wed, 5 Apr 2023 08:45:37 +0000 (GMT) Received: from smtpav05.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id DA52820040; Wed, 5 Apr 2023 08:45:36 +0000 (GMT) Received: from t14-nrb.ibmuc.com (unknown [9.171.30.226]) by smtpav05.fra02v.mail.ibm.com (Postfix) with ESMTP; Wed, 5 Apr 2023 08:45:36 +0000 (GMT) From: Nico Boehr To: thuth@redhat.com, pbonzini@redhat.com, andrew.jones@linux.dev Cc: kvm@vger.kernel.org, frankja@linux.ibm.com, imbrenda@linux.ibm.com, Nina Schoetterl-Glausch Subject: [kvm-unit-tests GIT PULL v3 11/14] s390x: Add tests for execute-type instructions Date: Wed, 5 Apr 2023 10:45:25 +0200 Message-Id: <20230405084528.16027-12-nrb@linux.ibm.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230405084528.16027-1-nrb@linux.ibm.com> References: <20230405084528.16027-1-nrb@linux.ibm.com> X-TM-AS-GCONF: 00 X-Proofpoint-GUID: _acHhSDnmaZb0kB4FFQd_wVtJGpArkS_ X-Proofpoint-ORIG-GUID: FtZ-EWUEge-CgbaVVFvZ6y8GZGFYtSGC X-Proofpoint-UnRewURL: 0 URL was un-rewritten MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-04-05_04,2023-04-04_05,2023-02-09_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 phishscore=0 mlxlogscore=999 impostorscore=0 lowpriorityscore=0 priorityscore=1501 bulkscore=0 spamscore=0 clxscore=1015 adultscore=0 mlxscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2303200000 definitions=main-2304050079 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org From: Nina Schoetterl-Glausch Test the instruction address used by targets of an execute instruction. When the target instruction calculates a relative address, the result is relative to the target instruction, not the execute instruction. Reviewed-by: Janosch Frank Signed-off-by: Nina Schoetterl-Glausch Reviewed-by: Claudio Imbrenda Link: https://lore.kernel.org/r/20230317112339.774659-1-nsg@linux.ibm.com [ nrb: add ifndef __clang__ guard around if in assembly ] Signed-off-by: Nico Boehr --- s390x/Makefile | 1 + s390x/ex.c | 197 ++++++++++++++++++++++++++++++++++++++++++++ s390x/unittests.cfg | 3 + .gitlab-ci.yml | 1 + 4 files changed, 202 insertions(+) create mode 100644 s390x/ex.c diff --git a/s390x/Makefile b/s390x/Makefile index ab146eb..a80db53 100644 --- a/s390x/Makefile +++ b/s390x/Makefile @@ -39,6 +39,7 @@ tests += $(TEST_DIR)/panic-loop-extint.elf tests += $(TEST_DIR)/panic-loop-pgm.elf tests += $(TEST_DIR)/migration-sck.elf tests += $(TEST_DIR)/exittime.elf +tests += $(TEST_DIR)/ex.elf pv-tests += $(TEST_DIR)/pv-diags.elf diff --git a/s390x/ex.c b/s390x/ex.c new file mode 100644 index 0000000..92b387c --- /dev/null +++ b/s390x/ex.c @@ -0,0 +1,197 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * Copyright IBM Corp. 2023 + * + * Test EXECUTE (RELATIVE LONG). + * These instructions execute a target instruction. The target instruction is formed + * by reading an instruction from memory and optionally modifying some of its bits. + * The execution of the target instruction is the same as if it was executed + * normally as part of the instruction sequence, except for the instruction + * address and the instruction-length code. + */ + +#include + +/* + * Accesses to the operand of execute-type instructions are instruction fetches. + * Minimum alignment is two, since the relative offset is specified by number of halfwords. + */ +asm ( ".pushsection .text.exrl_targets,\"x\"\n" +" .balign 2\n" +" .popsection\n" +); + +/* + * BRANCH AND SAVE, register register variant. + * Saves the next instruction address (address from PSW + length of instruction) + * to the first register. No branch is taken in this test, because 0 is + * specified as target. + * BASR does *not* perform a relative address calculation with an intermediate. + */ +static void test_basr(void) +{ + uint64_t ret_addr, after_ex; + + report_prefix_push("BASR"); + asm volatile ( ".pushsection .text.exrl_targets\n" + "0: basr %[ret_addr],0\n" + " .popsection\n" + + " larl %[after_ex],1f\n" + " exrl 0,0b\n" + "1:\n" + : [ret_addr] "=d" (ret_addr), + [after_ex] "=d" (after_ex) + ); + + report(ret_addr == after_ex, "return address after EX"); + report_prefix_pop(); +} + +/* + * BRANCH RELATIVE AND SAVE. + * According to PoP (Branch-Address Generation), the address calculated relative + * to the instruction address is relative to BRAS when it is the target of an + * execute-type instruction, not relative to the execute-type instruction. + */ +static void test_bras(void) +{ + uint64_t after_target, ret_addr, after_ex, branch_addr; + + report_prefix_push("BRAS"); + asm volatile ( ".pushsection .text.exrl_targets\n" + "0: bras %[ret_addr],1f\n" + " nopr %%r7\n" + "1: larl %[branch_addr],0\n" + " j 4f\n" + " .popsection\n" + + " larl %[after_target],1b\n" + " larl %[after_ex],3f\n" + "2: exrl 0,0b\n" +/* + * In case the address calculation is correct, we jump by the relative offset 1b-0b from 0b to 1b. + * In case the address calculation is relative to the exrl (i.e. a test failure), + * put a valid instruction at the same relative offset from the exrl, so the test continues in a + * controlled manner. + */ + "3: larl %[branch_addr],0\n" + "4:\n" + +/* + * Clang 15 doesn't like the if below, guard it s.t. we still have the assertion + * when compiling with GCC. + * + * s390x/ex.c:81:4: error: expected absolute expression + * " .if (1b - 0b) != (3b - 2b)\n" + */ +#ifndef __clang__ + " .if (1b - 0b) != (3b - 2b)\n" + " .error \"right and wrong target must have same offset\"\n" + " .endif\n" +#endif + : [after_target] "=d" (after_target), + [ret_addr] "=d" (ret_addr), + [after_ex] "=d" (after_ex), + [branch_addr] "=d" (branch_addr) + ); + + report(after_target == branch_addr, "address calculated relative to BRAS"); + report(ret_addr == after_ex, "return address after EX"); + report_prefix_pop(); +} + +/* + * LOAD ADDRESS RELATIVE LONG. + * If it is the target of an execute-type instruction, the address is relative + * to the LARL. + */ +static void test_larl(void) +{ + uint64_t target, addr; + + report_prefix_push("LARL"); + asm volatile ( ".pushsection .text.exrl_targets\n" + "0: larl %[addr],0\n" + " .popsection\n" + + " larl %[target],0b\n" + " exrl 0,0b\n" + : [target] "=d" (target), + [addr] "=d" (addr) + ); + + report(target == addr, "address calculated relative to LARL"); + report_prefix_pop(); +} + +/* LOAD LOGICAL RELATIVE LONG. + * If it is the target of an execute-type instruction, the address is relative + * to the LLGFRL. + */ +static void test_llgfrl(void) +{ + uint64_t target, value; + + report_prefix_push("LLGFRL"); + asm volatile ( ".pushsection .text.exrl_targets\n" + " .balign 4\n" + //operand of llgfrl must be word aligned + "0: llgfrl %[value],0\n" + " .popsection\n" + + " llgfrl %[target],0b\n" + //align (pad with nop), in case the wrong operand is used + " .balignw 4,0x0707\n" + " exrl 0,0b\n" + : [target] "=d" (target), + [value] "=d" (value) + ); + + report(target == value, "loaded correct value"); + report_prefix_pop(); +} + +/* + * COMPARE RELATIVE LONG + * If it is the target of an execute-type instruction, the address is relative + * to the CRL. + */ +static void test_crl(void) +{ + uint32_t program_mask, cc, crl_word; + + report_prefix_push("CRL"); + asm volatile ( ".pushsection .text.exrl_targets\n" + //operand of crl must be word aligned + " .balign 4\n" + "0: crl %[crl_word],0\n" + " .popsection\n" + + " lrl %[crl_word],0b\n" + //align (pad with nop), in case the wrong operand is used + " .balignw 4,0x0707\n" + " exrl 0,0b\n" + " ipm %[program_mask]\n" + : [program_mask] "=d" (program_mask), + [crl_word] "=d" (crl_word) + :: "cc" + ); + + cc = program_mask >> 28; + report(!cc, "operand compared to is relative to CRL"); + report_prefix_pop(); +} + +int main(int argc, char **argv) +{ + report_prefix_push("ex"); + test_basr(); + test_bras(); + test_larl(); + test_llgfrl(); + test_crl(); + report_prefix_pop(); + + return report_summary(); +} diff --git a/s390x/unittests.cfg b/s390x/unittests.cfg index d97eb5e..b61faf0 100644 --- a/s390x/unittests.cfg +++ b/s390x/unittests.cfg @@ -215,3 +215,6 @@ file = migration-skey.elf smp = 2 groups = migration extra_params = -append '--parallel' + +[execute] +file = ex.elf diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index ad7949c..a999f64 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -275,6 +275,7 @@ s390x-kvm: - ACCEL=kvm ./run_tests.sh selftest-setup intercept emulator sieve sthyi diag10 diag308 pfmf cmm vector gs iep cpumodel diag288 stsi sclp-1g sclp-3g css skrf sie + execute | tee results.txt - grep -q PASS results.txt && ! grep -q FAIL results.txt only: From patchwork Wed Apr 5 08:45:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nico Boehr X-Patchwork-Id: 13201381 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BAE7FC77B62 for ; Wed, 5 Apr 2023 08:46:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237634AbjDEIqB (ORCPT ); Wed, 5 Apr 2023 04:46:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39098 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237577AbjDEIpu (ORCPT ); Wed, 5 Apr 2023 04:45:50 -0400 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B96CC273F for ; Wed, 5 Apr 2023 01:45:47 -0700 (PDT) Received: from pps.filterd (m0127361.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3358DNRq024828; Wed, 5 Apr 2023 08:45:45 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : mime-version; s=pp1; bh=cE6HLqwLSiWBQJdBjSZwLHdImuDnpP1zSM+T7zCcHIs=; b=leeWJhvBYRYpU5YKS7wGJIl2gOUalxLaUINs7l6kB+bXh6WX3HMGm52MgEmfx2HUqy+g 3EOadzoVc0gFrsXJ52bxqdkTqit1LTjWDc2+CVdWsQyUXzn6llqd+MikYM6/aN+oDExx M8YW7uvAUv2Ua9SCq2jtLPdFZwDqk+J+9cGZkmaVBDGfZHbbJYfdKH6DmnFlJHRavWBG b/OR8kAiieDV7huV3IgFjMw6QkQmjQhfo1Cc/MB2GmW8Ql9urgQqiD1aXfhZZKgs5n9a HDxh+4K7rVhALIG9oQ/eZY3tjmysGGZIFB1JO63axPG7wgCycP7I97JOLrrziVEXNIRb yA== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3ps59n0ngx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 05 Apr 2023 08:45:45 +0000 Received: from m0127361.ppops.net (m0127361.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 3358P4C1027964; Wed, 5 Apr 2023 08:45:45 GMT Received: from ppma02fra.de.ibm.com (47.49.7a9f.ip4.static.sl-reverse.com [159.122.73.71]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3ps59n0ng9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 05 Apr 2023 08:45:44 +0000 Received: from pps.filterd (ppma02fra.de.ibm.com [127.0.0.1]) by ppma02fra.de.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 3355SF5D004244; Wed, 5 Apr 2023 08:45:43 GMT Received: from smtprelay03.fra02v.mail.ibm.com ([9.218.2.224]) by ppma02fra.de.ibm.com (PPS) with ESMTPS id 3ppc86td27-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 05 Apr 2023 08:45:41 +0000 Received: from smtpav05.fra02v.mail.ibm.com (smtpav05.fra02v.mail.ibm.com [10.20.54.104]) by smtprelay03.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 3358jckl14549648 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 5 Apr 2023 08:45:38 GMT Received: from smtpav05.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E531F20043; Wed, 5 Apr 2023 08:45:37 +0000 (GMT) Received: from smtpav05.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 7ADBB20040; Wed, 5 Apr 2023 08:45:37 +0000 (GMT) Received: from t14-nrb.ibmuc.com (unknown [9.171.30.226]) by smtpav05.fra02v.mail.ibm.com (Postfix) with ESMTP; Wed, 5 Apr 2023 08:45:37 +0000 (GMT) From: Nico Boehr To: thuth@redhat.com, pbonzini@redhat.com, andrew.jones@linux.dev Cc: kvm@vger.kernel.org, frankja@linux.ibm.com, imbrenda@linux.ibm.com, Nina Schoetterl-Glausch Subject: [kvm-unit-tests GIT PULL v3 12/14] s390x: spec_ex: Add test for misaligned load Date: Wed, 5 Apr 2023 10:45:26 +0200 Message-Id: <20230405084528.16027-13-nrb@linux.ibm.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230405084528.16027-1-nrb@linux.ibm.com> References: <20230405084528.16027-1-nrb@linux.ibm.com> X-TM-AS-GCONF: 00 X-Proofpoint-GUID: EuYOXX-X-AGm4dZhejCll2CMX-ewdgG9 X-Proofpoint-ORIG-GUID: lIB58o6udBZMTwzP8NUQYOdL6oZwSzah X-Proofpoint-UnRewURL: 0 URL was un-rewritten MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-04-05_04,2023-04-04_05,2023-02-09_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 mlxlogscore=999 spamscore=0 mlxscore=0 priorityscore=1501 phishscore=0 malwarescore=0 clxscore=1015 bulkscore=0 impostorscore=0 suspectscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2303200000 definitions=main-2304050079 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org From: Nina Schoetterl-Glausch The operand of LOAD RELATIVE LONG must be word aligned, otherwise a specification exception occurs. Test that this exception occurs. Signed-off-by: Nina Schoetterl-Glausch Reviewed-by: Nico Boehr Reviewed-by: Claudio Imbrenda Link: https://lore.kernel.org/r/20230301132638.3336040-1-nsg@linux.ibm.com Signed-off-by: Nico Boehr --- s390x/spec_ex.c | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/s390x/spec_ex.c b/s390x/spec_ex.c index e5f7b12..e3dd85d 100644 --- a/s390x/spec_ex.c +++ b/s390x/spec_ex.c @@ -201,7 +201,7 @@ static int odd_ex_target(void) return 0; } -static int bad_alignment(void) +static int bad_alignment_lqp(void) { uint32_t words[5] __attribute__((aligned(16))); uint32_t (*bad_aligned)[4] = (uint32_t (*)[4])&words[1]; @@ -214,6 +214,22 @@ static int bad_alignment(void) return 0; } +static int bad_alignment_lrl(void) +{ + uint64_t r; + + asm volatile ( ".pushsection .rodata\n" + " .balign 4\n" + " . = . + 2\n" + "0: .fill 4\n" + " .popsection\n" + + " lrl %0,0b\n" + : "=d" (r) + ); + return 0; +} + static int not_even(void) { uint64_t quad[2] __attribute__((aligned(16))) = {0}; @@ -243,7 +259,8 @@ static const struct spec_ex_trigger spec_ex_triggers[] = { { "short_psw_bit_12_is_0", &short_psw_bit_12_is_0, false, &fixup_invalid_psw }, { "psw_odd_address", &psw_odd_address, false, &fixup_invalid_psw }, { "odd_ex_target", &odd_ex_target, true, NULL }, - { "bad_alignment", &bad_alignment, true, NULL }, + { "bad_alignment_lqp", &bad_alignment_lqp, true, NULL }, + { "bad_alignment_lrl", &bad_alignment_lrl, true, NULL }, { "not_even", ¬_even, true, NULL }, { NULL, NULL, false, NULL }, }; From patchwork Wed Apr 5 08:45:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Nico Boehr X-Patchwork-Id: 13201379 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 63212C76188 for ; Wed, 5 Apr 2023 08:46:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237623AbjDEIp7 (ORCPT ); Wed, 5 Apr 2023 04:45:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39120 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237589AbjDEIpt (ORCPT ); Wed, 5 Apr 2023 04:45:49 -0400 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6D89C4ECF for ; Wed, 5 Apr 2023 01:45:47 -0700 (PDT) Received: from pps.filterd (m0187473.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 33566II4035752; Wed, 5 Apr 2023 08:45:45 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-type : content-transfer-encoding : mime-version; s=pp1; bh=TQj/CLq8Xfqlz6SrmQQ3j+00+jgb2sU6nBcLaWgSyKE=; b=tFSklnedPUckeBK1pYTYIAK5A8m3qhdMuFsMW5KcC6YO4OSCVeZzt0zJG54tLum6hnsF UM8sTSpqDwCe8Tj1xH54HxKyxzbIETNGpZxx3YNcHXwqe+KiTZ5E9FS5c5KYgjw9T5UM iJmgMisaI/mAxQdaFOeKrIJ+AC6V98ceFer+yio0BsaoaM8/KX+jodutIkDxI5RiQTZY NA8DxpqoCWsZN0bfRRtviVXDbRw+VOQNVrr0suu5MVY7kJS46UPpszHPn+Pnx8hCnQam T3Znp0LxhFb3fpqruB8KenjErHjkcemx9tvggpJxYU6DmN20vrZaUgCTL4h+5aT2vgOB Kw== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3ps2p1vs4q-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 05 Apr 2023 08:45:44 +0000 Received: from m0187473.ppops.net (m0187473.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 3358gpJ8033155; Wed, 5 Apr 2023 08:45:44 GMT Received: from ppma03ams.nl.ibm.com (62.31.33a9.ip4.static.sl-reverse.com [169.51.49.98]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3ps2p1vs44-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 05 Apr 2023 08:45:44 +0000 Received: from pps.filterd (ppma03ams.nl.ibm.com [127.0.0.1]) by ppma03ams.nl.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 3352CtBV023017; Wed, 5 Apr 2023 08:45:42 GMT Received: from smtprelay03.fra02v.mail.ibm.com ([9.218.2.224]) by ppma03ams.nl.ibm.com (PPS) with ESMTPS id 3ppc8735nd-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 05 Apr 2023 08:45:41 +0000 Received: from smtpav05.fra02v.mail.ibm.com (smtpav05.fra02v.mail.ibm.com [10.20.54.104]) by smtprelay03.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 3358jcAF43254088 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 5 Apr 2023 08:45:38 GMT Received: from smtpav05.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 7050320043; Wed, 5 Apr 2023 08:45:38 +0000 (GMT) Received: from smtpav05.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 0564620040; Wed, 5 Apr 2023 08:45:38 +0000 (GMT) Received: from t14-nrb.ibmuc.com (unknown [9.171.30.226]) by smtpav05.fra02v.mail.ibm.com (Postfix) with ESMTP; Wed, 5 Apr 2023 08:45:37 +0000 (GMT) From: Nico Boehr To: thuth@redhat.com, pbonzini@redhat.com, andrew.jones@linux.dev Cc: kvm@vger.kernel.org, frankja@linux.ibm.com, imbrenda@linux.ibm.com Subject: [kvm-unit-tests GIT PULL v3 13/14] MAINTAINERS: Add Nico as s390x Maintainer and make Thomas reviewer Date: Wed, 5 Apr 2023 10:45:27 +0200 Message-Id: <20230405084528.16027-14-nrb@linux.ibm.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230405084528.16027-1-nrb@linux.ibm.com> References: <20230405084528.16027-1-nrb@linux.ibm.com> X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: J4vYaNg40QK8Bm7LXfkobQfsjgPIGUmU X-Proofpoint-GUID: ERwlHeXLyUSoHoeOUgF3VjBBo7G3oL3O X-Proofpoint-UnRewURL: 0 URL was un-rewritten MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-04-05_04,2023-04-04_05,2023-02-09_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 malwarescore=0 adultscore=0 impostorscore=0 bulkscore=0 priorityscore=1501 mlxlogscore=999 suspectscore=0 phishscore=0 spamscore=0 lowpriorityscore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2303200000 definitions=main-2304050079 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org From: Janosch Frank The circle of life continues as we bring in Nico as a s390x maintainer. Thomas moves from the maintainer position to reviewer but he's a general maintainer of the project anyway. Signed-off-by: Janosch Frank Acked-by: Thomas Huth Reviewed-by: Claudio Imbrenda Acked-by: Nico Boehr Link: https://lore.kernel.org/r/20230322113400.1123378-1-frankja@linux.ibm.com Signed-off-by: Nico Boehr --- MAINTAINERS | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/MAINTAINERS b/MAINTAINERS index 649de50..bd1761d 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -85,11 +85,12 @@ F: lib/powerpc/ F: lib/ppc64/ S390X -M: Thomas Huth M: Janosch Frank M: Claudio Imbrenda +M: Nico Böhr S: Supported R: David Hildenbrand +R: Thomas Huth L: kvm@vger.kernel.org L: linux-s390@vger.kernel.org F: s390x/ From patchwork Wed Apr 5 08:45:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nico Boehr X-Patchwork-Id: 13201380 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7519CC761AF for ; Wed, 5 Apr 2023 08:46:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237608AbjDEIqA (ORCPT ); Wed, 5 Apr 2023 04:46:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39118 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237590AbjDEIpt (ORCPT ); Wed, 5 Apr 2023 04:45:49 -0400 Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 365E24693 for ; Wed, 5 Apr 2023 01:45:47 -0700 (PDT) Received: from pps.filterd (m0098416.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3358QYtk015622; Wed, 5 Apr 2023 08:45:45 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : mime-version; s=pp1; bh=3AMcCdIrjohLjHCBBSvqMu35AOG2/1a/6RSDFdhoE2s=; b=ZLzVOpQTzCSOla4AD0iSKMQly0YWkaSwnTp9yBpp199ECMYUnr1NeBkqsVvqyOdUAJ3w ThzNjzFO8+w5LSuYdWNz+V4vCrKXd12WS5g1Qc9vBTVes1TspTwPKcRBPOlXuH6zUK4k 10H0lYsfWJPESpqE/ipFlvrdA+FTnRrOg3EPY9P9l0w3QoGvgpixqIJ4rhnvvMvTYVby hkFyeeulSzkczZ0nU35sB/pJvVRfF7GPO1P1qGtgOqbETI0ZlP+V7BE7fkypIZLvKb0h mNZYvePSpZ8G/zpd9WDrxyfJnBZ37uvzn9e/z9cbAEJLddSrqnNvvx8fUp+j8OoRsPOk IA== Received: from pps.reinject (localhost [127.0.0.1]) by mx0b-001b2d01.pphosted.com (PPS) with ESMTPS id 3ps5fwrdd2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 05 Apr 2023 08:45:44 +0000 Received: from m0098416.ppops.net (m0098416.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 3358Rh64018284; Wed, 5 Apr 2023 08:45:44 GMT Received: from ppma03fra.de.ibm.com (6b.4a.5195.ip4.static.sl-reverse.com [149.81.74.107]) by mx0b-001b2d01.pphosted.com (PPS) with ESMTPS id 3ps5fwrdch-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 05 Apr 2023 08:45:44 +0000 Received: from pps.filterd (ppma03fra.de.ibm.com [127.0.0.1]) by ppma03fra.de.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 3345JbQm003662; Wed, 5 Apr 2023 08:45:42 GMT Received: from smtprelay04.fra02v.mail.ibm.com ([9.218.2.228]) by ppma03fra.de.ibm.com (PPS) with ESMTPS id 3ppc872cst-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 05 Apr 2023 08:45:42 +0000 Received: from smtpav05.fra02v.mail.ibm.com (smtpav05.fra02v.mail.ibm.com [10.20.54.104]) by smtprelay04.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 3358jdBV31064516 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 5 Apr 2023 08:45:39 GMT Received: from smtpav05.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E866120043; Wed, 5 Apr 2023 08:45:38 +0000 (GMT) Received: from smtpav05.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 86D4720040; Wed, 5 Apr 2023 08:45:38 +0000 (GMT) Received: from t14-nrb.ibmuc.com (unknown [9.171.30.226]) by smtpav05.fra02v.mail.ibm.com (Postfix) with ESMTP; Wed, 5 Apr 2023 08:45:38 +0000 (GMT) From: Nico Boehr To: thuth@redhat.com, pbonzini@redhat.com, andrew.jones@linux.dev Cc: kvm@vger.kernel.org, frankja@linux.ibm.com, imbrenda@linux.ibm.com Subject: [kvm-unit-tests GIT PULL v3 14/14] s390x: sie: Test whether the epoch extension field is working as expected Date: Wed, 5 Apr 2023 10:45:28 +0200 Message-Id: <20230405084528.16027-15-nrb@linux.ibm.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230405084528.16027-1-nrb@linux.ibm.com> References: <20230405084528.16027-1-nrb@linux.ibm.com> X-TM-AS-GCONF: 00 X-Proofpoint-GUID: iL6mW8gkBuysM2guR_yXi3NngtnljC2r X-Proofpoint-ORIG-GUID: e1o1fUU_FxnYMkrucfymtGwpyO04X4DT X-Proofpoint-UnRewURL: 0 URL was un-rewritten MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-04-05_04,2023-04-04_05,2023-02-09_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 phishscore=0 spamscore=0 lowpriorityscore=0 mlxscore=0 suspectscore=0 adultscore=0 impostorscore=0 clxscore=1015 priorityscore=1501 mlxlogscore=999 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2303200000 definitions=main-2304050079 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org From: Thomas Huth We recently discovered a bug with the time management in nested scenarios which got fixed by kernel commit "KVM: s390: vsie: Fix the initialization of the epoch extension (epdx) field". This adds a simple test for this bug so that it is easier to determine whether the host kernel of a machine has already been fixed or not. Signed-off-by: Thomas Huth Reviewed-by: Claudio Imbrenda Link: https://lore.kernel.org/r/20221208170502.17984-1-thuth@redhat.com Signed-off-by: Nico Boehr --- s390x/sie.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/s390x/sie.c b/s390x/sie.c index 87575b2..cd3cea1 100644 --- a/s390x/sie.c +++ b/s390x/sie.c @@ -58,6 +58,33 @@ static void test_diags(void) } } +static void test_epoch_ext(void) +{ + u32 instr[] = { + 0xb2780000, /* STCKE 0 */ + 0x83000044 /* DIAG 0x44 to intercept */ + }; + + if (!test_facility(139)) { + report_skip("epdx: Multiple Epoch Facility is not available"); + return; + } + + guest[0] = 0x00; + memcpy(guest_instr, instr, sizeof(instr)); + + vm.sblk->gpsw.addr = PAGE_SIZE * 2; + vm.sblk->gpsw.mask = PSW_MASK_64; + + vm.sblk->ecd |= ECD_MEF; + vm.sblk->epdx = 0x47; /* Setting the epoch extension here ... */ + + sie(&vm); + + /* ... should result in the same epoch extension here: */ + report(guest[0] == 0x47, "epdx: different epoch is visible in the guest"); +} + static void setup_guest(void) { setup_vm(); @@ -80,6 +107,7 @@ int main(void) setup_guest(); test_diags(); + test_epoch_ext(); sie_guest_destroy(&vm); done: