From patchwork Tue Jul 5 18:37:47 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tamas Lengyel X-Patchwork-Id: 9215101 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 23D816048B for ; Tue, 5 Jul 2016 18:41:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 18D6A28119 for ; Tue, 5 Jul 2016 18:41:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0D7592817F; Tue, 5 Jul 2016 18:41:26 +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=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 ACB4828119 for ; Tue, 5 Jul 2016 18:41:24 +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 1bKVEN-000163-KA; Tue, 05 Jul 2016 18:37:59 +0000 Received: from mail6.bemta6.messagelabs.com ([85.158.143.247]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bKVEM-00015g-Mg for xen-devel@lists.xenproject.org; Tue, 05 Jul 2016 18:37:58 +0000 Received: from [85.158.143.35] by server-3.bemta-6.messagelabs.com id FE/E3-22092-58EFB775; Tue, 05 Jul 2016 18:37:57 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrGIsWRWlGSWpSXmKPExsVyMfT+Qd3Wf9X hBjumyVt83zKZyYHR4/CHKywBjFGsmXlJ+RUJrBmLfixjLFjEV9E3uZ2pgfEodxcjF4eQwExG iUXdJ5lAHBaBZlaJ/rb3bCCOhEA/q8TbX3OAMhxATozE7yvBXYycQGatxKMlU5lBbCEBTYmDG 84wQ0yaxCTRsqwDLMEmYCRx9WoPG4gtIqAkcW/VZLANzAItjBL7P1xkB0kIC/hLnP/8gAXEZh FQlbjxdTMriM0r4Cnx+fJ7NohtchKXpz8AszkFvCSOrP/FBrHZU+LOtvvMExgFFjAyrGJUL04 tKkst0jXWSyrKTM8oyU3MzNE1NDDTy00tLk5MT81JTCrWS87P3cQIDC0GINjB2PHP6RCjJAeT kigvy7fqcCG+pPyUyozE4oz4otKc1OJDjDIcHEoSvD/+AOUEi1LTUyvSMnOAQQ6TluDgURLhD fwLlOYtLkjMLc5Mh0idYjTm2PL72lomjm1T761lEmLJy89LlRLnlQcpFQApzSjNgxsEi75LjL JSwryMQKcJ8RSkFuVmlqDKv2IU52BUEubNAZnCk5lXArfvFdApTECn/HQBO6UkESEl1cAoc3m GpPHEeUo8UX6GfYc/urglS/ELq7xosjGtk7/2MHOxT/+2DVI+H2sVeLUmHU0Ksr/IM/+9r8QG m8Zjj57uDQ2d+vb4YZnzE/QOawlaMxU949774QnL+0m62f7vVOJ0N3dxbeX0+3HmnvGfr8/Ez oZd4GnhiWV22/XfbUOBrVj6TwvGO1VKLMUZiYZazEXFiQBV63AluQIAAA== X-Env-Sender: tamas.lengyel@zentific.com X-Msg-Ref: server-12.tower-21.messagelabs.com!1467743876!22534906!1 X-Originating-IP: [209.85.223.193] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 8.46; banners=-,-,- X-VirusChecked: Checked Received: (qmail 49688 invoked from network); 5 Jul 2016 18:37:57 -0000 Received: from mail-io0-f193.google.com (HELO mail-io0-f193.google.com) (209.85.223.193) by server-12.tower-21.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 5 Jul 2016 18:37:57 -0000 Received: by mail-io0-f193.google.com with SMTP id u25so21561609iou.2 for ; Tue, 05 Jul 2016 11:37:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zentific-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=3Gn+ZXPO3qJg/ZUvwF0a7mWQ1tsZ+thVyHKaFfyUqVg=; b=ZoeF3BqJA37pEkYQdIX8MiVQ4O0j09kPbVDNlYxltjNII1wLcDALeKBs47dJNV/0/L E6lEXNB4ybLs/8yH6w4M0EGig4P/M+sgwU2utX2xmro/fAla/oXgRvkZIfwaODWiyM0z iu1yDYTSl6pTTGGQ8wp7OeQ99iDpFQQaVpDkGqVrv+dAn6DitDYVUqHFv/MhyM+r36/O hnshQdUFVnWuJjB5MXK30A3FH6aG/eqjrSqYnyQ6Om+VJBpDWFawyWOlN+ACpYWyt0T1 UpBRfcINAegHUOVvFRUSlSwdPmLm3G0sMmdTQ91N7MZ8sjDUGbjkQCUQckTqxaPAQAhQ WyHA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=3Gn+ZXPO3qJg/ZUvwF0a7mWQ1tsZ+thVyHKaFfyUqVg=; b=daP5S1Ga3r2Y6oLPmJoGNZ7r+cwbu1CO9P7gAeAIjuctyUx/2UpmUCBilcvX8ikw+h qIQzG/8Q1Bv4Tk9HJTkRnU1PR6zRjgL+AsOgs8kyHzwe3zSr/NSIUHgX52CbEtB1n5Wo rBQNLxdMtpm7n23tZzSnMEg52bhnoVfUTfM5g6ku8v9xyD37ZemH2U0VdnvTlZxg85f8 WJ5zJkjTB0BKlQOFYikylij35u6yR1tyOqK5ZH6RnUn89lQRbkgt1mV3AzxbEB0pDyr2 R6oLrpFo1txDKCUUJjbKuH0V/PW23spbLuCaiOnG8TWbumnhU9HOZxBrcbAeoAOpKYkk 883A== X-Gm-Message-State: ALyK8tLD4mfk6mInB2RbqGJNdXiaVhDlmBCFeuoxZilR3A+0Hd4hJ77PcV75/nQSuwechg== X-Received: by 10.107.202.198 with SMTP id a189mr15177010iog.164.1467743875874; Tue, 05 Jul 2016 11:37:55 -0700 (PDT) Received: from l1.lan (c-73-14-35-59.hsd1.co.comcast.net. [73.14.35.59]) by smtp.gmail.com with ESMTPSA id o133sm2083760ioo.10.2016.07.05.11.37.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 05 Jul 2016 11:37:55 -0700 (PDT) From: Tamas K Lengyel To: xen-devel@lists.xenproject.org Date: Tue, 5 Jul 2016 12:37:47 -0600 Message-Id: <1467743871-9644-2-git-send-email-tamas.lengyel@zentific.com> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1467743871-9644-1-git-send-email-tamas.lengyel@zentific.com> References: <1467743871-9644-1-git-send-email-tamas.lengyel@zentific.com> Cc: Tamas K Lengyel , Julien Grall , Stefano Stabellini Subject: [Xen-devel] [PATCH v8 2/6] arm: filter SMC exceptions with failed condition checks 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: , MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP In AArch32 state, the ARMv8-A architecture permits, but does not require, this trap to apply to conditional SMC instructions that fail their condition code check, in the same way as with traps on other conditional instructions. Signed-off-by: Tamas K Lengyel Suggested-by: Julien Grall --- Cc: Stefano Stabellini Cc: Julien Grall --- xen/arch/arm/traps.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/xen/arch/arm/traps.c b/xen/arch/arm/traps.c index 44926ca..627e8c9 100644 --- a/xen/arch/arm/traps.c +++ b/xen/arch/arm/traps.c @@ -2507,6 +2507,17 @@ bad_data_abort: inject_dabt_exception(regs, info.gva, hsr.len); } +static void do_trap_smc(struct cpu_user_regs *regs, const union hsr hsr) +{ + if ( !check_conditional_instr(regs, hsr) ) + { + advance_pc(regs, hsr); + return; + } + + inject_undef_exception(regs, hsr); +} + static void enter_hypervisor_head(struct cpu_user_regs *regs) { if ( guest_mode(regs) ) @@ -2582,7 +2593,7 @@ asmlinkage void do_trap_hypervisor(struct cpu_user_regs *regs) */ GUEST_BUG_ON(!psr_mode_is_32bit(regs->cpsr)); perfc_incr(trap_smc32); - inject_undef32_exception(regs); + do_trap_smc(regs, hsr); break; case HSR_EC_HVC32: GUEST_BUG_ON(!psr_mode_is_32bit(regs->cpsr)); @@ -2615,7 +2626,7 @@ asmlinkage void do_trap_hypervisor(struct cpu_user_regs *regs) */ GUEST_BUG_ON(psr_mode_is_32bit(regs->cpsr)); perfc_incr(trap_smc64); - inject_undef64_exception(regs, hsr.len); + do_trap_smc(regs, hsr); break; case HSR_EC_SYSREG: GUEST_BUG_ON(psr_mode_is_32bit(regs->cpsr));