aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/x86/include/asm/kvm_host.h2
-rw-r--r--arch/x86/kvm/mmu.c2
-rw-r--r--arch/x86/kvm/vmx.c5
3 files changed, 6 insertions, 3 deletions
diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h
index 50c79b9f5c38..502e53f999cf 100644
--- a/arch/x86/include/asm/kvm_host.h
+++ b/arch/x86/include/asm/kvm_host.h
@@ -40,6 +40,8 @@
40 0xFFFFFF0000000000ULL) 40 0xFFFFFF0000000000ULL)
41 41
42#define INVALID_PAGE (~(hpa_t)0) 42#define INVALID_PAGE (~(hpa_t)0)
43#define VALID_PAGE(x) ((x) != INVALID_PAGE)
44
43#define UNMAPPED_GVA (~(gpa_t)0) 45#define UNMAPPED_GVA (~(gpa_t)0)
44 46
45/* KVM Hugepage definitions for x86 */ 47/* KVM Hugepage definitions for x86 */
diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c
index a20fd613acfe..70cdf6876b5f 100644
--- a/arch/x86/kvm/mmu.c
+++ b/arch/x86/kvm/mmu.c
@@ -92,8 +92,6 @@ module_param(oos_shadow, bool, 0644);
92#define PT_FIRST_AVAIL_BITS_SHIFT 9 92#define PT_FIRST_AVAIL_BITS_SHIFT 9
93#define PT64_SECOND_AVAIL_BITS_SHIFT 52 93#define PT64_SECOND_AVAIL_BITS_SHIFT 52
94 94
95#define VALID_PAGE(x) ((x) != INVALID_PAGE)
96
97#define PT64_LEVEL_BITS 9 95#define PT64_LEVEL_BITS 9
98 96
99#define PT64_LEVEL_SHIFT(level) \ 97#define PT64_LEVEL_SHIFT(level) \
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index 4dfb1dc09c88..2fdcc9819f36 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -1828,8 +1828,11 @@ static void exit_lmode(struct kvm_vcpu *vcpu)
1828static void vmx_flush_tlb(struct kvm_vcpu *vcpu) 1828static void vmx_flush_tlb(struct kvm_vcpu *vcpu)
1829{ 1829{
1830 vpid_sync_context(to_vmx(vcpu)); 1830 vpid_sync_context(to_vmx(vcpu));
1831 if (enable_ept) 1831 if (enable_ept) {
1832 if (!VALID_PAGE(vcpu->arch.mmu.root_hpa))
1833 return;
1832 ept_sync_context(construct_eptp(vcpu->arch.mmu.root_hpa)); 1834 ept_sync_context(construct_eptp(vcpu->arch.mmu.root_hpa));
1835 }
1833} 1836}
1834 1837
1835static void vmx_decache_cr0_guest_bits(struct kvm_vcpu *vcpu) 1838static void vmx_decache_cr0_guest_bits(struct kvm_vcpu *vcpu)