Skip to content

Commit fea5354

Browse files
amitdanielkachhapRussell King (Oracle)
authored andcommitted
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 <[email protected]> Signed-off-by: Amit Daniel Kachhap <[email protected]> Signed-off-by: Russell King (Oracle) <[email protected]>
1 parent 3bda6d8 commit fea5354

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

arch/arm/include/uapi/asm/hwcap.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,5 +44,6 @@
4444
#define HWCAP2_SHA2 (1 << 3)
4545
#define HWCAP2_CRC32 (1 << 4)
4646
#define HWCAP2_SB (1 << 5)
47+
#define HWCAP2_SSBS (1 << 6)
4748

4849
#endif /* _UAPI__ASMARM_HWCAP_H */

arch/arm/kernel/setup.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -451,6 +451,7 @@ static void __init cpuid_init_hwcaps(void)
451451
int block;
452452
u32 isar5;
453453
u32 isar6;
454+
u32 pfr2;
454455

455456
if (cpu_architecture() < CPU_ARCH_ARMv7)
456457
return;
@@ -492,6 +493,12 @@ static void __init cpuid_init_hwcaps(void)
492493
block = cpuid_feature_extract_field(isar6, 12);
493494
if (block >= 1)
494495
elf_hwcap2 |= HWCAP2_SB;
496+
497+
/* Check for Speculative Store Bypassing control */
498+
pfr2 = read_cpuid_ext(CPUID_EXT_PFR2);
499+
block = cpuid_feature_extract_field(pfr2, 4);
500+
if (block >= 1)
501+
elf_hwcap2 |= HWCAP2_SSBS;
495502
}
496503

497504
static void __init elf_hwcap_fixup(void)
@@ -1272,6 +1279,7 @@ static const char *hwcap2_str[] = {
12721279
"sha2",
12731280
"crc32",
12741281
"sb",
1282+
"ssbs",
12751283
NULL
12761284
};
12771285

0 commit comments

Comments
 (0)