x86/tdx: Add unaccepted memory support
authorKirill A. Shutemov <kirill.shutemov@linux.intel.com>
Tue, 6 Jun 2023 14:26:37 +0000 (17:26 +0300)
committerBorislav Petkov (AMD) <bp@alien8.de>
Tue, 6 Jun 2023 16:25:57 +0000 (18:25 +0200)
commit75d090fd167acab4d7eda7e2b65729e877c0fd64
tree50b5ea974fee5ca5bee0dd213e090fd1e993db43
parentc2b353ae24d6fecddcc599529ad8319282494781
x86/tdx: Add unaccepted memory support

Hookup TDX-specific code to accept memory.

Accepting the memory is done with ACCEPT_PAGE module call on every page
in the range. MAP_GPA hypercall is not required as the unaccepted memory
is considered private already.

Extract the part of tdx_enc_status_changed() that does memory acceptance
in a new helper. Move the helper tdx-shared.c. It is going to be used by
both main kernel and decompressor.

  [ bp: Fix the INTEL_TDX_GUEST=y, KVM_GUEST=n build. ]

Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Link: https://lore.kernel.org/r/20230606142637.5171-10-kirill.shutemov@linux.intel.com
12 files changed:
arch/x86/Kconfig
arch/x86/boot/compressed/Makefile
arch/x86/boot/compressed/error.c
arch/x86/boot/compressed/error.h
arch/x86/boot/compressed/mem.c
arch/x86/boot/compressed/tdx-shared.c [new file with mode: 0644]
arch/x86/coco/tdx/Makefile
arch/x86/coco/tdx/tdx-shared.c [new file with mode: 0644]
arch/x86/coco/tdx/tdx.c
arch/x86/include/asm/shared/tdx.h
arch/x86/include/asm/tdx.h
arch/x86/include/asm/unaccepted_memory.h [new file with mode: 0644]