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 <evgeniy.naydanov@syntacore.com>
This commit is contained in:
Evgeniy Naydanov 2024-12-25 13:11:33 +03:00
parent f82c5a7c04
commit 83dc8a6446
1 changed files with 9 additions and 0 deletions

View File

@ -630,6 +630,15 @@ static int abstract_cmd_batch_check_and_clear_cmderr(struct target *target,
if (res != ERROR_OK)
goto clear_cmderr;
}
dm013_info_t * const dm = get_dm(target);
if (!dm) {
LOG_ERROR("BUG: Target %s is not assigned to any RISC-V debug module",
target_name(target));
return ERROR_FAIL;
}
dm->abstract_cmd_maybe_busy = false;
*cmderr = get_field32(abstractcs, DM_ABSTRACTCS_CMDERR);
if (*cmderr == CMDERR_NONE)
return ERROR_OK;