Re: [PATCH v7 2/3] x86/boot/compressed: Skip Video Memory access in Decompressor for SEV-ES/SNP.

From: Borislav Petkov
Date: Wed Jun 05 2024 - 16:15:03 EST


On Thu, May 30, 2024 at 11:37:14PM +0000, Ashish Kalra wrote:
> - lines = boot_params_ptr->screen_info.orig_video_lines;
> - cols = boot_params_ptr->screen_info.orig_video_cols;
> + if (!(sev_status & MSR_AMD64_SEV_ES_ENABLED)) {
> + lines = boot_params_ptr->screen_info.orig_video_lines;
> + cols = boot_params_ptr->screen_info.orig_video_cols;
> + }

By now I get an allergic reaction from this sprinkling of "if sev..."
everywhere in the code.

> init_default_io_ops();

<--- right here there's a call to

early_tdx_detect();

You can add a early_sev_detect() counterpart here and clear lines and
cols in it along with an explanation why it is being done.

This is at least a bit cleaner than this.

Thx.

--
Regards/Gruss,
Boris.

https://people.kernel.org/tglx/notes-about-netiquette