Commit 59a27e11 authored by Alexandre Ghiti's avatar Alexandre Ghiti Committed by Palmer Dabbelt

riscv: Optimize kernel virtual address conversion macro

The current test in kernel_mapping_va_to_pa only applies when
CONFIG_XIP_KERNEL is set, so use IS_ENABLED to optimize this macro at
compile-time in standard kernels that do not require this test.
Signed-off-by: default avatarAlexandre Ghiti <alex@ghiti.fr>
Tested-by: default avatarEmil Renner Berthing <kernel@esmil.dk>
Reviewed-by: default avatarJisheng Zhang <jszhang@kernel.org>
Reviewed-By: default avatarVitaly Wool <vitaly.wool@konsulko.com>
Signed-off-by: default avatarPalmer Dabbelt <palmerdabbelt@google.com>
parent 9f2a5aeb
......@@ -122,7 +122,7 @@ extern struct kernel_mapping kernel_map;
#define linear_mapping_va_to_pa(x) ((unsigned long)(x) - kernel_map.va_pa_offset)
#define kernel_mapping_va_to_pa(y) ({ \
unsigned long _y = y; \
(_y < kernel_map.virt_addr + XIP_OFFSET) ? \
(IS_ENABLED(CONFIG_XIP_KERNEL) && _y < kernel_map.virt_addr + XIP_OFFSET) ? \
((unsigned long)(_y) - kernel_map.va_kernel_xip_pa_offset) : \
((unsigned long)(_y) - kernel_map.va_kernel_pa_offset - XIP_OFFSET); \
})
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment