From: "yang.zhang" <gaoshanliukou@163.com>
To: "Alexandre Ghiti" <alex@ghiti.fr>
Cc: alexghiti@rivosinc.com, paul.walmsley@sifive.com,
palmer@dabbelt.com, aou@eecs.berkeley.edu,
linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org,
"yang.zhang" <yang.zhang@hexintek.com>
Subject: Re:Re: [PATCH V2] riscv: set trap vector earlier
Date: Wed, 8 May 2024 09:42:16 +0800 (CST) [thread overview]
Message-ID: <4feaf8ec.2435.18f55dd9745.Coremail.gaoshanliukou@163.com> (raw)
In-Reply-To: <bfb82e87-94c0-4a23-b59d-bb57911224b5@ghiti.fr>
At 2024-05-07 13:28:58, "Alexandre Ghiti" <alex@ghiti.fr> wrote:
>Hi Yang,
>
>On 06/05/2024 04:22, yang.zhang wrote:
>> From: "yang.zhang" <yang.zhang@hexintek.com>
>>
>> If trap earlier, trap vector doesn't yet set properly, current
>> value maybe set by previous firmwire, typically it's the _start of kernel,
>> it's confused and difficult to debuge, so set it earlier.
>
>
>What about:
>
>"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_kernel. That makes it hard to debug setup_vm() when bad
>things happen. So fix that by setting the exception vector earlier."
Hi alex:
Maybe "typically _start" not "typically _start_kernel", right?
Thanks for your help。
>> ---
>> v1 -> v2:
>> As Alex commented, remove the patch for supporting hugesize kernek image
>> Add the omissive logic of set trap vector earlier
>>
>> Signed-off-by: yang.zhang <yang.zhang@hexintek.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
>
>Note that this patch will allow to catch any exception happening in
>setup_vm() but as we reset stvec in relocate_enable_mmu. But that's ok,
>it will help catching weird bugs more easily :)
>
>With the commit message fixed, you can add:
>
>Reviewed-by: Alexandre Ghiti <alexghiti@rivosinc.com>
>
>Thanks,
>
>Alex
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
prev parent reply other threads:[~2024-05-08 1:42 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-06 2:22 [PATCH V2] riscv: set trap vector earlier yang.zhang
2024-05-07 5:28 ` Alexandre Ghiti
2024-05-08 1:42 ` yang.zhang [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4feaf8ec.2435.18f55dd9745.Coremail.gaoshanliukou@163.com \
--to=gaoshanliukou@163.com \
--cc=alex@ghiti.fr \
--cc=alexghiti@rivosinc.com \
--cc=aou@eecs.berkeley.edu \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=palmer@dabbelt.com \
--cc=paul.walmsley@sifive.com \
--cc=yang.zhang@hexintek.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).