From: Andreas Schwab <schwab@suse.de>
To: opensbi@lists.infradead.org
Subject: [PATCH] lib: sbi: Refine the settings for switching to Virtual Supervisor Mode.
Date: Tue, 09 Apr 2024 09:44:21 +0200 [thread overview]
Message-ID: <mvmle5naskq.fsf@suse.de> (raw)
In-Reply-To: <20240409022410.1866-1-popeblei@gmail.com> (Pope B. Lei's message of "Tue, 9 Apr 2024 10:24:10 +0800")
On Apr 09 2024, Pope B.Lei wrote:
> diff --git a/lib/sbi/sbi_hart.c b/lib/sbi/sbi_hart.c
> index 3d13694..e145cdc 100644
> --- a/lib/sbi/sbi_hart.c
> +++ b/lib/sbi/sbi_hart.c
> @@ -1041,10 +1041,17 @@ sbi_hart_switch_mode(unsigned long arg0, unsigned long arg1,
> csr_write(CSR_MEPC, next_addr);
>
> if (next_mode == PRV_S) {
> - csr_write(CSR_STVEC, next_addr);
> - csr_write(CSR_SSCRATCH, 0);
> - csr_write(CSR_SIE, 0);
> - csr_write(CSR_SATP, 0);
> + if (true == next_virt){
Never compare a boolean with a constant.
> + csr_write(CSR_VSTVEC, next_addr);
> + csr_write(CSR_VSSCRATCH, 0);
> + csr_write(CSR_VSIE, 0);
> + csr_write(CSR_VSATP, 0);
> + } else if (false == next_virt){
This condition is obviously redundant.
--
Andreas Schwab, SUSE Labs, schwab at suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."
next prev parent reply other threads:[~2024-04-09 7:44 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-09 2:24 [PATCH] lib: sbi: Refine the settings for switching to Virtual Supervisor Mode Pope B.Lei
2024-04-09 2:27 ` Pope B.Lei
2024-04-09 7:44 ` Andreas Schwab [this message]
-- strict thread matches above, loose matches on Subject: below --
2024-04-09 9:23 Pope B.Lei
2024-04-09 10:34 ` Xiang W
2024-04-09 13:34 ` Andrew Jones
2024-04-09 2:18 Pope B.Lei
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=mvmle5naskq.fsf@suse.de \
--to=schwab@suse.de \
--cc=opensbi@lists.infradead.org \
/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