Skip to content

Commit 83dc8a6

Browse files
committed
target/riscv: clear abstract_cmd_maybe_busy after commands
If a sufficient delay was used before reading `abstractcs` during the batch execution, `dm->abstract_cmd_maybe_busy` was not cleared and the following call to `wait_for_idle_if_needed()` (e.g. on `resume`), would result in a call to `wait_for_idle()` performing a redundant read of `abstractcs`. While this is not a bug, it impedes the performance. Change-Id: I9d234ef6d53af96c60892d71247c10e631dfcc3b Signed-off-by: Evgeniy Naydanov <[email protected]>
1 parent f82c5a7 commit 83dc8a6

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/target/riscv/riscv-013.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -630,6 +630,15 @@ static int abstract_cmd_batch_check_and_clear_cmderr(struct target *target,
630630
if (res != ERROR_OK)
631631
goto clear_cmderr;
632632
}
633+
634+
dm013_info_t * const dm = get_dm(target);
635+
if (!dm) {
636+
LOG_ERROR("BUG: Target %s is not assigned to any RISC-V debug module",
637+
target_name(target));
638+
return ERROR_FAIL;
639+
}
640+
dm->abstract_cmd_maybe_busy = false;
641+
633642
*cmderr = get_field32(abstractcs, DM_ABSTRACTCS_CMDERR);
634643
if (*cmderr == CMDERR_NONE)
635644
return ERROR_OK;

0 commit comments

Comments
 (0)