summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTom Lendacky <thomas.lendacky@amd.com>2017-10-20 10:30:45 -0400
committerThomas Gleixner <tglx@linutronix.de>2017-11-07 09:35:55 -0500
commit682af54399b6111730aec0be63e5f6a3a3359a76 (patch)
tree680f2698b48d05973940ba429772547094217aeb
parentd8aa7eea78a1401cce39b3bb61ead0150044a3df (diff)
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 <thomas.lendacky@amd.com> Signed-off-by: Brijesh Singh <brijesh.singh@amd.com> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Borislav Petkov <bp@suse.de> Tested-by: Borislav Petkov <bp@suse.de> Cc: kvm@vger.kernel.org Cc: Borislav Petkov <bp@alien8.de> Cc: Andy Lutomirski <luto@kernel.org> Link: https://lkml.kernel.org/r/20171020143059.3291-4-brijesh.singh@amd.com
-rw-r--r--arch/x86/kernel/setup.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
index 0957dd73d127..507100a72eb3 100644
--- a/arch/x86/kernel/setup.c
+++ b/arch/x86/kernel/setup.c
@@ -380,9 +380,11 @@ static void __init reserve_initrd(void)
380 * If SME is active, this memory will be marked encrypted by the 380 * If SME is active, this memory will be marked encrypted by the
381 * kernel when it is accessed (including relocation). However, the 381 * kernel when it is accessed (including relocation). However, the
382 * ramdisk image was loaded decrypted by the bootloader, so make 382 * ramdisk image was loaded decrypted by the bootloader, so make
383 * sure that it is encrypted before accessing it. 383 * sure that it is encrypted before accessing it. For SEV the
384 * ramdisk will already be encrypted, so only do this for SME.
384 */ 385 */
385 sme_early_encrypt(ramdisk_image, ramdisk_end - ramdisk_image); 386 if (sme_active())
387 sme_early_encrypt(ramdisk_image, ramdisk_end - ramdisk_image);
386 388
387 initrd_start = 0; 389 initrd_start = 0;
388 390