@@ -21,13 +21,15 @@
#define MAX_CPU_FEATURES (8 * sizeof(elf_hwcap))
#define cpu_feature(x) ilog2(HWCAP_ ## x)
-#define ARM64_WORKAROUND_CLEAN_CACHE 0
-#define ARM64_WORKAROUND_DEVICE_LOAD_ACQUIRE 1
-#define ARM64_WORKAROUND_845719 2
-#define ARM64_HAS_SYSREG_GIC_CPUIF 3
-#define ARM64_WORKAROUND_CAVIUM_23154 4
+/* reserve zero to match all cpus for use of caps in empty structs */
+#define ARM64_ALL_CPUS 0
+#define ARM64_WORKAROUND_CLEAN_CACHE 1
+#define ARM64_WORKAROUND_DEVICE_LOAD_ACQUIRE 2
+#define ARM64_WORKAROUND_845719 3
+#define ARM64_HAS_SYSREG_GIC_CPUIF 4
+#define ARM64_WORKAROUND_CAVIUM_23154 5
-#define ARM64_NCAPS 5
+#define ARM64_NCAPS 6
#ifndef __ASSEMBLY__
@@ -57,6 +59,9 @@ static inline bool cpu_have_feature(unsigned int num)
static inline bool cpus_have_cap(unsigned int num)
{
+ /* zero matches for all cpus */
+ if (!num)
+ return true;
if (num >= ARM64_NCAPS)
return false;
return test_bit(num, cpu_hwcaps);
@@ -25,7 +25,7 @@ void gic_check_capabilities(u32 iidr, const struct gic_capabilities *cap,
void *data)
{
for (; cap->desc; cap++) {
- if (cap->cpu_cap && !cpus_have_cap(cap->cpu_cap))
+ if (!cpus_have_cap(cap->cpu_cap))
continue;
if (cap->iidr != (cap->mask & iidr))
continue;