summaryrefslogtreecommitdiff
path: root/include/sbi/sbi_init.h
AgeCommit message (Collapse)Author
2025-06-16lib: sbi: Revert entry_count before doing hsm stop in hsm wait loopAnup Patel
Using hsm stop in hsm wait loop causes secondary harts to be stuck forever in OpenSBI on RISC-V platforms where HSM hart hotplug is available and all harts come-up at the same time during system power-on. For example, lets say we have two harts A and B on a RISC-V platform with HSM hart hotplug which come-up at the same time during system power-on. The hart A enters OpenSBI before hart B hence it becomes the primary (or cold-boot) hart whereas hart B becomes the secondary (or warm-boot) hart. The hart A follows the OpenSBI cold-boot path and registers hsm device before hart B enters OpenSBI. The hart B eventually enters OpenSBI and follows the OpenSBI warm-boot path so it will increment it's own entry_count before entering hsm wait loop where it sees hsm device and stops itself. Later as part of the Linux boot-up sequence, hart A issues SBI HSM start call to bring-up hart B but OpenSBI sees entry_count != init_count for hart B in sbi_hsm_hart_start() hence hsm_device_hart_start() is not called for hart B resulting in hart B stuck forever in OpenSBI. To fix the above issue, revert entry_count before doing hsm stop in hsm wait loop. Fixes: d844deadec94 ("lib: sbi: Use hsm stop for hsm wait") Signed-off-by: Anup Patel <[email protected]> Reviewed-by: Nick Hu <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Anup Patel <[email protected]>
2024-09-26lib: sbi: Update sbi_{entry,init}_count() to take a hart indexSamuel Holland
All callers already have the hartindex available, so this removes a hartid to hartindex conversion. Signed-off-by: Samuel Holland <[email protected]> Reviewed-by: Anup Patel <[email protected]>
2023-04-06lib: sbi: Introduce sbi_entry_count() functionAnup Patel
We introduce sbi_entry_count() function which counts the number of times a HART enters OpenSBI via cold-boot or warm-boot path. Signed-off-by: Anup Patel <[email protected]>
2020-01-07lib: Add sbi_init_count() APIAnup Patel
We add sbi_init_count() API which provides number of times a given HART completed init sequence (warmboot/coldboot). This will be very useful in debugging. With upcoming SBI HSM extension, it will also help in implementing one-time init code for each HART. Signed-off-by: Anup Patel <[email protected]> Reviewed-by: Atish Patra <[email protected]>
2020-01-07lib: Add initial sbi_exit() APIAnup Patel
This patch adds initial implementation of sbi_exit() API which can be used to perform OpenSBI exit sequence for current HART. The sbi_exit() implementation will be further extended by subsequent patches. Signed-off-by: Anup Patel <[email protected]> Reviewed-by: Atish Patra <[email protected]>
2019-01-24all: Update copyright header in all filesAnup patel
This patch updates copyright header in all files as follows: 1. Makes "SPDX-License-Identifier: BSD-2-Clause" as first line 2. Change copyright year to 2019 for Western Digital Signed-off-by: Anup Patel <[email protected]>
2019-01-16lib: Add documentation for sbi_init() APIAnup Patel
This patch adds doxygen style documentation for sbi_init() API. Signed-off-by: Anup Patel <[email protected]>
2018-12-11Initial commit.Anup Patel
Signed-off-by: Anup Patel <[email protected]>