Skip to content

Commit 977765c

Browse files
AlexGhitipalmer-dabbelt
authored andcommitted
riscv: Simplify BUILTIN_DTB device tree mapping handling
__PAGETABLE_PMD_FOLDED defines a 2-level page table that is only used in 32-bit kernel, so there is no need to check for CONFIG_64BIT in #ifndef __PAGETABLE_PMD_FOLDED and vice-versa. Signed-off-by: Alexandre Ghiti <[email protected]> Signed-off-by: Palmer Dabbelt <[email protected]>
1 parent 6f3e5fd commit 977765c

File tree

1 file changed

+2
-10
lines changed

1 file changed

+2
-10
lines changed

arch/riscv/mm/init.c

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -607,18 +607,14 @@ asmlinkage void __init setup_vm(uintptr_t dtb_pa)
607607
pa + PMD_SIZE, PMD_SIZE, PAGE_KERNEL);
608608
dtb_early_va = (void *)DTB_EARLY_BASE_VA + (dtb_pa & (PMD_SIZE - 1));
609609
#else /* CONFIG_BUILTIN_DTB */
610-
#ifdef CONFIG_64BIT
611610
/*
612611
* __va can't be used since it would return a linear mapping address
613612
* whereas dtb_early_va will be used before setup_vm_final installs
614613
* the linear mapping.
615614
*/
616615
dtb_early_va = kernel_mapping_pa_to_va(XIP_FIXUP(dtb_pa));
617-
#else
618-
dtb_early_va = __va(dtb_pa);
619-
#endif /* CONFIG_64BIT */
620616
#endif /* CONFIG_BUILTIN_DTB */
621-
#else
617+
#else /* __PAGETABLE_PMD_FOLDED */
622618
#ifndef CONFIG_BUILTIN_DTB
623619
/* Create two consecutive PGD mappings for FDT early scan */
624620
pa = dtb_pa & ~(PGDIR_SIZE - 1);
@@ -628,13 +624,9 @@ asmlinkage void __init setup_vm(uintptr_t dtb_pa)
628624
pa + PGDIR_SIZE, PGDIR_SIZE, PAGE_KERNEL);
629625
dtb_early_va = (void *)DTB_EARLY_BASE_VA + (dtb_pa & (PGDIR_SIZE - 1));
630626
#else /* CONFIG_BUILTIN_DTB */
631-
#ifdef CONFIG_64BIT
632-
dtb_early_va = kernel_mapping_pa_to_va(XIP_FIXUP(dtb_pa));
633-
#else
634627
dtb_early_va = __va(dtb_pa);
635-
#endif /* CONFIG_64BIT */
636628
#endif /* CONFIG_BUILTIN_DTB */
637-
#endif
629+
#endif /* __PAGETABLE_PMD_FOLDED */
638630
dtb_early_pa = dtb_pa;
639631

640632
/*

0 commit comments

Comments
 (0)