From patchwork Wed Mar 15 15:54:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nina Schoetterl-Glausch X-Patchwork-Id: 13176274 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 AB9DCC76195 for ; Wed, 15 Mar 2023 15:57:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232433AbjCOP4q (ORCPT ); Wed, 15 Mar 2023 11:56:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52252 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232607AbjCOP43 (ORCPT ); Wed, 15 Mar 2023 11:56:29 -0400 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E353B7BA2A; Wed, 15 Mar 2023 08:55:45 -0700 (PDT) Received: from pps.filterd (m0098404.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 32FELPT8014830; Wed, 15 Mar 2023 15:54:54 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=pp1; bh=4EOlfCmNGvIxiL0ryJUgTnF6FtNfHtl9rkTbZX3ocrk=; b=i9bf3inrEekYx1ZFC8hREtUe6IQMeYDC3V7JVw3dmLMjbYKPkc+zZm/rQzvZmXMxvtab gU2bcpqM1T8b/o+J9UJvlHv4Y5Bs9sU0lelTqfQ3zTvZKNN8WcAw0U2tFHA+J6BwIjmC fD/BhBPbqIdq2hrEvc4cOh+zDugLN66LEEuuvyXI8i40G+o+Ibk+ndRlNWSqhvETQZEs qqQDePNu4pEP4Rv+qItykgAsGlcoiPMwO7jIxrBrlnMm3X3JjK7qsGWEflr7qbe/fucb 4EneDaDmxDfbTfqyxoyN+OVi0csqYmAbLbj6iSTzXo+prmY7rJnzxj0K/zm+FbuozCp/ eg== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3pbfq8tuhr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 15 Mar 2023 15:54:54 +0000 Received: from m0098404.ppops.net (m0098404.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 32FELaUT015292; Wed, 15 Mar 2023 15:54:53 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 3pbfq8tugp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 15 Mar 2023 15:54:53 +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 32F3UQsG008910; Wed, 15 Mar 2023 15:54:51 GMT Received: from smtprelay02.fra02v.mail.ibm.com ([9.218.2.226]) by ppma04fra.de.ibm.com (PPS) with ESMTPS id 3pb29t0ths-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 15 Mar 2023 15:54:51 +0000 Received: from smtpav06.fra02v.mail.ibm.com (smtpav06.fra02v.mail.ibm.com [10.20.54.105]) by smtprelay02.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 32FFsljJ27525844 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 15 Mar 2023 15:54:47 GMT Received: from smtpav06.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id C61B320049; Wed, 15 Mar 2023 15:54:47 +0000 (GMT) Received: from smtpav06.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 905A020040; Wed, 15 Mar 2023 15:54:47 +0000 (GMT) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.152.85.9]) by smtpav06.fra02v.mail.ibm.com (Postfix) with ESMTP; Wed, 15 Mar 2023 15:54:47 +0000 (GMT) From: Nina Schoetterl-Glausch To: Thomas Huth , Janosch Frank , Claudio Imbrenda Cc: Nina Schoetterl-Glausch , David Hildenbrand , kvm@vger.kernel.org, linux-s390@vger.kernel.org Subject: [kvm-unit-tests PATCH v3 3/3] s390x/spec_ex: Add test of EXECUTE with odd target address Date: Wed, 15 Mar 2023 16:54:44 +0100 Message-Id: <20230315155445.1688249-4-nsg@linux.ibm.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20230315155445.1688249-1-nsg@linux.ibm.com> References: <20230315155445.1688249-1-nsg@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: nVjc1-KDtWl0zH0ZudaGJeZp37RMxnC9 X-Proofpoint-GUID: CBJYvU-QXxwqLYo8FkICS8bcZuvDADYP 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-03-15_08,2023-03-15_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 spamscore=0 adultscore=0 clxscore=1015 impostorscore=0 suspectscore=0 mlxlogscore=999 mlxscore=0 bulkscore=0 lowpriorityscore=0 priorityscore=1501 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2302240000 definitions=main-2303150131 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org 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. Signed-off-by: Nina Schoetterl-Glausch Reviewed-by: Janosch Frank Acked-by: Thomas Huth --- s390x/spec_ex.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/s390x/spec_ex.c b/s390x/spec_ex.c index 83b8c58e..5fa05dba 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 },