diff options
author | Kyösti Mälkki <kyosti.malkki@gmail.com> | 2023-07-08 20:17:59 +0300 |
---|---|---|
committer | Subrata Banik <subratabanik@google.com> | 2023-07-08 18:54:24 +0000 |
commit | 0834b222c9fd9c3e2b054b81581d2d03ad9dfbc6 (patch) | |
tree | f47b80e27dc87a1072a3316d94507066ceda3965 /src/cpu | |
parent | 3c1b7b485b6a9e2213d90cd4b904c2dacf79f666 (diff) |
cpu/x86/lapic: Fix regression with X2APIC_LATE_WORKAROUND
This patch fixes the boot hang due to commit 053a45bcdb3ccf8 ("cpu/x86/lapic: Fix X2APIC_ONLY regression") on platform which selects X2APIC_LATE_WORKAROUND config.
[EMERG] Switching from X2APIC to XAPIC mode is not implemented.
Without this patch: Boot gets stuck inside at BS_WRITE_TABLES when enable_lapic() gets called after X2APIC mode has been enabled. The fix is to change enable_lapic() to track when late enablement for X2APIC mode happens with X2APIC_LATE_WORKAROUND.
TEST=Able to build and boot google/rex to chromeos.
Change-Id: I41e72380e9cfb59721d0df607ad875d7b6546974
Signed-off-by: Kyösti Mälkki <kyosti.malkki@gmail.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/76384
Reviewed-by: Subrata Banik <subratabanik@google.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'src/cpu')
-rw-r--r-- | src/cpu/x86/lapic/lapic.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/cpu/x86/lapic/lapic.c b/src/cpu/x86/lapic/lapic.c index 24d2e37d47..8e0449a5fe 100644 --- a/src/cpu/x86/lapic/lapic.c +++ b/src/cpu/x86/lapic/lapic.c @@ -9,6 +9,8 @@ #include <smp/node.h> #include <types.h> +static bool quirk_x2apic_allowed; + void enable_lapic_mode(bool try_set_x2apic) { uintptr_t apic_base; @@ -46,14 +48,18 @@ void enable_lapic_mode(bool try_set_x2apic) die("Switching from X2APIC to XAPIC mode is not implemented."); } + if (CONFIG(X2APIC_LATE_WORKAROUND) && use_x2apic) + quirk_x2apic_allowed = true; } void enable_lapic(void) { bool try_set_x2apic = true; - if (CONFIG(XAPIC_ONLY) || CONFIG(X2APIC_LATE_WORKAROUND)) + if (CONFIG(XAPIC_ONLY)) try_set_x2apic = false; + else if (CONFIG(X2APIC_LATE_WORKAROUND)) + try_set_x2apic = quirk_x2apic_allowed; enable_lapic_mode(try_set_x2apic); } |