From patchwork Wed Aug 9 19:44:30 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Volodymyr Babchuk X-Patchwork-Id: 9891819 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 C3C49602D7 for ; Wed, 9 Aug 2017 19:48:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B587C28A56 for ; Wed, 9 Aug 2017 19:48:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AA77328A84; Wed, 9 Aug 2017 19:48:31 +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 8066D28A94 for ; Wed, 9 Aug 2017 19:48: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 1dfWv1-0003GG-25; Wed, 09 Aug 2017 19:45:27 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dfWv0-0003Fr-7E for xen-devel@lists.xen.org; Wed, 09 Aug 2017 19:45:26 +0000 Received: from [193.109.254.147] by server-2.bemta-6.messagelabs.com id 8F/AA-27137-5566B895; Wed, 09 Aug 2017 19:45:25 +0000 X-Bright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Ref: server-12.tower-27.messagelabs.com!1502307924!109644157!1 X-Originating-IP: [104.47.2.45] 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 28780 invoked from network); 9 Aug 2017 19:45:24 -0000 Received: from mail-db5eur01on0045.outbound.protection.outlook.com (HELO EUR01-DB5-obe.outbound.protection.outlook.com) (104.47.2.45) by server-12.tower-27.messagelabs.com with AES256-SHA256 encrypted SMTP; 9 Aug 2017 19:45:24 -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=uW0MW7ofJH+6vcT+Kx0XNjZShAZtYbKJM15HrWNBsdw=; b=FPhLKUSZ8qgL8cnxEmr0bkQJ+ZLg7V6M2jwgsuueTzaJ2fslW6b5b8UsMY90wR3yoCrcJ+ZG6Gr77rA4totkgrlGal33UBHBo3MOF+IWrBf4nbEPHWzBobIaZ42vjwkwup2sDd6KTuAwlzPOxJQv6zE8eNQpTSAv7s+f5bQbKkM= Received: from EPUAKYIW2556.kyiv.epam.com (85.223.209.53) by VI1PR0301MB2142.eurprd03.prod.outlook.com (2603:10a6:800:26::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.1.1320.16; Wed, 9 Aug 2017 19:45:21 +0000 Received: by EPUAKYIW2556.kyiv.epam.com (sSMTP sendmail emulation); Wed, 09 Aug 2017 22:45:16 +0300 From: Volodymyr Babchuk To: xen-devel@lists.xen.org Date: Wed, 9 Aug 2017 22:44:30 +0300 Message-Id: <1502307870-11317-5-git-send-email-volodymyr_babchuk@epam.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1502307870-11317-1-git-send-email-volodymyr_babchuk@epam.com> References: <1502307870-11317-1-git-send-email-volodymyr_babchuk@epam.com> MIME-Version: 1.0 X-Originating-IP: [85.223.209.53] X-ClientProxiedBy: DB6PR1001CA0025.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:4:55::11) To VI1PR0301MB2142.eurprd03.prod.outlook.com (2603:10a6:800:26::15) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 19054a8a-c9bd-45d1-3b58-08d4df5f2c32 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:VI1PR0301MB2142; X-Microsoft-Exchange-Diagnostics: 1; VI1PR0301MB2142; 3:ggFLvj1wQdGD5Zfoc+LOgUXCp5tUUat3rS11GG8a2T23TpvGaeCGEo0FYy4execlyKA10mtCNQzVkSdGaqU6f2prxSBWMfHa8prD+fJlPa+BDw4IBoTAwsVuDJCDV8v2rFzUTi6LD6Iw19wLTfvOUqoH34LLyAMWeRoP82E0jH5fMAbWzD+UwnMaH2GpBuSGpG2UDjSlYoTmaQvOBD/W3cvQB/iq8DQ6kVIUcXyPznR4mhIIvvdVnYN0EEQ6nDCX; 25:YgVBxC5/C4T9cB+XyOdvedrySs4qRIxwNWQ9cLo5d6JG2D8cvKiMDUCDvcDT43DGTrlT/L9dU7pN6KBi7T80mFC4r8UhBDRMD09EYUc5r5wr97wfVg+Xl6E5S7Lc75QDuGg4+rFLlBRvLlSq2e+GqogHGDQAG+GlMV29s0hdMTIUkn0Jr2glh8ZKeiRdfzfQOJbHM7YyWOUvx45rsvJCPZKHMc8ir7+dgmiTciqYYdaOswK1O4LLvaSayoleXlUWjZDTW4+5U2azd5nsJj72KNiLM6fHMknpXqxdoeRMn+xxEjG88jznuGRaGekUVPWaHAymZFr5JUp0wIOXgQWuKA==; 31:RCgyuks+gSCDKxPg153/0TCRCBzSZszqYuZvX6L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mls0T7J07cXyZnOAaRk= X-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)(5005006)(8121501046)(10201501046)(93006095)(93001095)(100000703101)(100105400095)(3002001)(6041248)(20161123555025)(20161123562025)(20161123558100)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123560025)(20161123564025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:VI1PR0301MB2142; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:VI1PR0301MB2142; X-Forefront-PRVS: 0394259C80 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(7370300001)(4630300001)(6009001)(39400400002)(39850400002)(39410400002)(39840400002)(39450400003)(199003)(189002)(72206003)(54906002)(2351001)(7350300001)(101416001)(5660300001)(305945005)(7736002)(48376002)(50466002)(68736007)(2361001)(81166006)(106356001)(105586002)(8676002)(97736004)(81156014)(122856001)(66066001)(50226002)(86362001)(33646002)(47776003)(42186005)(38730400002)(4326008)(6116002)(3846002)(2950100002)(189998001)(36756003)(110136004)(50986999)(53936002)(5003940100001)(2906002)(6666003)(80792005)(107886003)(478600001)(76176999)(6916009); DIR:OUT; SFP:1101; SCL:1; SRVR:VI1PR0301MB2142; 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; VI1PR0301MB2142; 23:0rLA1H43DxQGERs+7NVacCB30kYZEcP13fRmyhI?= =?us-ascii?Q?mOia/bE8WEuna9iuHHCyGmeuXQhqtp/Njnbxx/lcSpUuF3vbRCafmssTED6j?= =?us-ascii?Q?74UxcsAjBEOjsgRjEk3u4fD8SlFil/gZTNgweRdYeBMkMcOCN+hk3+PIeLCa?= =?us-ascii?Q?HDj8wvw6Yxjjrl3zlIdXOvh89JDMiCFeDJJFCsBZZiZYJrRN4ALeHmwxG3it?= =?us-ascii?Q?lUpYcfehtGFb2imgfryDJYyhTxsk+7voccngRtpRFyhz9niujo/i7p703GWw?= =?us-ascii?Q?wgjxoGJioBZG0tp3Gzy6iuXIuIzQI1klTmxnhupBHkzM7/TX57+T10ve64wh?= =?us-ascii?Q?xenlDbWzIBVj1nXfQayoShaO6PZmbxqas94Kb8jkCgFHu9wO2BuDA2yzFjgK?= =?us-ascii?Q?/pwuiRKXDo+j5R6exDTabcnUodicNDJxHgbauLxM8YL0dBZWAOZSVDdRUkn0?= =?us-ascii?Q?VJ5c1Z+11nipUYneKKcq0U/NNbf3JN0Jz4Lopxhjg5QnTlFbH08y4DObiIQE?= =?us-ascii?Q?BnO8OWfWLTA8PnQunHEhFYJReP03KveUzf1srspX9EubthArC1GxacrIQvf6?= =?us-ascii?Q?oGb9MtZPESlBbTj142ZMJ07rAfBlTijPvRMKq8Bz9/LW/myMgMrET+bgd9W4?= =?us-ascii?Q?btPUhwT32AO0u05G6xu3bLOvJtCXpPU52Q97mjb6SrrrgoAIwWXmTi/ECw8P?= =?us-ascii?Q?FWHn8MYhjohE7xhesK7RMALY63x3H9C8aKwrt9OQGMaAvtVcJcpLgfpRtzER?= =?us-ascii?Q?KgXaTOyKaSoSuQrResMhBXEgrOwgoeTMaK9raFOnf67jfs2wJGcTyIH+Fayj?= =?us-ascii?Q?A2aLEl73myRmghUJKs0x7LTU3cGjtiw7gwxRStLV+Yu/15b7x9chjYpdf988?= =?us-ascii?Q?HWBMItS7ezKF9kAGmag9+TSJfVHqW5WmhjEA/3vTVJGVjFCahMOSdGzv1JKv?= =?us-ascii?Q?UzUQzIn1AXW+v2A+yu5AqvB310hAO7Q7CReJGSRTSJH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Jyx9rV5WR3grpOsjlI9/VE/vGoMQhb3799UdJubsAEh3rk1e+A6iU8LvQST0BohaY6qYt8VdrcB9+LP2HX5n1zdiM2+I04V+9cMwGwh9JqewjZB4RLGK5N0QB1E9GW4TWrzs3EcgveKri8B7j//Y/pnSqbDh7TtZi8R+lbTObFgIgyksvGB18Csv2B2Eyohth7u+2tqSl+fd5iytkIzFwcTkv0Rff81d9Rz0M= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: epam.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Aug 2017 19:45:21.6052 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0301MB2142 Cc: Julien Grall , Stefano Stabellini , Volodymyr Babchuk Subject: [Xen-devel] [PATCH v2 4/4] 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 SMC instruction from aarch32 state can be conditional. (ARM DDI 0487A.k page D7-1949) 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 check before perfoming standard handling of CCVALID and COND fields. Because we can't distinguish ARMv7 from aarch32 state, we will always check CCKNOWNPASS field. On ARMv7 it will be read as 0 (ARM DDI 0406C.c page B3-1431), so there will be no problem. Signed-off-by: Volodymyr Babchuk --- - Added references to the ARM manuals. - Moved code from under #ifdef CONFIG_ARM_64 - Added comment with rationale for this --- 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..384219d 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 very special. Under SMC32 we mean + * SMC instruction on ARMv7 or SMC instruction originating from + * aarch32 state on ARMv8. + * On ARMv7 it is uncoditional (ARM DDI 0406C.c page B3-1431), + * but is conditional on ARMv8 (ARM DDI 0487A.k page D7-1949). + * Problem is that we can't determine if XEN is running on + * ARMv7 on ARMv8 in aarch32 mode. Fortunately, while running + * on ARMv7 all conditonal bits of HSR will read as 0 + * (ARM DDI 0406C.c page B3-1431). + * This includes CCKNOWNPASS bit of HSR. Thereby we will be okay, + * if we'll check that bit. + */ + 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 */