[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH RFC 6/7] xen/arm: Instruction prefetch abort (X) mem_event handling



Add missing structure definition for iabt and update the trap handling
mechanism to only inject the exception if the mem_access checker
decides to do so.

Signed-off-by: Tamas K Lengyel <tamas.lengyel@xxxxxxxxxxxx>
---
 xen/arch/arm/traps.c            | 26 +++++++++++++++++++++++++-
 xen/include/asm-arm/processor.h | 10 +++++++++-
 2 files changed, 34 insertions(+), 2 deletions(-)

diff --git a/xen/arch/arm/traps.c b/xen/arch/arm/traps.c
index 82305c4..16139fd 100644
--- a/xen/arch/arm/traps.c
+++ b/xen/arch/arm/traps.c
@@ -1730,7 +1730,31 @@ err:
 static void do_trap_instr_abort_guest(struct cpu_user_regs *regs,
                                       union hsr hsr)
 {
-    register_t addr = READ_SYSREG(FAR_EL2);
+    struct hsr_iabt iabt = hsr.iabt;
+    int rc;
+    register_t addr;
+    vaddr_t gva;
+    paddr_t gpa;
+
+#ifdef CONFIG_ARM_32
+    gva = READ_CP32(HIFAR);
+#else
+    /* TODO: is this the correct register? */
+    info.gva = READ_SYSREG64(FAR_EL2);
+#endif
+
+    rc = gva_to_ipa(gva, &gpa);
+    if ( rc == -EFAULT )
+        return;
+
+    rc = p2m_mem_access_check(gpa, gva,
+                         1, 0, 1,
+                         iabt.s1ptw);
+
+    if ( !rc )
+        return;
+
+    addr = READ_SYSREG(FAR_EL2);
     inject_iabt_exception(regs, addr, hsr.len);
 }
 
diff --git a/xen/include/asm-arm/processor.h b/xen/include/asm-arm/processor.h
index 9d230f3..c906c94 100644
--- a/xen/include/asm-arm/processor.h
+++ b/xen/include/asm-arm/processor.h
@@ -338,10 +338,18 @@ union hsr {
     } sysreg; /* HSR_EC_SYSREG */
 #endif
 
+    struct hsr_iabt {
+        unsigned long ifsc:6;   /* Instruction fault status code */
+        unsigned long res0:1;
+        unsigned long s1ptw:1;  /* Fault during a stage 1 translation table 
walk */
+        unsigned long res1:1;
+        unsigned long ea:1;     /* External abort type */
+    } iabt; /* HSR_EC_INSTR_ABORT_* */
+
     struct hsr_dabt {
         unsigned long dfsc:6;  /* Data Fault Status Code */
         unsigned long write:1; /* Write / not Read */
-        unsigned long s1ptw:1; /* */
+        unsigned long s1ptw:1; /* Fault during a stage 1 translation table 
walk */
         unsigned long cache:1; /* Cache Maintenance */
         unsigned long eat:1;   /* External Abort Type */
 #ifdef CONFIG_ARM_32
-- 
2.0.1


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.