mirror of
https://github.com/torvalds/linux.git
synced 2024-12-27 13:22:23 +00:00
6c96a4a6e2
The subarchitecture field in the fpsid register is 7 bits wide on ARM CPUs using the CPUID identification scheme, spanning bits 22 to 16. The topmost bit is used to designate that the subarchitecture designer is not ARM when it is set to 1. On non-CPUID scheme CPUs the subarchitecture field is only 4 bits wide and the higher bits are used to indicate no double precision support (bit 20) and the FTSMX/FLDMX format (bits 21-22). The VFP support code only looks at bits 19-16 to determine the VFP version. On Qualcomm's processors (Krait and Scorpion) we should see that we have HWCAP_VFPv3 but we don't because bit 22 is set to 1 to indicate that the subarchitecture is not implemented by ARM and the rest of the bits are left as 0 because this is the first subarchitecture that Qualcomm has designed. Unfortunately we can't just widen the FPSID subarchitecture bitmask to consider all the bits on a CPUID scheme because there may be CPUs without the CPUID scheme that have VFP without double precision support and then the version would be a very wrong and large number. Instead, update the version detection logic to consider if the CPU is using the CPUID scheme. If the CPU is using CPUID scheme, use the MVFR registers to determine what version of VFP is supported. We already do this for VFPv4, so do something similar for VFPv3 and look for single or double precision support in MVFR0. Otherwise fall back to using FPSID to detect VFP support on non-CPUID scheme CPUs. We know that VFPv3 is only present in CPUs that have support for the CPUID scheme so this should be equivalent. Tested-by: Rob Clark <robdclark@gmail.com> Reviewed-by: Will Deacon <will.deacon@arm.com> Signed-off-by: Stephen Boyd <sboyd@codeaurora.org> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
90 lines
2.7 KiB
C
90 lines
2.7 KiB
C
/*
|
|
* arch/arm/include/asm/vfp.h
|
|
*
|
|
* VFP register definitions.
|
|
* First, the standard VFP set.
|
|
*/
|
|
|
|
#define FPSID cr0
|
|
#define FPSCR cr1
|
|
#define MVFR1 cr6
|
|
#define MVFR0 cr7
|
|
#define FPEXC cr8
|
|
#define FPINST cr9
|
|
#define FPINST2 cr10
|
|
|
|
/* FPSID bits */
|
|
#define FPSID_IMPLEMENTER_BIT (24)
|
|
#define FPSID_IMPLEMENTER_MASK (0xff << FPSID_IMPLEMENTER_BIT)
|
|
#define FPSID_SOFTWARE (1<<23)
|
|
#define FPSID_FORMAT_BIT (21)
|
|
#define FPSID_FORMAT_MASK (0x3 << FPSID_FORMAT_BIT)
|
|
#define FPSID_NODOUBLE (1<<20)
|
|
#define FPSID_ARCH_BIT (16)
|
|
#define FPSID_ARCH_MASK (0xF << FPSID_ARCH_BIT)
|
|
#define FPSID_CPUID_ARCH_MASK (0x7F << FPSID_ARCH_BIT)
|
|
#define FPSID_PART_BIT (8)
|
|
#define FPSID_PART_MASK (0xFF << FPSID_PART_BIT)
|
|
#define FPSID_VARIANT_BIT (4)
|
|
#define FPSID_VARIANT_MASK (0xF << FPSID_VARIANT_BIT)
|
|
#define FPSID_REV_BIT (0)
|
|
#define FPSID_REV_MASK (0xF << FPSID_REV_BIT)
|
|
|
|
/* FPEXC bits */
|
|
#define FPEXC_EX (1 << 31)
|
|
#define FPEXC_EN (1 << 30)
|
|
#define FPEXC_DEX (1 << 29)
|
|
#define FPEXC_FP2V (1 << 28)
|
|
#define FPEXC_VV (1 << 27)
|
|
#define FPEXC_TFV (1 << 26)
|
|
#define FPEXC_LENGTH_BIT (8)
|
|
#define FPEXC_LENGTH_MASK (7 << FPEXC_LENGTH_BIT)
|
|
#define FPEXC_IDF (1 << 7)
|
|
#define FPEXC_IXF (1 << 4)
|
|
#define FPEXC_UFF (1 << 3)
|
|
#define FPEXC_OFF (1 << 2)
|
|
#define FPEXC_DZF (1 << 1)
|
|
#define FPEXC_IOF (1 << 0)
|
|
#define FPEXC_TRAP_MASK (FPEXC_IDF|FPEXC_IXF|FPEXC_UFF|FPEXC_OFF|FPEXC_DZF|FPEXC_IOF)
|
|
|
|
/* FPSCR bits */
|
|
#define FPSCR_DEFAULT_NAN (1<<25)
|
|
#define FPSCR_FLUSHTOZERO (1<<24)
|
|
#define FPSCR_ROUND_NEAREST (0<<22)
|
|
#define FPSCR_ROUND_PLUSINF (1<<22)
|
|
#define FPSCR_ROUND_MINUSINF (2<<22)
|
|
#define FPSCR_ROUND_TOZERO (3<<22)
|
|
#define FPSCR_RMODE_BIT (22)
|
|
#define FPSCR_RMODE_MASK (3 << FPSCR_RMODE_BIT)
|
|
#define FPSCR_STRIDE_BIT (20)
|
|
#define FPSCR_STRIDE_MASK (3 << FPSCR_STRIDE_BIT)
|
|
#define FPSCR_LENGTH_BIT (16)
|
|
#define FPSCR_LENGTH_MASK (7 << FPSCR_LENGTH_BIT)
|
|
#define FPSCR_IOE (1<<8)
|
|
#define FPSCR_DZE (1<<9)
|
|
#define FPSCR_OFE (1<<10)
|
|
#define FPSCR_UFE (1<<11)
|
|
#define FPSCR_IXE (1<<12)
|
|
#define FPSCR_IDE (1<<15)
|
|
#define FPSCR_IOC (1<<0)
|
|
#define FPSCR_DZC (1<<1)
|
|
#define FPSCR_OFC (1<<2)
|
|
#define FPSCR_UFC (1<<3)
|
|
#define FPSCR_IXC (1<<4)
|
|
#define FPSCR_IDC (1<<7)
|
|
|
|
/* MVFR0 bits */
|
|
#define MVFR0_A_SIMD_BIT (0)
|
|
#define MVFR0_A_SIMD_MASK (0xf << MVFR0_A_SIMD_BIT)
|
|
#define MVFR0_SP_BIT (4)
|
|
#define MVFR0_SP_MASK (0xf << MVFR0_SP_BIT)
|
|
#define MVFR0_DP_BIT (8)
|
|
#define MVFR0_DP_MASK (0xf << MVFR0_DP_BIT)
|
|
|
|
/* Bit patterns for decoding the packaged operation descriptors */
|
|
#define VFPOPDESC_LENGTH_BIT (9)
|
|
#define VFPOPDESC_LENGTH_MASK (0x07 << VFPOPDESC_LENGTH_BIT)
|
|
#define VFPOPDESC_UNUSED_BIT (24)
|
|
#define VFPOPDESC_UNUSED_MASK (0xFF << VFPOPDESC_UNUSED_BIT)
|
|
#define VFPOPDESC_OPDESC_MASK (~(VFPOPDESC_LENGTH_MASK | VFPOPDESC_UNUSED_MASK))
|