summaryrefslogtreecommitdiffstats
path: root/arch/x86/kvm/mmu.c
diff options
context:
space:
mode:
authorTakuya Yoshikawa2012-02-08 04:59:10 +0100
committerAvi Kivity2012-03-08 13:10:19 +0100
commitfb03cb6f44236f4bef62a0dda8e025ff5ca51417 (patch)
treefdece464add97210435bb4d778f7b09a852f61e3 /arch/x86/kvm/mmu.c
parentKVM: s390: provide control registers via kvm_run (diff)
downloadkernel-qcow2-linux-fb03cb6f44236f4bef62a0dda8e025ff5ca51417.tar.gz
kernel-qcow2-linux-fb03cb6f44236f4bef62a0dda8e025ff5ca51417.tar.xz
kernel-qcow2-linux-fb03cb6f44236f4bef62a0dda8e025ff5ca51417.zip
KVM: Introduce gfn_to_index() which returns the index for a given level
This patch cleans up the code and removes the "(void)level;" warning suppressor. Note that we can also use this for PT_PAGE_TABLE_LEVEL to treat every level uniformly later. Signed-off-by: Takuya Yoshikawa <yoshikawa.takuya@oss.ntt.co.jp> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com> Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'arch/x86/kvm/mmu.c')
-rw-r--r--arch/x86/kvm/mmu.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c
index ae76cc3392e1..37e7f100a0e0 100644
--- a/arch/x86/kvm/mmu.c
+++ b/arch/x86/kvm/mmu.c
@@ -688,8 +688,7 @@ static struct kvm_lpage_info *lpage_info_slot(gfn_t gfn,
{
unsigned long idx;
- idx = (gfn >> KVM_HPAGE_GFN_SHIFT(level)) -
- (slot->base_gfn >> KVM_HPAGE_GFN_SHIFT(level));
+ idx = gfn_to_index(gfn, slot->base_gfn, level);
return &slot->lpage_info[level - 2][idx];
}