diff options
author | Marc Zyngier <maz@kernel.org> | 2023-06-09 17:21:47 +0100 |
---|---|---|
committer | Oliver Upton <oliver.upton@linux.dev> | 2023-06-12 23:17:23 +0000 |
commit | e2d6c906f0ac69559da887c0a2c3c10070e746c5 (patch) | |
tree | fae40aa09fde93a947cb9927958e38d47d722a8a /arch/arm64/include/asm/virt.h | |
parent | 0ddc312b7c73049d982d173fee4c5dabf1727ebb (diff) |
arm64: Add KVM_HVHE capability and has_hvhe() predicate
Expose a capability keying the hVHE feature as well as a new
predicate testing it. Nothing is so far using it, and nothing
is enabling it yet.
Signed-off-by: Marc Zyngier <maz@kernel.org>
Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>
Link: https://lore.kernel.org/r/20230609162200.2024064-5-maz@kernel.org
Signed-off-by: Oliver Upton <oliver.upton@linux.dev>
Diffstat (limited to 'arch/arm64/include/asm/virt.h')
-rw-r--r-- | arch/arm64/include/asm/virt.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/arch/arm64/include/asm/virt.h b/arch/arm64/include/asm/virt.h index 21e94068804d..5227db7640c8 100644 --- a/arch/arm64/include/asm/virt.h +++ b/arch/arm64/include/asm/virt.h @@ -142,6 +142,14 @@ static __always_inline bool is_protected_kvm_enabled(void) return cpus_have_final_cap(ARM64_KVM_PROTECTED_MODE); } +static __always_inline bool has_hvhe(void) +{ + if (is_vhe_hyp_code()) + return false; + + return cpus_have_final_cap(ARM64_KVM_HVHE); +} + static inline bool is_hyp_nvhe(void) { return is_hyp_mode_available() && !is_kernel_in_hyp_mode(); |