Skip to content

Commit ab4f2ee

Browse files
Russell KingRussell King
authored andcommitted
[ARM] fix naming of MODULE_START / MODULE_END
As of 73bdf0a, the kernel needs to know where modules are located in the virtual address space. On ARM, we located this region between MODULE_START and MODULE_END. Unfortunately, everyone else calls it MODULES_VADDR and MODULES_END. Update ARM to use the same naming, so is_vmalloc_or_module_addr() can work properly. Also update the comment on mm/vmalloc.c to reflect that ARM also places modules in a separate region from the vmalloc space. Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
1 parent d2ed5cb commit ab4f2ee

4 files changed

Lines changed: 13 additions & 13 deletions

File tree

‎arch/arm/include/asm/memory.h‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,10 @@
4444
* The module space lives between the addresses given by TASK_SIZE
4545
* and PAGE_OFFSET - it must be within 32MB of the kernel text.
4646
*/
47-
#define MODULE_END (PAGE_OFFSET)
48-
#define MODULE_START (MODULE_END - 16*1048576)
47+
#define MODULES_END (PAGE_OFFSET)
48+
#define MODULES_VADDR (MODULES_END - 16*1048576)
4949

50-
#if TASK_SIZE > MODULE_START
50+
#if TASK_SIZE > MODULES_VADDR
5151
#error Top of user space clashes with start of module space
5252
#endif
5353

@@ -56,7 +56,7 @@
5656
* Since we use sections to map it, this macro replaces the physical address
5757
* with its virtual address while keeping offset from the base section.
5858
*/
59-
#define XIP_VIRT_ADDR(physaddr) (MODULE_START + ((physaddr) & 0x000fffff))
59+
#define XIP_VIRT_ADDR(physaddr) (MODULES_VADDR + ((physaddr) & 0x000fffff))
6060

6161
/*
6262
* Allow 16MB-aligned ioremap pages
@@ -94,8 +94,8 @@
9494
/*
9595
* The module can be at any place in ram in nommu mode.
9696
*/
97-
#define MODULE_END (END_MEM)
98-
#define MODULE_START (PHYS_OFFSET)
97+
#define MODULES_END (END_MEM)
98+
#define MODULES_VADDR (PHYS_OFFSET)
9999

100100
#endif /* !CONFIG_MMU */
101101

‎arch/arm/kernel/module.c‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,12 @@
2626
/*
2727
* The XIP kernel text is mapped in the module area for modules and
2828
* some other stuff to work without any indirect relocations.
29-
* MODULE_START is redefined here and not in asm/memory.h to avoid
29+
* MODULES_VADDR is redefined here and not in asm/memory.h to avoid
3030
* recompiling the whole kernel when CONFIG_XIP_KERNEL is turned on/off.
3131
*/
3232
extern void _etext;
33-
#undef MODULE_START
34-
#define MODULE_START (((unsigned long)&_etext + ~PGDIR_MASK) & PGDIR_MASK)
33+
#undef MODULES_VADDR
34+
#define MODULES_VADDR (((unsigned long)&_etext + ~PGDIR_MASK) & PGDIR_MASK)
3535
#endif
3636

3737
#ifdef CONFIG_MMU
@@ -43,7 +43,7 @@ void *module_alloc(unsigned long size)
4343
if (!size)
4444
return NULL;
4545

46-
area = __get_vm_area(size, VM_ALLOC, MODULE_START, MODULE_END);
46+
area = __get_vm_area(size, VM_ALLOC, MODULES_VADDR, MODULES_END);
4747
if (!area)
4848
return NULL;
4949

‎arch/arm/mm/mmu.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -654,7 +654,7 @@ static inline void prepare_page_table(struct meminfo *mi)
654654
/*
655655
* Clear out all the mappings below the kernel image.
656656
*/
657-
for (addr = 0; addr < MODULE_START; addr += PGDIR_SIZE)
657+
for (addr = 0; addr < MODULES_VADDR; addr += PGDIR_SIZE)
658658
pmd_clear(pmd_off_k(addr));
659659

660660
#ifdef CONFIG_XIP_KERNEL
@@ -766,7 +766,7 @@ static void __init devicemaps_init(struct machine_desc *mdesc)
766766
*/
767767
#ifdef CONFIG_XIP_KERNEL
768768
map.pfn = __phys_to_pfn(CONFIG_XIP_PHYS_ADDR & SECTION_MASK);
769-
map.virtual = MODULE_START;
769+
map.virtual = MODULES_VADDR;
770770
map.length = ((unsigned long)&_etext - map.virtual + ~SECTION_MASK) & SECTION_MASK;
771771
map.type = MT_ROM;
772772
create_mapping(&map);

‎mm/vmalloc.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ static int vmap_page_range(unsigned long addr, unsigned long end,
178178
static inline int is_vmalloc_or_module_addr(const void *x)
179179
{
180180
/*
181-
* x86-64 and sparc64 put modules in a special place,
181+
* ARM, x86-64 and sparc64 put modules in a special place,
182182
* and fall back on vmalloc() if that fails. Others
183183
* just put it in the vmalloc space.
184184
*/

0 commit comments

Comments
 (0)