Skip to content

Commit 45f5d7f

Browse files
Marc ZyngierAlex Shi
authored andcommitted
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> Signed-off-by: Marc Zyngier <marc.zyngier@arm.com> (cherry picked from commit d88701bea3664cea99b8b7380f63a3bd0ec3ead3) Signed-off-by: Alex Shi <alex.shi@linaro.org> Conflicts: arch/arm64/include/asm/cpufeature.h
1 parent baf8b41 commit 45f5d7f

2 files changed

Lines changed: 17 additions & 1 deletion

File tree

arch/arm64/include/asm/cpufeature.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,12 @@
3232
#define ARM64_WORKAROUND_834220 7
3333
#define ARM64_WORKAROUND_CAVIUM_27456 8
3434

35-
#define ARM64_NCAPS 9
35+
/* #define ARM64_HAS_NO_HW_PREFETCH 8 */
36+
/* #define ARM64_HAS_UAO 9 */
37+
/* #define ARM64_ALT_PAN_NOT_UAO 10 */
38+
#define ARM64_HAS_VIRT_HOST_EXTN 11
39+
40+
#define ARM64_NCAPS 12
3641

3742
#ifndef __ASSEMBLY__
3843

arch/arm64/kernel/cpufeature.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
#include <asm/cpu_ops.h>
2727
#include <asm/processor.h>
2828
#include <asm/sysreg.h>
29+
#include <asm/virt.h>
2930

3031
unsigned long elf_hwcap __read_mostly;
3132
EXPORT_SYMBOL_GPL(elf_hwcap);
@@ -621,6 +622,11 @@ static bool has_useable_gicv3_cpuif(const struct arm64_cpu_capabilities *entry)
621622
return has_sre;
622623
}
623624

625+
static bool runs_at_el2(const struct arm64_cpu_capabilities *entry)
626+
{
627+
return is_kernel_in_hyp_mode();
628+
}
629+
624630
static const struct arm64_cpu_capabilities arm64_features[] = {
625631
{
626632
.desc = "GIC system register CPU interface",
@@ -651,6 +657,11 @@ static const struct arm64_cpu_capabilities arm64_features[] = {
651657
.min_field_value = 2,
652658
},
653659
#endif /* CONFIG_AS_LSE && CONFIG_ARM64_LSE_ATOMICS */
660+
{
661+
.desc = "Virtualization Host Extensions",
662+
.capability = ARM64_HAS_VIRT_HOST_EXTN,
663+
.matches = runs_at_el2,
664+
},
654665
{},
655666
};
656667

0 commit comments

Comments
 (0)