]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
KVM: mmio: cleanup kvm_set_mmio_spte_mask
authorTiejun Chen <tiejun.chen@intel.com>
Mon, 1 Sep 2014 10:44:04 +0000 (18:44 +0800)
committerPaolo Bonzini <pbonzini@redhat.com>
Wed, 3 Sep 2014 08:04:10 +0000 (10:04 +0200)
Just reuse rsvd_bits() inside kvm_set_mmio_spte_mask()
for slightly better code.

Signed-off-by: Tiejun Chen <tiejun.chen@intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/mmu.c
arch/x86/kvm/mmu.h
arch/x86/kvm/x86.c

index 1cd2a5fbde07d8d92e9aa099c187fc3e629b0dc9..6b6df0c5be3d2760e56aa4ed2a21eedf749d21fd 100644 (file)
@@ -295,11 +295,6 @@ static bool check_mmio_spte(struct kvm *kvm, u64 spte)
        return likely(kvm_gen == spte_gen);
 }
 
-static inline u64 rsvd_bits(int s, int e)
-{
-       return ((1ULL << (e - s + 1)) - 1) << s;
-}
-
 void kvm_mmu_set_mask_ptes(u64 user_mask, u64 accessed_mask,
                u64 dirty_mask, u64 nx_mask, u64 x_mask)
 {
index b982112d2ca5a9e112e79981dacefe6904025063..bde8ee7257546ec74400162387fbd5073c6aa7ca 100644 (file)
 #define PFERR_RSVD_MASK (1U << PFERR_RSVD_BIT)
 #define PFERR_FETCH_MASK (1U << PFERR_FETCH_BIT)
 
+static inline u64 rsvd_bits(int s, int e)
+{
+       return ((1ULL << (e - s + 1)) - 1) << s;
+}
+
 int kvm_mmu_get_spte_hierarchy(struct kvm_vcpu *vcpu, u64 addr, u64 sptes[4]);
 void kvm_mmu_set_mmio_spte_mask(u64 mmio_mask);
 
index 916e89515210b660d32cd68538b1949167ebc2d6..e4ed85e07a01587cfcfdcf58963ca57fb2529d5c 100644 (file)
@@ -5569,7 +5569,7 @@ static void kvm_set_mmio_spte_mask(void)
         * entry to generate page fault with PFER.RSV = 1.
         */
         /* Mask the reserved physical address bits. */
-       mask = ((1ull << (51 - maxphyaddr + 1)) - 1) << maxphyaddr;
+       mask = rsvd_bits(maxphyaddr, 51);
 
        /* Bit 62 is always reserved for 32bit host. */
        mask |= 0x3ull << 62;