Commit 3bda6d88 authored by Amit Daniel Kachhap's avatar Amit Daniel Kachhap Committed by Russell King (Oracle)

ARM: 9273/1: Add hwcap for Speculation Barrier(SB)

Speculation Barrier(FEAT_SB) is a feature present in AArch32 state for
Armv8 and is represented by ISAR6.SB identification register.

This feature denotes the presence of SB instruction and hence adding a
hwcap will enable the userspace to check it before trying to use this
instruction.

This commit adds the ID feature bit detection, and uses elf_hwcap2
accordingly.
Reviewed-by: default avatarLinus Walleij <linus.walleij@linaro.org>
Signed-off-by: default avatarAmit Daniel Kachhap <amit.kachhap@arm.com>
Signed-off-by: default avatarRussell King (Oracle) <rmk+kernel@armlinux.org.uk>
parent 956ca3a4
...@@ -43,5 +43,6 @@ ...@@ -43,5 +43,6 @@
#define HWCAP2_SHA1 (1 << 2) #define HWCAP2_SHA1 (1 << 2)
#define HWCAP2_SHA2 (1 << 3) #define HWCAP2_SHA2 (1 << 3)
#define HWCAP2_CRC32 (1 << 4) #define HWCAP2_CRC32 (1 << 4)
#define HWCAP2_SB (1 << 5)
#endif /* _UAPI__ASMARM_HWCAP_H */ #endif /* _UAPI__ASMARM_HWCAP_H */
...@@ -450,6 +450,7 @@ static void __init cpuid_init_hwcaps(void) ...@@ -450,6 +450,7 @@ static void __init cpuid_init_hwcaps(void)
{ {
int block; int block;
u32 isar5; u32 isar5;
u32 isar6;
if (cpu_architecture() < CPU_ARCH_ARMv7) if (cpu_architecture() < CPU_ARCH_ARMv7)
return; return;
...@@ -485,6 +486,12 @@ static void __init cpuid_init_hwcaps(void) ...@@ -485,6 +486,12 @@ static void __init cpuid_init_hwcaps(void)
block = cpuid_feature_extract_field(isar5, 16); block = cpuid_feature_extract_field(isar5, 16);
if (block >= 1) if (block >= 1)
elf_hwcap2 |= HWCAP2_CRC32; elf_hwcap2 |= HWCAP2_CRC32;
/* Check for Speculation barrier instruction */
isar6 = read_cpuid_ext(CPUID_EXT_ISAR6);
block = cpuid_feature_extract_field(isar6, 12);
if (block >= 1)
elf_hwcap2 |= HWCAP2_SB;
} }
static void __init elf_hwcap_fixup(void) static void __init elf_hwcap_fixup(void)
...@@ -1264,6 +1271,7 @@ static const char *hwcap2_str[] = { ...@@ -1264,6 +1271,7 @@ static const char *hwcap2_str[] = {
"sha1", "sha1",
"sha2", "sha2",
"crc32", "crc32",
"sb",
NULL NULL
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment