WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-ia64-devel

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

To: xen-ia64-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-ia64-devel] [patch 8/8] Kexec: Simplify EFI check in ia64_do_page_fault
From: Simon Horman <horms@xxxxxxxxxxxx>
Date: Tue, 23 Oct 2007 16:43:32 +0900
Cc: Isaku Yamahata <yamahata@xxxxxxxxxxxxx>, Alex Williamson <alex.williamson@xxxxxx>
Delivery-date: Tue, 23 Oct 2007 00:50:16 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-ia64-devel-request@lists.xensource.com?subject=help>
List-id: Discussion of the ia64 port of Xen <xen-ia64-devel.lists.xensource.com>
List-post: <mailto:xen-ia64-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-ia64-devel>, <mailto:xen-ia64-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-ia64-devel>, <mailto:xen-ia64-devel-request@lists.xensource.com?subject=unsubscribe>
References: <20071023074324.298028864@xxxxxxxxxxxx>
Sender: xen-ia64-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: quilt/0.46-1
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