]> git.baikalelectronics.ru Git - kernel.git/commit
riscv: Get rid of CONFIG_PHYS_RAM_BASE in kernel physical address conversion
authorAlexandre Ghiti <alex@ghiti.fr>
Wed, 21 Jul 2021 07:59:35 +0000 (09:59 +0200)
committerPalmer Dabbelt <palmerdabbelt@google.com>
Sat, 7 Aug 2021 05:41:28 +0000 (22:41 -0700)
commit52d8a372f9b47200375ef88aaac9ed4452068d62
treec7eab36885e2e1985241ad931afe48c15bc4f411
parent8acbcc2c526e357b5b483f40da414468100e342a
riscv: Get rid of CONFIG_PHYS_RAM_BASE in kernel physical address conversion

The usage of CONFIG_PHYS_RAM_BASE for all kernel types was a mistake:
this value is implementation-specific and this breaks the genericity of
the RISC-V kernel.

Fix this by introducing a new variable phys_ram_base that holds this
value at runtime and use it in the kernel physical address conversion
macro. Since this value is used only for XIP kernels, evaluate it only if
CONFIG_XIP_KERNEL is set which in addition optimizes this macro for
standard kernels at compile-time.

Signed-off-by: Alexandre Ghiti <alex@ghiti.fr>
Tested-by: Emil Renner Berthing <kernel@esmil.dk>
Reviewed-by: Jisheng Zhang <jszhang@kernel.org>
Fixes: d8fd95cc20ec ("RISC-V: enable XIP")
Cc: stable@vger.kernel.org
Signed-off-by: Palmer Dabbelt <palmerdabbelt@google.com>
arch/riscv/include/asm/page.h
arch/riscv/mm/init.c