]> git.baikalelectronics.ru Git - kernel.git/commit
KVM: x86/mmu: Fully re-evaluate MMIO caching when SPTE masks change
authorSean Christopherson <seanjc@google.com>
Wed, 3 Aug 2022 22:49:56 +0000 (22:49 +0000)
committerPaolo Bonzini <pbonzini@redhat.com>
Wed, 10 Aug 2022 19:08:24 +0000 (15:08 -0400)
commitfa823c917c5cb2c9351e113bb78ff3cd197475ef
tree460b3db1631b5a7a65194c3902d896dcea11d327
parenta00e5e7de373323f6205b8428fb2bf97bf194ec8
KVM: x86/mmu: Fully re-evaluate MMIO caching when SPTE masks change

Fully re-evaluate whether or not MMIO caching can be enabled when SPTE
masks change; simply clearing enable_mmio_caching when a configuration
isn't compatible with caching fails to handle the scenario where the
masks are updated, e.g. by VMX for EPT or by SVM to account for the C-bit
location, and toggle compatibility from false=>true.

Snapshot the original module param so that re-evaluating MMIO caching
preserves userspace's desire to allow caching.  Use a snapshot approach
so that enable_mmio_caching still reflects KVM's actual behavior.

Fixes: 6c379b5cab58 ("KVM: x86/mmu: Use enable_mmio_caching to track if MMIO caching is enabled")
Reported-by: Michael Roth <michael.roth@amd.com>
Cc: Tom Lendacky <thomas.lendacky@amd.com>
Cc: stable@vger.kernel.org
Tested-by: Michael Roth <michael.roth@amd.com>
Signed-off-by: Sean Christopherson <seanjc@google.com>
Reviewed-by: Kai Huang <kai.huang@intel.com>
Message-Id: <20220803224957.1285926-3-seanjc@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/mmu/mmu.c
arch/x86/kvm/mmu/spte.c
arch/x86/kvm/mmu/spte.h