Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 212734
b: refs/heads/master
c: 6f2a753
h: refs/heads/master
v: v3
  • Loading branch information
Yinghai Lu authored and H. Peter Anvin committed Aug 27, 2010
1 parent 0f3376b commit 9442c65
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 8 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: a587d2daebcd2bc159d4348b6a7b028950a6d803
refs/heads/master: 6f2a75369e7561e800d86927ecd83c970996b21f
2 changes: 2 additions & 0 deletions trunk/arch/x86/include/asm/e820.h
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,8 @@ extern unsigned long e820_end_of_low_ram_pfn(void);
extern u64 early_reserve_e820(u64 startt, u64 sizet, u64 align);

void memblock_x86_fill(void);
void memblock_find_dma_reserve(void);

extern void finish_e820_parsing(void);
extern void e820_reserve_resources(void);
extern void e820_reserve_resources_late(void);
Expand Down
16 changes: 16 additions & 0 deletions trunk/arch/x86/kernel/e820.c
Original file line number Diff line number Diff line change
Expand Up @@ -1105,3 +1105,19 @@ void __init memblock_x86_fill(void)
memblock_analyze();
memblock_dump_all();
}

void __init memblock_find_dma_reserve(void)
{
#ifdef CONFIG_X86_64
u64 free_size_pfn;
u64 mem_size_pfn;
/*
* need to find out used area below MAX_DMA_PFN
* need to use memblock to get free size in [0, MAX_DMA_PFN]
* at first, and assume boot_mem will not take below MAX_DMA_PFN
*/
mem_size_pfn = memblock_x86_memory_in_range(0, MAX_DMA_PFN << PAGE_SHIFT) >> PAGE_SHIFT;
free_size_pfn = memblock_x86_free_memory_in_range(0, MAX_DMA_PFN << PAGE_SHIFT) >> PAGE_SHIFT;
set_dma_reserve(mem_size_pfn - free_size_pfn);
#endif
}
1 change: 1 addition & 0 deletions trunk/arch/x86/kernel/setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -1013,6 +1013,7 @@ void __init setup_arch(char **cmdline_p)
#endif

initmem_init(0, max_pfn, acpi, k8);
memblock_find_dma_reserve();
#ifndef CONFIG_NO_BOOTMEM
memblock_x86_to_bootmem(0, max_low_pfn<<PAGE_SHIFT);
#endif
Expand Down
7 changes: 0 additions & 7 deletions trunk/arch/x86/mm/init_64.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,6 @@
#include <asm/init.h>
#include <linux/bootmem.h>

static unsigned long dma_reserve __initdata;

static int __init parse_direct_gbpages_off(char *arg)
{
direct_gbpages = 0;
Expand Down Expand Up @@ -821,11 +819,6 @@ int __init reserve_bootmem_generic(unsigned long phys, unsigned long len,

reserve_bootmem(phys, len, flags);

if (phys+len <= MAX_DMA_PFN*PAGE_SIZE) {
dma_reserve += len / PAGE_SIZE;
set_dma_reserve(dma_reserve);
}

return 0;
}
#endif
Expand Down

0 comments on commit 9442c65

Please sign in to comment.