Skip to content

Commit 75fdf79

Browse files
covanampalmer-dabbelt
authored andcommitted
riscv: drop the use of XIP_OFFSET in kernel_mapping_va_to_pa()
XIP_OFFSET is the hard-coded offset of writable data section within the kernel. By hard-coding this value, the read-only section of the kernel (which is placed before the writable data section) is restricted in size. As a preparation to remove this hard-coded macro XIP_OFFSET entirely, remove the use of XIP_OFFSET in kernel_mapping_va_to_pa(). The macro XIP_OFFSET is used in this case to check if the virtual address is mapped to Flash or to RAM. The same check can be done with kernel_map.xiprom_sz. Signed-off-by: Nam Cao <[email protected]> Reviewed-by: Alexandre Ghiti <[email protected]> Link: https://lore.kernel.org/r/644c13d9467525a06f5d63d157875a35b2edb4bc.1717789719.git.namcao@linutronix.de Signed-off-by: Palmer Dabbelt <[email protected]>
1 parent 23311f5 commit 75fdf79

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

arch/riscv/include/asm/page.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ phys_addr_t linear_mapping_va_to_pa(unsigned long x);
159159
#ifdef CONFIG_XIP_KERNEL
160160
#define kernel_mapping_va_to_pa(y) ({ \
161161
unsigned long _y = (unsigned long)(y); \
162-
(_y < kernel_map.virt_addr + XIP_OFFSET) ? \
162+
(_y < kernel_map.virt_addr + kernel_map.xiprom_sz) ? \
163163
(_y - kernel_map.va_kernel_xip_text_pa_offset) : \
164164
(_y - kernel_map.va_kernel_xip_data_pa_offset); \
165165
})

0 commit comments

Comments
 (0)