]> git.baikalelectronics.ru Git - kernel.git/commit
KVM: x86/mmu: Add optimized helper to retrieve an SPTE's index
authorSean Christopherson <seanjc@google.com>
Tue, 12 Jul 2022 02:07:22 +0000 (02:07 +0000)
committerPaolo Bonzini <pbonzini@redhat.com>
Thu, 14 Jul 2022 15:31:23 +0000 (11:31 -0400)
commit1c2e0643c9ea1ed7dcb7f0f82f2c37c825541725
tree6fbaf53d21b12bde36b5a011c3403c0a181e47b2
parent89a625afa5144e6096ff9cbbcb9803f87354ece1
KVM: x86/mmu: Add optimized helper to retrieve an SPTE's index

Add spte_index() to dedup all the code that calculates a SPTE's index
into its parent's page table and/or spt array.  Opportunistically tweak
the calculation to avoid pointer arithmetic, which is subtle (subtract in
8-byte chunks) and less performant (requires the compiler to generate the
subtraction).

Suggested-by: David Matlack <dmatlack@google.com>
Reviewed-by: David Matlack <dmatlack@google.com>
Signed-off-by: Sean Christopherson <seanjc@google.com>
Message-Id: <20220712020724.1262121-2-seanjc@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/mmu/mmu.c
arch/x86/kvm/mmu/paging_tmpl.h
arch/x86/kvm/mmu/spte.h