OSDN Git Service

KVM: x86/mmu: Document and enforce MMU-writable and Host-writable invariants
authorDavid Matlack <dmatlack@google.com>
Thu, 13 Jan 2022 23:30:19 +0000 (23:30 +0000)
committerPaolo Bonzini <pbonzini@redhat.com>
Wed, 19 Jan 2022 17:07:06 +0000 (12:07 -0500)
commit5f16bcac6e280a7dade580d9627f5cf93ef6aa56
treec681ede4a333e6ec0fb340f1aa170860667702a6
parentf082d86ea68559e4bd1ecaffa04981b72281e28f
KVM: x86/mmu: Document and enforce MMU-writable and Host-writable invariants

SPTEs are tagged with software-only bits to indicate if it is
"MMU-writable" and "Host-writable". These bits are used to determine why
KVM has marked an SPTE as read-only.

Document these bits and their invariants, and enforce the invariants
with new WARNs in spte_can_locklessly_be_made_writable() to ensure they
are not accidentally violated in the future.

Opportunistically move DEFAULT_SPTE_{MMU,HOST}_WRITABLE next to
EPT_SPTE_{MMU,HOST}_WRITABLE since the new documentation applies to
both.

No functional change intended.

Signed-off-by: David Matlack <dmatlack@google.com>
Message-Id: <20220113233020.3986005-4-dmatlack@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/mmu/spte.h