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

ARM: 9274/1: Add hwcap for Speculative Store Bypassing Safe

Speculative Store Bypassing Safe(FEAT_SSBS) is a feature present in
AArch32 state for Armv8 and is represented by ID_PFR2_EL1.SSBS
identification register.

This feature denotes the presence of PSTATE.ssbs bit and hence adding a
hwcap will enable the userspace to check it before trying to set/unset
this PSTATE.

This commit adds the ID feature bit detection, and uses elf_hwcap2
accordingly.

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)
fea53546 3bda6d88

+9
+1
arch/arm/include/uapi/asm/hwcap.h
··· 44 44 #define HWCAP2_SHA2 (1 << 3) 45 45 #define HWCAP2_CRC32 (1 << 4) 46 46 #define HWCAP2_SB (1 << 5) 47 + #define HWCAP2_SSBS (1 << 6) 47 48 48 49 #endif /* _UAPI__ASMARM_HWCAP_H */
+8
arch/arm/kernel/setup.c
··· 451 451 int block; 452 452 u32 isar5; 453 453 u32 isar6; 454 + u32 pfr2; 454 455 455 456 if (cpu_architecture() < CPU_ARCH_ARMv7) 456 457 return; ··· 493 492 block = cpuid_feature_extract_field(isar6, 12); 494 493 if (block >= 1) 495 494 elf_hwcap2 |= HWCAP2_SB; 495 + 496 + /* Check for Speculative Store Bypassing control */ 497 + pfr2 = read_cpuid_ext(CPUID_EXT_PFR2); 498 + block = cpuid_feature_extract_field(pfr2, 4); 499 + if (block >= 1) 500 + elf_hwcap2 |= HWCAP2_SSBS; 496 501 } 497 502 498 503 static void __init elf_hwcap_fixup(void) ··· 1279 1272 "sha2", 1280 1273 "crc32", 1281 1274 "sb", 1275 + "ssbs", 1282 1276 NULL 1283 1277 }; 1284 1278