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>
This commit is contained in:
Kyösti Mälkki 2021-10-15 17:14:20 +03:00
parent 710bdc42a5
commit 7aea15aa6b
1 changed files with 8 additions and 0 deletions

View File

@ -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)