]> www.infradead.org Git - users/dwmw2/linux.git/commit
x86/sev: Do RMP memory coverage check after max_pfn has been set
authorTom Lendacky <thomas.lendacky@amd.com>
Fri, 21 Jun 2024 15:42:05 +0000 (10:42 -0500)
committerBorislav Petkov (AMD) <bp@alien8.de>
Thu, 11 Jul 2024 10:03:23 +0000 (12:03 +0200)
commit0440feb090790c6243bca85d6a794824e71ff26c
tree3bb5b497e49f7b0accc70623c967cce682a4aebf
parent38918e0bb2c51c21ea464b071a254b27ff9aa71d
x86/sev: Do RMP memory coverage check after max_pfn has been set

The RMP table is probed early in the boot process before max_pfn has been
set, so the logic to check if the RMP covers all of system memory is not
valid.

Move the RMP memory coverage check from snp_probe_rmptable_info() into
snp_rmptable_init(), which is well after max_pfn has been set. Also, fix
the calculation to use PFN_UP instead of PHYS_PFN, in order to compute
the required RMP size properly.

Fixes: 216d106c7ff7 ("x86/sev: Add SEV-SNP host initialization support")
Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Link: https://lore.kernel.org/r/bec4364c7e34358cc576f01bb197a7796a109169.1718984524.git.thomas.lendacky@amd.com
arch/x86/virt/svm/sev.c