mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-09-18 22:14:16 +00:00
nios2: define virtual address space for modules
nios2 uses kmalloc() to implement module_alloc() because CALL26/PCREL26 cannot reach all of vmalloc address space. Define module space as 32MiB below the kernel base and switch nios2 to use vmalloc for module allocations. Suggested-by: Thomas Gleixner <tglx@linutronix.de> Acked-by: Dinh Nguyen <dinguyen@kernel.org> Acked-by: Song Liu <song@kernel.org> Signed-off-by: Mike Rapoport (IBM) <rppt@kernel.org> Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
This commit is contained in:
parent
0cdf5876c4
commit
38762155fd
2 changed files with 8 additions and 16 deletions
|
@ -25,7 +25,10 @@
|
||||||
#include <asm-generic/pgtable-nopmd.h>
|
#include <asm-generic/pgtable-nopmd.h>
|
||||||
|
|
||||||
#define VMALLOC_START CONFIG_NIOS2_KERNEL_MMU_REGION_BASE
|
#define VMALLOC_START CONFIG_NIOS2_KERNEL_MMU_REGION_BASE
|
||||||
#define VMALLOC_END (CONFIG_NIOS2_KERNEL_REGION_BASE - 1)
|
#define VMALLOC_END (CONFIG_NIOS2_KERNEL_REGION_BASE - SZ_32M - 1)
|
||||||
|
|
||||||
|
#define MODULES_VADDR (CONFIG_NIOS2_KERNEL_REGION_BASE - SZ_32M)
|
||||||
|
#define MODULES_END (CONFIG_NIOS2_KERNEL_REGION_BASE - 1)
|
||||||
|
|
||||||
struct mm_struct;
|
struct mm_struct;
|
||||||
|
|
||||||
|
|
|
@ -21,23 +21,12 @@
|
||||||
|
|
||||||
#include <asm/cacheflush.h>
|
#include <asm/cacheflush.h>
|
||||||
|
|
||||||
/*
|
|
||||||
* Modules should NOT be allocated with kmalloc for (obvious) reasons.
|
|
||||||
* But we do it for now to avoid relocation issues. CALL26/PCREL26 cannot reach
|
|
||||||
* from 0x80000000 (vmalloc area) to 0xc00000000 (kernel) (kmalloc returns
|
|
||||||
* addresses in 0xc0000000)
|
|
||||||
*/
|
|
||||||
void *module_alloc(unsigned long size)
|
void *module_alloc(unsigned long size)
|
||||||
{
|
{
|
||||||
if (size == 0)
|
return __vmalloc_node_range(size, 1, MODULES_VADDR, MODULES_END,
|
||||||
return NULL;
|
GFP_KERNEL, PAGE_KERNEL_EXEC,
|
||||||
return kmalloc(size, GFP_KERNEL);
|
VM_FLUSH_RESET_PERMS, NUMA_NO_NODE,
|
||||||
}
|
__builtin_return_address(0));
|
||||||
|
|
||||||
/* Free memory returned from module_alloc */
|
|
||||||
void module_memfree(void *module_region)
|
|
||||||
{
|
|
||||||
kfree(module_region);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int apply_relocate_add(Elf32_Shdr *sechdrs, const char *strtab,
|
int apply_relocate_add(Elf32_Shdr *sechdrs, const char *strtab,
|
||||||
|
|
Loading…
Add table
Reference in a new issue