aboutsummaryrefslogtreecommitdiff
path: root/arch/arm64/include
diff options
context:
space:
mode:
authorAndre Przywara <andre.przywara@arm.com>2015-04-24 10:30:45 -0700
committerSasha Levin <sasha.levin@oracle.com>2015-04-27 17:13:43 -0400
commit9a21c96c4672f02cc195c69ec083b3e664bd2221 (patch)
treee231aa73e368cc8c88474ea506244b4ea1514c05 /arch/arm64/include
parentdd6903432858c88c0b277f936352af248da9fe7e (diff)
downloadlinux-linaro-stable-9a21c96c4672f02cc195c69ec083b3e664bd2221.tar.gz
arm64: add cpu_capabilities bitmap
For taking note if at least one CPU in the system needs a bug workaround or would benefit from a code optimization, we create a new bitmap to hold (artificial) feature bits. Since elf_hwcap is part of the userland ABI, we keep it alone and introduce a new data structure for that (along with some accessors). Signed-off-by: Andre Przywara <andre.przywara@arm.com> Signed-off-by: Will Deacon <will.deacon@arm.com> Cc: <stable@vger.kernel.org> # v3.18.y (cherry picked from commit 930da09f5e50dd22fb0a8600388da8677d62d671) Signed-off-by: Kevin Hilman <khilman@linaro.org> Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
Diffstat (limited to 'arch/arm64/include')
-rw-r--r--arch/arm64/include/asm/cpufeature.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/arch/arm64/include/asm/cpufeature.h b/arch/arm64/include/asm/cpufeature.h
index cd4ac0516488..20b2b3d6b702 100644
--- a/arch/arm64/include/asm/cpufeature.h
+++ b/arch/arm64/include/asm/cpufeature.h
@@ -21,9 +21,29 @@
#define MAX_CPU_FEATURES (8 * sizeof(elf_hwcap))
#define cpu_feature(x) ilog2(HWCAP_ ## x)
+#define NCAPS 0
+
+extern DECLARE_BITMAP(cpu_hwcaps, NCAPS);
+
static inline bool cpu_have_feature(unsigned int num)
{
return elf_hwcap & (1UL << num);
}
+static inline bool cpus_have_cap(unsigned int num)
+{
+ if (num >= NCAPS)
+ return false;
+ return test_bit(num, cpu_hwcaps);
+}
+
+static inline void cpus_set_cap(unsigned int num)
+{
+ if (num >= NCAPS)
+ pr_warn("Attempt to set an illegal CPU capability (%d >= %d)\n",
+ num, NCAPS);
+ else
+ __set_bit(num, cpu_hwcaps);
+}
+
#endif