@@ -527,8 +527,9 @@ 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 while the cores are in the
-kernel.
+At the moment gdbserver is only supported on P8 and P9.
+
+Memory access can only be performed on kernel memory.
To run a gdbserver on a P8 machine from a BMC running openbmc:
@@ -540,7 +541,7 @@ $ ./pdbg -d p8 -p0 -c11 -t0 gdbserver 44
On your local machine:
$ gdb
-(gdb) set architecture powerpc:common64
+(gdb) set architecture powerpc:common64
(gdb) target remote palm5-bmc:44
Debugging info:
@@ -559,6 +560,13 @@ Notes:
happen.
2. If you want to view the kernel call trace then run gdb on the vmlinux that
the host is running (the kernel needs to be compiled with debug symbols).
+3. The kernel HARDLOCKUP watchdog can interact badly with GDBSERVER (and all
+pdbg direct controls for that matter). Disabling it before debugging is a
+good idea.
+4. Idle states have often had problems with pdbg direct controls. If things are
+misbehaving, booting Linux with powersave=off is the first thing to try.
+5. attn instructions seem to cause host hangs on POWER9. gdb breakpoints should
+not be used.
## Submitting patches
@@ -105,6 +105,9 @@ static void detach(uint64_t *stack, void *priv)
#define POWER8_HID_ENABLE_ATTN PPC_BIT(31)
+#define POWER9_HID_ENABLE_ATTN PPC_BIT(3)
+#define POWER9_HID_FLUSH_ICACHE PPC_BIT(2)
+
static int set_attn(bool enable)
{
uint64_t hid;
@@ -122,6 +125,17 @@ static int set_attn(bool enable)
return 0;
hid &= ~POWER8_HID_ENABLE_ATTN;
}
+ } else if (pdbg_target_compatible(thread_target, "ibm,power9-thread")) {
+ if (enable) {
+ if (hid & POWER9_HID_ENABLE_ATTN)
+ return 0;
+ hid |= POWER9_HID_ENABLE_ATTN;
+ } else {
+ if (!(hid & POWER9_HID_ENABLE_ATTN))
+ return 0;
+ hid &= ~POWER9_HID_ENABLE_ATTN;
+ }
+ hid |= POWER9_HID_FLUSH_ICACHE;
} else {
return -1;
}
@@ -658,13 +672,20 @@ static int gdbserver(uint16_t port)
return 0;
}
- //
- // Temporary until I can get this working a bit smoother on p9
- if (!pdbg_target_compatible(thread, "ibm,power8-thread")) {
- PR_ERROR("GDBSERVER is only available on POWER8\n");
+ 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");
return -1;
}
+ if (pdbg_target_compatible(thread, "ibm,power9-thread")) {
+ /*
+ * XXX: If we advertise no swbreak support on POWER9 does
+ * that prevent the client using them?
+ */
+ PR_WARNING("Breakpoints may cause host crashes on POWER9 and should not be used\n");
+ }
+
/* Check endianess in MSR */
rc = thread_getmsr(thread, &msr);
if (rc) {
POWER9 has a strange problem with attn, but otherwise gdbserver works well. Enable it. Signed-off-by: Nicholas Piggin <npiggin@gmail.com> --- README.md | 14 +++++++++++--- src/pdbgproxy.c | 29 +++++++++++++++++++++++++---- 2 files changed, 36 insertions(+), 7 deletions(-)