Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ARM: 9268/1: vfp: Add hwcap FPHP and ASIMDHP for FEAT_FP16

Floating point half-precision (FPHP) and Advanced SIMD half-precision
(ASIMDHP) are VFP features (FEAT_FP16) represented by MVFR1 identification register. These capabilities can optionally exist with VFPv3 and mandatory with VFPv4. Both these new features exist for Armv8 architecture in AArch32 state.

These hwcaps may be useful for the userspace to add conditional check
before trying to use FEAT_FP16 feature specific instructions.

Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Amit Daniel Kachhap <amit.kachhap@arm.com>
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>

authored by

Amit Daniel Kachhap and committed by
Russell King (Oracle)
c00a19c8 74c344e6

+14
+6
arch/arm/include/asm/vfp.h
··· 87 87 #define MVFR0_DP_BIT (8) 88 88 #define MVFR0_DP_MASK (0xf << MVFR0_DP_BIT) 89 89 90 + /* MVFR1 bits */ 91 + #define MVFR1_ASIMDHP_BIT (20) 92 + #define MVFR1_ASIMDHP_MASK (0xf << MVFR1_ASIMDHP_BIT) 93 + #define MVFR1_FPHP_BIT (24) 94 + #define MVFR1_FPHP_MASK (0xf << MVFR1_FPHP_BIT) 95 + 90 96 /* Bit patterns for decoding the packaged operation descriptors */ 91 97 #define VFPOPDESC_LENGTH_BIT (9) 92 98 #define VFPOPDESC_LENGTH_MASK (0x07 << VFPOPDESC_LENGTH_BIT)
+2
arch/arm/include/uapi/asm/hwcap.h
··· 28 28 #define HWCAP_IDIV (HWCAP_IDIVA | HWCAP_IDIVT) 29 29 #define HWCAP_LPAE (1 << 20) 30 30 #define HWCAP_EVTSTRM (1 << 21) 31 + #define HWCAP_FPHP (1 << 22) 32 + #define HWCAP_ASIMDHP (1 << 23) 31 33 32 34 /* 33 35 * HWCAP2 flags - for elf_hwcap2 (in kernel) and AT_HWCAP2
+2
arch/arm/kernel/setup.c
··· 1249 1249 "vfpd32", 1250 1250 "lpae", 1251 1251 "evtstrm", 1252 + "fphp", 1253 + "asimdhp", 1252 1254 NULL 1253 1255 }; 1254 1256
+4
arch/arm/vfp/vfpmodule.c
··· 831 831 832 832 if ((fmrx(MVFR1) & 0xf0000000) == 0x10000000) 833 833 elf_hwcap |= HWCAP_VFPv4; 834 + if (((fmrx(MVFR1) & MVFR1_ASIMDHP_MASK) >> MVFR1_ASIMDHP_BIT) == 0x2) 835 + elf_hwcap |= HWCAP_ASIMDHP; 836 + if (((fmrx(MVFR1) & MVFR1_FPHP_MASK) >> MVFR1_FPHP_BIT) == 0x3) 837 + elf_hwcap |= HWCAP_FPHP; 834 838 } 835 839 /* Extract the architecture version on pre-cpuid scheme */ 836 840 } else {