arch/x86: Ensure LAPIC mode for exception handler

Attempting to use X2APIC MSRs before the call to enable_lapic()
is made raises exception and double-faults.

Change-Id: Ib97889466af0fbe639bec2be730784acc015b525
Signed-off-by: Kyösti Mälkki <kyosti.malkki@gmail.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/76194
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Elyes Haouas <ehaouas@noos.fr>
This commit is contained in:
Kyösti Mälkki 2023-06-28 06:16:11 +03:00 committed by Shelley Chen
commit d7542cb338
2 changed files with 14 additions and 3 deletions

View file

@ -184,4 +184,16 @@ void enable_lapic_mode(bool try_set_x2apic);
void disable_lapic(void);
void setup_lapic_interrupts(void);
static inline unsigned int early_lapicid(void)
{
if (!CONFIG(SMP))
return 0;
if (!ENV_RAMSTAGE)
return 0;
enable_lapic();
return lapicid();
}
#endif /* CPU_X86_LAPIC_H */