[PATCH] include: Fix LLVM compile error in sbi_utils/hsm/fdt_hsm_sifive_inst.h

Anup Patel anup at brainfault.org
Sun Dec 28 07:19:09 PST 2025


On Sat, Dec 27, 2025 at 3:39 PM Anup Patel <anup.patel at oss.qualcomm.com> wrote:
>
> Currently, OpenSBI fails to compile for LLVM=1 using 2025.11.27
> riscv-gnu-toolchain with the following error:
>
> In file included from opensbi/lib/utils/suspend/fdt_suspend_sifive_smc0.c:20:
> opensbi/include/sbi_utils/hsm/fdt_hsm_sifive_inst.h:17:23: error: expected instruction format
>    17 |         __asm__ __volatile__(".insn 0xfc000073" ::: "memory");
>       |                              ^
> <inline asm>:1:8: note: instantiated into assembly here
>     1 |         .insn 0xfc000073
>       |               ^
> In file included from opensbi/lib/utils/suspend/fdt_suspend_sifive_smc0.c:20:
> opensbi/include/sbi_utils/hsm/fdt_hsm_sifive_inst.h:12:23: error: expected instruction format
>    12 |         __asm__ __volatile__(".insn 0x30500073" ::: "memory");
>       |                              ^
> <inline asm>:1:8: note: instantiated into assembly here
>     1 |         .insn 0x30500073
>       |               ^
> 2 errors generated.
>
> To fix this compile error, use ".word" in-place ".insn".
>
> Fixes: 1514a327306b ("lib: utils/hsm: Add SiFive TMC0 driver")
> Signed-off-by: Anup Patel <anup.patel at oss.qualcomm.com>

Applied this patch to the riscv/opensbi repo.

Thanks,
Anup

> ---
>  include/sbi_utils/hsm/fdt_hsm_sifive_inst.h | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/include/sbi_utils/hsm/fdt_hsm_sifive_inst.h b/include/sbi_utils/hsm/fdt_hsm_sifive_inst.h
> index de8aba19..7e9180ea 100644
> --- a/include/sbi_utils/hsm/fdt_hsm_sifive_inst.h
> +++ b/include/sbi_utils/hsm/fdt_hsm_sifive_inst.h
> @@ -9,12 +9,12 @@
>
>  static inline void sifive_cease(void)
>  {
> -       __asm__ __volatile__(".insn 0x30500073" ::: "memory");
> +       __asm__ __volatile__(".word 0x30500073" ::: "memory");
>  }
>
>  static inline void sifive_cflush(void)
>  {
> -       __asm__ __volatile__(".insn 0xfc000073" ::: "memory");
> +       __asm__ __volatile__(".word 0xfc000073" ::: "memory");
>  }
>
>  #endif
> --
> 2.43.0
>



More information about the opensbi mailing list