Re: [RFT PATCH v2 06/23] x86/sev: Disentangle #VC handling code from startup code

Tom Lendacky
2025-05-05T14:58:23Z

On 5/4/25 04:52, Ard Biesheuvel wrote:
> From: Ard Biesheuvel <ardb@kernel.org>
>
> Most of the SEV support code used to reside in a single C source file
> that was included in two places: the core kernel, and the decompressor.
>
> The code that is actually shared with the decompressor was moved into a
> separate, shared source file under startup/, on the basis that the
> decompressor also executes from the early 1:1 mapping of memory.
>
> However, while the elaborate #VC handling and instruction decoding that
> it involves is also performed by the decompressor, it does not actually
> occur in the core kernel at early boot, and therefore, does not need to
> be part of the confined early startup code.
>
> So split off the #VC handling code and move it back into arch/x86/coco
> where it came from, into another C source file that is included from
> both the decompressor and the core kernel.
>
> Code movement only - no functional change intended.
>
> Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
> ---
> arch/x86/boot/compressed/misc.h | 1 +
> arch/x86/boot/compressed/sev-handle-vc.c | 83 ++
> arch/x86/boot/compressed/sev.c | 96 +-
> arch/x86/boot/compressed/sev.h | 19 +
> arch/x86/boot/startup/sev-shared.c | 519 +---------
> arch/x86/boot/startup/sev-startup.c | 1022 -------------------
> arch/x86/coco/sev/Makefile | 2 +-
> arch/x86/coco/sev/vc-handle.c | 1061 ++++++++++++++++++++

Probably vc-handler.c would be a better name. And actually the same
format for the compressed file, sev-vc-handler.c, would be nice.

Thanks,
Tom

> arch/x86/coco/sev/vc-shared.c | 504 ++++++++++
> arch/x86/include/asm/sev-internal.h | 8 -
> arch/x86/include/asm/sev.h | 22 +
> 11 files changed, 1694 insertions(+), 1643 deletions(-)
>