Add a macro, which is probably long overdue, to replace open coded
variants of "~(KVM_PAGES_PER_HPAGE(level) - 1)".  The straw that broke the
camel's back is the TDP MMU's round_gfn_for_level(), which goes straight
for the optimized approach of using NEG instead of SUB+NOT (gcc uses NEG
for both).  The use of '-(...)' made me do a double take (more like a
quadrupal take) when reading the TDP MMU code as my eyes/brain have been
heavily trained to look for the more common '~(... - 1)'.

Sean Christopherson (3):
  KVM: x86/mmu: Add helper macro for computing hugepage GFN mask
  KVM: x86/mmu: Open code GFN "rounding" in TDP MMU
  KVM: x86/mmu: Use hugepage GFN mask to compute GFN offset mask

 arch/x86/include/asm/kvm_host.h |  1 +
 arch/x86/kvm/mmu/mmu.c          |  4 ++--
 arch/x86/kvm/mmu/mmutrace.h     |  2 +-
 arch/x86/kvm/mmu/paging_tmpl.h  |  4 ++--
 arch/x86/kvm/mmu/tdp_iter.c     | 11 +++--------
 arch/x86/kvm/mmu/tdp_mmu.c      |  2 +-
 arch/x86/kvm/x86.c              |  6 +++---
 7 files changed, 13 insertions(+), 17 deletions(-)

-- 
2.28.0

Reply via email to