summaryrefslogtreecommitdiffstats
path: root/src/include/cpu
diff options
context:
space:
mode:
authorKyösti Mälkki <kyosti.malkki@gmail.com>2021-10-15 17:14:20 +0300
committerKyösti Mälkki <kyosti.malkki@gmail.com>2022-02-05 07:49:21 +0000
commit7aea15aa6b59c96a6d4c0c847352dd1c45145c7c (patch)
treeab2ca87ac0ded85bd6f8e2d056ea935f2503541f /src/include/cpu
parent710bdc42a5f409261335495c03882e2b133a384c (diff)
downloadcoreboot-7aea15aa6b59c96a6d4c0c847352dd1c45145c7c.tar.gz
coreboot-7aea15aa6b59c96a6d4c0c847352dd1c45145c7c.tar.bz2
coreboot-7aea15aa6b59c96a6d4c0c847352dd1c45145c7c.zip
cpu/x86/lapic: Fix choice X2APIC_ONLY
When sending self an IPI, some instructions may be processed before IPI is serviced. Spend some time doing nothing, to avoid entering a printk() and acquiring console_lock and dead-locking. Change-Id: I78070ae91e78c11c3e3aa225e5673d4667d6f7bb Signed-off-by: Kyösti Mälkki <kyosti.malkki@gmail.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/60213 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Angel Pons <th3fanbus@gmail.com> Reviewed-by: Arthur Heymans <arthur@aheymans.xyz>
Diffstat (limited to 'src/include/cpu')
-rw-r--r--src/include/cpu/x86/lapic.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/include/cpu/x86/lapic.h b/src/include/cpu/x86/lapic.h
index c1603f21f0ef..e131d2ec46aa 100644
--- a/src/include/cpu/x86/lapic.h
+++ b/src/include/cpu/x86/lapic.h
@@ -145,8 +145,16 @@ static __always_inline unsigned int lapicid(void)
static __always_inline void lapic_send_ipi_self(uint32_t icrlow)
{
+ int i = 1000;
+
/* LAPIC_DEST_SELF does not support all delivery mode -fields. */
lapic_send_ipi(icrlow, lapicid());
+
+ /* In case of X2APIC force a short delay, to prevent deadlock in a case
+ * the immediately following code acquires some lock, like with printk().
+ */
+ while (CONFIG(X2APIC_ONLY) && i--)
+ cpu_relax();
}
static __always_inline void lapic_send_ipi_others(uint32_t icrlow)