[GIT PULL] KVM changes for Linux 6.11-rc2

From: Paolo Bonzini
Date: Fri Aug 02 2024 - 12:51:37 EST


Linus,

The following changes since commit 8400291e289ee6b2bf9779ff1c83a291501f017b:

Linux 6.11-rc1 (2024-07-28 14:19:55 -0700)

are available in the Git repository at:

https://git.kernel.org/pub/scm/virt/kvm/kvm.git tags/for-linus

for you to fetch changes up to 1773014a975919195be71646fc2c2cad1570fce4:

Merge branch 'kvm-fixes' into HEAD (2024-08-02 12:33:43 -0400)

The bulk of the changes here is a largish change to guest_memfd, delaying
the clearing and encryption of guest-private pages until they are
actually added to guest page tables. This started as "let's make it
impossible to misuse the API" for SEV-SNP; but then it ballooned a bit.
The new logic is generally simpler and more ready for hugepage support
in guest_memfd.

Thanks,

Paolo
----------------------------------------------------------------
* fix latent bug in how usage of large pages is determined for
confidential VMs

* fix "underline too short" in docs

* eliminate log spam from limited APIC timer periods

* disallow pre-faulting of memory before SEV-SNP VMs are initialized

* delay clearing and encrypting private memory until it is added to
guest page tables

* this change also enables another small cleanup: the checks in
SNP_LAUNCH_UPDATE that limit it to non-populated, private pages
can now be moved in the common kvm_gmem_populate() function

* fix compilation error that the RISC-V merge introduced in selftests

----------------------------------------------------------------
Ackerley Tng (1):
KVM: x86/mmu: fix determination of max NPT mapping level for private pages

Chang Yu (1):
KVM: Documentation: Fix title underline too short warning

Jim Mattson (1):
KVM: x86: Eliminate log spam from limited APIC timer periods

Paolo Bonzini (16):
KVM: x86: disallow pre-fault for SNP VMs before initialization
KVM: guest_memfd: return folio from __kvm_gmem_get_pfn()
KVM: guest_memfd: delay folio_mark_uptodate() until after successful preparation
KVM: guest_memfd: do not go through struct page
KVM: rename CONFIG_HAVE_KVM_GMEM_* to CONFIG_HAVE_KVM_ARCH_GMEM_*
KVM: guest_memfd: return locked folio from __kvm_gmem_get_pfn
KVM: guest_memfd: delay kvm_gmem_prepare_folio() until the memory is passed to the guest
KVM: guest_memfd: make kvm_gmem_prepare_folio() operate on a single struct kvm
KVM: remove kvm_arch_gmem_prepare_needed()
KVM: guest_memfd: move check for already-populated page to common code
KVM: cleanup and add shortcuts to kvm_range_has_memory_attributes()
KVM: extend kvm_range_has_memory_attributes() to check subset of attributes
KVM: guest_memfd: let kvm_gmem_populate() operate only on private gfns
KVM: guest_memfd: abstract how prepared folios are recorded
Merge tag 'kvm-riscv-fixes-6.11-1' of https://github.com/kvm-riscv/linux into HEAD
Merge branch 'kvm-fixes' into HEAD

Yong-Xuan Wang (1):
KVM: riscv: selftests: Fix compile error

Documentation/virt/kvm/api.rst | 8 +-
arch/x86/include/asm/kvm_host.h | 1 +
arch/x86/kvm/Kconfig | 4 +-
arch/x86/kvm/lapic.c | 2 +-
arch/x86/kvm/mmu/mmu.c | 7 +-
arch/x86/kvm/svm/sev.c | 17 +-
arch/x86/kvm/svm/svm.c | 1 +
arch/x86/kvm/x86.c | 12 +-
include/linux/kvm_host.h | 9 +-
tools/testing/selftests/kvm/riscv/get-reg-list.c | 8 +-
virt/kvm/Kconfig | 4 +-
virt/kvm/guest_memfd.c | 227 ++++++++++++++---------
virt/kvm/kvm_main.c | 73 ++++----
13 files changed, 214 insertions(+), 159 deletions(-)