Re: [PATCHv6 20/30] x86/boot: Add a trampoline for booting APs via firmware handoff

Borislav Petkov
2022-03-18T09:56:13Z

On Thu, Mar 17, 2022 at 11:21:55PM +0300, Kirill A. Shutemov wrote:
> As I said[1],

Whoops, I've missed that in the mail flood, sorry.

> I'm confused by the request. These field initialized at
> build time. I don't see how a single field would work.

So I did take a deeper look last night, trying to see whether the SEV
one - sev_es_trampoline_start - could be assigned at build time already
to pa_trampoline_start so that it is already in the header.

However, you need to have this info available dynamically, during boot
also, so that you can prepare the AP jump table for SEV guests, see
sev_es_setup_ap_jump_table().

Which means, I need a way of communicating the sev_es_trampoline_start
physical address to kernel proper *but*, *also*, I need to not touch the
default trampoline_start for normal booting. And this header is that
communicating.

So yeah, I kinda convinced myself that we cannot assign the proper
trampoline_start at boot time - which we can do with trickery to modify
that arch/x86/realmode/rm/pasyms.h generated addition to the linker
script. We need to be able to assign it at *boot* time so we need both
addresses.

Oh well, forget what I said initially.

Thx.

--
Regards/Gruss,
Boris.