From: Tom Lendacky Date: Fri, 20 Oct 2017 14:30:45 +0000 (-0500) Subject: x86/mm: Don't attempt to encrypt initrd under SEV X-Git-Tag: v4.19~2241^2~31 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=682af54399b6111730aec0be63e5f6a3a3359a76;p=platform%2Fkernel%2Flinux-rpi.git x86/mm: Don't attempt to encrypt initrd under SEV When SEV is active the initrd/initramfs will already have already been placed in memory encrypted so do not try to encrypt it. Signed-off-by: Tom Lendacky Signed-off-by: Brijesh Singh Signed-off-by: Thomas Gleixner Reviewed-by: Borislav Petkov Tested-by: Borislav Petkov Cc: kvm@vger.kernel.org Cc: Borislav Petkov Cc: Andy Lutomirski Link: https://lkml.kernel.org/r/20171020143059.3291-4-brijesh.singh@amd.com --- diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c index 0957dd7..507100a 100644 --- a/arch/x86/kernel/setup.c +++ b/arch/x86/kernel/setup.c @@ -380,9 +380,11 @@ static void __init reserve_initrd(void) * If SME is active, this memory will be marked encrypted by the * kernel when it is accessed (including relocation). However, the * ramdisk image was loaded decrypted by the bootloader, so make - * sure that it is encrypted before accessing it. + * sure that it is encrypted before accessing it. For SEV the + * ramdisk will already be encrypted, so only do this for SME. */ - sme_early_encrypt(ramdisk_image, ramdisk_end - ramdisk_image); + if (sme_active()) + sme_early_encrypt(ramdisk_image, ramdisk_end - ramdisk_image); initrd_start = 0;