diff mbox series

lib: utils: hsm: Do not fail on EALREADY in rpmi-hsm fixup.

Message ID 20250507074620.3162747-1-wangziang.ok@bytedance.com
State New
Headers show
Series lib: utils: hsm: Do not fail on EALREADY in rpmi-hsm fixup. | expand

Commit Message

Ziang Wang May 7, 2025, 7:46 a.m. UTC
In case harts are divided into groups that use different
rpmi-hsm channels in different mailboxes, the suspend
state fixup function will return EALREADY on secondary
entry, simply skip on this error.

Signed-off-by: Ziang Wang <wangziang.ok@bytedance.com>
---
 lib/utils/hsm/fdt_hsm_rpmi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Ziang Wang May 12, 2025, 7:30 a.m. UTC | #1
Hi all,
I would like to hear your feedback on this.

It is common to have harts grouped by different mailboxes on a multi-socket system. The current HSM implementation can actually suffice this case, with the only minor change in this patch. We have tested it on both QEMU virt machine and our RISC-V project.

Best Regards,
Ziang

> From: "Ziang Wang"<wangziang.ok@bytedance.com>
> Date:  Wed, May 7, 2025, 15:46
> Subject:  [PATCH] lib: utils: hsm: Do not fail on EALREADY in rpmi-hsm fixup.
> To: <opensbi@lists.infradead.org>
> Cc: "Ziang Wang"<wangziang.ok@bytedance.com>
> In case harts are divided into groups that use different
> rpmi-hsm channels in different mailboxes, the suspend
> state fixup function will return EALREADY on secondary
> entry, simply skip on this error.

> Signed-off-by: Ziang Wang <wangziang.ok@bytedance.com>
> ---
>  lib/utils/hsm/fdt_hsm_rpmi.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

> diff --git a/lib/utils/hsm/fdt_hsm_rpmi.c b/lib/utils/hsm/fdt_hsm_rpmi.c
> index cc78436..09d0c91 100644
> --- a/lib/utils/hsm/fdt_hsm_rpmi.c
> +++ b/lib/utils/hsm/fdt_hsm_rpmi.c
> @@ -330,7 +330,7 @@ skip_suspend_states:
>  
>          /* Register HSM fixup callback */
>          rc = fdt_register_general_fixup(&rpmi_hsm_fixup);
> -        if (rc)
> +        if (rc && rc != SBI_EALREADY)
>                  goto fail_free_susp_state_names;
>  
>          /* Register HSM device */
> -- 
> 2.39.5
>
Ziang Wang May 13, 2025, 12:37 p.m. UTC | #2
Oh I think it's better to introduce myself first :D
Nice to meet you folks! this is Ziang. I'm an engineer from Bytedance Ltd, currently based in Shanghai, China. We've been constantly interested in the application of RISC-V in server area, plus the combination of OpenSBI and coreboot/Linuxboot as the firmware solution. We are eager to contribute, and are recently experimenting RPMI on our local RISC-V project, got some finding, hence come this tiny patch. Hope my abruptness didn't freak you out :), and this could be the starting point of our contribution.

Thanks!

Best Regards,
Ziang
> From: "王子昂"<wangziang.ok@bytedance.com>
> Date:  Mon, May 12, 2025, 15:30
> Subject:  Re: [PATCH] lib: utils: hsm: Do not fail on EALREADY in rpmi-hsm fixup.
> To: <opensbi@lists.infradead.org>
> Hi all,
> I would like to hear your feedback on this.

> It is common to have harts grouped by different mailboxes on a multi-socket system. The current HSM implementation can actually suffice this case, with the only minor change in this patch. We have tested it on both QEMU virt machine and our RISC-V project.

> Best Regards,
> Ziang

> > From: "Ziang Wang"<wangziang.ok@bytedance.com>
> > Date:  Wed, May 7, 2025, 15:46
> > Subject:  [PATCH] lib: utils: hsm: Do not fail on EALREADY in rpmi-hsm fixup.
> > To: <opensbi@lists.infradead.org>
> > Cc: "Ziang Wang"<wangziang.ok@bytedance.com>
> > In case harts are divided into groups that use different
> > rpmi-hsm channels in different mailboxes, the suspend
> > state fixup function will return EALREADY on secondary
> > entry, simply skip on this error.
> > 
> > Signed-off-by: Ziang Wang <wangziang.ok@bytedance.com>
> > ---
> >  lib/utils/hsm/fdt_hsm_rpmi.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/lib/utils/hsm/fdt_hsm_rpmi.c b/lib/utils/hsm/fdt_hsm_rpmi.c
> > index cc78436..09d0c91 100644
> > --- a/lib/utils/hsm/fdt_hsm_rpmi.c
> > +++ b/lib/utils/hsm/fdt_hsm_rpmi.c
> > @@ -330,7 +330,7 @@ skip_suspend_states:
> >  
> >          /* Register HSM fixup callback */
> >          rc = fdt_register_general_fixup(&rpmi_hsm_fixup);
> > -        if (rc)
> > +        if (rc && rc != SBI_EALREADY)
> >                  goto fail_free_susp_state_names;
> >  
> >          /* Register HSM device */
> > -- 
> > 2.39.5
> >
diff mbox series

Patch

diff --git a/lib/utils/hsm/fdt_hsm_rpmi.c b/lib/utils/hsm/fdt_hsm_rpmi.c
index cc78436..09d0c91 100644
--- a/lib/utils/hsm/fdt_hsm_rpmi.c
+++ b/lib/utils/hsm/fdt_hsm_rpmi.c
@@ -330,7 +330,7 @@  skip_suspend_states:
 
 	/* Register HSM fixup callback */
 	rc = fdt_register_general_fixup(&rpmi_hsm_fixup);
-	if (rc)
+	if (rc && rc != SBI_EALREADY)
 		goto fail_free_susp_state_names;
 
 	/* Register HSM device */