lib: sbi_hsm: Fix sbi_hsm_hart_start() for platform with hart hotplug
authorAnup Patel <apatel@ventanamicro.com>
Mon, 20 Mar 2023 13:28:54 +0000 (18:58 +0530)
committerAnup Patel <anup@brainfault.org>
Thu, 6 Apr 2023 13:18:19 +0000 (18:48 +0530)
commit30b9e7ee14498e5db805f471dbb23ea67c7a3b32
tree642d327b9b0ed649f41dc3ced0799de627ebf276
parentf64dfcd2b5e78e9eea3fe3fee58e0632b5f81b99
lib: sbi_hsm: Fix sbi_hsm_hart_start() for platform with hart hotplug

It possible that a platform supports hart hotplug (i.e. both hart_start
and hart_stop callbacks available) and all harts are start simultaneously
at platform boot-time. In this situation, the sbi_hsm_hart_start() will
call hsm_device_hart_start() for secondary harts at platform boot-time
which will fail because secondary harts were already started.

To fix above, we call hsm_device_hart_start() from sbi_hsm_hart_start()
only when entry_count is same as init_count for the secondary hart.

Signed-off-by: Anup Patel <apatel@ventanamicro.com>
lib/sbi/sbi_hsm.c