Commit f88eff74 authored by Yinghai Lu's avatar Yinghai Lu Committed by H. Peter Anvin

bootmem, x86: Add weak version of reserve_bootmem_generic

It will be used memblock_x86_to_bootmem converting

It is an wrapper for reserve_bootmem, and x86 64bit is using special one.

Also clean up that version for x86_64. We don't need to take care of numa
path for that, bootmem can handle it how
Signed-off-by: default avatarYinghai Lu <yinghai@kernel.org>
Signed-off-by: default avatarH. Peter Anvin <hpa@zytor.com>
parent fb74fb6d
...@@ -1069,9 +1069,3 @@ void mark_rodata_ro(void) ...@@ -1069,9 +1069,3 @@ void mark_rodata_ro(void)
#endif #endif
} }
#endif #endif
int __init reserve_bootmem_generic(unsigned long phys, unsigned long len,
int flags)
{
return reserve_bootmem(phys, len, flags);
}
...@@ -799,13 +799,10 @@ void mark_rodata_ro(void) ...@@ -799,13 +799,10 @@ void mark_rodata_ro(void)
#endif #endif
#ifndef CONFIG_NO_BOOTMEM
int __init reserve_bootmem_generic(unsigned long phys, unsigned long len, int __init reserve_bootmem_generic(unsigned long phys, unsigned long len,
int flags) int flags)
{ {
#ifdef CONFIG_NUMA
int nid, next_nid;
int ret;
#endif
unsigned long pfn = phys >> PAGE_SHIFT; unsigned long pfn = phys >> PAGE_SHIFT;
if (pfn >= max_pfn) { if (pfn >= max_pfn) {
...@@ -821,21 +818,7 @@ int __init reserve_bootmem_generic(unsigned long phys, unsigned long len, ...@@ -821,21 +818,7 @@ int __init reserve_bootmem_generic(unsigned long phys, unsigned long len,
return -EFAULT; return -EFAULT;
} }
/* Should check here against the e820 map to avoid double free */
#ifdef CONFIG_NUMA
nid = phys_to_nid(phys);
next_nid = phys_to_nid(phys + len - 1);
if (nid == next_nid)
ret = reserve_bootmem_node(NODE_DATA(nid), phys, len, flags);
else
ret = reserve_bootmem(phys, len, flags);
if (ret != 0)
return ret;
#else
reserve_bootmem(phys, len, flags); reserve_bootmem(phys, len, flags);
#endif
if (phys+len <= MAX_DMA_PFN*PAGE_SIZE) { if (phys+len <= MAX_DMA_PFN*PAGE_SIZE) {
dma_reserve += len / PAGE_SIZE; dma_reserve += len / PAGE_SIZE;
...@@ -844,6 +827,7 @@ int __init reserve_bootmem_generic(unsigned long phys, unsigned long len, ...@@ -844,6 +827,7 @@ int __init reserve_bootmem_generic(unsigned long phys, unsigned long len,
return 0; return 0;
} }
#endif
int kern_addr_valid(unsigned long addr) int kern_addr_valid(unsigned long addr)
{ {
......
...@@ -526,6 +526,12 @@ int __init reserve_bootmem(unsigned long addr, unsigned long size, ...@@ -526,6 +526,12 @@ int __init reserve_bootmem(unsigned long addr, unsigned long size,
} }
#ifndef CONFIG_NO_BOOTMEM #ifndef CONFIG_NO_BOOTMEM
int __weak __init reserve_bootmem_generic(unsigned long phys, unsigned long len,
int flags)
{
return reserve_bootmem(phys, len, flags);
}
static unsigned long __init align_idx(struct bootmem_data *bdata, static unsigned long __init align_idx(struct bootmem_data *bdata,
unsigned long idx, unsigned long step) unsigned long idx, unsigned long step)
{ {
......
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