KVM: MMU: retain more available bits on mmio spte
authorXiao Guangrong <xiaoguangrong@linux.vnet.ibm.com>
Fri, 7 Jun 2013 08:51:23 +0000 (16:51 +0800)
committerPaolo Bonzini <pbonzini@redhat.com>
Thu, 20 Jun 2013 21:33:20 +0000 (23:33 +0200)
Let mmio spte only use bit62 and bit63 on upper 32 bits, then bit 52 ~ bit 61
can be used for other purposes

Signed-off-by: Xiao Guangrong <xiaoguangrong@linux.vnet.ibm.com>
Reviewed-by: Gleb Natapov <gleb@redhat.com>
Reviewed-by: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/vmx.c
arch/x86/kvm/x86.c

index 260a9193955538b4fea743045b2f964b2736b24e..78ee123de7a333a53558b5d64860377ba478d33f 100644 (file)
@@ -4176,10 +4176,10 @@ static void ept_set_mmio_spte_mask(void)
        /*
         * EPT Misconfigurations can be generated if the value of bits 2:0
         * of an EPT paging-structure entry is 110b (write/execute).
-        * Also, magic bits (0xffull << 49) is set to quickly identify mmio
+        * Also, magic bits (0x3ull << 62) is set to quickly identify mmio
         * spte.
         */
-       kvm_mmu_set_mmio_spte_mask(0xffull << 49 | 0x6ull);
+       kvm_mmu_set_mmio_spte_mask((0x3ull << 62) | 0x6ull);
 }
 
 /*
index 737c804b310c74504540900f788e79685155b58e..15cf34d4ae9531a42e2ddd35c3b0d72747947b7d 100644 (file)
@@ -5280,7 +5280,13 @@ static void kvm_set_mmio_spte_mask(void)
         * Set the reserved bits and the present bit of an paging-structure
         * entry to generate page fault with PFER.RSV = 1.
         */
-       mask = ((1ull << (62 - maxphyaddr + 1)) - 1) << maxphyaddr;
+        /* Mask the reserved physical address bits. */
+       mask = ((1ull << (51 - maxphyaddr + 1)) - 1) << maxphyaddr;
+
+       /* Bit 62 is always reserved for 32bit host. */
+       mask |= 0x3ull << 62;
+
+       /* Set the present bit. */
        mask |= 1ull;
 
 #ifdef CONFIG_X86_64