diff mbox series

[v2] xen/riscv: check whether the assembler has Zbb extension support

Message ID 750fa79aecfae43031cbcda2b2f91248199d0794.1713522163.git.oleksii.kurochko@gmail.com (mailing list archive)
State Superseded
Headers show
Series [v2] xen/riscv: check whether the assembler has Zbb extension support | expand

Commit Message

Oleksii Kurochko April 19, 2024, 10:26 a.m. UTC
Update the argument of the as-insn for the Zbb case to verify that
Zbb is supported not only by a compiler, but also by an assembler.

Also, check_extenstion(ext_name, "insn") helper macro is introduced
to check whether extension is supported by a compiler and an assembler.

Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
---
 xen/arch/riscv/arch.mk | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

Comments

Oleksii Kurochko April 19, 2024, 10:32 a.m. UTC | #1
On Fri, 2024-04-19 at 12:26 +0200, Oleksii Kurochko wrote:
> Update the argument of the as-insn for the Zbb case to verify that
> Zbb is supported not only by a compiler, but also by an assembler.
> 
> Also, check_extenstion(ext_name, "insn") helper macro is introduced
> to check whether extension is supported by a compiler and an
> assembler.
> 
> Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
> ---
>  xen/arch/riscv/arch.mk | 11 ++++++++---
>  1 file changed, 8 insertions(+), 3 deletions(-)
> 
> diff --git a/xen/arch/riscv/arch.mk b/xen/arch/riscv/arch.mk
> index 53f3575e7d..a3d7d97ab6 100644
> --- a/xen/arch/riscv/arch.mk
> +++ b/xen/arch/riscv/arch.mk
> @@ -11,9 +11,14 @@ riscv-march-$(CONFIG_RISCV_ISA_C)       :=
> $(riscv-march-y)c
>  
>  riscv-generic-flags := $(riscv-abi-y) -march=$(riscv-march-y)
>  
> -zbb := $(call as-insn,$(CC) $(riscv-generic-flags)_zbb,"",_zbb)
> -zihintpause := $(call as-insn, \
> -                      $(CC) $(riscv-generic-
> flags)_zihintpause,"pause",_zihintpause)
> +# check_extension: Check whether extenstion is supported by a
> compiler and
> +#                  an assembler.
> +# Usage: $(call check_extension,extension_name,"instr")
> +check_extension = $(call as-insn,$(CC)
I missed to use correct naming. should be 'check-extension'.
I will sent a new patch version. Sorry for flooding.

~ Oleksii

> $(riscv-generic-flags)_$(1),$(2),_$(1))
> +
> +zbb_insn := "andn t0, t0, t0"
> +zbb := $(call check_extension,zbb,$(zbb_insn))
> +zihintpause := $(call check_extension,zihintpause,"pause")
>  
>  extensions := $(zbb) $(zihintpause)
>
diff mbox series

Patch

diff --git a/xen/arch/riscv/arch.mk b/xen/arch/riscv/arch.mk
index 53f3575e7d..a3d7d97ab6 100644
--- a/xen/arch/riscv/arch.mk
+++ b/xen/arch/riscv/arch.mk
@@ -11,9 +11,14 @@  riscv-march-$(CONFIG_RISCV_ISA_C)       := $(riscv-march-y)c
 
 riscv-generic-flags := $(riscv-abi-y) -march=$(riscv-march-y)
 
-zbb := $(call as-insn,$(CC) $(riscv-generic-flags)_zbb,"",_zbb)
-zihintpause := $(call as-insn, \
-                      $(CC) $(riscv-generic-flags)_zihintpause,"pause",_zihintpause)
+# check_extension: Check whether extenstion is supported by a compiler and
+#                  an assembler.
+# Usage: $(call check_extension,extension_name,"instr")
+check_extension = $(call as-insn,$(CC) $(riscv-generic-flags)_$(1),$(2),_$(1))
+
+zbb_insn := "andn t0, t0, t0"
+zbb := $(call check_extension,zbb,$(zbb_insn))
+zihintpause := $(call check_extension,zihintpause,"pause")
 
 extensions := $(zbb) $(zihintpause)