Commit 957446af authored by Joerg Roedel's avatar Joerg Roedel Committed by Avi Kivity

KVM: MMU: Check for root_level instead of long mode

The walk_addr function checks for !is_long_mode in its 64
bit version. But what is meant here is a check for pae
paging. Change the condition to really check for pae paging
so that it also works with nested nested paging.
Signed-off-by: default avatarJoerg Roedel <joerg.roedel@amd.com>
Signed-off-by: default avatarAvi Kivity <avi@redhat.com>
parent 7b914098
...@@ -132,7 +132,7 @@ static int FNAME(walk_addr)(struct guest_walker *walker, ...@@ -132,7 +132,7 @@ static int FNAME(walk_addr)(struct guest_walker *walker,
walker->level = vcpu->arch.mmu.root_level; walker->level = vcpu->arch.mmu.root_level;
pte = vcpu->arch.cr3; pte = vcpu->arch.cr3;
#if PTTYPE == 64 #if PTTYPE == 64
if (!is_long_mode(vcpu)) { if (vcpu->arch.mmu.root_level == PT32E_ROOT_LEVEL) {
pte = kvm_pdptr_read(vcpu, (addr >> 30) & 3); pte = kvm_pdptr_read(vcpu, (addr >> 30) & 3);
trace_kvm_mmu_paging_element(pte, walker->level); trace_kvm_mmu_paging_element(pte, walker->level);
if (!is_present_gpte(pte)) { if (!is_present_gpte(pte)) {
...@@ -205,7 +205,7 @@ static int FNAME(walk_addr)(struct guest_walker *walker, ...@@ -205,7 +205,7 @@ static int FNAME(walk_addr)(struct guest_walker *walker,
(PTTYPE == 64 || is_pse(vcpu))) || (PTTYPE == 64 || is_pse(vcpu))) ||
((walker->level == PT_PDPE_LEVEL) && ((walker->level == PT_PDPE_LEVEL) &&
is_large_pte(pte) && is_large_pte(pte) &&
is_long_mode(vcpu))) { vcpu->arch.mmu.root_level == PT64_ROOT_LEVEL)) {
int lvl = walker->level; int lvl = walker->level;
walker->gfn = gpte_to_gfn_lvl(pte, lvl); walker->gfn = gpte_to_gfn_lvl(pte, lvl);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment