From patchwork Fri Aug 11 18:02:53 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 109915 Delivered-To: patch@linaro.org Received: by 10.140.95.78 with SMTP id h72csp1250175qge; Fri, 11 Aug 2017 11:05:28 -0700 (PDT) X-Received: by 10.36.184.134 with SMTP id m128mr11837215ite.82.1502474728276; Fri, 11 Aug 2017 11:05:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1502474728; cv=none; d=google.com; s=arc-20160816; b=YgxchNnAnPYjkOUi9zvwEeQaf5/Y4w4fUAPZzL8HGkkKKf8htYIVstUNtdZYv9SQhF n4H6bdu4jSkdvMJS5KeBwORqew6qzf+kmYR9SlhD8s44twRX7S62OSyQzEZCQ2xZnbQT 38vTXMQewi5a6iwM0lXDp+u9EXG8dp066J8I4OmO/pbp8ORRdy1rZd3dy9PusU1ljfsP Ec9oBrH6iKDBwgIzwj5J7oO7YOCR1egA9XgknMEn3TBdcNyhVajHRXQahYlhSHzvQLsp K//ea78pEY/3H8s9hkoufNZS2mTwkcRRYvio1PRzeEm1Cc1DvrWvVT6/0Uz+v6D4MnOK Y2nw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-unsubscribe:list-id :precedence:subject:cc:references:in-reply-to:message-id:date:to :from:arc-authentication-results; bh=2JpH7DrNFzmWNcCFhL8j3zO8UU/rUPseaboU/s5BPiw=; b=NEPNPhjhUs3w3cHKW8nfAa5jfIOjv5uejcu0qw7lKKV7OrD2NAwCO+5QWARX4KeaDY rCkZi4YnlidowrUDApjrNLu+YJpq9bq/rC4F5lWA2X0pXZX0s0Wi1a5tSbvVcmK8Z/vE x4bAnI02ndc1zpRad5xmJxyRrhiCDnNZw+Wt2YCQHpkeJfUFvVA2nE66Ve37Av2MJGmE 2nOrWRGRfaDMGrC8dX8vNcgkpKsOVraaqbc9YI+iVznGuVkP5XzflBlGz+ApkEuRqQkO loShm5Q3/bFYDnkZNBDnzQD/ivrxFBRxLNe9aMO5R7gUA5qBDIp3pUZa6D0oeJS8QXDs ituw== ARC-Authentication-Results: i=1; mx.google.com; spf=neutral (google.com: 192.237.175.120 is neither permitted nor denied by best guess record for domain of xen-devel-bounces@lists.xen.org) smtp.mailfrom=xen-devel-bounces@lists.xen.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id n19si1460401ion.8.2017.08.11.11.05.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 11 Aug 2017 11:05:28 -0700 (PDT) Received-SPF: neutral (google.com: 192.237.175.120 is neither permitted nor denied by best guess record for domain of xen-devel-bounces@lists.xen.org) client-ip=192.237.175.120; Authentication-Results: mx.google.com; spf=neutral (google.com: 192.237.175.120 is neither permitted nor denied by best guess record for domain of xen-devel-bounces@lists.xen.org) smtp.mailfrom=xen-devel-bounces@lists.xen.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dgEHE-0002ak-VS; Fri, 11 Aug 2017 18:03:16 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dgEHE-0002aA-AQ for xen-devel@lists.xen.org; Fri, 11 Aug 2017 18:03:16 +0000 Received: from [85.158.137.68] by server-2.bemta-3.messagelabs.com id 71/1A-22472-361FD895; Fri, 11 Aug 2017 18:03:15 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrALMWRWlGSWpSXmKPExsVysyfVTTfpY2+ kwes2S4slHxezODB6HN39mymAMYo1My8pvyKBNeP6x3XMBW+MK87v2MfawLhMvYuRi0NIYDOj ROP9GcwQzmlGid+bd7B3MXJysAloStz5/IkJxBYRkJa49vkyI4jNLFAt8X/hSTYQW1ggRGL6i 19AzRwcLAKqEhN+5oGYvAIWEs33fEAqJATkJXa1XWQFCXMKWErMuSwLEhYCqtj+bx3bBEbuBY wMqxg1ilOLylKLdI0M9ZKKMtMzSnITM3N0DQ2M9XJTi4sT01NzEpOK9ZLzczcxAn1bz8DAuIO xZ6/fIUZJDiYlUd4En95IIb6k/JTKjMTijPii0pzU4kOMMhwcShK8IR+AcoJFqempFWmZOcAg g0lLcPAoifD2gaR5iwsSc4sz0yFSpxh1OV5N+P+NSYglLz8vVUqcdwJIkQBIUUZpHtwIWMBfY pSVEuZlZGBgEOIpSC3KzSxBlX/FKM7BqCQMMYUnM68EbtMroCOYQI7wATuiJBEhJdXA6LBgo8 HLXVlRiWuDOtzc8woVpNdW7AjaN//hO4H/wQ4NKpabmJwKIvds/xz9L7pw0tn777fq/npz+YC O0omSL7Kf15zhzdiRKbLwupGAfY52tMI9Y/3pC+u79r3++eBFS1zLqbo++xqnD/cZnfbJPsib xnUgi+m409bmzMtlz9fwSO7u+PiPTYmlOCPRUIu5qDgRANwyHC9zAgAA X-Env-Sender: julien.grall@arm.com X-Msg-Ref: server-12.tower-31.messagelabs.com!1502474594!92845740!1 X-Originating-IP: [217.140.101.70] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 9.4.45; banners=-,-,- X-VirusChecked: Checked Received: (qmail 17388 invoked from network); 11 Aug 2017 18:03:14 -0000 Received: from foss.arm.com (HELO foss.arm.com) (217.140.101.70) by server-12.tower-31.messagelabs.com with SMTP; 11 Aug 2017 18:03:14 -0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 06EA7164F; Fri, 11 Aug 2017 11:03:14 -0700 (PDT) Received: from e108454-lin.cambridge.arm.com (e108454-lin.cambridge.arm.com [10.1.206.53]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id E66973F577; Fri, 11 Aug 2017 11:03:12 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xen.org Date: Fri, 11 Aug 2017 19:02:53 +0100 Message-Id: <20170811180257.5493-8-julien.grall@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170811180257.5493-1-julien.grall@arm.com> References: <20170811180257.5493-1-julien.grall@arm.com> Cc: bhupinder.thakur@linaro.org, Julien Grall , sstabellini@kernel.org, volodymyr_babchuk@epam.com Subject: [Xen-devel] [PATCH 07/11] xen/arm: traps: Export a bunch of helpers to handle emulation 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" A follow-up patch will move some parts of traps.c in separate files. The will require to use helpers that are currently statically defined. Export the following helpers: - inject_undef64_exception - inject_undef_exception - check_conditional_instr - advance_pc - handle_raz_wi - handle_wo_wi - handle_ro_raz Note that asm-arm/arm32/traps.h is empty but it is to keep parity with the arm64 counterpart. Signed-off-by: Julien Grall --- Cc: volodymyr_babchuk@epam.com --- xen/arch/arm/traps.c | 43 +++++++++++++++++++-------------------- xen/include/asm-arm/arm32/traps.h | 13 ++++++++++++ xen/include/asm-arm/arm64/traps.h | 15 ++++++++++++++ xen/include/asm-arm/traps.h | 35 +++++++++++++++++++++++++++++++ 4 files changed, 84 insertions(+), 22 deletions(-) create mode 100644 xen/include/asm-arm/arm32/traps.h create mode 100644 xen/include/asm-arm/arm64/traps.h create mode 100644 xen/include/asm-arm/traps.h diff --git a/xen/arch/arm/traps.c b/xen/arch/arm/traps.c index d79e9605b5..ab56958717 100644 --- a/xen/arch/arm/traps.c +++ b/xen/arch/arm/traps.c @@ -49,6 +49,7 @@ #include #include #include +#include #include #include @@ -545,7 +546,7 @@ static vaddr_t exception_handler64(struct cpu_user_regs *regs, vaddr_t offset) } /* Inject an undefined exception into a 64 bit guest */ -static void inject_undef64_exception(struct cpu_user_regs *regs, int instr_len) +void inject_undef64_exception(struct cpu_user_regs *regs, int instr_len) { vaddr_t handler; const union hsr esr = { @@ -618,8 +619,7 @@ static void inject_iabt64_exception(struct cpu_user_regs *regs, #endif -static void inject_undef_exception(struct cpu_user_regs *regs, - const union hsr hsr) +void inject_undef_exception(struct cpu_user_regs *regs, const union hsr hsr) { if ( is_32bit_domain(current->domain) ) inject_undef32_exception(regs); @@ -1712,8 +1712,7 @@ static const unsigned short cc_map[16] = { 0 /* NV */ }; -static int check_conditional_instr(struct cpu_user_regs *regs, - const union hsr hsr) +int check_conditional_instr(struct cpu_user_regs *regs, const union hsr hsr) { unsigned long cpsr, cpsr_cond; int cond; @@ -1758,7 +1757,7 @@ static int check_conditional_instr(struct cpu_user_regs *regs, return 1; } -static void advance_pc(struct cpu_user_regs *regs, const union hsr hsr) +void advance_pc(struct cpu_user_regs *regs, const union hsr hsr) { unsigned long itbits, cond, cpsr = regs->cpsr; @@ -1799,11 +1798,11 @@ static void advance_pc(struct cpu_user_regs *regs, const union hsr hsr) } /* Read as zero and write ignore */ -static void handle_raz_wi(struct cpu_user_regs *regs, - int regidx, - bool read, - const union hsr hsr, - int min_el) +void handle_raz_wi(struct cpu_user_regs *regs, + int regidx, + bool read, + const union hsr hsr, + int min_el) { ASSERT((min_el == 0) || (min_el == 1)); @@ -1817,12 +1816,12 @@ static void handle_raz_wi(struct cpu_user_regs *regs, advance_pc(regs, hsr); } -/* Write only as write ignore */ -static void handle_wo_wi(struct cpu_user_regs *regs, - int regidx, - bool read, - const union hsr hsr, - int min_el) +/* write only as write ignore */ +void handle_wo_wi(struct cpu_user_regs *regs, + int regidx, + bool read, + const union hsr hsr, + int min_el) { ASSERT((min_el == 0) || (min_el == 1)); @@ -1837,11 +1836,11 @@ static void handle_wo_wi(struct cpu_user_regs *regs, } /* Read only as read as zero */ -static void handle_ro_raz(struct cpu_user_regs *regs, - int regidx, - bool read, - const union hsr hsr, - int min_el) +void handle_ro_raz(struct cpu_user_regs *regs, + int regidx, + bool read, + const union hsr hsr, + int min_el) { ASSERT((min_el == 0) || (min_el == 1)); diff --git a/xen/include/asm-arm/arm32/traps.h b/xen/include/asm-arm/arm32/traps.h new file mode 100644 index 0000000000..e3c4a8b473 --- /dev/null +++ b/xen/include/asm-arm/arm32/traps.h @@ -0,0 +1,13 @@ +#ifndef __ASM_ARM32_TRAPS__ +#define __ASM_ARM32_TRAPS__ + +#endif /* __ASM_ARM32_TRAPS__ */ +/* + * Local variables: + * mode: C + * c-file-style: "BSD" + * c-basic-offset: 4 + * indent-tabs-mode: nil + * End: + */ + diff --git a/xen/include/asm-arm/arm64/traps.h b/xen/include/asm-arm/arm64/traps.h new file mode 100644 index 0000000000..5cb45df6bd --- /dev/null +++ b/xen/include/asm-arm/arm64/traps.h @@ -0,0 +1,15 @@ +#ifndef __ASM_ARM32_TRAPS__ +#define __ASM_ARM32_TRAPS__ + +void inject_undef64_exception(struct cpu_user_regs *regs, int instr_len); + +#endif /* __ASM_ARM32_TRAPS__ */ +/* + * Local variables: + * mode: C + * c-file-style: "BSD" + * c-basic-offset: 4 + * indent-tabs-mode: nil + * End: + */ + diff --git a/xen/include/asm-arm/traps.h b/xen/include/asm-arm/traps.h new file mode 100644 index 0000000000..4e227c4dd2 --- /dev/null +++ b/xen/include/asm-arm/traps.h @@ -0,0 +1,35 @@ +#ifndef __ASM_ARM_TRAPS__ +#define __ASM_ARM_TRAPS__ + +#include + +#if defined(CONFIG_ARM_32) +# include +#elif defined(CONFIG_ARM_64) +# include +#endif + +int check_conditional_instr(struct cpu_user_regs *regs, const union hsr hsr); +void advance_pc(struct cpu_user_regs *regs, const union hsr hsr); + +void inject_undef_exception(struct cpu_user_regs *regs, const union hsr hsr); + +void handle_raz_wi(struct cpu_user_regs *regs, int regidx, bool read, + const union hsr hsr, int min_el); + +void handle_wo_wi(struct cpu_user_regs *regs, int regidx, bool read, + const union hsr hsr, int min_el); + +void handle_ro_raz(struct cpu_user_regs *regs, int regidx, bool read, + const union hsr hsr, int min_el); + +#endif /* __ASM_ARM_TRAPS__ */ +/* + * Local variables: + * mode: C + * c-file-style: "BSD" + * c-basic-offset: 4 + * indent-tabs-mode: nil + * End: + */ +