summaryrefslogtreecommitdiff
path: root/arch/x86/kvm/x86.h
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2019-06-06 18:52:44 +0200
committerPaolo Bonzini <pbonzini@redhat.com>2019-06-18 11:47:38 +0200
commitbf03d4f9334728bf7c8ffc7de787df48abd6340e (patch)
tree43104c3883abc622b5678b0878dc75b51b6dbd29 /arch/x86/kvm/x86.h
parentc27e5b0d139b8728abd6b087cb0d3b2eae6ab079 (diff)
KVM: x86: introduce is_pae_paging
Checking for 32-bit PAE is quite common around code that fiddles with the PDPTRs. Add a function to compress all checks into a single invocation. Reviewed-by: Sean Christopherson <sean.j.christopherson@intel.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'arch/x86/kvm/x86.h')
-rw-r--r--arch/x86/kvm/x86.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/arch/x86/kvm/x86.h b/arch/x86/kvm/x86.h
index 275b3b646023..e08a12892e8b 100644
--- a/arch/x86/kvm/x86.h
+++ b/arch/x86/kvm/x86.h
@@ -139,6 +139,11 @@ static inline int is_paging(struct kvm_vcpu *vcpu)
return likely(kvm_read_cr0_bits(vcpu, X86_CR0_PG));
}
+static inline bool is_pae_paging(struct kvm_vcpu *vcpu)
+{
+ return !is_long_mode(vcpu) && is_pae(vcpu) && is_paging(vcpu);
+}
+
static inline u32 bit(int bitno)
{
return 1 << (bitno & 31);