diff options
author | Evgenii Shatokhin <e.shatokhin@yadro.com> | 2023-03-06 00:22:47 +0300 |
---|---|---|
committer | Anup Patel <anup@brainfault.org> | 2023-03-10 11:43:40 +0300 |
commit | c6a092cd80112529cb2e92e180767ff5341b22a3 (patch) | |
tree | 3fe7ea041e7bc73f8f8e0df4f7648ba8f7a1cbbf /include/sbi/sbi_ecall_interface.h | |
parent | e8e9ed3790feac05ec6fd5c279ec80b05293d67b (diff) | |
download | opensbi-master.tar.xz |
lib: sbi: Clear IPIs before init_warm_startup in non-boot hartsHEADVF2_v3.8.2VF2_v3.7.5VF2_v3.6.1VF2_v3.4.5VF2_v3.1.5VF2_v3.0.4VF2_v2.11.5VF2_6.1_v3.8.2VF2_6.1_v3.7.5JH7110_VF2_6.6_v5.12.0JH7110_VF2_6.1_v5.12.0JH7110_VF2_6.1_v5.11.4JH7110_VF2_6.1_v5.11.3JH7110_VF2_6.1_v5.10.3JH7110_VF2_6.1_v3.9.3JH7110_VF2_515_v5.12.0JH7110_VF2_515_v5.11.4JH7110_VF2_515_v5.11.3JH7110_VF2_515_v5.10.3JH7110_VF2_515_v3.9.3master
Since commit 50d4fde1c5a4 ("lib: Remove redundant sbi_platform_ipi_clear()
calls"), the IPI sent from the boot hart in wake_coldboot_harts() is not
cleared in the secondary harts until they reach sbi_ipi_init(). However,
sbi_hsm_init() and sbi_hsm_hart_wait() are called earlier, so a secondary
hart might enter sbi_hsm_hart_wait() with an already pending IPI.
sbi_hsm_hart_wait() makes sure the hart leaves the loop only when it is
actually ready, so a pending unrelated IPI should not cause safety issues.
However, it might be inefficient on certain hardware, because it prevents
"wfi" from stalling the hart even if the hardware supports this, making the
hart needlessly spin in a "busy-wait" loop.
This behaviour can be observed, for example, in a QEMU VM (QEMU 7.2.0) with
"-machine virt" running a Linux guest. Inserting delays in
sbi_hsm_hart_start() allows reproducing the issue more reliably.
The comment in wait_for_coldboot() suggests that the initial IPI is needed
in the warm resume path, so let us clear it before init_warm_startup()
only.
To do this, sbi_ipi_raw_clear() was created similar to sbi_ipi_raw_send().
Signed-off-by: Evgenii Shatokhin <e.shatokhin@yadro.com>
Reviewed-by: Anup Patel <anup@brainfault.org>
Diffstat (limited to 'include/sbi/sbi_ecall_interface.h')
0 files changed, 0 insertions, 0 deletions