Hi all, This is the POC to enable in-place conversion and hugetlb support of gmem (guest memfd) in QEMU. It can work with 1G gmem support series[1] and TDX hugepage support series[2] to run TDX guest with hugepage. I don't have SNP environment and don't know how it goes with SNP.
It is just the POC and we share it to show how QEMU work with gmem ABI. The POC uses the simple implementation that switches to use in-place conversion and hugetlb when it is supported and it doesn't introduce new interface in QEMU so that existing command line to boot TDX can work without any change. Please go to each patch (specifically patch 3/4/5) to discuss the ABI usage, potential issue, and maybe the upstreamable design. [1] https://lore.kernel.org/all/cover.1747264138.git.ackerley...@google.com/ [2] https://lore.kernel.org/all/20250424030033.32635-1-yan.y.z...@intel.com/ Xiaoyao Li (4): update-linux-headers: Add guestmem.h headers: Fetch gmem updates memory/guest_memfd: Enable hugetlb support [HACK] memory: Don't enable in-place conversion for internal MemoryRegion with gmem Yan Zhao (1): memory/guest_memfd: Enable in-place conversion when available accel/kvm/kvm-all.c | 82 ++++++++++++++++++++++++--------- accel/stubs/kvm-stub.c | 2 + include/system/kvm.h | 2 + include/system/memory.h | 5 ++ include/system/ramblock.h | 1 + linux-headers/linux/guestmem.h | 29 ++++++++++++ linux-headers/linux/kvm.h | 18 ++++++++ scripts/update-linux-headers.sh | 2 +- system/memory.c | 9 +++- system/physmem.c | 40 ++++++++++++++-- 10 files changed, 163 insertions(+), 27 deletions(-) create mode 100644 linux-headers/linux/guestmem.h -- 2.43.0