Re: [PATCH v6 21/22] x86/boot: Move startup code out of __head section
From: Tom Lendacky
Date: Mon Aug 11 2025 - 14:05:59 EST
On 8/11/25 12:40, Borislav Petkov wrote:
> On Tue, Jul 22, 2025 at 09:27:30AM +0200, Ard Biesheuvel wrote:
>> @@ -210,7 +210,7 @@ bool __head snp_init(struct boot_params *bp)
>> return true;
>> }
>>
>> -void __head __noreturn snp_abort(void)
>> +void __init __noreturn snp_abort(void)
>> {
>> sev_es_terminate(SEV_TERM_SET_GEN, GHCB_SNP_UNSUPPORTED);
>> }
>
> So this thing already conflicts with the SAVIC stuff:
>
> ld: vmlinux.o: in function `savic_probe':
> /home/boris/kernel/2nd/linux/arch/x86/kernel/apic/x2apic_savic.c:29:(.text+0x6601f): undefined reference to `snp_abort'
> make[2]: *** [scripts/Makefile.vmlinux:91: vmlinux] Error 1
> make[1]: *** [/mnt/kernel/kernel/2nd/linux/Makefile:1244: vmlinux] Error 2
> make[1]: *** Waiting for unfinished jobs....
> make: *** [Makefile:248: __sub-make] Error 2
>
> because it calls snp_abort().
>
> I'm thinking since it is a one-liner, we can simply turn it into a macro which
> evaluates to
>
> sev_es_terminate(SEV_TERM_SET_GEN, GHCB_SNP_UNSUPPORTED);
>
> and problem solved.
Yes, that works. Or just get rid of snp_abort() and call
sev_es_terminate() directly. Secure AVIC could even use an
SEV_TERM_SET_LINUX specific code instead of the generic failure code.
Thanks,
Tom
>
> Or you folks have a better idea?
>
> Thx.
>