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

[Xen-ia64-devel] [patch 8/8] Kexec: Simplify EFI check in ia64_do_page_fault



This simplifies the check in ia64_do_page_fault() for an EFI mapping.  It
the course of doing this it elimiates the expensive call to
efi_mem_attributes(). And the check against guest_mode(regs), as suggested
by Yamahata-san. Neither of these checks are neccessary now that a special
RID is used for EFI, as a fault occur for these virtual addresses with the
EFI RID set if they are actually EFI addresses.

This also mirrors the check which is used in assembly in
efi_mem_attributes().  The reason that the C version was more comprehensive
relates to the way that the EFI mapping code patches evolved and put
simply, I was being very defensive while I was trying to get things right.
The assembly code came later, and thus I was more comfortable with using
fewer checks at that time.

Cc: Isaku Yamahata <yamahata@xxxxxxxxxxxxx>
Cc: Tristan Gingold <tgingold@xxxxxxx>
Signed-off-by: Simon Horman <horms@xxxxxxxxxxxx>

Index: xen-unstable.hg/xen/arch/ia64/xen/faults.c
===================================================================
--- xen-unstable.hg.orig/xen/arch/ia64/xen/faults.c     2007-10-23 
14:00:34.000000000 +0900
+++ xen-unstable.hg/xen/arch/ia64/xen/faults.c  2007-10-23 14:10:12.000000000 
+0900
@@ -184,25 +184,22 @@ void ia64_do_page_fault(unsigned long ad
        }
 
  again:
-       if (!guest_mode(regs)) {
-               if (address >> 59 == __IA64_EFI_CACHED_OFFSET >> 59) {
-                       attr = efi_mem_attributes(address &
-                                                 ~__IA64_EFI_CACHED_OFFSET);
-                       if (! (attr & EFI_MEMORY_RUNTIME &&
-                              attr & EFI_MEMORY_WB &&
-                              ia64_get_rr(7) == XEN_EFI_RID) )
-                               attr = 0;
-               }
-               else if (address >> 59 == __IA64_EFI_UNCACHED_OFFSET >> 59) {
-                       attr = efi_mem_attributes(address &
-                                                 ~__IA64_EFI_UNCACHED_OFFSET);
-                       if (! ((attr & EFI_MEMORY_RUNTIME) &&
-                              (attr & (EFI_MEMORY_UC|EFI_MEMORY_WC|
-                                       EFI_MEMORY_WT)) &&
-                              ia64_get_rr(6) == XEN_EFI_RID) )
-                               attr = 0;
-               }
-       }
+       /* All that matters here is that if we are accessing EFI memory
+        * we note that by setting EFI_MEMORY_WB for cached access
+        * or EFI_MEMORY_UC for uncached access. The actuall efi attibutes
+        * are not of any interest as we can deduce the needed values.
+        * This avoids an expensive call to efi_mem_attributes().
+        *
+        * The RID check prevents domains from accessing this memory.
+        *
+        * This check is also duplicated in assembly in alt_dtlb_miss
+        */
+       if (address >> 59 == __IA64_EFI_CACHED_OFFSET >> 59 &&
+           ia64_get_rr(7) == XEN_EFI_RID)
+               attr = EFI_MEMORY_WB;
+       else if (address >> 59 == __IA64_EFI_UNCACHED_OFFSET >> 59 &&
+                ia64_get_rr(6) == XEN_EFI_RID)
+               attr = EFI_MEMORY_UC;
 
        fault = vcpu_translate(current, address, is_data, &pteval,
                               &itir, &iha, attr);

-- 

-- 
Horms
  H: http://www.vergenet.net/~horms/
  W: http://www.valinux.co.jp/en/


_______________________________________________
Xen-ia64-devel mailing list
Xen-ia64-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-ia64-devel


 


Rackspace

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