diff options
author | David Brazdil <dbrazdil@google.com> | 2020-12-02 18:40:58 +0000 |
---|---|---|
committer | Marc Zyngier <maz@kernel.org> | 2020-12-04 08:44:19 +0000 |
commit | 3eb681fba2bf8b67b65ce92d0ebfd7cbfc263da9 (patch) | |
tree | 80f606f3844112537952138f600bcc926a5b1b35 /arch/arm64/include/asm/virt.h | |
parent | d8b369c4e31430a4746571bcae45a98933827232 (diff) |
KVM: arm64: Add ARM64_KVM_PROTECTED_MODE CPU capability
Expose the boolean value whether the system is running with KVM in
protected mode (nVHE + kernel param). CPU capability was selected over
a global variable to allow use in alternatives.
Signed-off-by: David Brazdil <dbrazdil@google.com>
Signed-off-by: Marc Zyngier <maz@kernel.org>
Link: https://lore.kernel.org/r/20201202184122.26046-3-dbrazdil@google.com
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 6069be50baf9..eb81dcc220b6 100644 --- a/arch/arm64/include/asm/virt.h +++ b/arch/arm64/include/asm/virt.h @@ -97,6 +97,14 @@ static __always_inline bool has_vhe(void) return cpus_have_final_cap(ARM64_HAS_VIRT_HOST_EXTN); } +static __always_inline bool is_protected_kvm_enabled(void) +{ + if (is_vhe_hyp_code()) + return false; + else + return cpus_have_final_cap(ARM64_KVM_PROTECTED_MODE); +} + #endif /* __ASSEMBLY__ */ #endif /* ! __ASM__VIRT_H */ |