[PATCH 2/5] lib: sbi: Introduce sbi_hart_protection_reconfigure() function
Rahul Pathak
rahul.pathak at oss.qualcomm.com
Wed Jul 22 03:59:54 PDT 2026
On Fri, Jul 17, 2026 at 1:15 PM Anup Patel <anup.patel at oss.qualcomm.com> wrote:
>
> Instead of assuming that hart protection reconfiguration is unconfigure
> followed by configure, introduce a separate sbi_hart_protection_reconfigure()
> function and use it in switch_to_next_domain_context().
>
> Signed-off-by: Anup Patel <anup.patel at oss.qualcomm.com>
> ---
> include/sbi/sbi_hart_protection.h | 7 +++++++
> lib/sbi/sbi_domain_context.c | 3 +--
> lib/sbi/sbi_hart_protection.c | 33 +++++++++++++++++++++++++------
> 3 files changed, 35 insertions(+), 8 deletions(-)
>
>
> +int sbi_hart_protection_configure(struct sbi_scratch *scratch)
> +{
> + return __hart_protection_configure(scratch, sbi_hart_protection_best());
> +}
> +
> +void sbi_hart_protection_unconfigure(struct sbi_scratch *scratch)
> +{
> + __hart_protection_unconfigure(scratch, sbi_hart_protection_best());
> +}
> +
> +int sbi_hart_protection_reconfigure(struct sbi_scratch *scratch)
> +{
> + struct sbi_hart_protection *hprot = sbi_hart_protection_best();
> + int ret;
> +
> + __hart_protection_unconfigure(scratch, hprot);
> + ret = __hart_protection_configure(scratch, hprot);
> + if (ret)
> + return ret;
Simply - return __hart_protection_configure(scratch, hprot);
> +
> + return 0;
> +}
More information about the opensbi
mailing list