This is an automated email from Gerrit.

"liangzhen <[email protected]>" just uploaded a new patch set to Gerrit, 
which you can find at https://review.openocd.org/c/openocd/+/9801

-- gerrit

commit 726d77269b216cda05d818033a625900243f755f
Author: Zane Leung <[email protected]>
Date:   Fri Jul 24 17:31:22 2026 +0800

    target/riscv: remove possible redundant DM examine
    
    - Return ERROR_FAIL directly when DM was already reset
    - Remove wait_for_idle_if_needed() call before changing hartsel
    
    Change-Id: I4036847c12db4043afac1427479c2a365388602d
    Signed-off-by: Zane Leung <[email protected]>

diff --git a/src/target/riscv/riscv-013.c b/src/target/riscv/riscv-013.c
index 34df26696c..0b9193a1ee 100644
--- a/src/target/riscv/riscv-013.c
+++ b/src/target/riscv/riscv-013.c
@@ -1937,14 +1937,10 @@ static int examine_dm(struct target *target)
        if (dm->was_examined)
                return ERROR_OK;
 
-       int result = ERROR_FAIL;
+       int result;
 
        if (dm->was_reset) {
-               /* The DM was already reset when examining a different hart.
-                * No need to reset it again. But for safety, assume that an 
abstract
-                * command might be in progress at the moment.
-                */
-               dm->abstract_cmd_maybe_busy = true;
+               return ERROR_FAIL;
        } else {
                result = reset_dm(target);
                if (result != ERROR_OK)
@@ -1995,12 +1991,6 @@ static int examine_dm(struct target *target)
 
                        if (get_field(s, DM_DMSTATUS_ANYHAVERESET)) {
                                dmcontrol = DM_DMCONTROL_DMACTIVE | 
DM_DMCONTROL_ACKHAVERESET;
-                               /* If `abstractcs.busy` is set, debugger should 
not
-                                * change `hartsel`.
-                                */
-                               result = wait_for_idle_if_needed(target);
-                               if (result != ERROR_OK)
-                                       return result;
                                dmcontrol = set_dmcontrol_hartsel(dmcontrol, i);
                                result = dm_write(target, DM_DMCONTROL, 
dmcontrol);
                                if (result != ERROR_OK)

-- 

Reply via email to