diff mbox series

[v3,10/13] libpdbg: Use sbe control to sreset threads if sbe is available

Message ID 20190715055851.26512-11-amitay@ozlabs.org
State Superseded
Headers show
Series Extend sbefifo driver | expand

Checks

Context Check Description
snowpatch_ozlabs/apply_patch success Successfully applied on branch master (fde570568c0ec70630b48813361c7b0ab84f5070)
snowpatch_ozlabs/build-multiarch success Test build-multiarch on branch master

Commit Message

Amitay Isaacs July 15, 2019, 5:58 a.m. UTC
Signed-off-by: Amitay Isaacs <amitay@ozlabs.org>
---
 libpdbg/chip.c | 22 ++++++++++++++++++++--
 1 file changed, 20 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/libpdbg/chip.c b/libpdbg/chip.c
index 03de44f..67e3afa 100644
--- a/libpdbg/chip.c
+++ b/libpdbg/chip.c
@@ -156,8 +156,26 @@  int thread_sreset(struct pdbg_target *thread_target)
 
 int thread_sreset_all(void)
 {
-	struct pdbg_target *thread;
-	int rc = 0;
+	struct pdbg_target *pib, *thread;
+	int rc = 0, count = 0;
+
+	pdbg_for_each_class_target("pib", pib) {
+		struct sbefifo *sbefifo;
+
+		sbefifo = pib_to_sbefifo(pib);
+		if (!sbefifo)
+			break;
+
+		/*
+		 * core_id = 0xff (all SMT4 cores)
+		 * thread_id = 0xf (all 4 threads in the SMT4 core)
+		 */
+		rc |= sbefifo->thread_sreset(sbefifo, 0xff, 0xf);
+		count++;
+	}
+
+	if (count > 0)
+		return rc;
 
 	pdbg_for_each_class_target("thread", thread) {
 		rc |= thread_sreset(thread);