qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] linux-user: Add AT_HWCAP2 for aarch64-linux-user
@ 2019-08-09 17:11 Richard Henderson
  2019-08-12 16:39 ` Peter Maydell
  2019-08-23 15:34 ` Laurent Vivier
  0 siblings, 2 replies; 3+ messages in thread
From: Richard Henderson @ 2019-08-09 17:11 UTC (permalink / raw)
  To: qemu-devel; +Cc: peter.maydell, laurent

Add the HWCAP2_* bits from kernel version v5.3-rc3.
Enable the bits corresponding to ARMv8.5-CondM and ARMv8.5-FRINT.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
 linux-user/elfload.c | 31 +++++++++++++++++++++++++++----
 1 file changed, 27 insertions(+), 4 deletions(-)
---

The HWCAP2_FLAGM2 and HWCAP2_FRINT bits came in during the 
last merge window and will be in the upcoming v5.3 release.
We don't yet implement any of the other extensions that make
up the rest of the HWCAP2 bits.


r~


diff --git a/linux-user/elfload.c b/linux-user/elfload.c
index bd43c4817d..4fd2f46f18 100644
--- a/linux-user/elfload.c
+++ b/linux-user/elfload.c
@@ -606,9 +606,23 @@ enum {
     ARM_HWCAP_A64_SB            = 1 << 29,
     ARM_HWCAP_A64_PACA          = 1 << 30,
     ARM_HWCAP_A64_PACG          = 1UL << 31,
+
+    ARM_HWCAP2_A64_DCPODP       = 1 << 0,
+    ARM_HWCAP2_A64_SVE2         = 1 << 1,
+    ARM_HWCAP2_A64_SVEAES       = 1 << 2,
+    ARM_HWCAP2_A64_SVEPMULL     = 1 << 3,
+    ARM_HWCAP2_A64_SVEBITPERM   = 1 << 4,
+    ARM_HWCAP2_A64_SVESHA3      = 1 << 5,
+    ARM_HWCAP2_A64_SVESM4       = 1 << 6,
+    ARM_HWCAP2_A64_FLAGM2       = 1 << 7,
+    ARM_HWCAP2_A64_FRINT        = 1 << 8,
 };
 
-#define ELF_HWCAP get_elf_hwcap()
+#define ELF_HWCAP   get_elf_hwcap()
+#define ELF_HWCAP2  get_elf_hwcap2()
+
+#define GET_FEATURE_ID(feat, hwcap) \
+    do { if (cpu_isar_feature(feat, cpu)) { hwcaps |= hwcap; } } while (0)
 
 static uint32_t get_elf_hwcap(void)
 {
@@ -620,8 +634,6 @@ static uint32_t get_elf_hwcap(void)
     hwcaps |= ARM_HWCAP_A64_CPUID;
 
     /* probe for the extra features */
-#define GET_FEATURE_ID(feat, hwcap) \
-    do { if (cpu_isar_feature(feat, cpu)) { hwcaps |= hwcap; } } while (0)
 
     GET_FEATURE_ID(aa64_aes, ARM_HWCAP_A64_AES);
     GET_FEATURE_ID(aa64_pmull, ARM_HWCAP_A64_PMULL);
@@ -644,11 +656,22 @@ static uint32_t get_elf_hwcap(void)
     GET_FEATURE_ID(aa64_sb, ARM_HWCAP_A64_SB);
     GET_FEATURE_ID(aa64_condm_4, ARM_HWCAP_A64_FLAGM);
 
-#undef GET_FEATURE_ID
+    return hwcaps;
+}
+
+static uint32_t get_elf_hwcap2(void)
+{
+    ARMCPU *cpu = ARM_CPU(thread_cpu);
+    uint32_t hwcaps = 0;
+
+    GET_FEATURE_ID(aa64_condm_5, ARM_HWCAP2_A64_FLAGM2);
+    GET_FEATURE_ID(aa64_frint, ARM_HWCAP2_A64_FRINT);
 
     return hwcaps;
 }
 
+#undef GET_FEATURE_ID
+
 #endif /* not TARGET_AARCH64 */
 #endif /* TARGET_ARM */
 
-- 
2.17.1



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH] linux-user: Add AT_HWCAP2 for aarch64-linux-user
  2019-08-09 17:11 [Qemu-devel] [PATCH] linux-user: Add AT_HWCAP2 for aarch64-linux-user Richard Henderson
@ 2019-08-12 16:39 ` Peter Maydell
  2019-08-23 15:34 ` Laurent Vivier
  1 sibling, 0 replies; 3+ messages in thread
From: Peter Maydell @ 2019-08-12 16:39 UTC (permalink / raw)
  To: Richard Henderson; +Cc: QEMU Developers, Laurent Vivier

On Fri, 9 Aug 2019 at 18:11, Richard Henderson
<richard.henderson@linaro.org> wrote:
>
> Add the HWCAP2_* bits from kernel version v5.3-rc3.
> Enable the bits corresponding to ARMv8.5-CondM and ARMv8.5-FRINT.
>
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---
>  linux-user/elfload.c | 31 +++++++++++++++++++++++++++----
>  1 file changed, 27 insertions(+), 4 deletions(-)
> ---
>
> The HWCAP2_FLAGM2 and HWCAP2_FRINT bits came in during the
> last merge window and will be in the upcoming v5.3 release.
> We don't yet implement any of the other extensions that make
> up the rest of the HWCAP2 bits.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>

thanks
-- PMM


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH] linux-user: Add AT_HWCAP2 for aarch64-linux-user
  2019-08-09 17:11 [Qemu-devel] [PATCH] linux-user: Add AT_HWCAP2 for aarch64-linux-user Richard Henderson
  2019-08-12 16:39 ` Peter Maydell
@ 2019-08-23 15:34 ` Laurent Vivier
  1 sibling, 0 replies; 3+ messages in thread
From: Laurent Vivier @ 2019-08-23 15:34 UTC (permalink / raw)
  To: Richard Henderson, qemu-devel; +Cc: peter.maydell

Le 09/08/2019 à 19:11, Richard Henderson a écrit :
> Add the HWCAP2_* bits from kernel version v5.3-rc3.
> Enable the bits corresponding to ARMv8.5-CondM and ARMv8.5-FRINT.
> 
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---
>  linux-user/elfload.c | 31 +++++++++++++++++++++++++++----
>  1 file changed, 27 insertions(+), 4 deletions(-)
> ---
> 
> The HWCAP2_FLAGM2 and HWCAP2_FRINT bits came in during the 
> last merge window and will be in the upcoming v5.3 release.
> We don't yet implement any of the other extensions that make
> up the rest of the HWCAP2 bits.
> 
> 
> r~
> 
> 
> diff --git a/linux-user/elfload.c b/linux-user/elfload.c
> index bd43c4817d..4fd2f46f18 100644
> --- a/linux-user/elfload.c
> +++ b/linux-user/elfload.c
> @@ -606,9 +606,23 @@ enum {
>      ARM_HWCAP_A64_SB            = 1 << 29,
>      ARM_HWCAP_A64_PACA          = 1 << 30,
>      ARM_HWCAP_A64_PACG          = 1UL << 31,
> +
> +    ARM_HWCAP2_A64_DCPODP       = 1 << 0,
> +    ARM_HWCAP2_A64_SVE2         = 1 << 1,
> +    ARM_HWCAP2_A64_SVEAES       = 1 << 2,
> +    ARM_HWCAP2_A64_SVEPMULL     = 1 << 3,
> +    ARM_HWCAP2_A64_SVEBITPERM   = 1 << 4,
> +    ARM_HWCAP2_A64_SVESHA3      = 1 << 5,
> +    ARM_HWCAP2_A64_SVESM4       = 1 << 6,
> +    ARM_HWCAP2_A64_FLAGM2       = 1 << 7,
> +    ARM_HWCAP2_A64_FRINT        = 1 << 8,
>  };
>  
> -#define ELF_HWCAP get_elf_hwcap()
> +#define ELF_HWCAP   get_elf_hwcap()
> +#define ELF_HWCAP2  get_elf_hwcap2()
> +
> +#define GET_FEATURE_ID(feat, hwcap) \
> +    do { if (cpu_isar_feature(feat, cpu)) { hwcaps |= hwcap; } } while (0)
>  
>  static uint32_t get_elf_hwcap(void)
>  {
> @@ -620,8 +634,6 @@ static uint32_t get_elf_hwcap(void)
>      hwcaps |= ARM_HWCAP_A64_CPUID;
>  
>      /* probe for the extra features */
> -#define GET_FEATURE_ID(feat, hwcap) \
> -    do { if (cpu_isar_feature(feat, cpu)) { hwcaps |= hwcap; } } while (0)
>  
>      GET_FEATURE_ID(aa64_aes, ARM_HWCAP_A64_AES);
>      GET_FEATURE_ID(aa64_pmull, ARM_HWCAP_A64_PMULL);
> @@ -644,11 +656,22 @@ static uint32_t get_elf_hwcap(void)
>      GET_FEATURE_ID(aa64_sb, ARM_HWCAP_A64_SB);
>      GET_FEATURE_ID(aa64_condm_4, ARM_HWCAP_A64_FLAGM);
>  
> -#undef GET_FEATURE_ID
> +    return hwcaps;
> +}
> +
> +static uint32_t get_elf_hwcap2(void)
> +{
> +    ARMCPU *cpu = ARM_CPU(thread_cpu);
> +    uint32_t hwcaps = 0;
> +
> +    GET_FEATURE_ID(aa64_condm_5, ARM_HWCAP2_A64_FLAGM2);
> +    GET_FEATURE_ID(aa64_frint, ARM_HWCAP2_A64_FRINT);
>  
>      return hwcaps;
>  }
>  
> +#undef GET_FEATURE_ID
> +
>  #endif /* not TARGET_AARCH64 */
>  #endif /* TARGET_ARM */
>  
> 

Applied to my linux-user branch.

Thanks,
Laurent


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-08-23 15:38 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-09 17:11 [Qemu-devel] [PATCH] linux-user: Add AT_HWCAP2 for aarch64-linux-user Richard Henderson
2019-08-12 16:39 ` Peter Maydell
2019-08-23 15:34 ` Laurent Vivier

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).