From patchwork Wed Aug 16 18:44:57 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Volodymyr Babchuk X-Patchwork-Id: 9904507 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 52E15603B5 for ; Wed, 16 Aug 2017 18:47:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 45F2228A3C for ; Wed, 16 Aug 2017 18:47:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3AB2A28A41; Wed, 16 Aug 2017 18:47:34 +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 B133F28A40 for ; Wed, 16 Aug 2017 18:47:33 +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 1di3Ju-00086D-8r; Wed, 16 Aug 2017 18:45:34 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1di3Jt-00085n-1t for xen-devel@lists.xen.org; Wed, 16 Aug 2017 18:45:33 +0000 Received: from [85.158.139.211] by server-1.bemta-5.messagelabs.com id 73/3F-01993-CC294995; Wed, 16 Aug 2017 18:45:32 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrNKsWRWlGSWpSXmKPExsWSoc9opHt60pR IgxUzZC2WfFzM4sDocXT3b6YAxijWzLyk/IoE1oxj6x4yFxzlr+g+08bWwDiLp4uRk4NFoJFZ 4vP7eBCbUSBGYtOWTsYuRi4OIYF+Jokt238ygSSEBJIl3j25yAZiswmYSKybf54dxBYRkJa49 vkyWAOzQBujROOBTUANHBzCAr4Sb8+EQSxQlVi/pYkZxOYV8JK4eO0UWK+EgJzEzXOdYHFOAW +JloOtbCCtQkA1bY+EIcoFJU7OfMICYjMLSEgcfPGCGaJVUWLqpvVsEPZkRombSxwhzlSX2Pv 7DVSNrMTRs3NYIGxfiYtPjoOdKSFwlUmi+cEmKKeZXeLWho1Qk3Qk9j+ZxAyReM4msXX3PFaI hKXExx8/oIoKJJbsnQ9VdINV4t7VT1D7ZCT23gD5HiTRzyrRPusyM8RRCRLv/v+GSnTxSCxY1 QDldLJLzLn3n30Co9osJN/OQvLtAkamVYzqxalFZalFumZ6SUWZ6RkluYmZObqGBqZ6uanFxY npqTmJScV6yfm5mxiBCYEBCHYwTm1wPsQoycGkJMrrlT8lUogvKT+lMiOxOCO+qDQntfgQoww Hh5IEb9FEoJxgUWp6akVaZg4wNcGkJTh4lER4u0DSvMUFibnFmekQqVOMuhyvJvz/xiTEkpef lyolzssOUiQAUpRRmgc3ApYmLzHKSgnzMgIdJcRTkFqUm1mCKv+KUZyDUUmY9zTIFJ7MvBK4T a+AjmACOuJK+ySQI0oSEVJSDYy7/BYGZ6SelOecPc1sib0y+wbPX348v24xPPpZs6N1i1nSs9 KFuy236GUat23do8D+RH6alMTfKepnZl2VOxx9pEdTanuFYYT2/vuBbs87l9VZqFy4oGgsVjg r80T1R9fFlyX2nMtgL35k+/x86G7xwp3TtiWskdZd/a0r03TR4saYSFb/uVuVWIozEg21mIuK EwGJ/LaHjgMAAA== X-Env-Sender: Volodymyr_Babchuk@epam.com X-Msg-Ref: server-13.tower-206.messagelabs.com!1502909131!92074696!1 X-Originating-IP: [104.47.1.50] 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 31925 invoked from network); 16 Aug 2017 18:45:31 -0000 Received: from mail-ve1eur01on0050.outbound.protection.outlook.com (HELO EUR01-VE1-obe.outbound.protection.outlook.com) (104.47.1.50) by server-13.tower-206.messagelabs.com with AES256-SHA256 encrypted SMTP; 16 Aug 2017 18:45:31 -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=g5Sky5ceZdZbPcJMs7iiHYtJTYqI1+hWtl4iLQE9jEI=; b=QOQJ6Uv4QXbCP8ocD8ZiTOqRtXTJWGxYAhstuspXkOKDzOYE8n9Reb9KaErnLYzBKsrIkaa1gHwiHi4s178BEiaaI7Gut5U+ScbICDe7jtb5gV6t/sjCzfZmTgBa3RaqHHgNha8Fp3vTBgJu79qTR1BiFrnIp6AsrVr6ah/Vk9I= Received: from EPUAKYIW2556.kyiv.epam.com (85.223.209.51) by HE1PR0301MB2139.eurprd03.prod.outlook.com (2603:10a6:3:21::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.1.1362.18; Wed, 16 Aug 2017 18:45:27 +0000 Received: by EPUAKYIW2556.kyiv.epam.com (sSMTP sendmail emulation); Wed, 16 Aug 2017 21:45:22 +0300 From: Volodymyr Babchuk To: xen-devel@lists.xen.org Date: Wed, 16 Aug 2017 21:44:57 +0300 Message-Id: <1502909097-13244-4-git-send-email-volodymyr_babchuk@epam.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1502909097-13244-1-git-send-email-volodymyr_babchuk@epam.com> References: <1502909097-13244-1-git-send-email-volodymyr_babchuk@epam.com> MIME-Version: 1.0 X-Originating-IP: [85.223.209.51] X-ClientProxiedBy: HE1PR05CA0155.eurprd05.prod.outlook.com (2603:10a6:7:28::42) To HE1PR0301MB2139.eurprd03.prod.outlook.com (2603:10a6:3:21::16) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 2b0ae940-d9ea-45e9-4ce8-08d4e4d6f6d9 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(22001)(300000502095)(300135100095)(2017030254152)(300000503095)(300135400095)(201703131423075)(201703031133081)(201702281549075)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095); SRVR:HE1PR0301MB2139; X-Microsoft-Exchange-Diagnostics: 1; HE1PR0301MB2139; 3:QDl5O2Df0QiTrFWqO3m0zI9gtv+PK6tC+gDDug3ygliiE0MtzI2LP+3VCHisM8jtIeDJdiWkrRwOJzLKsfROr50RciV2WR20vbBfiaZqEGTW/LaVvP6KdO1+gyYARvYyCyhJwA/0tgqJkKu+paQGv/JKD7HSa2QVwbsCy4BEbTn5H4yxl2Jhj9M78v04cEs8PGmG3fDS+Wi9PEQvmDI3OIiNhjTPX/G+JeKSjIeKGP8MpVR09SDXI9tpimcdrFuZ; 25:Y0ZrR0ycAu2tlxe73GimBdBphfeWTXLVCV+YQ2b7ZGkKgvtzQkqUv23gzBLuxCEEk1IjZwvkjoLwsu5EJo7/6yHUw3y+qDQxBktLK9bBNt1PYa1omoHdvCPm5GT2C9ltgKxRgCwmbnK2qAtQaCHn9M26KAQ8ByzeVtWYch3spXPg5buYzoudGVFaELvx1nuKXcxcqxCxl2eueZtt9sQQvX7W/W3SCEm3P2Jozz9VJ7Rz78YIMV/QewZOjrsbQ2VoXGtI44D8yBdvhkIoR4/chmyD8zP0FkCgq1mjaJWc2WjHRNwON7OWu63Ocot6YLoqYnlPxRV94pRxGsRXz/FB7g==; 31:fPALbXkkxjtBcRbV9lQFvM5v6BI6mxElBfZah7uQy8hOty3qRluP/sr7+WaYBy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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)(93006095)(93001095)(10201501046)(100000703101)(100105400095)(3002001)(6041248)(20161123560025)(20161123558100)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123555025)(20161123562025)(20161123564025)(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: 0401647B7F X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(7370300001)(4630300001)(6009001)(189002)(199003)(81156014)(47776003)(81166006)(122856001)(2950100002)(6666003)(6916009)(2351001)(72206003)(50226002)(105586002)(106356001)(33646002)(2361001)(305945005)(101416001)(4326008)(42186005)(3846002)(6116002)(7350300001)(7736002)(50466002)(97736004)(8676002)(2906002)(54906002)(5660300001)(48376002)(189998001)(5003940100001)(66066001)(68736007)(80792005)(50986999)(107886003)(86362001)(53936002)(76176999)(110136004)(36756003)(478600001); DIR:OUT; SFP:1101; SCL:1; SRVR:HE1PR0301MB2139; H:EPUAKYIW2556.kyiv.epam.com; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A: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:fPzm36FX/vTWMa5Ubg0szmuWRVjQ4NTNw+6jRWp?= =?us-ascii?Q?NgMCKLU35M1Tgx/S41dCUbpqCbpZX69jt6yrVEC1i2GInjw7iktzS3Le71au?= =?us-ascii?Q?gCrRich4iPiZKeEa+A2YF5gnw1UqkIQWVeRa6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iagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: epam.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Aug 2017 18:45:27.7746 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR0301MB2139 Cc: Julien Grall , Stefano Stabellini , Volodymyr Babchuk Subject: [Xen-devel] [PATCH v4 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 Reviewed-by: Julien Grall --- * Fixed spelling * Fixed coding style in 'if ( )' --- xen/arch/arm/traps.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/xen/arch/arm/traps.c b/xen/arch/arm/traps.c index eae2212..2e92223 100644 --- a/xen/arch/arm/traps.c +++ b/xen/arch/arm/traps.c @@ -1716,8 +1716,25 @@ 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 condition + * flags on ARMv8 (ARM DDI 0487B.a page D7-2271). + * Encoding 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 unconditional instruction or + * it has 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 */