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

[Xen-changelog] [xen master] xen/arm: traps: Second attempt to correctly use the content of HPFAR_EL2



commit 502c739d9bbaabbbe7c6968c7213f0ca8fcceeca
Author:     Julien Grall <julien.grall@xxxxxxx>
AuthorDate: Wed Jun 22 14:21:02 2016 +0100
Commit:     Stefano Stabellini <sstabellini@xxxxxxxxxx>
CommitDate: Thu Jul 14 12:13:09 2016 +0100

    xen/arm: traps: Second attempt to correctly use the content of HPFAR_EL2
    
    Commit c051618 "xen/arm: traps: Correctly interpret the content of the
    register HPFAR_EL2" attempted to fix the interpretation of HPFAR_EL2.
    
    However, the register contains a 4KB-aligned address. This means that
    the reported address is not directly usable to know the faulting IPA.
    The offset in the 4KB page can be found by looking at the associated virtual
    address (FAR_EL2/HDFAR).
    
    Signed-off-by: Julien Grall <julien.grall@xxxxxxx>
    Reviewed-by: Stefano Stabellini <sstabellini@xxxxxxxxxx>
---
 xen/arch/arm/traps.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/xen/arch/arm/traps.c b/xen/arch/arm/traps.c
index 42011c5..f7edd23 100644
--- a/xen/arch/arm/traps.c
+++ b/xen/arch/arm/traps.c
@@ -2371,11 +2371,15 @@ done:
     if (first) unmap_domain_page(first);
 }
 
-static inline paddr_t get_faulting_ipa(void)
+static inline paddr_t get_faulting_ipa(vaddr_t gva)
 {
     register_t hpfar = READ_SYSREG(HPFAR_EL2);
+    paddr_t ipa;
 
-    return ((paddr_t)(hpfar & HPFAR_MASK) << (12 - 4));
+    ipa = (paddr_t)(hpfar & HPFAR_MASK) << (12 - 4);
+    ipa |= gva & ~PAGE_MASK;
+
+    return ipa;
 }
 
 static void do_trap_instr_abort_guest(struct cpu_user_regs *regs,
@@ -2396,7 +2400,7 @@ static void do_trap_instr_abort_guest(struct 
cpu_user_regs *regs,
         };
 
         if ( hsr.iabt.s1ptw )
-            gpa = get_faulting_ipa();
+            gpa = get_faulting_ipa(gva);
         else
         {
             /*
@@ -2446,7 +2450,7 @@ static void do_trap_data_abort_guest(struct cpu_user_regs 
*regs,
 #endif
 
     if ( dabt.s1ptw )
-        info.gpa = get_faulting_ipa();
+        info.gpa = get_faulting_ipa(info.gva);
     else
     {
         rc = gva_to_ipa(info.gva, &info.gpa, GV2M_READ);
--
generated by git-patchbot for /home/xen/git/xen.git#master

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
https://lists.xenproject.org/xen-changelog

 


Rackspace

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