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

[Xen-changelog] [xen stable-4.2] x86_32: fix acpi_dmar_init()



commit b5445b141f6809dd4fa3ee4a11926eab6fc1f50c
Author:     Jan Beulich <jbeulich@xxxxxxxx>
AuthorDate: Mon Feb 25 13:20:22 2013 +0100
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Mon Feb 25 13:20:22 2013 +0100

    x86_32: fix acpi_dmar_init()
    
    map_pages_to_xen() can't be used here on x86_32, need to use up to 2
    newly introduced fixmap entries for this instead.
    
    Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
---
 xen/drivers/passthrough/vtd/dmar.c |   15 +++++++++++++++
 xen/include/asm-x86/fixmap.h       |    2 ++
 2 files changed, 17 insertions(+), 0 deletions(-)

diff --git a/xen/drivers/passthrough/vtd/dmar.c 
b/xen/drivers/passthrough/vtd/dmar.c
index 73ad1d7..a88f46b 100644
--- a/xen/drivers/passthrough/vtd/dmar.c
+++ b/xen/drivers/passthrough/vtd/dmar.c
@@ -776,6 +776,7 @@ out:
 }
 
 #ifdef CONFIG_X86
+#include <asm/fixmap.h>
 #include <asm/tboot.h>
 /* ACPI tables may not be DMA protected by tboot, so use DMAR copy */
 /* SINIT saved in SinitMleData in TXT heap (which is DMA protected) */
@@ -792,12 +793,26 @@ int __init acpi_dmar_init(void)
     if ( ACPI_SUCCESS(acpi_get_table_phys(ACPI_SIG_DMAR, 0,
                                           &dmar_addr, &dmar_len)) )
     {
+#ifdef CONFIG_X86_32
+        if ( dmar_addr + dmar_len > (DIRECTMAP_MBYTES << 20) )
+        {
+            unsigned long offset = dmar_addr & (PAGE_SIZE - 1);
+            unsigned long mapped_size = PAGE_SIZE - offset;
+
+            set_fixmap(FIX_DMAR_ZAP_LO, dmar_addr);
+            if ( mapped_size < sizeof(*dmar_table) )
+                set_fixmap(FIX_DMAR_ZAP_HI, dmar_addr + PAGE_SIZE);
+            dmar_table = (void *)fix_to_virt(FIX_DMAR_ZAP_LO) + offset;
+            goto exit;
+        }
+#endif
         map_pages_to_xen((unsigned long)__va(dmar_addr), PFN_DOWN(dmar_addr),
                          PFN_UP(dmar_addr + dmar_len) - PFN_DOWN(dmar_addr),
                          PAGE_HYPERVISOR);
         dmar_table = __va(dmar_addr);
     }
 
+ exit: __attribute__((__unused__))
     return parse_dmar_table(acpi_parse_dmar);
 }
 
diff --git a/xen/include/asm-x86/fixmap.h b/xen/include/asm-x86/fixmap.h
index 695e8d9..0a7aafa 100644
--- a/xen/include/asm-x86/fixmap.h
+++ b/xen/include/asm-x86/fixmap.h
@@ -37,6 +37,8 @@ enum fixed_addresses {
     FIX_PAE_HIGHMEM_END = FIX_PAE_HIGHMEM_0 + NR_CPUS-1,
 #define FIX_VGC_END FIX_PAE_HIGHMEM_0
 #define FIX_VGC_BEGIN FIX_PAE_HIGHMEM_END
+    FIX_DMAR_ZAP_HI,
+    FIX_DMAR_ZAP_LO,
 #else
     FIX_VGC_END,
     FIX_VGC_BEGIN = FIX_VGC_END
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.2

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

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