mirror of
https://github.com/torvalds/linux.git
synced 2026-05-25 07:33:19 +02:00
x86/boot: Move early_setup_gdt() back into head64.c
Move early_setup_gdt() out of the startup code that is callable from the 1:1 mapping - this is not needed, and instead, it is better to expose the helper that does reside in __head directly. This reduces the amount of code that needs special checks for 1:1 execution suitability. In particular, it avoids dealing with the GHCB page (and its physical address) in startup code, which runs from the 1:1 mapping, making physical to virtual translations ambiguous. Signed-off-by: Ard Biesheuvel <ardb@kernel.org> Signed-off-by: Ingo Molnar <mingo@kernel.org> Cc: Arnd Bergmann <arnd@arndb.de> Cc: David Woodhouse <dwmw@amazon.co.uk> Cc: Dionna Amalie Glaze <dionnaglaze@google.com> Cc: H. Peter Anvin <hpa@zytor.com> Cc: Kees Cook <keescook@chromium.org> Cc: Kevin Loughlin <kevinloughlin@google.com> Cc: Len Brown <len.brown@intel.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Cc: Tom Lendacky <thomas.lendacky@amd.com> Cc: linux-efi@vger.kernel.org Link: https://lore.kernel.org/r/20250504095230.2932860-26-ardb+git@google.com
This commit is contained in:
parent
39ffd86dd7
commit
bd4a58beaa
|
|
@ -24,7 +24,7 @@
|
|||
static gate_desc bringup_idt_table[NUM_EXCEPTION_VECTORS] __page_aligned_data;
|
||||
|
||||
/* This may run while still in the direct mapping */
|
||||
static void __head startup_64_load_idt(void *vc_handler)
|
||||
void __head startup_64_load_idt(void *vc_handler)
|
||||
{
|
||||
struct desc_ptr desc = {
|
||||
.address = (unsigned long)rip_rel_ptr(bringup_idt_table),
|
||||
|
|
@ -43,19 +43,6 @@ static void __head startup_64_load_idt(void *vc_handler)
|
|||
native_load_idt(&desc);
|
||||
}
|
||||
|
||||
/* This is used when running on kernel addresses */
|
||||
void early_setup_idt(void)
|
||||
{
|
||||
void *handler = NULL;
|
||||
|
||||
if (IS_ENABLED(CONFIG_AMD_MEM_ENCRYPT)) {
|
||||
setup_ghcb();
|
||||
handler = vc_boot_ghcb;
|
||||
}
|
||||
|
||||
startup_64_load_idt(handler);
|
||||
}
|
||||
|
||||
/*
|
||||
* Setup boot CPU state needed before kernel switches to virtual addresses.
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -52,6 +52,7 @@ extern void reserve_standard_io_resources(void);
|
|||
extern void i386_reserve_resources(void);
|
||||
extern unsigned long __startup_64(unsigned long p2v_offset, struct boot_params *bp);
|
||||
extern void startup_64_setup_gdt_idt(void);
|
||||
extern void startup_64_load_idt(void *vc_handler);
|
||||
extern void early_setup_idt(void);
|
||||
extern void __init do_early_exception(struct pt_regs *regs, int trapnr);
|
||||
|
||||
|
|
|
|||
|
|
@ -303,3 +303,15 @@ void __init __noreturn x86_64_start_reservations(char *real_mode_data)
|
|||
|
||||
start_kernel();
|
||||
}
|
||||
|
||||
void early_setup_idt(void)
|
||||
{
|
||||
void *handler = NULL;
|
||||
|
||||
if (IS_ENABLED(CONFIG_AMD_MEM_ENCRYPT)) {
|
||||
setup_ghcb();
|
||||
handler = vc_boot_ghcb;
|
||||
}
|
||||
|
||||
startup_64_load_idt(handler);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user