KVM: MMU: use page table level macro
authorDavidlohr Bueso <dave@gnu.org>
Wed, 18 Apr 2012 10:24:29 +0000 (12:24 +0200)
committerMarcelo Tosatti <mtosatti@redhat.com>
Thu, 19 Apr 2012 02:35:01 +0000 (23:35 -0300)
Its much cleaner to use PT_PAGE_TABLE_LEVEL than its numeric value.

Signed-off-by: Davidlohr Bueso <dave@gnu.org>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
arch/x86/kvm/mmu.c
arch/x86/kvm/paging_tmpl.h

index 29ad6f9..07424cf 100644 (file)
@@ -3618,7 +3618,7 @@ static bool detect_write_flooding(struct kvm_mmu_page *sp)
         * Skip write-flooding detected for the sp whose level is 1, because
         * it can become unsync, then the guest page is not write-protected.
         */
-       if (sp->role.level == 1)
+       if (sp->role.level == PT_PAGE_TABLE_LEVEL)
                return false;
 
        return ++sp->write_flooding_count >= 3;
index df5a703..34f9709 100644 (file)
@@ -658,7 +658,7 @@ static gpa_t FNAME(get_level1_sp_gpa)(struct kvm_mmu_page *sp)
 {
        int offset = 0;
 
-       WARN_ON(sp->role.level != 1);
+       WARN_ON(sp->role.level != PT_PAGE_TABLE_LEVEL);
 
        if (PTTYPE == 32)
                offset = sp->role.quadrant << PT64_LEVEL_BITS;