RTEMS | riscv: s-mode use SBI for timer, reset, and SMP support (!1108)
Gedare Bloom (@gedare)
gitlab at rtems.org
Wed Mar 11 19:54:31 UTC 2026
Gedare Bloom commented on a discussion on bsps/riscv/riscv/start/bspsmp.c: https://gitlab.rtems.org/rtems/rtos/rtems/-/merge_requests/1108#note_145026
> {
> Per_CPU_Control *cpu;
>
> - cpu = _Per_CPU_Get_by_index(target_processor_index);
> #ifdef RISCV_USE_S_MODE
> - /* TODO: Add IPI call. */
> + uint32_t hartid;
> + unsigned long hart_mask;
> (void) cpu;
> +
> + hartid = _RISCV_Map_cpu_index_to_hartid(target_processor_index);
> + hart_mask = 1UL << hartid;
> + sbi_send_ipi(&hart_mask);
> #else
> + cpu = _Per_CPU_Get_by_index(target_processor_index);
yeah I wonder if we want to set a preference. Generally, we prefer to define all the local variables at the start of their block. So in this case it wouldn't make a difference, but if the #if...#else block was in the middle of other code it would make a difference.
I'd almost be preferable to...
```
func(...)
{
(void) unused_args;
local_decls;
...
#if
(void) unused_args;
(void) unused_locals;
#else
(void) unused_args;
(void) unused_local;
#endif
...
}
```
@joel @opticron opinions?
--
View it on GitLab: https://gitlab.rtems.org/rtems/rtos/rtems/-/merge_requests/1108#note_145026
You're receiving this email because of your account on gitlab.rtems.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/bugs/attachments/20260311/ad8835c6/attachment-0001.htm>
More information about the bugs
mailing list