Commit 94a9e04a authored by Marc Zyngier's avatar Marc Zyngier Committed by Catalin Marinas

arm64: alternative: Introduce feature for GICv3 CPU interface

Add a new item to the feature set (ARM64_HAS_SYSREG_GIC_CPUIF)
to indicate that we have a system register GIC CPU interface

This will help KVM switching to alternative instruction patching.
Reviewed-by: default avatarAndre Przywara <andre.przywara@arm.com>
Reviewed-by: default avatarChristoffer Dall <christoffer.dall@linaro.org>
Acked-by: default avatarWill Deacon <will.deacon@arm.com>
Signed-off-by: default avatarMarc Zyngier <marc.zyngier@arm.com>
Signed-off-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
parent 73bf8412
...@@ -24,8 +24,9 @@ ...@@ -24,8 +24,9 @@
#define ARM64_WORKAROUND_CLEAN_CACHE 0 #define ARM64_WORKAROUND_CLEAN_CACHE 0
#define ARM64_WORKAROUND_DEVICE_LOAD_ACQUIRE 1 #define ARM64_WORKAROUND_DEVICE_LOAD_ACQUIRE 1
#define ARM64_WORKAROUND_845719 2 #define ARM64_WORKAROUND_845719 2
#define ARM64_HAS_SYSREG_GIC_CPUIF 3
#define ARM64_NCAPS 3 #define ARM64_NCAPS 4
#ifndef __ASSEMBLY__ #ifndef __ASSEMBLY__
...@@ -38,6 +39,11 @@ struct arm64_cpu_capabilities { ...@@ -38,6 +39,11 @@ struct arm64_cpu_capabilities {
u32 midr_model; u32 midr_model;
u32 midr_range_min, midr_range_max; u32 midr_range_min, midr_range_max;
}; };
struct { /* Feature register checking */
u64 register_mask;
u64 register_value;
};
}; };
}; };
......
...@@ -22,7 +22,23 @@ ...@@ -22,7 +22,23 @@
#include <asm/cpu.h> #include <asm/cpu.h>
#include <asm/cpufeature.h> #include <asm/cpufeature.h>
static bool
has_id_aa64pfr0_feature(const struct arm64_cpu_capabilities *entry)
{
u64 val;
val = read_cpuid(id_aa64pfr0_el1);
return (val & entry->register_mask) == entry->register_value;
}
static const struct arm64_cpu_capabilities arm64_features[] = { static const struct arm64_cpu_capabilities arm64_features[] = {
{
.desc = "GIC system register CPU interface",
.capability = ARM64_HAS_SYSREG_GIC_CPUIF,
.matches = has_id_aa64pfr0_feature,
.register_mask = (0xf << 24),
.register_value = (1 << 24),
},
{}, {},
}; };
......
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