From: Julien Grall <julien.grall@arm.com>
To: xen-devel@lists.xen.org
Cc: andre.przywara@arm.com, Julien Grall <julien.grall@arm.com>,
sstabellini@kernel.org
Subject: [PATCH v2 10/24] xen/arm: traps: Introduce a helper to read the hypersivor fault register
Date: Tue, 12 Sep 2017 11:03:16 +0100 [thread overview]
Message-ID: <20170912100330.2168-11-julien.grall@arm.com> (raw)
In-Reply-To: <20170912100330.2168-1-julien.grall@arm.com>
While ARM32 has 2 distinct registers for the hypervisor fault register
(one for prefetch abort, the other for data abort), AArch64 has only
one.
Currently, the logic is open-code but a follow-up patch will require to
read it too. So move the logic in a separate helper and use it instead
of open-coding it.
Signed-off-by: Julien Grall <julien.grall@arm.com>
Reviewed-by: Andre Przywara <andre.przywara@arm.com>
---
Changes in v2:
- Add Andre's reviewed-by
---
xen/arch/arm/traps.c | 35 +++++++++++++++++++++++++----------
1 file changed, 25 insertions(+), 10 deletions(-)
diff --git a/xen/arch/arm/traps.c b/xen/arch/arm/traps.c
index 967bfea4ed..2e48089d61 100644
--- a/xen/arch/arm/traps.c
+++ b/xen/arch/arm/traps.c
@@ -2549,6 +2549,28 @@ done:
if (first) unmap_domain_page(first);
}
+/*
+ * Return the value of the hypervisor fault address register.
+ *
+ * On ARM32, the register will be different depending whether the
+ * fault is a prefetch abort or data abort.
+ */
+static inline vaddr_t get_hfar(bool is_data)
+{
+ vaddr_t gva;
+
+#ifdef CONFIG_ARM_32
+ if ( is_data )
+ gva = READ_CP32(HDFAR);
+ else
+ gva = READ_CP32(HIFAR);
+#else
+ gva = READ_SYSREG(FAR_EL2);
+#endif
+
+ return gva;
+}
+
static inline paddr_t get_faulting_ipa(vaddr_t gva)
{
register_t hpfar = READ_SYSREG(HPFAR_EL2);
@@ -2584,11 +2606,7 @@ static void do_trap_instr_abort_guest(struct cpu_user_regs *regs,
paddr_t gpa;
mfn_t mfn;
-#ifdef CONFIG_ARM_32
- gva = READ_CP32(HIFAR);
-#else
- gva = READ_SYSREG64(FAR_EL2);
-#endif
+ gva = get_hfar(false /* is_data */);
/*
* If this bit has been set, it means that this instruction abort is caused
@@ -2730,11 +2748,8 @@ static void do_trap_data_abort_guest(struct cpu_user_regs *regs,
return __do_trap_serror(regs, true);
info.dabt = dabt;
-#ifdef CONFIG_ARM_32
- info.gva = READ_CP32(HDFAR);
-#else
- info.gva = READ_SYSREG64(FAR_EL2);
-#endif
+
+ info.gva = get_hfar(true /* is_data */);
if ( hpfar_is_valid(dabt.s1ptw, fsc) )
info.gpa = get_faulting_ipa(info.gva);
--
2.11.0
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
next prev parent reply other threads:[~2017-09-12 10:03 UTC|newest]
Thread overview: 72+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-12 10:03 [PATCH v2 00/24] xen/arm: Memory subsystem clean-up Julien Grall
2017-09-12 10:03 ` [PATCH v2 01/24] xen/x86: mm: Introduce {G, M}FN <-> {G, M}ADDR helpers Julien Grall
2017-09-12 10:14 ` Andrew Cooper
2017-09-12 10:29 ` Wei Liu
2017-09-12 10:03 ` [PATCH v2 02/24] xen/mm: Use typesafe MFN for alloc_boot_pages return Julien Grall
2017-09-12 10:27 ` Jan Beulich
2017-09-12 10:29 ` Wei Liu
2017-09-12 14:19 ` George Dunlap
2017-09-15 23:33 ` Stefano Stabellini
2017-09-12 10:03 ` [PATCH v2 03/24] xen/mm: Use __virt_to_mfn in map_domain_page instead of virt_to_mfn Julien Grall
2017-09-12 10:29 ` Wei Liu
2017-09-15 23:39 ` Stefano Stabellini
2017-09-12 10:03 ` [PATCH v2 04/24] xen/arm: mm: Redefine mfn_to_virt to use typesafe Julien Grall
2017-09-15 23:56 ` Stefano Stabellini
2017-09-16 9:27 ` Julien Grall
2017-09-19 22:58 ` Stefano Stabellini
2017-09-12 10:03 ` [PATCH v2 05/24] xen/arm: hsr_iabt: Document RES0 field Julien Grall
2017-09-15 23:43 ` Stefano Stabellini
2017-09-15 23:45 ` [PATCH v2 06/24] xen/arm: traps: Don't define FAR_EL2 for ARM32 Stefano Stabellini
2017-09-12 10:03 ` Julien Grall
2017-09-12 10:03 ` [PATCH v2 07/24] xen/arm: arm32: Don't define FAR_EL1 Julien Grall
2017-09-15 23:51 ` Stefano Stabellini
2017-09-12 10:03 ` [PATCH v2 08/24] xen/arm: Add FnV field in hsr_*abt Julien Grall
2017-09-15 23:58 ` Stefano Stabellini
2017-09-12 10:03 ` [PATCH v2 09/24] xen/arm: Introduce hsr_xabt to gather common bits between hsr_dabt and Julien Grall
2017-09-12 15:01 ` Julien Grall
2017-09-16 0:04 ` Stefano Stabellini
2017-09-12 10:03 ` Julien Grall [this message]
2017-09-16 0:08 ` [PATCH v2 10/24] xen/arm: traps: Introduce a helper to read the hypersivor fault register Stefano Stabellini
2017-09-12 10:03 ` [PATCH v2 11/24] xen/arm: traps: Improve logging for data/prefetch abort fault Julien Grall
2017-09-16 0:15 ` Stefano Stabellini
2017-09-12 10:03 ` [PATCH v2 12/24] xen/arm: Replace ioremap_attr(PAGE_HYPERVISOR_NOCACHE) call by ioremap_nocache Julien Grall
2017-09-16 0:17 ` Stefano Stabellini
2017-09-12 10:03 ` [PATCH v2 13/24] xen/arm: page: Remove unused attributes DEV_NONSHARED and DEV_CACHED Julien Grall
2017-09-19 23:32 ` Stefano Stabellini
2017-09-20 17:55 ` Julien Grall
2017-09-12 10:03 ` [PATCH v2 14/24] xen/arm: page: Use directly BUFFERABLE and drop DEV_WC Julien Grall
2017-09-19 23:33 ` Stefano Stabellini
2017-09-20 17:56 ` Julien Grall
2017-09-12 10:03 ` [PATCH v2 15/24] xen/arm: page: Prefix memory types with MT_ Julien Grall
2017-09-16 0:29 ` Stefano Stabellini
2017-09-12 10:03 ` [PATCH v2 16/24] xen/arm: page: Use ARMv8 naming to improve readability Julien Grall
2017-09-19 23:45 ` Stefano Stabellini
2017-09-21 15:17 ` Julien Grall
2017-09-21 15:46 ` Stefano Stabellini
2017-09-21 15:52 ` Andre Przywara
2017-09-21 16:37 ` Julien Grall
2017-09-12 10:03 ` [PATCH v2 17/24] xen/arm: page: Clean-up the definition of MAIRVAL Julien Grall
2017-09-19 23:51 ` Stefano Stabellini
2017-09-20 17:57 ` Julien Grall
2017-09-20 21:03 ` Stefano Stabellini
2017-09-20 22:11 ` Julien Grall
2017-09-12 10:03 ` [PATCH v2 18/24] xen/arm: mm: Rename and clarify AP[1] in the stage-1 page table Julien Grall
2017-09-19 23:01 ` Stefano Stabellini
2017-09-12 10:03 ` [PATCH v2 19/24] xen/arm: Switch to SYS_STATE_boot just after end_boot_allocator() Julien Grall
2017-09-19 23:02 ` Stefano Stabellini
2017-09-12 10:03 ` [PATCH v2 20/24] xen/arm: mm: Rename 'ai' into 'flags' in create_xen_entries Julien Grall
2017-09-19 23:10 ` Stefano Stabellini
2017-09-12 10:03 ` [PATCH v2 21/24] xen/arm: page: Describe the layout of flags used to update page tables Julien Grall
2017-09-19 23:11 ` Stefano Stabellini
2017-09-12 10:03 ` [PATCH v2 22/24] xen/arm: mm: Embed permission in the flags Julien Grall
2017-09-19 23:59 ` Stefano Stabellini
2017-09-20 18:03 ` Julien Grall
2017-09-20 21:07 ` Stefano Stabellini
2017-09-20 22:13 ` Julien Grall
2017-09-12 10:03 ` [PATCH v2 23/24] xen/arm: mm: Handle permission flags when adding a new mapping Julien Grall
2017-09-19 23:17 ` Stefano Stabellini
2017-10-02 13:30 ` Julien Grall
2017-09-12 10:03 ` [PATCH v2 24/24] xen/arm: mm: Use memory flags for modify_xen_mappings rather than custom one Julien Grall
2017-09-20 0:02 ` Stefano Stabellini
2017-09-20 0:29 ` [PATCH v2 00/24] xen/arm: Memory subsystem clean-up Stefano Stabellini
2017-09-20 21:12 ` Stefano Stabellini
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170912100330.2168-11-julien.grall@arm.com \
--to=julien.grall@arm.com \
--cc=andre.przywara@arm.com \
--cc=sstabellini@kernel.org \
--cc=xen-devel@lists.xen.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).