]> www.infradead.org Git - users/jedix/linux-maple.git/commit
x86/tdx: Account shared memory
authorKirill A. Shutemov <kirill.shutemov@linux.intel.com>
Fri, 14 Jun 2024 09:58:54 +0000 (12:58 +0300)
committerBorislav Petkov (AMD) <bp@alien8.de>
Mon, 17 Jun 2024 15:45:59 +0000 (17:45 +0200)
commitc3abbf1376874f0d6eb22859a8655831644efa42
tree2697caf5b226bdfdfdbe2ef1a39f89a484cc2e21
parent9d1dcdfa909178b6f465625bbfd8311e6107b48e
x86/tdx: Account shared memory

The kernel will convert all shared memory back to private during kexec.
The direct mapping page tables will provide information on which memory
is shared.

It is extremely important to convert all shared memory. If a page is
missed, it will cause the second kernel to crash when it accesses it.

Keep track of the number of shared pages. This will allow for
cross-checking against the shared information in the direct mapping and
reporting if the shared bit is lost.

Memory conversion is slow and does not happen often. Global atomic is
not going to be a bottleneck.

Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Reviewed-by: Kai Huang <kai.huang@intel.com>
Tested-by: Tao Liu <ltao@redhat.com>
Link: https://lore.kernel.org/r/20240614095904.1345461-10-kirill.shutemov@linux.intel.com
arch/x86/coco/tdx/tdx.c