[RFC PATCH v2 4/5] sbi: hsm: Activate MPT for domain on hart start/resume
Pawandeep Oza
pawandeep.oza at oss.qualcomm.com
Tue Jul 28 11:18:09 PDT 2026
On Mon, Jul 27, 2026 at 6:56 AM Rahul Pathak
<rahul.pathak at oss.qualcomm.com> wrote:
>
> 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 at 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 at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/opensbi
Reviewed-by: Pawandeep Oza <pawandeep.oza at oss.qualcomm.com>
More information about the opensbi
mailing list