summaryrefslogtreecommitdiff
path: root/arch/x86/purgatory/setup-x86_64.S
diff options
context:
space:
mode:
authorAshish Kalra <ashish.kalra@amd.com>2024-08-01 19:14:50 +0000
committerBorislav Petkov (AMD) <bp@alien8.de>2024-10-28 18:06:54 +0100
commit3074152e56c9b0f9b9c67edfbc08b371db050b6d (patch)
treea1e706b42546a83ef7c09837a3b2543bdfa9e421 /arch/x86/purgatory/setup-x86_64.S
parent2a783066b6f5f5250b838d2acfc716561d2a66e0 (diff)
x86/sev: Convert shared memory back to private on kexec
SNP guests allocate shared buffers to perform I/O. It is done by allocating pages normally from the buddy allocator and converting them to shared with set_memory_decrypted(). The second, kexec-ed, kernel has no idea what memory is converted this way. It only sees E820_TYPE_RAM. Accessing shared memory via private mapping will cause unrecoverable RMP page-faults. On kexec, walk direct mapping and convert all shared memory back to private. It makes all RAM private again and second kernel may use it normally. Additionally, for SNP guests, convert all bss decrypted section pages back to private. The conversion occurs in two steps: stopping new conversions and unsharing all memory. In the case of normal kexec, the stopping of conversions takes place while scheduling is still functioning. This allows for waiting until any ongoing conversions are finished. The second step is carried out when all CPUs except one are inactive and interrupts are disabled. This prevents any conflicts with code that may access shared memory. Co-developed-by: Borislav Petkov (AMD) <bp@alien8.de> Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de> Signed-off-by: Ashish Kalra <ashish.kalra@amd.com> Reviewed-by: Tom Lendacky <thomas.lendacky@amd.com> Link: https://lore.kernel.org/r/05a8c15fb665dbb062b04a8cb3d592a63f235937.1722520012.git.ashish.kalra@amd.com
Diffstat (limited to 'arch/x86/purgatory/setup-x86_64.S')
0 files changed, 0 insertions, 0 deletions