linux/include
Sean Christopherson fb50ca77b6 KVM: guest_memfd: Explicitly pass number of pages to make_private() hook
Tweak the guest_memfd make_private() hook to explicitly pass the number of
pages to align with the signature of the make_shared() hook, and because
the existing code is outright broken if a guest_memfd folio is comprised of
more than one page (which can't happen, yet).  The SNP code *tries* to
create a corresponding huge entry, but if the RMP must use 4KiB entries for
whatever reason, KVM will only convert the first pfn, and not the entire
range of pfns that will be mapped into the guest.

Alternatively, @max_order could simply be repurposed as _the_ @order, but
that will fall apart when in-place conversion comes along, at which point
KVM will need to deal with conversions that aren't bound 1:1 to a folio.
I.e. the number of pages to convert may not be exactly a power-of-2 (and
folios don't strictly guarantee power-of-2 pages anyways).

WARN in the SNP code if the number of pages to prepare is anything other
than '1', i.e. if guest_memfd is trying to prepare/convert more than a
single 4KiB page, as sev_gmem_prepare() doesn't actually handle conversion
greater than order-0 folios.

Opportunistically swap the ordering of @pfn and @gfn params for
kvm_x86_ops.gmem_make_private() to match kvm_arch_gmem_make_private().

Fixes: b85524314a ("KVM: guest_memfd: delay kvm_gmem_prepare_folio() until the memory is passed to the guest")
Reviewed-by: Xiaoyao Li <xiaoyao.li@intel.com>
Reviewed-by: Ackerley Tng <ackerleytng@google.com>
Link: https://patch.msgid.link/20260723210811.72720-9-seanjc@google.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
2026-07-27 09:43:19 -07:00
..
acpi ACPI: button: Enable wakeup GPEs for ACPI buttons at probe time 2026-05-25 09:52:34 +02:00
asm-generic ring-buffer: Flush and stop persistent ring buffer on panic 2026-05-21 08:20:58 -04:00
clocksource
crypto crypto/krb5, rxrpc: Fix lack of pre-decrypt/pre-verify length checks 2026-05-20 16:36:45 -07:00
cxl
drm Short summary of fixes pull: 2026-06-13 07:52:40 +10:00
dt-bindings We've finally gotten rid of the struct clk_ops::round_rate() code after months 2026-04-21 08:33:26 -07:00
hyperv hyperv: Clean up and fix the guest ID comment in hvgdk.h 2026-05-27 15:05:26 -07:00
keys
kunit kunit: fix use-after-free in debugfs when using kunit.filter 2026-05-21 10:45:49 -06:00
kvm Merge branch kvm-arm64/vgic-v5-PPI-fixes into kvmarm-master/next 2026-06-12 09:08:31 +01:00
linux KVM: guest_memfd: Explicitly pass number of pages to make_private() hook 2026-07-27 09:43:19 -07:00
math-emu
media
memory
misc
net netfilter pull request 26-06-10 2026-06-11 12:30:00 +02:00
pcmcia
ras
rdma RDMA: During rereg_mr ensure that REREG_ACCESS is compatible 2026-06-08 13:39:20 -03:00
rv rv: Prevent task migration while handling per-CPU events 2026-06-03 12:33:25 +02:00
scsi scsi: libsas: Delete unused to_dom_device() and to_dev_attr() 2026-04-08 21:55:51 -04:00
soc
sound ASoC: Fixes for v7.1 2026-04-23 09:34:28 +02:00
target
trace Including fixes from Bluetooth, wireless and netfilter. 2026-05-21 14:39:12 -07:00
uapi KVM: s390: New features for 7.2 2026-06-15 15:36:43 +02:00
ufs scsi: ufs: core: Fix bRefClkFreq write failure in HS-LSS mode 2026-04-21 20:58:06 -04:00
vdso
video fbdev: udlfb: add vm_ops to dlfb_ops_mmap to prevent use-after-free 2026-05-04 10:35:55 +02:00
xen xen/arm: Replace __ASSEMBLY__ with __ASSEMBLER__ in interface.h 2026-05-12 17:31:38 +02:00
Kbuild