Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 108638
b: refs/heads/master
c: 60296c7
h: refs/heads/master
v: v3
  • Loading branch information
Lennert Buytenhek authored and Lennert Buytenhek committed Aug 9, 2008
1 parent ec3a55b commit 4e9847b
Show file tree
Hide file tree
Showing 4 changed files with 72 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 09c0ed2e6eb87613b2670c15ba771ac671db19d9
refs/heads/master: 60296c71f6c5063e3c1f1d2619ca0b60940162e7
8 changes: 8 additions & 0 deletions trunk/arch/arm/include/asm/memory.h
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,14 @@
#define arch_adjust_zones(node,size,holes) do { } while (0)
#endif

/*
* Amount of memory reserved for the vmalloc() area, and minimum
* address for vmalloc mappings.
*/
extern unsigned long vmalloc_reserve;

#define VMALLOC_MIN (void *)(VMALLOC_END - vmalloc_reserve)

/*
* PFNs are used to describe any physical page; this means
* PFN 0 == physical address 0.
Expand Down
13 changes: 13 additions & 0 deletions trunk/arch/arm/kernel/setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ EXPORT_SYMBOL(system_serial_high);
unsigned int elf_hwcap;
EXPORT_SYMBOL(elf_hwcap);

unsigned long __initdata vmalloc_reserve = 128 << 20;


#ifdef MULTI_CPU
struct processor processor;
Expand Down Expand Up @@ -500,6 +502,17 @@ static void __init early_mem(char **p)
}
__early_param("mem=", early_mem);

/*
* vmalloc=size forces the vmalloc area to be exactly 'size'
* bytes. This can be used to increase (or decrease) the vmalloc
* area - the default is 128m.
*/
static void __init early_vmalloc(char **arg)
{
vmalloc_reserve = memparse(*arg, arg);
}
__early_param("vmalloc=", early_vmalloc);

/*
* Initial parsing of the command line.
*/
Expand Down
50 changes: 50 additions & 0 deletions trunk/arch/arm/mm/mmu.c
Original file line number Diff line number Diff line change
Expand Up @@ -568,6 +568,55 @@ void __init iotable_init(struct map_desc *io_desc, int nr)
create_mapping(io_desc + i);
}

static int __init check_membank_valid(struct membank *mb)
{
/*
* Check whether this memory region has non-zero size.
*/
if (mb->size == 0)
return 0;

/*
* Check whether this memory region would entirely overlap
* the vmalloc area.
*/
if (phys_to_virt(mb->start) >= VMALLOC_MIN) {
printk(KERN_NOTICE "Ignoring RAM at %.8lx-%.8lx "
"(vmalloc region overlap).\n",
mb->start, mb->start + mb->size - 1);
return 0;
}

/*
* Check whether this memory region would partially overlap
* the vmalloc area.
*/
if (phys_to_virt(mb->start + mb->size) < phys_to_virt(mb->start) ||
phys_to_virt(mb->start + mb->size) > VMALLOC_MIN) {
unsigned long newsize = VMALLOC_MIN - phys_to_virt(mb->start);

printk(KERN_NOTICE "Truncating RAM at %.8lx-%.8lx "
"to -%.8lx (vmalloc region overlap).\n",
mb->start, mb->start + mb->size - 1,
mb->start + newsize - 1);
mb->size = newsize;
}

return 1;
}

static void __init sanity_check_meminfo(struct meminfo *mi)
{
int i;
int j;

for (i = 0, j = 0; i < mi->nr_banks; i++) {
if (check_membank_valid(&mi->bank[i]))
mi->bank[j++] = mi->bank[i];
}
mi->nr_banks = j;
}

static inline void prepare_page_table(struct meminfo *mi)
{
unsigned long addr;
Expand Down Expand Up @@ -753,6 +802,7 @@ void __init paging_init(struct meminfo *mi, struct machine_desc *mdesc)
void *zero_page;

build_mem_type_table();
sanity_check_meminfo(mi);
prepare_page_table(mi);
bootmem_init(mi);
devicemaps_init(mdesc);
Expand Down

0 comments on commit 4e9847b

Please sign in to comment.