From patchwork Mon Aug 14 17:15:09 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Volodymyr Babchuk X-Patchwork-Id: 9899833 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 7F6D9602CA for ; Mon, 14 Aug 2017 17:18:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6953528678 for ; Mon, 14 Aug 2017 17:18:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5DFC12867C; Mon, 14 Aug 2017 17:18:29 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED, RCVD_IN_DNSWL_MED, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 09BDD28678 for ; Mon, 14 Aug 2017 17:18:29 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dhIyR-0004Q2-28; Mon, 14 Aug 2017 17:16:19 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dhIyQ-0004Pf-9E for xen-devel@lists.xen.org; Mon, 14 Aug 2017 17:16:18 +0000 Received: from [85.158.137.68] by server-14.bemta-3.messagelabs.com id 45/61-01862-1EAD1995; Mon, 14 Aug 2017 17:16:17 +0000 X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-8.tower-31.messagelabs.com!1502730975!110049432!1 X-Originating-IP: [104.47.0.57] X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG X-StarScan-Received: X-StarScan-Version: 9.4.45; banners=-,-,- X-VirusChecked: Checked Received: (qmail 62212 invoked from network); 14 Aug 2017 17:16:16 -0000 Received: from mail-he1eur01on0057.outbound.protection.outlook.com (HELO EUR01-HE1-obe.outbound.protection.outlook.com) (104.47.0.57) by server-8.tower-31.messagelabs.com with AES256-SHA256 encrypted SMTP; 14 Aug 2017 17:16:16 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=EPAM.onmicrosoft.com; s=selector1-epam-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=JeSu3Ctu8+hFq1oKCtIP0aUBySym93JX/QqYnUgswRo=; b=DOHG1uJxXxUMkv2bEeMfGccQ3smcPi3hWAZJWiPlt5rCm6h9e2oxF0hd5+1VxT3xL6XLxv6zMNRiacpnfW1m4w0MWf0sUfhP6CSKp9bAt/IIQZBAnyDynHWsxbJWPQe/qT+7UG2MXzwgkqJlHFkhYJWDny0TrdqA5Xi2+dgngI4= Received: from EPUAKYIW2556.kyiv.epam.com (85.223.209.52) by HE1PR0301MB2139.eurprd03.prod.outlook.com (2603:10a6:3:21::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1341.17; Mon, 14 Aug 2017 17:16:11 +0000 Received: by EPUAKYIW2556.kyiv.epam.com (sSMTP sendmail emulation); Mon, 14 Aug 2017 20:15:57 +0300 From: Volodymyr Babchuk To: xen-devel@lists.xen.org Date: Mon, 14 Aug 2017 20:15:09 +0300 Message-Id: <1502730909-28413-4-git-send-email-volodymyr_babchuk@epam.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1502730909-28413-1-git-send-email-volodymyr_babchuk@epam.com> References: <1502730909-28413-1-git-send-email-volodymyr_babchuk@epam.com> MIME-Version: 1.0 X-Originating-IP: [85.223.209.52] X-ClientProxiedBy: CO2PR18CA0063.namprd18.prod.outlook.com (2603:10b6:104:2::31) To HE1PR0301MB2139.eurprd03.prod.outlook.com (2603:10a6:3:21::16) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 06a91823-d673-4890-1c1a-08d4e3382a82 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(300000502095)(300135100095)(22001)(2017030254152)(300000503095)(300135400095)(201703131423075)(201703031133081)(201702281549075)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095); SRVR:HE1PR0301MB2139; X-Microsoft-Exchange-Diagnostics: 1; HE1PR0301MB2139; 3:BQZkvJr+I+5vnutl2poJcy5DT15EXeABSRZ7fFeheGo0uNmybrldXB8dVXRdcwYvq9rMN1yMh6ib0oQpw26ZE/dZnao4hFV86pILraQBYPpxfgUyQS/7fsadvDMLUSmcjid1DNZf14OklKbZ/XMOPb6WzRQ6fSKC74Fc5MyAlhMKrRzVHeqUp1kTfPZNY77bqDLYOcbrXT6cX616Y+MoIjCYbchO5rFqI8i+QIBl70Zskq8QinYv7f1CyNV33tyQ; 25:eE2fqyJ2N3qqtfoZYpvptfwRZV2+t3qnmAnDFgb+sSJ8/DcNq8O1ZEXSlogvqsZrHzoNJMKDYYrh04IuSuzvXhOCTKGtS0uD69NRZcYPWCbzI3PVazv3Tdxpnfatxnx/+qmLz5rAFprWvko7YQ8cbyNkgStG9t7kFQspEM2/ZFY3hGMt73AWdRL1MYV6TUD1nfgQSD5vjz6jsSgG+faPUo0KIvLKjTWXC1OkjqQ/jhtYxcEwddww5eseNNcLilyaFbu6ZXpVOvxkgc1uXy7teDJxP9YgRw37ktad4Z/G1Su3Nu7B4PtL1Q3nD96dxjRyQ53KxopMIMYEqRU1fx5mDg==; 31:7lzuS/BqdV1fGN64EWeoaZ01dWeJGjjI91Ae+R/4WX/uW8oy5/b5chj0sJp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-Exchange-Antispam-Report-Test: UriScan:(4114951738403); X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(601004)(2401047)(8121501046)(5005006)(10201501046)(3002001)(100000703101)(100105400095)(93006095)(93001095)(6041248)(20161123562025)(20161123558100)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123564025)(20161123555025)(20161123560025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:HE1PR0301MB2139; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:HE1PR0301MB2139; X-Forefront-PRVS: 039975700A X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(7370300001)(6009001)(199003)(189002)(50986999)(76176999)(2906002)(97736004)(72206003)(5660300001)(6916009)(106356001)(42186005)(105586002)(2361001)(33646002)(110136004)(107886003)(122856001)(81166006)(81156014)(8676002)(6666003)(101416001)(68736007)(5003940100001)(2351001)(50226002)(478600001)(2950100002)(86362001)(47776003)(54906002)(66066001)(7736002)(50466002)(36756003)(305945005)(53936002)(48376002)(7350300001)(4326008)(3846002)(189998001)(80792005)(6116002); DIR:OUT; SFP:1101; SCL:1; SRVR:HE1PR0301MB2139; H:EPUAKYIW2556.kyiv.epam.com; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; Received-SPF: None (protection.outlook.com: epam.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; HE1PR0301MB2139; 23:b8Zy8M4H7ShhrMGyeOIK28YMLkCLGGGW/ZprEa+?= =?us-ascii?Q?zU3DPZdpxVuSLWgPPMwx7HSFQcy11AZ/X41HipEVP4DIOOGS15NsKayxUM36?= =?us-ascii?Q?EKLgVj5SALwBk7MOtrud8n/KBQ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ZphG?= =?us-ascii?Q?wq97LfsiOqPFucgs8EZYmvNiRHGkLwMQVKc5exqh4V4Hz7pgHh5j3rUiS044?= =?us-ascii?Q?32msLiOke4Vu9FP/lAJ3qfPG2A31vCIJlCoulbKEhVUDgrm4Yx6gTGtxsnmP?= =?us-ascii?Q?mjniRkCzTcOwEyKNvemkrDNUSyS47pauz?= X-Microsoft-Exchange-Diagnostics: 1; HE1PR0301MB2139; 6:P42ZMJUVEqo611wT3xLF/rrAxFcgi1Vk/SRzQK+x8R+jz0lg1LAttcv5khu084YdSNin6klMCn8iqANVn7SBBN60bZ1BKvcxa0D3nxLtOEa0UKEfrdZePS0tKynwb/AcY85gj/Vmbzx12uiO8leLZx/IQadx0Dtzck5rmdG5CLJH+LGVsaAWSyO/sXOzU4CaX5RhLrLvqHeNZMUrxlbD6FgiPghHCq37OD5KQkTOFzVC/tpajeYDSW/YMC3PszPtqTQ5qb4laDZWByNiyEu02jVqPWkJv8Ytkg6Acv0bjXz1eIInRBI1ljVfhYhOJAajFhls1Sg4ZgcK88JII+/Oyg==; 5:Pm39sMen2i10aceAjvqDEORDONcEL9VS5on5ChtM9dwHHMX4HQ+CSQb1OwX3nlWF61j7gbfGmTKbveZPk1zElw5kKArGYuM1l6q1ZLYPn2nC7XnsEvAuWoICZttFjTtSgcoERcaPwEHevoL10d/dSw==; 24:RhIwedVlSlnEcWHPsqJorcwFwlyIo9r9pijyGRtA5d/vfd/T7/j43n+DVvQ2daFGUf9cs33APqrANhetKRwtCeHf+dDrcw9C276NbC2324w=; 7:7xB01eruC7MfjceRH3Dd0ylQggjvBthoQAv2qKkGVr/xJFdWa4bX1H0XFZsoq6rcPKJW+pbe72hFXOWcuI1ARsfmY8NMJ6t6I9h5kiBPbaxNO+i/c904WylseDMNwY69deLkSl098utRDXyHG0SxDaOKdVa/t/LUZD3wiHpkkl4IgPtVZTAbgLFQvCyvDH4OTdt5q+hYbTJUHMiRibRCF20uP/NDh/BqnoFY7jj+8Sw= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: epam.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Aug 2017 17:16:11.3019 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR0301MB2139 Cc: Julien Grall , Stefano Stabellini , Volodymyr Babchuk Subject: [Xen-devel] [PATCH v3 3/3] arm: traps: handle SMC32 in check_conditional_instr() X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP On ARMv8 architecture we need to ensure that conditional check was passed for a trapped SMC instruction that originates from AArch32 state (ARM DDI 0487B.a page D7-2271). Thus, we should not skip it while checking HSR.EC value. For this type of exception special coding of HSR.ISS is used. There is additional flag (CCKNOWNPASS) to be checked before performing standard handling of CCVALID and COND fields. Signed-off-by: Volodymyr Babchuk --- xen/arch/arm/traps.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/xen/arch/arm/traps.c b/xen/arch/arm/traps.c index eae2212..39791fc 100644 --- a/xen/arch/arm/traps.c +++ b/xen/arch/arm/traps.c @@ -1716,8 +1716,24 @@ static int check_conditional_instr(struct cpu_user_regs *regs, unsigned long cpsr, cpsr_cond; int cond; + /* + * SMC32 instruction case is special. Under SMC32 we mean SMC + * instruction on ARMv7 or SMC instruction originating from + * AArch32 state on ARMv8. + * On ARMv7 it will be trapped only if it passed condition check + * (ARM DDI 0406C.c page B3-1431), but we need to check conditon + * flags on ARMv8 (ARM DDI 0487B.a page D7-2271). + * Ecoding for HSR.ISS on ARMv8 is backwards compatible with ARMv7: + * HSR.ISS is defined as UNK/SBZP on ARMv7 which means, that it + * will be read as 0. This includes CCKNOWNPASS field. + * If CCKNOWNPASS == 0 then this was an uncoditional instruction or + * it have passed conditional check (ARM DDI 0487B.a page D7-2272). + */ + if (hsr.ec == HSR_EC_SMC32 && hsr.smc32.ccknownpass == 0) + return 1; + /* Unconditional Exception classes */ - if ( hsr.ec == HSR_EC_UNKNOWN || hsr.ec >= 0x10 ) + if ( hsr.ec == HSR_EC_UNKNOWN || (hsr.ec >= 0x10 && hsr.ec != HSR_EC_SMC32)) return 1; /* Check for valid condition in hsr */