Skip to content

Commit 4f2c9bf

Browse files
amitdanielkachhapctmarinas
authored andcommitted
arm64: Add compat hwcap SSBS
This hwcap was added for 32-bit native arm kernel by commit fea5354 ("ARM: 9274/1: Add hwcap for Speculative Store Bypassing Safe") and hence the corresponding changes added in 32-bit compat arm64 for similar user interfaces. Speculative Store Bypass Safe is a feature(FEAT_SSBS) present in AArch32/AArch64 state for Armv8 and can be identified by PFR2.SSBS identification register. This hwcap is already advertised in native arm64 kernel. Signed-off-by: Amit Daniel Kachhap <[email protected]> Reviewed-by: Mark Brown <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Catalin Marinas <[email protected]>
1 parent 2d602aa commit 4f2c9bf

File tree

3 files changed

+4
-1
lines changed

3 files changed

+4
-1
lines changed

arch/arm64/include/asm/hwcap.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
#define COMPAT_HWCAP2_SHA2 (1 << 3)
4545
#define COMPAT_HWCAP2_CRC32 (1 << 4)
4646
#define COMPAT_HWCAP2_SB (1 << 5)
47+
#define COMPAT_HWCAP2_SSBS (1 << 6)
4748

4849
#ifndef __ASSEMBLY__
4950
#include <linux/log2.h>

arch/arm64/kernel/cpufeature.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -562,7 +562,7 @@ static const struct arm64_ftr_bits ftr_id_pfr1[] = {
562562
};
563563

564564
static const struct arm64_ftr_bits ftr_id_pfr2[] = {
565-
ARM64_FTR_BITS(FTR_HIDDEN, FTR_NONSTRICT, FTR_LOWER_SAFE, ID_PFR2_EL1_SSBS_SHIFT, 4, 0),
565+
ARM64_FTR_BITS(FTR_VISIBLE, FTR_NONSTRICT, FTR_LOWER_SAFE, ID_PFR2_EL1_SSBS_SHIFT, 4, 0),
566566
ARM64_FTR_BITS(FTR_HIDDEN, FTR_NONSTRICT, FTR_LOWER_SAFE, ID_PFR2_EL1_CSV3_SHIFT, 4, 0),
567567
ARM64_FTR_END,
568568
};
@@ -2878,6 +2878,7 @@ static const struct arm64_cpu_capabilities compat_elf_hwcaps[] = {
28782878
HWCAP_CAP(SYS_ID_ISAR6_EL1, ID_ISAR6_EL1_SB_SHIFT, 4, FTR_UNSIGNED, 1, CAP_COMPAT_HWCAP2, COMPAT_HWCAP2_SB),
28792879
HWCAP_CAP(SYS_ID_ISAR6_EL1, ID_ISAR6_EL1_BF16_SHIFT, 4, FTR_UNSIGNED, 1, CAP_COMPAT_HWCAP, COMPAT_HWCAP_ASIMDBF16),
28802880
HWCAP_CAP(SYS_ID_ISAR6_EL1, ID_ISAR6_EL1_I8MM_SHIFT, 4, FTR_UNSIGNED, 1, CAP_COMPAT_HWCAP, COMPAT_HWCAP_I8MM),
2881+
HWCAP_CAP(SYS_ID_PFR2_EL1, ID_PFR2_EL1_SSBS_SHIFT, 4, FTR_UNSIGNED, 1, CAP_COMPAT_HWCAP2, COMPAT_HWCAP2_SSBS),
28812882
#endif
28822883
{},
28832884
};

arch/arm64/kernel/cpuinfo.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,7 @@ static const char *const compat_hwcap2_str[] = {
162162
[COMPAT_KERNEL_HWCAP2(SHA2)] = "sha2",
163163
[COMPAT_KERNEL_HWCAP2(CRC32)] = "crc32",
164164
[COMPAT_KERNEL_HWCAP2(SB)] = "sb",
165+
[COMPAT_KERNEL_HWCAP2(SSBS)] = "ssbs",
165166
};
166167
#endif /* CONFIG_COMPAT */
167168

0 commit comments

Comments
 (0)