 
	
| [Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-ia64-devel] [patch] respect memory attributes for EFI_RUNTIME memory
 Hi, The code in complete_dom0_memmap() was overly simplified pretending all EFI_RUNTIME memory was writable and cachable. Xen must respect the EFI memory attributes correctly when assigning these pages. This one should be against Alex's tree, but it also applies with a minor modification to Isaku's NUMA patches. Alex, I'd appreciate it if you apply this one, it's important for sn2. Thanks, Jes Respect memory attributes when mapping EFI_RUNTIME and reserved pages.
Not all of these pages are writable and/or cachable!
Signed-off-by: Jes Sorensen <jes@xxxxxxx>
diff -r 533e06b4151c xen/arch/ia64/xen/dom_fw.c
--- a/xen/arch/ia64/xen/dom_fw.c        Fri Dec 29 14:28:10 2006 +0100
+++ b/xen/arch/ia64/xen/dom_fw.c        Fri Dec 29 16:23:21 2006 +0100
@@ -516,10 +516,11 @@ complete_dom0_memmap(struct domain *d,
 {
        efi_memory_desc_t *md;
        u64 addr;
        int j;
        void *efi_map_start, *efi_map_end, *p;
        u64 efi_desc_size;
        int i;
+       unsigned long flags;
 
        /* Walk through all MDT entries.
           Copy all interesting entries.  */
@@ -540,9 +541,19 @@ complete_dom0_memmap(struct domain *d,
                case EFI_ACPI_RECLAIM_MEMORY:
                case EFI_ACPI_MEMORY_NVS:
                case EFI_RESERVED_TYPE:
-                       /* Map into dom0 - All these are writable.  */
-                       assign_domain_mach_page(d, start, size,
-                                               ASSIGN_writable);
+                       /*
+                        * Map into dom0 - we must respect protection 
+                        * and cache attributes. Not all of these pages
+                        * are writable!!!
+                        */
+                       flags = ASSIGN_writable;        /* dummy - zero */
+                       if (md->attribute & EFI_MEMORY_WP)
+                               flags |= ASSIGN_readonly;
+                       if (md->attribute & EFI_MEMORY_UC)
+                               flags |= ASSIGN_nocache;
+
+                       assign_domain_mach_page(d, start, size, flags);
+
                        /* Fall-through.  */
                case EFI_MEMORY_MAPPED_IO:
                        /* Will be mapped with ioremap.  */
_______________________________________________ Xen-ia64-devel mailing list Xen-ia64-devel@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-ia64-devel 
 | 
|  | Lists.xenproject.org is hosted with RackSpace, monitoring our |