* [PATCH -fixes] riscv: kexec: Align the kexeced kernel entry
@ 2023-09-06 9:58 ` Song Shuai
0 siblings, 0 replies; 6+ messages in thread
From: Song Shuai @ 2023-09-06 9:58 UTC (permalink / raw)
To: paul.walmsley, palmer, aou, lihuafei1, conor.dooley, liaochang1,
songshuaishuai, lizhengyu3
Cc: linux-riscv, linux-kernel
The current riscv boot protocol requires 2MB alignment for RV64
and 4MB alignment for RV32.
In KEXEC_FILE path, the elf_find_pbase() function should align
the kexeced kernel entry according to the requirement, otherwise
the kexeced kernel would silently BUG at the setup_vm().
Fixes: 8acea455fafa ("RISC-V: Support for kexec_file on panic")
Signed-off-by: Song Shuai <songshuaishuai@tinylab.org>
---
You can use my kexec-tools[1] to test the kexec-file-syscall and this patch.
[1]: https://github.com/sugarfillet/kexec-tools/tree/fix-riscv
---
arch/riscv/kernel/elf_kexec.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/arch/riscv/kernel/elf_kexec.c b/arch/riscv/kernel/elf_kexec.c
index 5372b708fae2..9a81d6926ac6 100644
--- a/arch/riscv/kernel/elf_kexec.c
+++ b/arch/riscv/kernel/elf_kexec.c
@@ -98,7 +98,13 @@ static int elf_find_pbase(struct kimage *image, unsigned long kernel_len,
kbuf.image = image;
kbuf.buf_min = lowest_paddr;
kbuf.buf_max = ULONG_MAX;
- kbuf.buf_align = PAGE_SIZE;
+
+ /*
+ * Current riscv boot protocol requires 2MB alignment for
+ * RV64 and 4MB alignment for RV32
+ *
+ */
+ kbuf.buf_align = PMD_SIZE;
kbuf.mem = KEXEC_BUF_MEM_UNKNOWN;
kbuf.memsz = ALIGN(kernel_len, PAGE_SIZE);
kbuf.top_down = false;
--
2.20.1
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH -fixes] riscv: kexec: Align the kexeced kernel entry
@ 2023-09-06 9:58 ` Song Shuai
0 siblings, 0 replies; 6+ messages in thread
From: Song Shuai @ 2023-09-06 9:58 UTC (permalink / raw)
To: paul.walmsley, palmer, aou, lihuafei1, conor.dooley, liaochang1,
songshuaishuai, lizhengyu3
Cc: linux-riscv, linux-kernel
The current riscv boot protocol requires 2MB alignment for RV64
and 4MB alignment for RV32.
In KEXEC_FILE path, the elf_find_pbase() function should align
the kexeced kernel entry according to the requirement, otherwise
the kexeced kernel would silently BUG at the setup_vm().
Fixes: 8acea455fafa ("RISC-V: Support for kexec_file on panic")
Signed-off-by: Song Shuai <songshuaishuai@tinylab.org>
---
You can use my kexec-tools[1] to test the kexec-file-syscall and this patch.
[1]: https://github.com/sugarfillet/kexec-tools/tree/fix-riscv
---
arch/riscv/kernel/elf_kexec.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/arch/riscv/kernel/elf_kexec.c b/arch/riscv/kernel/elf_kexec.c
index 5372b708fae2..9a81d6926ac6 100644
--- a/arch/riscv/kernel/elf_kexec.c
+++ b/arch/riscv/kernel/elf_kexec.c
@@ -98,7 +98,13 @@ static int elf_find_pbase(struct kimage *image, unsigned long kernel_len,
kbuf.image = image;
kbuf.buf_min = lowest_paddr;
kbuf.buf_max = ULONG_MAX;
- kbuf.buf_align = PAGE_SIZE;
+
+ /*
+ * Current riscv boot protocol requires 2MB alignment for
+ * RV64 and 4MB alignment for RV32
+ *
+ */
+ kbuf.buf_align = PMD_SIZE;
kbuf.mem = KEXEC_BUF_MEM_UNKNOWN;
kbuf.memsz = ALIGN(kernel_len, PAGE_SIZE);
kbuf.top_down = false;
--
2.20.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH -fixes] riscv: kexec: Align the kexeced kernel entry
2023-09-06 9:58 ` Song Shuai
@ 2023-09-13 0:23 ` Palmer Dabbelt
-1 siblings, 0 replies; 6+ messages in thread
From: Palmer Dabbelt @ 2023-09-13 0:23 UTC (permalink / raw)
To: Paul Walmsley, Palmer Dabbelt, aou, lihuafei1, Conor Dooley,
liaochang1, lizhengyu3, Song Shuai
Cc: linux-riscv, linux-kernel
On Wed, 06 Sep 2023 17:58:17 +0800, Song Shuai wrote:
> The current riscv boot protocol requires 2MB alignment for RV64
> and 4MB alignment for RV32.
>
> In KEXEC_FILE path, the elf_find_pbase() function should align
> the kexeced kernel entry according to the requirement, otherwise
> the kexeced kernel would silently BUG at the setup_vm().
>
> [...]
Applied, thanks!
[1/1] riscv: kexec: Align the kexeced kernel entry
https://git.kernel.org/palmer/c/1bfb2b618d52
Best regards,
--
Palmer Dabbelt <palmer@rivosinc.com>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH -fixes] riscv: kexec: Align the kexeced kernel entry
@ 2023-09-13 0:23 ` Palmer Dabbelt
0 siblings, 0 replies; 6+ messages in thread
From: Palmer Dabbelt @ 2023-09-13 0:23 UTC (permalink / raw)
To: Paul Walmsley, Palmer Dabbelt, aou, lihuafei1, Conor Dooley,
liaochang1, lizhengyu3, Song Shuai
Cc: linux-riscv, linux-kernel
On Wed, 06 Sep 2023 17:58:17 +0800, Song Shuai wrote:
> The current riscv boot protocol requires 2MB alignment for RV64
> and 4MB alignment for RV32.
>
> In KEXEC_FILE path, the elf_find_pbase() function should align
> the kexeced kernel entry according to the requirement, otherwise
> the kexeced kernel would silently BUG at the setup_vm().
>
> [...]
Applied, thanks!
[1/1] riscv: kexec: Align the kexeced kernel entry
https://git.kernel.org/palmer/c/1bfb2b618d52
Best regards,
--
Palmer Dabbelt <palmer@rivosinc.com>
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH -fixes] riscv: kexec: Align the kexeced kernel entry
2023-09-06 9:58 ` Song Shuai
@ 2023-09-13 0:37 ` patchwork-bot+linux-riscv
-1 siblings, 0 replies; 6+ messages in thread
From: patchwork-bot+linux-riscv @ 2023-09-13 0:37 UTC (permalink / raw)
To: Song Shuai
Cc: linux-riscv, paul.walmsley, palmer, aou, lihuafei1, conor.dooley,
liaochang1, lizhengyu3, linux-kernel
Hello:
This patch was applied to riscv/linux.git (fixes)
by Palmer Dabbelt <palmer@rivosinc.com>:
On Wed, 6 Sep 2023 17:58:17 +0800 you wrote:
> The current riscv boot protocol requires 2MB alignment for RV64
> and 4MB alignment for RV32.
>
> In KEXEC_FILE path, the elf_find_pbase() function should align
> the kexeced kernel entry according to the requirement, otherwise
> the kexeced kernel would silently BUG at the setup_vm().
>
> [...]
Here is the summary with links:
- [-fixes] riscv: kexec: Align the kexeced kernel entry
https://git.kernel.org/riscv/c/1bfb2b618d52
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH -fixes] riscv: kexec: Align the kexeced kernel entry
@ 2023-09-13 0:37 ` patchwork-bot+linux-riscv
0 siblings, 0 replies; 6+ messages in thread
From: patchwork-bot+linux-riscv @ 2023-09-13 0:37 UTC (permalink / raw)
To: Song Shuai
Cc: linux-riscv, paul.walmsley, palmer, aou, lihuafei1, conor.dooley,
liaochang1, lizhengyu3, linux-kernel
Hello:
This patch was applied to riscv/linux.git (fixes)
by Palmer Dabbelt <palmer@rivosinc.com>:
On Wed, 6 Sep 2023 17:58:17 +0800 you wrote:
> The current riscv boot protocol requires 2MB alignment for RV64
> and 4MB alignment for RV32.
>
> In KEXEC_FILE path, the elf_find_pbase() function should align
> the kexeced kernel entry according to the requirement, otherwise
> the kexeced kernel would silently BUG at the setup_vm().
>
> [...]
Here is the summary with links:
- [-fixes] riscv: kexec: Align the kexeced kernel entry
https://git.kernel.org/riscv/c/1bfb2b618d52
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2023-09-13 0:37 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-06 9:58 [PATCH -fixes] riscv: kexec: Align the kexeced kernel entry Song Shuai
2023-09-06 9:58 ` Song Shuai
2023-09-13 0:23 ` Palmer Dabbelt
2023-09-13 0:23 ` Palmer Dabbelt
2023-09-13 0:37 ` patchwork-bot+linux-riscv
2023-09-13 0:37 ` patchwork-bot+linux-riscv
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.