KVM: MMU: Calculate correct base gfn for direct non-DIR level
authorLai Jiangshan <laijs@cn.fujitsu.com>
Wed, 26 May 2010 08:48:25 +0000 (16:48 +0800)
committerAvi Kivity <avi@redhat.com>
Sun, 1 Aug 2010 07:35:53 +0000 (10:35 +0300)
commitc9fa0b3bef9a0b117b3c3f958ec553c21f609a9f
tree072850f275f2091c4104960275dc66332bd8e113
parent2032a93d66fa282ba0f2ea9152eeff9511fa9a96
KVM: MMU: Calculate correct base gfn for direct non-DIR level

In Document/kvm/mmu.txt:
  gfn:
    Either the guest page table containing the translations shadowed by this
    page, or the base page frame for linear translations. See role.direct.

But in __direct_map(), the base gfn calculation is incorrect,
it does not calculate correctly when level=3 or 4.

Fix by using PT64_LVL_ADDR_MASK() which accounts for all levels correctly.

Reported-by: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
arch/x86/kvm/mmu.c