|
@@ -9,8 +9,6 @@
|
|
|
#ifndef __ASM_CPUFEATURE_H
|
|
|
#define __ASM_CPUFEATURE_H
|
|
|
|
|
|
-#include <linux/jump_label.h>
|
|
|
-
|
|
|
#include <asm/hwcap.h>
|
|
|
#include <asm/sysreg.h>
|
|
|
|
|
@@ -45,6 +43,8 @@
|
|
|
|
|
|
#ifndef __ASSEMBLY__
|
|
|
|
|
|
+#include <linux/bug.h>
|
|
|
+#include <linux/jump_label.h>
|
|
|
#include <linux/kernel.h>
|
|
|
|
|
|
/* CPU feature register tracking */
|
|
@@ -122,14 +122,19 @@ static inline bool cpu_have_feature(unsigned int num)
|
|
|
return elf_hwcap & (1UL << num);
|
|
|
}
|
|
|
|
|
|
+/* System capability check for constant caps */
|
|
|
+static inline bool cpus_have_const_cap(int num)
|
|
|
+{
|
|
|
+ if (num >= ARM64_NCAPS)
|
|
|
+ return false;
|
|
|
+ return static_branch_unlikely(&cpu_hwcap_keys[num]);
|
|
|
+}
|
|
|
+
|
|
|
static inline bool cpus_have_cap(unsigned int num)
|
|
|
{
|
|
|
if (num >= ARM64_NCAPS)
|
|
|
return false;
|
|
|
- if (__builtin_constant_p(num))
|
|
|
- return static_branch_unlikely(&cpu_hwcap_keys[num]);
|
|
|
- else
|
|
|
- return test_bit(num, cpu_hwcaps);
|
|
|
+ return test_bit(num, cpu_hwcaps);
|
|
|
}
|
|
|
|
|
|
static inline void cpus_set_cap(unsigned int num)
|
|
@@ -218,7 +223,7 @@ static inline bool cpu_supports_mixed_endian_el0(void)
|
|
|
|
|
|
static inline bool system_supports_32bit_el0(void)
|
|
|
{
|
|
|
- return cpus_have_cap(ARM64_HAS_32BIT_EL0);
|
|
|
+ return cpus_have_const_cap(ARM64_HAS_32BIT_EL0);
|
|
|
}
|
|
|
|
|
|
static inline bool system_supports_mixed_endian_el0(void)
|