Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 18b9dc13 authored by Will Deacon's avatar Will Deacon
Browse files

ARM: vfp: add VFPv4 capability detection and populate elf_hwcap



The presence of VFPv4 cannot be detected simply by looking at the FPSID
subarchitecture field, as a value >= 2 signifies the architecture as
VFPv3 or later.

This patch reads from MVFR1 to check whether or not the fused multiply
accumulate instructions are supported. Since these are introduced with
VFPv4, this tells us what we need to know.

Signed-off-by: default avatarWill Deacon <will.deacon@arm.com>
parent 254cdf8e
Loading
Loading
Loading
Loading
+4 −2
Original line number Original line Diff line number Diff line
@@ -582,7 +582,6 @@ static int __init vfp_init(void)
				elf_hwcap |= HWCAP_VFPv3D16;
				elf_hwcap |= HWCAP_VFPv3D16;
		}
		}
#endif
#endif
#ifdef CONFIG_NEON
		/*
		/*
		 * Check for the presence of the Advanced SIMD
		 * Check for the presence of the Advanced SIMD
		 * load/store instructions, integer and single
		 * load/store instructions, integer and single
@@ -590,10 +589,13 @@ static int __init vfp_init(void)
		 * for NEON if the hardware has the MVFR registers.
		 * for NEON if the hardware has the MVFR registers.
		 */
		 */
		if ((read_cpuid_id() & 0x000f0000) == 0x000f0000) {
		if ((read_cpuid_id() & 0x000f0000) == 0x000f0000) {
#ifdef CONFIG_NEON
			if ((fmrx(MVFR1) & 0x000fff00) == 0x00011100)
			if ((fmrx(MVFR1) & 0x000fff00) == 0x00011100)
				elf_hwcap |= HWCAP_NEON;
				elf_hwcap |= HWCAP_NEON;
		}
#endif
#endif
			if ((fmrx(MVFR1) & 0xf0000000) == 0x10000000)
				elf_hwcap |= HWCAP_VFPv4;
		}
	}
	}
	return 0;
	return 0;
}
}