Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for smp in multiple DMs #907

Closed
lz-bro opened this issue Aug 25, 2023 · 7 comments
Closed

Support for smp in multiple DMs #907

lz-bro opened this issue Aug 25, 2023 · 7 comments

Comments

@lz-bro
Copy link
Contributor

lz-bro commented Aug 25, 2023

How to support for smp in multiple DMs? It appears from the code that harts across multiple DMs can be haled/resumed, but the same threadid in multiple DMs, and gdb can only debug harts in sigle DM

config with

set _TARGETNAME_0 $_CHIPNAME.dm0cpu0
set _TARGETNAME_1 $_CHIPNAME.dm0cpu1
set _TARGETNAME_2 $_CHIPNAME.dm1cpu0
set _TARGETNAME_3 $_CHIPNAME.dm1cpu1

# cluster 0
target create $_TARGETNAME_0 riscv -chain-position $_CHIPNAME.cpu -coreid 0 -rtos hwthread
target create $_TARGETNAME_1 riscv -chain-position $_CHIPNAME.cpu -coreid 1

# cluster 1
target create $_TARGETNAME_2 riscv -chain-position $_CHIPNAME.cpu -coreid 0 -dbgbase 0x400 -rtos hwthread
target create $_TARGETNAME_3 riscv -chain-position $_CHIPNAME.cpu -coreid 1 -dbgbase 0x400

target smp $_TARGETNAME_0 $_TARGETNAME_1 $_TARGETNAME_2 $_TARGETNAME_3

The index of each hart on the DM define
https://github.com/riscv/riscv-openocd/blob/a45589d60aa6864475fddcded885c8ff47d50be1/src/target/riscv/riscv-013.c#L1715-L1716
openocd log shown

Info :  [riscv.dm0cpu0] became available (halted)
Info :  [riscv.dm0cpu1] became available (halted)
Info :  [riscv.dm1cpu0] became available (halted)
Info :  [riscv.dm1cpu1] became available (halted)

threadid define
https://github.com/riscv/riscv-openocd/blob/21d21408aa36ccb458ccfaad871f7dd1bb1f731a/src/rtos/hwthread.c#L40-L43

so 1 gdb can only see 2 core in dm1

(gdb) info threads
  Id   Target Id                                                            Frame
* 1    Thread 1 "riscv.dm1cpu0" (Name: riscv.dm1cpu0, state: debug-request) 0x0000000000001c6c in ?? ()
  2    Thread 2 "riscv.dm1cpu1" (Name: riscv.dm1cpu1, state: debug-request) 0x000000000000769a in ?? ()

Can anyone give me some advice?

@en-sc
Copy link
Collaborator

en-sc commented Jan 19, 2024

If I'm correct this should help: https://review.openocd.org/c/openocd/+/7957

@lz-bro
Copy link
Contributor Author

lz-bro commented Feb 1, 2024

I would like to know if riscv-openocd currently implements the halt groups and resume groups in spec-1.0 to support simultaneous halt/resume harts in multiple DMs, thanks.

@en-sc
Copy link
Collaborator

en-sc commented Feb 1, 2024

Yes, halt groups are supported, though there are some problems (e.g. #1010)

@aap-sc
Copy link
Collaborator

aap-sc commented Feb 1, 2024

Yes, halt groups are supported, though there are some problems

and this one: #902

@lz-bro
Copy link
Contributor Author

lz-bro commented Aug 19, 2024

If I'm correct this should help: https://review.openocd.org/c/openocd/+/7957

Hi, this PR has been merged, could you please sync it?

@aap-sc
Copy link
Collaborator

aap-sc commented Aug 19, 2024

@lz-bro I'll create MR today

@aap-sc
Copy link
Collaborator

aap-sc commented Aug 20, 2024

@lz-bro #1116 (there are codestyle/checkpatch failure, though). There were few merge conflicts - these are resolved, tests pass.

@lz-bro lz-bro closed this as completed Sep 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants