From: Rahul Pathak <rahul.pathak@oss.qualcomm.com>
To: opensbi@lists.infradead.org
Cc: rahul.pathak@oss.qualcomm.com, rahul@summations.net
Subject: [RFC PATCH v2 4/5] sbi: hsm: Activate MPT for domain on hart start/resume
Date: Mon, 27 Jul 2026 19:26:02 +0530 [thread overview]
Message-ID: <20260727135605.465309-5-rahul.pathak@oss.qualcomm.com> (raw)
In-Reply-To: <20260727135605.465309-1-rahul.pathak@oss.qualcomm.com>
Program the hart mmpt CSR for its supervisor domain on the HSM
start and resume paths before entering S-mode.
Signed-off-by: Rahul Pathak <rahul.pathak@oss.qualcomm.com>
---
lib/sbi/sbi_hsm.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/lib/sbi/sbi_hsm.c b/lib/sbi/sbi_hsm.c
index 0a355f9c..eb39d5c2 100644
--- a/lib/sbi/sbi_hsm.c
+++ b/lib/sbi/sbi_hsm.c
@@ -25,6 +25,7 @@
#include <sbi/sbi_system.h>
#include <sbi/sbi_timer.h>
#include <sbi/sbi_console.h>
+#include <sbi/sbi_mpt.h>
#define __sbi_hsm_hart_change_state(hdata, oldstate, newstate) \
({ \
@@ -154,6 +155,9 @@ void __noreturn sbi_hsm_hart_start_finish(struct sbi_scratch *scratch,
next_mode = scratch->next_mode;
hsm_start_ticket_release(hdata);
+ /* Program hart mmpt for its supervisor domain before entering S-mode. */
+ sbi_mpt_hart_activate_for_domain(sbi_domain_thishart_ptr());
+
sbi_hart_switch_mode(hartid, next_arg1, next_addr, next_mode, false);
}
@@ -478,6 +482,9 @@ void __noreturn sbi_hsm_hart_resume_finish(struct sbi_scratch *scratch,
*/
__sbi_hsm_suspend_non_ret_restore(scratch);
+ /* Reprogram mmpt on the a resumed hart */
+ sbi_mpt_hart_activate_for_domain(sbi_domain_thishart_ptr());
+
sbi_hart_switch_mode(hartid, scratch->next_arg1,
scratch->next_addr,
scratch->next_mode, false);
--
2.51.0
--
opensbi mailing list
opensbi@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/opensbi
next prev parent reply other threads:[~2026-07-27 13:56 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-27 13:55 [RFC PATCH v2 0/5] Add Smsdid and Smmpt supervisor domain protection Rahul Pathak
2026-07-27 13:55 ` [RFC PATCH v2 1/5] riscv: Add Smsdid and Smmpt hart extensions Rahul Pathak
2026-07-27 13:56 ` [RFC PATCH v2 2/5] mpt: Add Smsdid and Smmpt supervisor domain core Rahul Pathak
2026-08-14 18:28 ` Pawandeep Oza
2026-08-22 12:18 ` Rahul Pathak
2026-07-27 13:56 ` [RFC PATCH v2 3/5] platform/generic: Initialise MPT at boot Rahul Pathak
2026-07-28 17:53 ` Pawandeep Oza
2026-07-29 2:37 ` Rahul Pathak
2026-07-27 13:56 ` Rahul Pathak [this message]
2026-07-28 18:18 ` [RFC PATCH v2 4/5] sbi: hsm: Activate MPT for domain on hart start/resume Pawandeep Oza
2026-07-27 13:56 ` [RFC PATCH v2 5/5] sbi: init: Print supervisor domains at boot Rahul Pathak
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=20260727135605.465309-5-rahul.pathak@oss.qualcomm.com \
--to=rahul.pathak@oss.qualcomm.com \
--cc=opensbi@lists.infradead.org \
--cc=rahul@summations.net \
/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