diff mbox series

[v2,2/8] riscv: don't export va_kernel_pa_offset in vmcoreinfo for XIP kernel

Message ID 8f8760d3f9a11af4ea0acbc247e4f49ff5d317e9.1717789719.git.namcao@linutronix.de (mailing list archive)
State Accepted
Commit f2df5b4fdd74a3490c35498de935ebf4f9b7c382
Headers show
Series remove size limit on XIP kernel | expand

Checks

Context Check Description
conchuod/vmtest-fixes-PR fail merge-conflict

Commit Message

Nam Cao June 7, 2024, 8:22 p.m. UTC
The crash utility uses va_kernel_pa_offset to translate virtual addresses.
This is incorrect in the case of XIP kernel, because va_kernel_pa_offset is
not the virtual-physical address offset (yes, the name is misleading; this
variable will be removed for XIP in a following commit).

Stop exporting this variable for XIP kernel. The replacement is to be
determined, note it as a TODO for now.

Signed-off-by: Nam Cao <namcao@linutronix.de>
---
 arch/riscv/kernel/vmcore_info.c | 7 +++++++
 1 file changed, 7 insertions(+)

Comments

Alexandre Ghiti June 21, 2024, 10:27 a.m. UTC | #1
Hi Nam,

On 07/06/2024 22:22, Nam Cao wrote:
> The crash utility uses va_kernel_pa_offset to translate virtual addresses.
> This is incorrect in the case of XIP kernel, because va_kernel_pa_offset is
> not the virtual-physical address offset (yes, the name is misleading; this
> variable will be removed for XIP in a following commit).
>
> Stop exporting this variable for XIP kernel. The replacement is to be
> determined, note it as a TODO for now.
>
> Signed-off-by: Nam Cao <namcao@linutronix.de>
> ---
>   arch/riscv/kernel/vmcore_info.c | 7 +++++++
>   1 file changed, 7 insertions(+)
>
> diff --git a/arch/riscv/kernel/vmcore_info.c b/arch/riscv/kernel/vmcore_info.c
> index 6d7a22522d63..d5e448aa90e7 100644
> --- a/arch/riscv/kernel/vmcore_info.c
> +++ b/arch/riscv/kernel/vmcore_info.c
> @@ -19,6 +19,13 @@ void arch_crash_save_vmcoreinfo(void)
>   #endif
>   #endif
>   	vmcoreinfo_append_str("NUMBER(KERNEL_LINK_ADDR)=0x%lx\n", KERNEL_LINK_ADDR);
> +#ifdef CONFIG_XIP_KERNEL
> +	/* TODO: Communicate with crash-utility developers on the information to
> +	 * export. The XIP case is more complicated, because the virtual-physical
> +	 * address offset depends on whether the address is in ROM or in RAM.
> +	 */
> +#else
>   	vmcoreinfo_append_str("NUMBER(va_kernel_pa_offset)=0x%lx\n",
>   						kernel_map.va_kernel_pa_offset);
> +#endif
>   }


So that will regress crash on XIP kernels, but on the other hand this 
was wrong in the first place. And not sure anyone ever used crash on a 
XIP platform.

At least people will know that using va_kernel_pa_offset was wrong, so:

Reviewed-by: Alexandre Ghiti <alexghiti@rivosinc.com>

Thanks for all your changes in v2,

Alex
diff mbox series

Patch

diff --git a/arch/riscv/kernel/vmcore_info.c b/arch/riscv/kernel/vmcore_info.c
index 6d7a22522d63..d5e448aa90e7 100644
--- a/arch/riscv/kernel/vmcore_info.c
+++ b/arch/riscv/kernel/vmcore_info.c
@@ -19,6 +19,13 @@  void arch_crash_save_vmcoreinfo(void)
 #endif
 #endif
 	vmcoreinfo_append_str("NUMBER(KERNEL_LINK_ADDR)=0x%lx\n", KERNEL_LINK_ADDR);
+#ifdef CONFIG_XIP_KERNEL
+	/* TODO: Communicate with crash-utility developers on the information to
+	 * export. The XIP case is more complicated, because the virtual-physical
+	 * address offset depends on whether the address is in ROM or in RAM.
+	 */
+#else
 	vmcoreinfo_append_str("NUMBER(va_kernel_pa_offset)=0x%lx\n",
 						kernel_map.va_kernel_pa_offset);
+#endif
 }