summaryrefslogtreecommitdiffstats
path: root/arch/x86/kvm/cpuid.h
diff options
context:
space:
mode:
authorBinbin Wu <binbin.wu@linux.intel.com>2023-09-13 20:42:17 +0800
committerSean Christopherson <seanjc@google.com>2023-11-28 17:54:04 -0800
commit2c49db455ee27c72a680c9e4fad1c12433902ee3 (patch)
tree1a6c9b247b3fd1282324250d4426f5724525c940 /arch/x86/kvm/cpuid.h
parenta130066f74008858ac425b7497d231742474a0ea (diff)
downloadlinux-2c49db455ee27c72a680c9e4fad1c12433902ee3.tar.gz
linux-2c49db455ee27c72a680c9e4fad1c12433902ee3.tar.bz2
linux-2c49db455ee27c72a680c9e4fad1c12433902ee3.zip
KVM: x86: Add & use kvm_vcpu_is_legal_cr3() to check CR3's legality
Add and use kvm_vcpu_is_legal_cr3() to check CR3's legality to provide a clear distinction between CR3 and GPA checks. This will allow exempting bits from kvm_vcpu_is_legal_cr3() without affecting general GPA checks, e.g. for upcoming features that will use high bits in CR3 for feature enabling. No functional change intended. Signed-off-by: Binbin Wu <binbin.wu@linux.intel.com> Tested-by: Xuelian Guo <xuelian.guo@intel.com> Link: https://lore.kernel.org/r/20230913124227.12574-7-binbin.wu@linux.intel.com Signed-off-by: Sean Christopherson <seanjc@google.com>
Diffstat (limited to 'arch/x86/kvm/cpuid.h')
-rw-r--r--arch/x86/kvm/cpuid.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/arch/x86/kvm/cpuid.h b/arch/x86/kvm/cpuid.h
index 0b90532b6e26..5fd3f2d1ca14 100644
--- a/arch/x86/kvm/cpuid.h
+++ b/arch/x86/kvm/cpuid.h
@@ -279,4 +279,9 @@ static __always_inline bool guest_can_use(struct kvm_vcpu *vcpu,
vcpu->arch.governed_features.enabled);
}
+static inline bool kvm_vcpu_is_legal_cr3(struct kvm_vcpu *vcpu, unsigned long cr3)
+{
+ return kvm_vcpu_is_legal_gpa(vcpu, cr3);
+}
+
#endif