public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH V3] riscv: set trap vector earlier
@ 2024-05-08  2:24 yang.zhang
  2024-07-14 20:30 ` patchwork-bot+linux-riscv
  0 siblings, 1 reply; 3+ messages in thread
From: yang.zhang @ 2024-05-08  2:24 UTC (permalink / raw)
  To: alexghiti
  Cc: paul.walmsley, palmer, aou, linux-riscv, linux-kernel, yang.zhang

From: "yang.zhang" <yang.zhang@hexintek.com>

The exception vector of the booting hart is not set before enabling
the mmu and then still points to the value of the previous firmware,
typically _start. That makes it hard to debug setup_vm() when bad
things happen. So fix that by setting the exception vector earlier.

Reviewed-by: Alexandre Ghiti <alexghiti@rivosinc.com>
Signed-off-by: yang.zhang <yang.zhang@hexintek.com>

---
V2 -> v3:
- Fix commit message

v1 -> v2:
- As Alex commented, remove the patch for supporting hugesize kernek image
- Add the omissive logic of set trap vector earlier
https://lore.kernel.org/lkml/20240506022239.6817-1-gaoshanliukou@163.com
---
 arch/riscv/kernel/head.S | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/arch/riscv/kernel/head.S b/arch/riscv/kernel/head.S
index 4236a69c35cb..03dc440e643e 100644
--- a/arch/riscv/kernel/head.S
+++ b/arch/riscv/kernel/head.S
@@ -300,6 +300,9 @@ SYM_CODE_START(_start_kernel)
 #else
 	mv a0, a1
 #endif /* CONFIG_BUILTIN_DTB */
+	/* Set trap vector to spin forever to help debug */
+	la a3, .Lsecondary_park
+	csrw CSR_TVEC, a3
 	call setup_vm
 #ifdef CONFIG_MMU
 	la a0, early_pg_dir
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH V3] riscv: set trap vector earlier
  2024-05-08  2:24 [PATCH V3] riscv: set trap vector earlier yang.zhang
@ 2024-07-14 20:30 ` patchwork-bot+linux-riscv
  2024-07-15  5:42   ` yang.zhang
  0 siblings, 1 reply; 3+ messages in thread
From: patchwork-bot+linux-riscv @ 2024-07-14 20:30 UTC (permalink / raw)
  To: yang.zhang
  Cc: linux-riscv, alexghiti, paul.walmsley, palmer, aou, linux-kernel,
	yang.zhang

Hello:

This patch was applied to riscv/linux.git (for-next)
by Palmer Dabbelt <palmer@rivosinc.com>:

On Wed,  8 May 2024 10:24:45 +0800 you wrote:
> From: "yang.zhang" <yang.zhang@hexintek.com>
> 
> The exception vector of the booting hart is not set before enabling
> the mmu and then still points to the value of the previous firmware,
> typically _start. That makes it hard to debug setup_vm() when bad
> things happen. So fix that by setting the exception vector earlier.
> 
> [...]

Here is the summary with links:
  - [V3] riscv: set trap vector earlier
    https://git.kernel.org/riscv/c/6ad8735994b8

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] 3+ messages in thread

* Re:Re: [PATCH V3] riscv: set trap vector earlier
  2024-07-14 20:30 ` patchwork-bot+linux-riscv
@ 2024-07-15  5:42   ` yang.zhang
  0 siblings, 0 replies; 3+ messages in thread
From: yang.zhang @ 2024-07-15  5:42 UTC (permalink / raw)
  To: patchwork-bot+linux-riscv
  Cc: linux-riscv, alexghiti, paul.walmsley, palmer, aou, linux-kernel,
	yang.zhang



hi:
Yeah, thanks.













At 2024-07-15 04:30:33, patchwork-bot+linux-riscv@kernel.org wrote:
>Hello:
>
>This patch was applied to riscv/linux.git (for-next)
>by Palmer Dabbelt <palmer@rivosinc.com>:
>
>On Wed,  8 May 2024 10:24:45 +0800 you wrote:
>> From: "yang.zhang" <yang.zhang@hexintek.com>
>> 
>> The exception vector of the booting hart is not set before enabling
>> the mmu and then still points to the value of the previous firmware,
>> typically _start. That makes it hard to debug setup_vm() when bad
>> things happen. So fix that by setting the exception vector earlier.
>> 
>> [...]
>
>Here is the summary with links:
>  - [V3] riscv: set trap vector earlier
>    https://git.kernel.org/riscv/c/6ad8735994b8
>
>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] 3+ messages in thread

end of thread, other threads:[~2024-07-15  5:59 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-05-08  2:24 [PATCH V3] riscv: set trap vector earlier yang.zhang
2024-07-14 20:30 ` patchwork-bot+linux-riscv
2024-07-15  5:42   ` yang.zhang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox