-
Couldn't load subscription status.
- Fork 365
Description
There is an issue with bce93f6
Enabling SMP does not respect the SMP group identifier and always changes it to 1:
riscv-openocd/src/target/smp.c
Lines 110 to 115 in 48483a8
| if (!strcmp(CMD_ARGV[0], "on")) { | |
| foreach_smp_target(head, target->smp_targets) | |
| head->target->smp = 1; | |
| return ERROR_OK; | |
| } |
RISC-V targets use the SMP identifier as the identifier of the halt group the target is in:
riscv-openocd/src/target/riscv/riscv-013.c
Lines 2154 to 2163 in 48483a8
| if (target->smp) { | |
| if (set_group(target, &info->haltgroup_supported, target->smp, HALT_GROUP) != ERROR_OK) | |
| return ERROR_FAIL; | |
| if (info->haltgroup_supported) | |
| LOG_TARGET_INFO(target, "Core %d made part of halt group %d.", info->index, | |
| target->smp); | |
| else | |
| LOG_TARGET_INFO(target, "Core %d could not be made part of halt group %d.", | |
| info->index, target->smp); | |
| } |
riscv-openocd/src/target/riscv/riscv-013.c
Lines 1762 to 1768 in 48483a8
| if (info->haltgroup_supported) { | |
| bool supported; | |
| if (set_group(target, &supported, target->smp, HALT_GROUP) != ERROR_OK) | |
| return ERROR_FAIL; | |
| if (!supported) | |
| LOG_TARGET_ERROR(target, "Couldn't place hart back in halt group %d. " | |
| "Some harts may be unexpectedly halted.", target->smp); |
Therefore, running smp off; smp on will change the halt group the hart is assumed to be a part of to 1, without re-configuring the DM.
AFAIU, there are two possible solutions to this issue:
- Decouple
target->smpand the identifier of the SMP group by introducing something liketarget->smp_id. Withsmp on/offchanging onlytarget->smp. - Decouple SMP groups and halt groups by introducing RISC-V specific commands that allow to configure halt groups. These commands can depend on the SMP (e.g. only the harts from the same SMP group can be made part of the same halt group with the check on resume whether the SMP group includes all the harts of the halt groups of the harts in the SMP groups).
IMHO the second option is preferable, however the first one is easier to implement.