Re: [RFT PATCH v2 05/23] x86/sev: Move instruction decoder into separate source file

Tom Lendacky
2025-05-05T14:48:54Z

On 5/4/25 04:52, Ard Biesheuvel wrote:
> From: Ard Biesheuvel <ardb@kernel.org>
>
> As a first step towards disentangling the SEV #VC handling code -which
> is shared between the decompressor and the core kernel- from the SEV
> startup code, move the decompressor's copy of the instruction decoder
> into a separate source file.
>
> Code movement only - no functional change intended.
>
> Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
> ---
> arch/x86/boot/compressed/Makefile | 6 +--
> arch/x86/boot/compressed/misc.h | 7 +++
> arch/x86/boot/compressed/sev-handle-vc.c | 51 ++++++++++++++++++++
> arch/x86/boot/compressed/sev.c | 39 +--------------
> 4 files changed, 62 insertions(+), 41 deletions(-)
>
> diff --git a/arch/x86/boot/compressed/Makefile b/arch/x86/boot/compressed/Makefile
> index 0fcad7b7e007..f4f7b22d8113 100644
> --- a/arch/x86/boot/compressed/Makefile
> +++ b/arch/x86/boot/compressed/Makefile
> @@ -44,10 +44,10 @@ KBUILD_CFLAGS += -D__DISABLE_EXPORTS
> KBUILD_CFLAGS += $(call cc-option,-Wa$(comma)-mrelax-relocations=no)
> KBUILD_CFLAGS += -include $(srctree)/include/linux/hidden.h
>
> -# sev.c indirectly includes inat-table.h which is generated during
> +# sev-decode-insn.c indirectly includes inat-table.c which is generated during

did you mean sev-handle-vc.c ?

Thanks,
Tom

> # compilation and stored in $(objtree). Add the directory to the includes so
> # that the compiler finds it even with out-of-tree builds (make O=/some/path).
> -CFLAGS_sev.o += -I$(objtree)/arch/x86/lib/
> +CFLAGS_sev-handle-vc.o += -I$(objtree)/arch/x86/lib/
>
> KBUILD_AFLAGS := $(KBUILD_CFLAGS) -D__ASSEMBLY__
>
> @@ -96,7 +96,7 @@ ifdef CONFIG_X86_64
> vmlinux-objs-y += $(obj)/idt_64.o $(obj)/idt_handlers_64.o
> vmlinux-objs-$(CONFIG_AMD_MEM_ENCRYPT) += $(obj)/mem_encrypt.o
> vmlinux-objs-y += $(obj)/pgtable_64.o
> - vmlinux-objs-$(CONFIG_AMD_MEM_ENCRYPT) += $(obj)/sev.o
> + vmlinux-objs-$(CONFIG_AMD_MEM_ENCRYPT) += $(obj)/sev.o $(obj)/sev-handle-vc.o
> endif
>
> vmlinux-objs-$(CONFIG_ACPI) += $(obj)/acpi.o