Skip to content

Commit f30470c

Browse files
ashkalrabp3tk0v
authored andcommitted
x86/boot: Skip video memory access in the decompressor for SEV-ES/SNP
Accessing guest video memory/RAM in the decompressor causes guest termination as the boot stage2 #VC handler for SEV-ES/SNP systems does not support MMIO handling. This issue is observed during a SEV-ES/SNP guest kexec as kexec -c adds screen_info to the boot parameters passed to the second kernel, which causes console output to be dumped to both video and serial. As the decompressor output gets cleared really fast, it is preferable to get the console output only on serial, hence, skip accessing the video RAM during decompressor stage to prevent guest termination. Serial console output during decompressor stage works as boot stage2 #VC handler already supports handling port I/O. [ bp: Massage. ] Suggested-by: Borislav Petkov (AMD) <[email protected]> Suggested-by: Thomas Lendacky <[email protected]> Signed-off-by: Ashish Kalra <[email protected]> Signed-off-by: Borislav Petkov (AMD) <[email protected]> Reviewed-by: Kuppuswamy Sathyanarayanan <[email protected]> Reviewed-by: Tom Lendacky <[email protected]> Link: https://lore.kernel.org/r/8a55ea86524c686e575d273311acbe57ce8cee23.1722520012.git.ashish.kalra@amd.com
1 parent 0a895c0 commit f30470c

File tree

1 file changed

+15
-0
lines changed
  • arch/x86/boot/compressed

1 file changed

+15
-0
lines changed

arch/x86/boot/compressed/misc.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -385,6 +385,19 @@ static void parse_mem_encrypt(struct setup_header *hdr)
385385
hdr->xloadflags |= XLF_MEM_ENCRYPTION;
386386
}
387387

388+
static void early_sev_detect(void)
389+
{
390+
/*
391+
* Accessing video memory causes guest termination because
392+
* the boot stage2 #VC handler of SEV-ES/SNP guests does not
393+
* support MMIO handling and kexec -c adds screen_info to the
394+
* boot parameters passed to the kexec kernel, which causes
395+
* console output to be dumped to both video and serial.
396+
*/
397+
if (sev_status & MSR_AMD64_SEV_ES_ENABLED)
398+
lines = cols = 0;
399+
}
400+
388401
/*
389402
* The compressed kernel image (ZO), has been moved so that its position
390403
* is against the end of the buffer used to hold the uncompressed kernel
@@ -440,6 +453,8 @@ asmlinkage __visible void *extract_kernel(void *rmode, unsigned char *output)
440453
*/
441454
early_tdx_detect();
442455

456+
early_sev_detect();
457+
443458
console_init();
444459

445460
/*

0 commit comments

Comments
 (0)