Commit 5491ff51 authored by Yinghai Lu's avatar Yinghai Lu Committed by Jesse Barnes

x86/PCI: Remove dma32_reserve_bootmem

This workaround holds a dma32 buffer at early boot to prevent later
bootmem allocations from stealing it in the case of large RAM configs.

Now that x86 is using memblock, and the nobootmem wrapper does top-down
allocation, it's no longer necessary, so remove it.
Signed-off-by: default avatarYinghai Lu <yinghai@kernel.org>
Signed-off-by: default avatarJesse Barnes <jbarnes@virtuousgeek.org>
parent 63c44080
...@@ -135,8 +135,6 @@ void default_teardown_msi_irqs(struct pci_dev *dev); ...@@ -135,8 +135,6 @@ void default_teardown_msi_irqs(struct pci_dev *dev);
#include "pci_64.h" #include "pci_64.h"
#endif #endif
void dma32_reserve_bootmem(void);
/* implement the pci_ DMA API in terms of the generic device dma_ one */ /* implement the pci_ DMA API in terms of the generic device dma_ one */
#include <asm-generic/pci-dma-compat.h> #include <asm-generic/pci-dma-compat.h>
......
...@@ -68,74 +68,10 @@ int dma_set_mask(struct device *dev, u64 mask) ...@@ -68,74 +68,10 @@ int dma_set_mask(struct device *dev, u64 mask)
} }
EXPORT_SYMBOL(dma_set_mask); EXPORT_SYMBOL(dma_set_mask);
#if defined(CONFIG_X86_64) && !defined(CONFIG_NUMA)
static __initdata void *dma32_bootmem_ptr;
static unsigned long dma32_bootmem_size __initdata = (128ULL<<20);
static int __init parse_dma32_size_opt(char *p)
{
if (!p)
return -EINVAL;
dma32_bootmem_size = memparse(p, &p);
return 0;
}
early_param("dma32_size", parse_dma32_size_opt);
void __init dma32_reserve_bootmem(void)
{
unsigned long size, align;
if (max_pfn <= MAX_DMA32_PFN)
return;
/*
* check aperture_64.c allocate_aperture() for reason about
* using 512M as goal
*/
align = 64ULL<<20;
size = roundup(dma32_bootmem_size, align);
dma32_bootmem_ptr = __alloc_bootmem_nopanic(size, align,
512ULL<<20);
/*
* Kmemleak should not scan this block as it may not be mapped via the
* kernel direct mapping.
*/
kmemleak_ignore(dma32_bootmem_ptr);
if (dma32_bootmem_ptr)
dma32_bootmem_size = size;
else
dma32_bootmem_size = 0;
}
static void __init dma32_free_bootmem(void)
{
if (max_pfn <= MAX_DMA32_PFN)
return;
if (!dma32_bootmem_ptr)
return;
free_bootmem(__pa(dma32_bootmem_ptr), dma32_bootmem_size);
dma32_bootmem_ptr = NULL;
dma32_bootmem_size = 0;
}
#else
void __init dma32_reserve_bootmem(void)
{
}
static void __init dma32_free_bootmem(void)
{
}
#endif
void __init pci_iommu_alloc(void) void __init pci_iommu_alloc(void)
{ {
struct iommu_table_entry *p; struct iommu_table_entry *p;
/* free the range so iommu could get some range less than 4G */
dma32_free_bootmem();
sort_iommu_table(__iommu_table, __iommu_table_end); sort_iommu_table(__iommu_table, __iommu_table_end);
check_iommu_entries(__iommu_table, __iommu_table_end); check_iommu_entries(__iommu_table, __iommu_table_end);
......
...@@ -966,7 +966,6 @@ void __init setup_arch(char **cmdline_p) ...@@ -966,7 +966,6 @@ void __init setup_arch(char **cmdline_p)
initmem_init(); initmem_init();
memblock_find_dma_reserve(); memblock_find_dma_reserve();
dma32_reserve_bootmem();
#ifdef CONFIG_KVM_CLOCK #ifdef CONFIG_KVM_CLOCK
kvmclock_init(); kvmclock_init();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment