UEFI Specification version 2.9 introduces concept of memory acceptance: Some Virtual Machine platforms, such as Intel TDX or AMD SEV-SNP, requiring memory to be accepted before it can be used by the guest. Accepting happens via a protocol specific for the Virtrual Machine platform. Accepting memory is costly and it makes VMM allocate memory for the accepted guest physical address range. We don't want to accept all memory upfront. The patchset implements on-demand memory acceptance for TDX. Please, review. Any feedback is welcome. Kirill A. Shutemov (5): mm: Add support for unaccepted memory efi/x86: Implement support for unaccepted memory x86/boot/compressed: Handle unaccepted memory x86/mm: Provide helpers for unaccepted memory x86/tdx: Unaccepted memory support Documentation/x86/zero-page.rst | 1 + arch/x86/Kconfig | 1 + arch/x86/boot/compressed/Makefile | 1 + arch/x86/boot/compressed/bitmap.c | 86 ++++++++++++++++++++ arch/x86/boot/compressed/kaslr.c | 14 +++- arch/x86/boot/compressed/misc.c | 9 ++ arch/x86/boot/compressed/tdx.c | 29 +++++++ arch/x86/boot/compressed/unaccepted_memory.c | 51 ++++++++++++ arch/x86/include/asm/page.h | 5 ++ arch/x86/include/asm/tdx.h | 2 + arch/x86/include/asm/unaccepted_memory.h | 17 ++++ arch/x86/include/uapi/asm/bootparam.h | 3 +- arch/x86/kernel/tdx.c | 8 ++ arch/x86/mm/Makefile | 2 + arch/x86/mm/unaccepted_memory.c | 84 +++++++++++++++++++ drivers/firmware/efi/Kconfig | 12 +++ drivers/firmware/efi/efi.c | 1 + drivers/firmware/efi/libstub/x86-stub.c | 75 ++++++++++++++--- include/linux/efi.h | 3 +- mm/internal.h | 14 ++++ mm/memblock.c | 1 + mm/page_alloc.c | 13 ++- 22 files changed, 414 insertions(+), 18 deletions(-) create mode 100644 arch/x86/boot/compressed/bitmap.c create mode 100644 arch/x86/boot/compressed/unaccepted_memory.c create mode 100644 arch/x86/include/asm/unaccepted_memory.h create mode 100644 arch/x86/mm/unaccepted_memory.c -- 2.31.1