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

Oleksii Kurochko posted 1 patch 1 week, 6 days ago
Patches applied successfully (tree, apply log)
git fetch https://gitlab.com/xen-project/patchew/xen tags/patchew/750fa79aecfae43031cbcda2b2f91248199d0794.1713522163.git.oleksii.kurochko@gmail.com
There is a newer version of this series
xen/arch/riscv/arch.mk | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
[PATCH v2] xen/riscv: check whether the assembler has Zbb extension support
Posted by Oleksii Kurochko 1 week, 6 days ago
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) $(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)
 
-- 
2.44.0
Re: [PATCH v2] xen/riscv: check whether the assembler has Zbb extension support
Posted by Oleksii 1 week, 6 days ago
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)
>