From 16cc853bcfbcc8dba6eadd91b434c05387034c0a Mon Sep 17 00:00:00 2001 From: Antonio Borneo Date: Thu, 16 Dec 2021 01:59:14 +0100 Subject: target/smp: use a struct list_head to hold the smp targets Instead of reinventing a simply linked list, reuse the list helper for the list of targets in a smp cluster. Using the existing helper, that implements a double linked list, makes trivial going through the list in reverse order. Change-Id: Ib36ad2955f15cd2a601b0b9e36ca6d948b12d00f Signed-off-by: Antonio Borneo Reviewed-on: https://review.openocd.org/c/openocd/+/6783 Tested-by: jenkins --- src/target/armv8_cache.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'src/target/armv8_cache.c') diff --git a/src/target/armv8_cache.c b/src/target/armv8_cache.c index f05ac07..5b58d3f 100644 --- a/src/target/armv8_cache.c +++ b/src/target/armv8_cache.c @@ -23,6 +23,7 @@ #include "armv8_cache.h" #include "armv8_dpm.h" #include "armv8_opcodes.h" +#include "smp.h" /* CLIDR cache types */ #define CACHE_LEVEL_HAS_UNIFIED_CACHE 0x4 @@ -250,15 +251,12 @@ static int armv8_flush_all_data(struct target *target) /* look if all the other target have been flushed in order to flush level * 2 */ struct target_list *head; - struct target *curr; - head = target->head; - while (head) { - curr = head->target; + foreach_smp_target(head, target->smp_targets) { + struct target *curr = head->target; if (curr->state == TARGET_HALTED) { LOG_INFO("Wait flushing data l1 on core %" PRId32, curr->coreid); retval = _armv8_flush_all_data(curr); } - head = head->next; } } else retval = _armv8_flush_all_data(target); -- cgit v1.1