Commit 672c54466d24994eb9633f993862c89539504a42
1 parent
1b59be2a6c
Exists in
master
and in
4 other branches
dt/flattree: Return virtual address from early_init_dt_alloc_memory_arch()
The physical address is never used by the device tree code when allocating memory for unflattening. Change the architecture's alloc hook to return the virutal address instead. Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Showing 5 changed files with 8 additions and 16 deletions Side-by-side Diff
arch/microblaze/kernel/prom.c
... | ... | @@ -47,9 +47,9 @@ |
47 | 47 | memblock_add(base, size); |
48 | 48 | } |
49 | 49 | |
50 | -u64 __init early_init_dt_alloc_memory_arch(u64 size, u64 align) | |
50 | +void * __init early_init_dt_alloc_memory_arch(u64 size, u64 align) | |
51 | 51 | { |
52 | - return memblock_alloc(size, align); | |
52 | + return __va(memblock_alloc(size, align)); | |
53 | 53 | } |
54 | 54 | |
55 | 55 | #ifdef CONFIG_EARLY_PRINTK |
arch/mips/kernel/prom.c
... | ... | @@ -45,11 +45,9 @@ |
45 | 45 | return free_bootmem(addr, size); |
46 | 46 | } |
47 | 47 | |
48 | -u64 __init early_init_dt_alloc_memory_arch(u64 size, u64 align) | |
48 | +void * __init early_init_dt_alloc_memory_arch(u64 size, u64 align) | |
49 | 49 | { |
50 | - return virt_to_phys( | |
51 | - __alloc_bootmem(size, align, __pa(MAX_DMA_ADDRESS)) | |
52 | - ); | |
50 | + return __alloc_bootmem(size, align, __pa(MAX_DMA_ADDRESS)); | |
53 | 51 | } |
54 | 52 | |
55 | 53 | #ifdef CONFIG_BLK_DEV_INITRD |
arch/powerpc/kernel/prom.c
... | ... | @@ -519,9 +519,9 @@ |
519 | 519 | memblock_add(base, size); |
520 | 520 | } |
521 | 521 | |
522 | -u64 __init early_init_dt_alloc_memory_arch(u64 size, u64 align) | |
522 | +void * __init early_init_dt_alloc_memory_arch(u64 size, u64 align) | |
523 | 523 | { |
524 | - return memblock_alloc(size, align); | |
524 | + return __va(memblock_alloc(size, align)); | |
525 | 525 | } |
526 | 526 | |
527 | 527 | #ifdef CONFIG_BLK_DEV_INITRD |
drivers/of/fdt.c
... | ... | @@ -692,12 +692,6 @@ |
692 | 692 | return 1; |
693 | 693 | } |
694 | 694 | |
695 | -static void *__init early_device_tree_alloc(u64 size, u64 align) | |
696 | -{ | |
697 | - unsigned long mem = early_init_dt_alloc_memory_arch(size, align); | |
698 | - return __va(mem); | |
699 | -} | |
700 | - | |
701 | 695 | /** |
702 | 696 | * unflatten_device_tree - create tree of device_nodes from flat blob |
703 | 697 | * |
... | ... | @@ -709,7 +703,7 @@ |
709 | 703 | void __init unflatten_device_tree(void) |
710 | 704 | { |
711 | 705 | __unflatten_device_tree(initial_boot_params, &allnodes, |
712 | - early_device_tree_alloc); | |
706 | + early_init_dt_alloc_memory_arch); | |
713 | 707 | |
714 | 708 | /* Get pointer to OF "/chosen" node for use everywhere */ |
715 | 709 | of_chosen = of_find_node_by_path("/chosen"); |
include/linux/of_fdt.h
... | ... | @@ -97,7 +97,7 @@ |
97 | 97 | extern int early_init_dt_scan_memory(unsigned long node, const char *uname, |
98 | 98 | int depth, void *data); |
99 | 99 | extern void early_init_dt_add_memory_arch(u64 base, u64 size); |
100 | -extern u64 early_init_dt_alloc_memory_arch(u64 size, u64 align); | |
100 | +extern void * early_init_dt_alloc_memory_arch(u64 size, u64 align); | |
101 | 101 | extern u64 dt_mem_next_cell(int s, __be32 **cellp); |
102 | 102 | |
103 | 103 | /* |