-
Notifications
You must be signed in to change notification settings - Fork 327
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
provide riscv-specific controls to disable triggers from being used for watchpoints #917
provide riscv-specific controls to disable triggers from being used for watchpoints #917
Conversation
I have done only a superficial review so far. What is the motivation for having these new configuration options, please? If the target supports the given trigger types, why not to always use them? Why would someone force-disable that functionality when the target provides it? |
I think, it will be usefull for hardware debugging (for testing particular type of trigger). |
If you wish to test the HW with the help of OpenOCD, I recommend to stick with the existing low-level commands ( I would rather not add any TCL commands that have no other use case than testing. |
If we think like that we can write everything with low-level jtag commands (and it is possible, I think), but I think that we want to extend existing codebase to simplify control of debugged unit. We have a problem with our hardware: |
Thank you for sharing the motivation for this feature.
If it would be a hw-testing-only feature, I maintain the opinion that these should not be added to OpenOCD. Test cases for hardware should be developed separately. And if someone wishes to execute them through OpenOCD, the interface to do so is already available (as mentioned in the previous comment).
I agree as long as there are real use cases for those commands or options (beyond testing).
Known issues in existing hardware - that is IMO a good argument to include the feature 👍 |
a541283
to
27839b1
Compare
27839b1
to
fe16177
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks fine to me overall. I have few last suggestions.
I will not be able to make another review of this since I am out of office until Oct 9. This should not be an issue as this merge request is very close to completion and only minor items are left.
fe16177
to
fb9486a
Compare
I finally read this. General comments:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The implemented feature applies only to watchpoints, but the documentation and command names don't say anything about that.
Instead of making the command names even more cumbersome, I propose:
riscv set_enable_eq_match_trigger [r][w][x]
This lets a user set those trigger types for any combination of read, write, and execute. It might make the implementation a bit more straightforward even. I think you can simply modify try_setup_single_match_trigger() and try_setup_chained_match_triggers() to return error when a type is passed that doesn't fit with the r/w/x bits that are requested.
doc/openocd.texi
Outdated
@@ -10871,6 +10871,20 @@ Control dcsr.ebreaku. When on (default), U-mode ebreak instructions trap to | |||
OpenOCD. When off, they generate a breakpoint exception handled internally. | |||
@end deffn | |||
|
|||
The commands below can be used to prevent OpenOCD from using certain RISC-V trigger features, for example in cases when there are known issues in the target hardware. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you wrap this line? No need to be strictly 80 columns, but 166 is a bit much.
(I know there are a few exceptions to this already, but going forward we're trying to keep the line lengths reasonable.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Addressed
|
As I know, OpenOCD use only equality match trigger for bp. Do we really need command that disables, for example, NAPOT trigger for bp (e mode)? |
We don't now type of trigger inside of |
63547f4
to
4c12f4a
Compare
Change output of |
…for watchpoints Add a new riscv specific commands to disable triggers Change-Id: Ic1842085aa66851c740e0abcbfbe0adbe930920e Signed-off-by: Kirill Radkin <[email protected]>
4c12f4a
to
e76a9b7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have re-checked the code visually and it looks all right.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't know type of trigger inside of
try_setup_single_match_trigger
, because we only passtrigger_request_info
struct in it, so I think that it's better not to modify this function.
The type is encoded in tdata1 of the trigger_request_info, though. It would be trivial to add a line there that checks the type and match fields, and then compares it against whatever the user configured.
Regardless. Since you've already implemented this, I guess it's good enough. In the future, can you open an issue or something when you're planning on adding new commands? That way we can have a little discussion on what commands make the most sense. I think my idea would have been just as much work to implement, and would have left us with a command that is more useful in the future, when OpenOCD implementation changes, or when we encounter hardware with different bugs.
Yes, next time I'll do it. |
.tdata1_ignore_mask = fields.tdata1_ignore_mask | ||
}; | ||
struct trigger_request_info ge_2 = { | ||
if (r->enable_ge_lt_trigger) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kr-sc , I'd like to request few additional improvements:
enable_ge_lt_trigger
should be renamed towp_enable_ge_lt_trigger
(this applies to other controls as well). This is to clearly identify that these controls are for watchpoints only.- when
trigger->length == 0
we should allow for equality match to be used regardless of this control (otherwise we won't be able to set such wathcpoints)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@timsifive , @JanMatCodasip FYI
Add a new riscv specific commands to disable triggers