diff options
Diffstat (limited to 'arch/x86/kvm/mmu.c')
-rw-r--r-- | arch/x86/kvm/mmu.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c index 311f6dad8951..7fed5b793faf 100644 --- a/arch/x86/kvm/mmu.c +++ b/arch/x86/kvm/mmu.c | |||
@@ -2254,6 +2254,10 @@ static int mmu_alloc_roots(struct kvm_vcpu *vcpu) | |||
2254 | return 0; | 2254 | return 0; |
2255 | } | 2255 | } |
2256 | direct = !is_paging(vcpu); | 2256 | direct = !is_paging(vcpu); |
2257 | |||
2258 | if (mmu_check_root(vcpu, root_gfn)) | ||
2259 | return 1; | ||
2260 | |||
2257 | for (i = 0; i < 4; ++i) { | 2261 | for (i = 0; i < 4; ++i) { |
2258 | hpa_t root = vcpu->arch.mmu.pae_root[i]; | 2262 | hpa_t root = vcpu->arch.mmu.pae_root[i]; |
2259 | 2263 | ||
@@ -2265,13 +2269,13 @@ static int mmu_alloc_roots(struct kvm_vcpu *vcpu) | |||
2265 | continue; | 2269 | continue; |
2266 | } | 2270 | } |
2267 | root_gfn = pdptr >> PAGE_SHIFT; | 2271 | root_gfn = pdptr >> PAGE_SHIFT; |
2272 | if (mmu_check_root(vcpu, root_gfn)) | ||
2273 | return 1; | ||
2268 | } else if (vcpu->arch.mmu.root_level == 0) | 2274 | } else if (vcpu->arch.mmu.root_level == 0) |
2269 | root_gfn = 0; | 2275 | root_gfn = 0; |
2270 | if (mmu_check_root(vcpu, root_gfn)) | ||
2271 | return 1; | ||
2272 | if (tdp_enabled) { | 2276 | if (tdp_enabled) { |
2273 | direct = 1; | 2277 | direct = 1; |
2274 | root_gfn = i << 30; | 2278 | root_gfn = i << (30 - PAGE_SHIFT); |
2275 | } | 2279 | } |
2276 | spin_lock(&vcpu->kvm->mmu_lock); | 2280 | spin_lock(&vcpu->kvm->mmu_lock); |
2277 | kvm_mmu_free_some_pages(vcpu); | 2281 | kvm_mmu_free_some_pages(vcpu); |