Skip to content
Snippets Groups Projects
Commit 417576c2 authored by Miao Yan's avatar Miao Yan Committed by Simon Glass
Browse files

x86: Add a 'pause' instruction in __udelay() for QEMU target


When running SMP configuration on QEMU (tcg mode, no kvm), there is
a busy loop in start_aps(), calling udelay(), that waits for APs to
show up online. However, there is a chance that VCPU1 will be timeout
waiting, IOW the secondary VCPUs haven't started their execution yet.

This patch adds a 'pause' instruction in __udelay() only for QEMU
target, to give other VCPUs a chance to run. When QEMU sees the
'pause' instruction, it will yeild the execution to other CPUs.

Signed-off-by: default avatarMiao Yan <yanmiaobest@gmail.com>
Signed-off-by: default avatarBin Meng <bmeng.cn@gmail.com>
Acked-by: default avatarSimon Glass <sjg@chromium.org>
Tested-by: default avatarSimon Glass <sjg@chromium.org>
parent 947eb439
No related branches found
No related tags found
No related merge requests found
......@@ -355,7 +355,15 @@ void __udelay(unsigned long usec)
stop = now + usec * get_tbclk_mhz();
while ((int64_t)(stop - get_ticks()) > 0)
#if defined(CONFIG_QEMU) && defined(CONFIG_SMP)
/*
* Add a 'pause' instruction on qemu target,
* to give other VCPUs a chance to run.
*/
asm volatile("pause");
#else
;
#endif
}
int timer_init(void)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment