aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/x86/kvm/mmu.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c
index 1e9ba81accba..d3c3d5e5ffd4 100644
--- a/arch/x86/kvm/mmu.c
+++ b/arch/x86/kvm/mmu.c
@@ -5602,14 +5602,18 @@ static int alloc_mmu_pages(struct kvm_vcpu *vcpu)
5602 struct page *page; 5602 struct page *page;
5603 int i; 5603 int i;
5604 5604
5605 if (tdp_enabled)
5606 return 0;
5607
5608 /* 5605 /*
5609 * When emulating 32-bit mode, cr3 is only 32 bits even on x86_64. 5606 * When using PAE paging, the four PDPTEs are treated as 'root' pages,
5610 * Therefore we need to allocate shadow page tables in the first 5607 * while the PDP table is a per-vCPU construct that's allocated at MMU
5611 * 4GB of memory, which happens to fit the DMA32 zone. 5608 * creation. When emulating 32-bit mode, cr3 is only 32 bits even on
5609 * x86_64. Therefore we need to allocate the PDP table in the first
5610 * 4GB of memory, which happens to fit the DMA32 zone. Except for
5611 * SVM's 32-bit NPT support, TDP paging doesn't use PAE paging and can
5612 * skip allocating the PDP table.
5612 */ 5613 */
5614 if (tdp_enabled && kvm_x86_ops->get_tdp_level(vcpu) > PT32E_ROOT_LEVEL)
5615 return 0;
5616
5613 page = alloc_page(GFP_KERNEL_ACCOUNT | __GFP_DMA32); 5617 page = alloc_page(GFP_KERNEL_ACCOUNT | __GFP_DMA32);
5614 if (!page) 5618 if (!page)
5615 return -ENOMEM; 5619 return -ENOMEM;