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

target/riscv: Implement ability to re-examine target #1020

Closed
wants to merge 2 commits into from

Conversation

kr-sc
Copy link
Contributor

@kr-sc kr-sc commented Feb 21, 2024

Add a new OpenOCD command re_examine to enforce re-examination of target. Some of existing hardware have a writable misa.V bit. It means that it can be enabled by software. We need an opportunity to enforce examine procedure in OpenOCD to query the capabilities of the target.

Also this patch includes commit with fix of a little issue connected with clearing triggers cache.

r->wp_triggers_negative_cache should be NULL after free
to avoid issues connected with multiple sequential calls
of free_wp_triggers_cache()

Change-Id: Ib39fe0c9dcd01b6e78021bf86a34f3888e94b1d5
Signed-off-by: Kirill Radkin <[email protected]>
Add a new OpenOCD command `re_examine` to enforce re-examination of target.
Some of existing hardware have a writable misa.V bit. It means that it can
be enabled by software. We need an opportunity to enforce examine procedure
in OpenOCD to query the capabilities of the target.

Change-Id: Id523315486f416c28021199e29f53242d1a37069
Signed-off-by: Kirill Radkin <[email protected]>
@kr-sc kr-sc force-pushed the kr-sc/re-examine-command branch from 085e80b to 0dba65f Compare February 21, 2024 15:52
Copy link
Collaborator

@MarekVCodasip MarekVCodasip left a comment

Choose a reason for hiding this comment

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

Thanks for the patch. I have found a few things.

I would like others to also take a look, I have a feeling that re-examination needs more discussion.

@@ -11515,6 +11515,13 @@ riscv exec_progbuf 0x0330000f 0x0000100f
riscv exec_progbuf 0x94a20405
@end example

@subsection RISC-V Syntacore hardware-specific Commands
Copy link
Collaborator

Choose a reason for hiding this comment

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

I would not call this a Syntacore hardware-specific command.

Spike also has the ability to change at runtime which extensions are implemented. The RISC-V specification does allow the ISA to change at runtime if the hardware supports it.

Copy link
Collaborator

@aap-sc aap-sc Mar 15, 2024

Choose a reason for hiding this comment

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

I would not call this a Syntacore hardware-specific command.

This is a mistake on our side. This code was in Syntacore codebase for a while and we just missed that this part had to be re-written during internal review.

{
target->examined = false;
}

Copy link
Collaborator

Choose a reason for hiding this comment

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

I am not sure if touching target.h/c is the best approach.

Myself, I would open a patch on the upsteam OpenOCD changing the visibility of this function.

For now, I would set the target->examined = false directly in the handle_re_examine_target() and add a // TODO to change it later.

RISCV_INFO(r);

if (target->watchpoints || target->breakpoints) {
LOG_TARGET_ERROR(target, "Please, remove all breakpoints and watchpoints.");
Copy link
Collaborator

Choose a reason for hiding this comment

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

I would change the message, something akin to: "Re-examination requires the removal of all breakpoints and watchpoints."

@aap-sc
Copy link
Collaborator

aap-sc commented Mar 15, 2024

NOTE: @MarekVCodasip Kirill will be out for a while... This patch won't get any updates because of this for some time. Likely, we'll refactor the patch a little bit and re-upload it again. In any case - thanks for review, the suggested changes will be integrated.

@aap-sc aap-sc closed this May 28, 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

Successfully merging this pull request may close these issues.

3 participants