riscv/purgatory: align riscv_kernel_entry
PATCH 1/1 riscv/purgatory: align riscv_kernel_entry
When alignment handling is delegated to the kernel, everything must be word-aligned in purgatory, since the trap handler is then set to the kexec one. Without the alignment, hitting the exception would ultimately crash. On other occasions, the kernel's handler would take care of exceptions.
This has been tested with oreboot and its SBI delegating unaligned access exceptions and the kernel configured to handle them.
--- arch/riscv/purgatory/entry.S | 1 + 1 file changed, 1 insertion(+)
arch/riscv/purgatory/entry.S +1 -0
@@ -34,6 +34,7 @@ SYM_CODE_END(purgatory_start) .data +.align 4 SYM_DATA(riscv_kernel_entry, .quad 0) .end
Signature · 7 lines
2.34.1 _______________________________________________ linux-riscv mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-riscv
Alexandre Ghiti
reviewerHi Daniel,
Quoted 18 lines · Daniel Maslowski
When alignment handling is delegated to the kernel, everything must be word-aligned in purgatory, since the trap handler is then set to the kexec one. Without the alignment, hitting the exception would ultimately crash. On other occasions, the kernel's handler would take care of exceptions.
This has been tested with oreboot and its SBI delegating unaligned access exceptions and the kernel configured to handle them.Signed-off-by Daniel Maslowski <[email protected]>--- arch/riscv/purgatory/entry.S | 1 + 1 file changed, 1 insertion(+)arch/riscv/purgatory/entry.S +0
-0
arch/riscv/purgatory/entry.S SYM_CODE_END(purgatory_start) · line 37
Quoted 4 lines
arch/riscv/purgatory/entry.S +1
-0@@ -34,6 +34,7 @@ SYM_CODE_END(purgatory_start) .data +.align 4
IIRC, .align on riscv takes a power of two as argument, which means you align riscv_kernel_entry symbol to 16B here, any reason for this alignment? I guess you want 4B on rv32 and 8B on rv64 right? In that case, the best here would be to use LGREG https://elixir.bootlin.com/linux/latest/source/arch/riscv/include/asm/asm.h#L29
Thanks,
Alex
arch/riscv/purgatory/entry.S SYM_CODE_END(purgatory_start) · line 40
Quoted 3 lines
arch/riscv/purgatory/entry.S +0
-0SYM_DATA(riscv_kernel_entry, .quad 0) .end
_______________________________________________
linux-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv
Alexandre Ghiti
reviewerQuoted 32 lines · Alexandre Ghiti
Hi Daniel,
Quoted 18 lines · Daniel Maslowski
When alignment handling is delegated to the kernel, everything must be word-aligned in purgatory, since the trap handler is then set to the kexec one. Without the alignment, hitting the exception would ultimately crash. On other occasions, the kernel's handler would take care of exceptions.
This has been tested with oreboot and its SBI delegating unaligned access exceptions and the kernel configured to handle them.Signed-off-by Daniel Maslowski <[email protected]>---
arch/riscv/purgatory/entry.S| 1 +1 file changed, 1 insertion(+)arch/riscv/purgatory/entry.S +0
-0@@ -34,6 +34,7 @@ SYM_CODE_END(purgatory_start)Quoted 2 lines
.data
+.align 4IIRC, .align on riscv takes a power of two as argument, which means you align
riscv_kernel_entrysymbol to 16B here, any reason for this alignment? I guess you want 4B on rv32 and 8B on rv64 right? In that case, the best here would be to use LGREG https://elixir.bootlin.com/linux/latest/source/arch/riscv/include/asm/asm.h#L29Thanks,
Alex
Quoted 7 lines
Quoted 2 lines
SYM_DATA(riscv_kernel_entry, .quad 0)
.end_______________________________________________
linux-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv
And since this is a fix, can you add a Fixes tag please?
Thanks,
Alex
_______________________________________________
linux-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv