This is an automated email from Gerrit.

"Daniel Goehring <dgoeh...@os.amperecomputing.com>" just uploaded a new patch 
set to Gerrit, which you can find at https://review.openocd.org/c/openocd/+/7737

-- gerrit

commit 4c51801c947aa4b7222d0d279a5fa20fdf142596
Author: Daniel Goehring <dgoeh...@os.amperecomputing.com>
Date:   Tue Jun 6 14:44:13 2023 -0600

    target/aarch64: add missing aarch64_poll() calls
    
    The code in aarch64_step() does not check the core status before
    returning. Add call to aarch64_poll() before returning from
    aarch64_step() to ensure the event TARGET_EVENT_HALTED is called.
    
    Also add the aarch64_poll() call to aarch64_init_debug_access()
    to update target state information.
    
    This is necessary with the poller update introduced in commit
    95603fae18f8 ("openocd: revert workarounds for 'expr' syntax change")
    
    Signed-off-by: Daniel Goehring <dgoeh...@os.amperecomputing.com>
    Change-Id: I6e91f1b6bc1f0d16e6f0eb76fc67d20111e3afd2

diff --git a/src/target/aarch64.c b/src/target/aarch64.c
index 5a16b3a3bf..354b4a1059 100644
--- a/src/target/aarch64.c
+++ b/src/target/aarch64.c
@@ -234,12 +234,14 @@ static int aarch64_init_debug_access(struct target 
*target)
        /* output restart requests to PE on channel 1 event */
        if (retval == ERROR_OK)
                retval = arm_cti_write_reg(armv8->cti, CTI_OUTEN1, CTI_CHNL(1));
-       if (retval != ERROR_OK)
-               return retval;
 
        /* Resync breakpoint registers */
 
-       return ERROR_OK;
+       /* Since this is likely called from init or reset, update target state 
information */
+       if (retval == ERROR_OK)
+               retval = aarch64_poll(target);
+
+       return retval;
 }
 
 /* Write to memory mapped registers directly with no cache or mmu handling */
@@ -1089,6 +1091,7 @@ static int aarch64_step(struct target *target, int 
current, target_addr_t addres
        struct armv8_common *armv8 = target_to_armv8(target);
        struct aarch64_common *aarch64 = target_to_aarch64(target);
        int saved_retval = ERROR_OK;
+       int poll_retval;
        int retval;
        uint32_t edecr;
 
@@ -1171,6 +1174,9 @@ static int aarch64_step(struct target *target, int 
current, target_addr_t addres
        if (retval == ERROR_TARGET_TIMEOUT)
                saved_retval = aarch64_halt_one(target, HALT_SYNC);
 
+       /* Update target state information */
+       poll_retval = aarch64_poll(target);
+
        /* restore EDECR */
        retval = mem_ap_write_atomic_u32(armv8->debug_ap,
                        armv8->debug_base + CPUV8_DBG_EDECR, edecr);
@@ -1187,6 +1193,9 @@ static int aarch64_step(struct target *target, int 
current, target_addr_t addres
        if (saved_retval != ERROR_OK)
                return saved_retval;
 
+       if (poll_retval != ERROR_OK)
+               return poll_retval;
+
        return ERROR_OK;
 }
 

-- 

Reply via email to