Skip to content

add dmstatus.ndmresetpending to allow a debugger to determine when ndmreset is complete#594

Merged
timsifive merged 4 commits into
riscv:masterfrom
benscotstaveley:bstaveley_ndmresetpending
Nov 16, 2020
Merged

add dmstatus.ndmresetpending to allow a debugger to determine when ndmreset is complete#594
timsifive merged 4 commits into
riscv:masterfrom
benscotstaveley:bstaveley_ndmresetpending

Conversation

@benscotstaveley
Copy link
Copy Markdown
Contributor

Currently there is a well-defined way for a debugger to determine when reset has begun and completed for any arbitrary subset of harts (most recently discussed in PR 480, 494). However the system as a whole is composed of more than just the harts, and there is no overarching “havendmreset” signal analogous to the per-hart “havereset” signals to indicate when this state outside of the harts has completed reset.

Because some system state accessible to a debugger (for example, peripherals' register space via SBA) can continue to be in reset after all harts in a system have completed reset, it is useful for the debugger to know when ndmreset is still happening and when it has completed.

This PR implements a way for a debugger to determine if ndmreset has completed on implementations that choose to support the feature. It proposes to use a bit of dmstatus called ndmresetpending that can be asserted by a debug module at the start of ndmreset and deasserted when ndmreset is complete. Hardware that does not implement this feature leaves the bit hardwired zero (as prior to this PR), and a debugger is not required to read the bit, in order to maintain backward compatibility.

The proposal also has the ndmresetpending bit return a value of 1 on reads whenever ndmreset is 1. This part of the proposal is in place to allow a debugger to detect whether the feature is supported without requiring a separate 'capabilities' bit or breaking backward compatibility. Therefore, the prescription for using this feature is: when requesting ndmreset,

  1. write(ndmreset, 1)
  2. if(debugger_wants_to_poll) debugger_will_poll = read(ndmresetpending); else debugger_will_poll = 0;
  3. write(ndmreset, 0)
  4. if (debugger_will_poll) while (read(ndmresetpending)) { wait }

so debuggers not wanting to use this feature have no change to present behavior.

Copy link
Copy Markdown
Collaborator

@ernie-sifive ernie-sifive left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change looks fine to me.

Copy link
Copy Markdown
Contributor

@timsifive timsifive left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feature looks good.

Comment thread debug_module.tex Outdated
Comment thread xml/dm_registers.xml Outdated
Comment thread debug_module.tex Outdated
Copy link
Copy Markdown
Contributor

@timsifive timsifive left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Thanks.

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

Successfully merging this pull request may close these issues.

3 participants