diff mbox series

[v2,20/38] gdbserver: Add POWER10 support

Message ID 20220329154931.493851-21-npiggin@gmail.com
State New
Headers show
Series gdbserver multi-threaded debugging and POWER9/10 support | expand

Commit Message

Nicholas Piggin March 29, 2022, 3:49 p.m. UTC
Reviewed-by: Joel Stanley <joel@jms.id.au>
Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
---
 README.md       |  2 +-
 src/pdbgproxy.c | 19 +++++++++++++++++--
 2 files changed, 18 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/README.md b/README.md
index 5c5c05d..0faa1bf 100644
--- a/README.md
+++ b/README.md
@@ -527,7 +527,7 @@  There are also low level htm commands which can also be used:
  - `dump` will dump the trace to a file.
 
 ### GDBSERVER
-At the moment gdbserver is only supported on P8 and P9.
+At the moment gdbserver is only supported on P8 and P9 and P10.
 
 Memory access can only be performed on kernel memory.
 
diff --git a/src/pdbgproxy.c b/src/pdbgproxy.c
index b3bf5bd..eddf813 100644
--- a/src/pdbgproxy.c
+++ b/src/pdbgproxy.c
@@ -108,6 +108,9 @@  static void detach(uint64_t *stack, void *priv)
 #define POWER9_HID_ENABLE_ATTN			PPC_BIT(3)
 #define POWER9_HID_FLUSH_ICACHE			PPC_BIT(2)
 
+#define POWER10_HID_ENABLE_ATTN			PPC_BIT(3)
+#define POWER10_HID_FLUSH_ICACHE		PPC_BIT(2)
+
 static int set_attn(bool enable)
 {
 	uint64_t hid;
@@ -136,6 +139,17 @@  static int set_attn(bool enable)
 			hid &= ~POWER9_HID_ENABLE_ATTN;
 		}
 		hid |= POWER9_HID_FLUSH_ICACHE;
+	} else if (pdbg_target_compatible(thread_target, "ibm,power10-thread")) {
+		if (enable) {
+			if (hid & POWER10_HID_ENABLE_ATTN)
+				return 0;
+			hid |= POWER10_HID_ENABLE_ATTN;
+		} else {
+			if (!(hid & POWER10_HID_ENABLE_ATTN))
+				return 0;
+			hid &= ~POWER10_HID_ENABLE_ATTN;
+		}
+		hid |= POWER10_HID_FLUSH_ICACHE;
 	} else {
 		return -1;
 	}
@@ -673,8 +687,9 @@  static int gdbserver(uint16_t port)
 	}
 
 	if (!pdbg_target_compatible(thread, "ibm,power8-thread") &&
-	    !pdbg_target_compatible(thread, "ibm,power9-thread")) {
-		PR_ERROR("GDBSERVER is only available on POWER8 and POWER9\n");
+	    !pdbg_target_compatible(thread, "ibm,power9-thread") &&
+	    !pdbg_target_compatible(thread, "ibm,power10-thread")) {
+		PR_ERROR("GDBSERVER is only available on POWER8,9,10\n");
 		return -1;
 	}