diff options
author | Marc Zyngier <marc.zyngier@arm.com> | 2015-09-30 06:50:04 -0400 |
---|---|---|
committer | Marc Zyngier <marc.zyngier@arm.com> | 2015-10-09 17:16:54 -0400 |
commit | 963fcd40958711cecf9e9a1a8525f88b782d6a98 (patch) | |
tree | f4e6c437796fc63d7f5204baccd91dbb3af5c1b5 | |
parent | 7cabd0086acd8f204d9b11a9b0aca90d6a9fcc5b (diff) |
arm64: cpufeatures: Check ICC_EL1_SRE.SRE before enabling ARM64_HAS_SYSREG_GIC_CPUIF
As the firmware (or the hypervisor) may have disabled SRE access,
check that SRE can actually be enabled before declaring that we
do have that capability.
Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
-rw-r--r-- | arch/arm64/kernel/cpufeature.c | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/arch/arm64/kernel/cpufeature.c b/arch/arm64/kernel/cpufeature.c index 3c9aed32f70b..305f30dc9e63 100644 --- a/arch/arm64/kernel/cpufeature.c +++ b/arch/arm64/kernel/cpufeature.c | |||
@@ -23,6 +23,8 @@ | |||
23 | #include <asm/cpufeature.h> | 23 | #include <asm/cpufeature.h> |
24 | #include <asm/processor.h> | 24 | #include <asm/processor.h> |
25 | 25 | ||
26 | #include <linux/irqchip/arm-gic-v3.h> | ||
27 | |||
26 | static bool | 28 | static bool |
27 | feature_matches(u64 reg, const struct arm64_cpu_capabilities *entry) | 29 | feature_matches(u64 reg, const struct arm64_cpu_capabilities *entry) |
28 | { | 30 | { |
@@ -45,11 +47,26 @@ __ID_FEAT_CHK(id_aa64pfr0); | |||
45 | __ID_FEAT_CHK(id_aa64mmfr1); | 47 | __ID_FEAT_CHK(id_aa64mmfr1); |
46 | __ID_FEAT_CHK(id_aa64isar0); | 48 | __ID_FEAT_CHK(id_aa64isar0); |
47 | 49 | ||
50 | static bool has_useable_gicv3_cpuif(const struct arm64_cpu_capabilities *entry) | ||
51 | { | ||
52 | bool has_sre; | ||
53 | |||
54 | if (!has_id_aa64pfr0_feature(entry)) | ||
55 | return false; | ||
56 | |||
57 | has_sre = gic_enable_sre(); | ||
58 | if (!has_sre) | ||
59 | pr_warn_once("%s present but disabled by higher exception level\n", | ||
60 | entry->desc); | ||
61 | |||
62 | return has_sre; | ||
63 | } | ||
64 | |||
48 | static const struct arm64_cpu_capabilities arm64_features[] = { | 65 | static const struct arm64_cpu_capabilities arm64_features[] = { |
49 | { | 66 | { |
50 | .desc = "GIC system register CPU interface", | 67 | .desc = "GIC system register CPU interface", |
51 | .capability = ARM64_HAS_SYSREG_GIC_CPUIF, | 68 | .capability = ARM64_HAS_SYSREG_GIC_CPUIF, |
52 | .matches = has_id_aa64pfr0_feature, | 69 | .matches = has_useable_gicv3_cpuif, |
53 | .field_pos = 24, | 70 | .field_pos = 24, |
54 | .min_field_value = 1, | 71 | .min_field_value = 1, |
55 | }, | 72 | }, |