]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - arch/x86_64/mm/init.c
[PATCH] x86_64: Don't try to put kernel page tables beyond ZONE_DMA32.
[karo-tx-linux.git] / arch / x86_64 / mm / init.c
index 1faae5fc1c01c35c5e7cd7b1458bc34b5f63dd05..ef84106c1509b5d0b74b6f35d053ae0a95ee7c67 100644 (file)
@@ -23,6 +23,7 @@
 #include <linux/bootmem.h>
 #include <linux/proc_fs.h>
 #include <linux/pci.h>
+#include <linux/dma-mapping.h>
 
 #include <asm/processor.h>
 #include <asm/system.h>
 #include <asm/proto.h>
 #include <asm/smp.h>
 #include <asm/sections.h>
+#include <asm/dma-mapping.h>
+#include <asm/swiotlb.h>
 
 #ifndef Dprintk
 #define Dprintk(x...)
 #endif
 
+struct dma_mapping_ops* dma_ops;
+EXPORT_SYMBOL(dma_ops);
+
 static unsigned long dma_reserve __initdata;
 
 DEFINE_PER_CPU(struct mmu_gather, mmu_gathers);
@@ -249,14 +255,18 @@ static void __init phys_pud_init(pud_t *pud, unsigned long address, unsigned lon
 
 static void __init find_early_table_space(unsigned long end)
 {
-       unsigned long puds, pmds, tables;
+       unsigned long puds, pmds, tables, start;
 
        puds = (end + PUD_SIZE - 1) >> PUD_SHIFT;
        pmds = (end + PMD_SIZE - 1) >> PMD_SHIFT;
        tables = round_up(puds * sizeof(pud_t), PAGE_SIZE) +
                 round_up(pmds * sizeof(pmd_t), PAGE_SIZE);
 
-       table_start = find_e820_area(0x8000, __pa_symbol(&_text), tables);
+       /* RED-PEN putting page tables only on node 0 could
+          cause a hotspot and fill up ZONE_DMA. The page tables
+          need roughly 0.5KB per GB. */
+       start = 0x8000;
+       table_start = find_e820_area(start, end, tables);
        if (table_start == -1UL)
                panic("Cannot find space for the kernel page tables");
 
@@ -423,12 +433,9 @@ void __init mem_init(void)
        long codesize, reservedpages, datasize, initsize;
 
 #ifdef CONFIG_SWIOTLB
-       if (!iommu_aperture &&
-           (end_pfn >= 0xffffffff>>PAGE_SHIFT || force_iommu))
-              swiotlb = 1;
-       if (swiotlb)
-               swiotlb_init(); 
+       pci_swiotlb_init();
 #endif
+       no_iommu_init();
 
        /* How many end-of-memory variables you have, grandma! */
        max_low_pfn = end_pfn;