diff options
author | Alex Shi <alex.shi@linaro.org> | 2016-05-24 17:08:09 +0800 |
---|---|---|
committer | Alex Shi <alex.shi@linaro.org> | 2016-05-24 17:15:05 +0800 |
commit | 4af24d46c37a93f0488a3d9ee4794bd67e1dd723 (patch) | |
tree | c8a53151e2606eb6f6978c0943927767ac2967c5 | |
parent | 721974df3739fd8b311f33d7d134d09605c7b75c (diff) |
arm64: Add ARM64_HAS_VIRT_HOST_EXTN feature
Add a new ARM64_HAS_VIRT_HOST_EXTN features to indicate that the
CPU has the ARMv8.1 VHE capability.
This will be used to trigger kernel patching in KVM.
Acked-by: Christoffer Dall <christoffer.dall@linaro.org>
Acked-by: Catalin Marinas <catalin.marinas@arm.com>
cherry picked from commit d88701bea3664cea99b8b7380f63a3bd0ec3ead3
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
Signed-off-by: Alex Shi <alex.shi@linaro.org>
-rw-r--r-- | arch/arm64/include/asm/cpufeature.h | 6 | ||||
-rw-r--r-- | arch/arm64/kernel/cpufeature.c | 11 |
2 files changed, 16 insertions, 1 deletions
diff --git a/arch/arm64/include/asm/cpufeature.h b/arch/arm64/include/asm/cpufeature.h index c1e74014784a..7b694db1f3fa 100644 --- a/arch/arm64/include/asm/cpufeature.h +++ b/arch/arm64/include/asm/cpufeature.h @@ -29,8 +29,12 @@ #define ARM64_HAS_LSE_ATOMICS 5 #define ARM64_WORKAROUND_CAVIUM_23154 6 #define ARM64_WORKAROUND_834220 7 +/* #define ARM64_HAS_NO_HW_PREFETCH 8 */ +/* #define ARM64_HAS_UAO 9 */ +/* #define ARM64_ALT_PAN_NOT_UAO 10 */ +#define ARM64_HAS_VIRT_HOST_EXTN 11 -#define ARM64_NCAPS 8 +#define ARM64_NCAPS 12 #ifndef __ASSEMBLY__ diff --git a/arch/arm64/kernel/cpufeature.c b/arch/arm64/kernel/cpufeature.c index 5ad86ceac010..e1dcd6396958 100644 --- a/arch/arm64/kernel/cpufeature.c +++ b/arch/arm64/kernel/cpufeature.c @@ -21,6 +21,7 @@ #include <linux/types.h> #include <asm/cpu.h> #include <asm/cpufeature.h> +#include <asm/virt.h> static bool has_id_aa64pfr0_feature(const struct arm64_cpu_capabilities *entry) @@ -31,6 +32,11 @@ has_id_aa64pfr0_feature(const struct arm64_cpu_capabilities *entry) return (val & entry->register_mask) == entry->register_value; } +static bool runs_at_el2(const struct arm64_cpu_capabilities *entry) +{ + return is_kernel_in_hyp_mode(); +} + static const struct arm64_cpu_capabilities arm64_features[] = { { .desc = "GIC system register CPU interface", @@ -39,6 +45,11 @@ static const struct arm64_cpu_capabilities arm64_features[] = { .register_mask = (0xf << 24), .register_value = (1 << 24), }, + { + .desc = "Virtualization Host Extensions", + .capability = ARM64_HAS_VIRT_HOST_EXTN, + .matches = runs_at_el2, + }, {}, }; |