linux/arch/x86/kvm/mmu
Paolo Bonzini ec283cb1dc KVM: x86/mmu: remove ept_ad field
The ept_ad field is used during page walk to determine if the guest PTEs
have accessed and dirty bits.  In the MMU role, the ad_disabled
bit represents whether the *shadow* PTEs have the bits, so it
would be incorrect to replace PT_HAVE_ACCESSED_DIRTY with just
!mmu->mmu_role.base.ad_disabled.

However, the similar field in the CPU mode, ad_disabled, is initialized
correctly: to the opposite value of ept_ad for shadow EPT, and zero
for non-EPT guest paging modes (which always have A/D bits).  It is
therefore possible to compute PT_HAVE_ACCESSED_DIRTY from the CPU mode,
like other page-format fields; it just has to be inverted to account
for the different polarity.

In fact, now that the CPU mode is distinct from the MMU roles, it would
even be possible to remove PT_HAVE_ACCESSED_DIRTY macro altogether, and
use !mmu->cpu_role.base.ad_disabled instead.  I am not doing this because
the macro has a small effect in terms of dead code elimination:

   text	   data	    bss	    dec	    hex
 103544	  16665	    112	 120321	  1d601    # as of this patch
 103746	  16665	    112	 120523	  1d6cb    # without PT_HAVE_ACCESSED_DIRTY

Reviewed-by: Sean Christopherson <seanjc@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2022-04-29 12:49:54 -04:00
..
mmu_internal.h KVM: x86/mmu: Zap invalidated roots via asynchronous worker 2022-03-08 10:55:27 -05:00
mmu.c KVM: x86/mmu: remove ept_ad field 2022-04-29 12:49:54 -04:00
mmutrace.h KVM: x86/mmu: Add tracepoint for splitting huge pages 2022-02-10 13:50:43 -05:00
page_track.c KVM: use __vcalloc for very large allocations 2022-03-08 09:30:57 -05:00
paging_tmpl.h KVM: x86/mmu: remove ept_ad field 2022-04-29 12:49:54 -04:00
paging.h KVM: x86/mmu: Do not apply HPA (memory encryption) mask to GPAs 2021-07-14 12:17:56 -04:00
spte.c KVM: x86/mmu: Use enable_mmio_caching to track if MMIO caching is enabled 2022-04-29 12:49:16 -04:00
spte.h KVM: x86/mmu: Use enable_mmio_caching to track if MMIO caching is enabled 2022-04-29 12:49:16 -04:00
tdp_iter.c KVM: x86/mmu: Add helpers to read/write TDP MMU SPTEs and document RCU 2022-03-08 09:31:52 -05:00
tdp_iter.h KVM: x86/mmu: Defer TLB flush to caller when freeing TDP MMU shadow pages 2022-03-08 09:31:57 -05:00
tdp_mmu.c KVM: x86/mmu: Do not create SPTEs for GFNs that exceed host.MAXPHYADDR 2022-04-29 12:38:21 -04:00
tdp_mmu.h KVM: x86/mmu: Zap only TDP MMU leafs in zap range and mmu_notifier unmap 2022-04-02 05:34:39 -04:00