diff mbox series

[14/14] gdbserver: Add POWER10 support

Message ID 20220314041735.542867-16-npiggin@gmail.com
State New
Headers show
Series gdbserver fixes and POWER10 support | expand

Checks

Context Check Description
snowpatch_ozlabs/github-CI fail Build failed at step Install dependencies.
snowpatch_ozlabs/github-build_and_test success Successfully ran 1 jobs.

Commit Message

Nicholas Piggin March 14, 2022, 4:17 a.m. UTC
Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
---
 src/pdbgproxy.c | 22 +++++++++++++++++++---
 1 file changed, 19 insertions(+), 3 deletions(-)

Comments

Joel Stanley March 15, 2022, 11:47 p.m. UTC | #1
On Mon, 14 Mar 2022 at 04:18, Nicholas Piggin <npiggin@gmail.com> wrote:
>
> Signed-off-by: Nicholas Piggin <npiggin@gmail.com>

Reviewed-by: Joel Stanley <joel@jms.id.au>

> ---
>  src/pdbgproxy.c | 22 +++++++++++++++++++---
>  1 file changed, 19 insertions(+), 3 deletions(-)
>
> diff --git a/src/pdbgproxy.c b/src/pdbgproxy.c
> index e8aab70..b44aea4 100644
> --- a/src/pdbgproxy.c
> +++ b/src/pdbgproxy.c
> @@ -104,6 +104,8 @@ static void detach(uint64_t *stack, void *priv)
>  }
>
>  #define POWER8_HID_ENABLE_ATTN                 PPC_BIT(31)
> +#define POWER10_HID_ENABLE_ATTN                        PPC_BIT(3)
> +#define POWER10_HID_FLUSH_ICACHE               PPC_BIT(2)
>
>  static int set_attn(bool enable)
>  {
> @@ -122,6 +124,17 @@ static int set_attn(bool enable)
>                                 return 0;
>                         hid &= ~POWER8_HID_ENABLE_ATTN;
>                 }
> +       } 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;
>         }
> @@ -572,9 +585,12 @@ static int gdbserver(uint16_t port)
>         }
>
>         //
> -       // 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");
> +       // POWER9 appears to have problems with PSI interrupts when hitting
> +       // an attn intstruction. Could just disallow breakpoints on P9.
> +       //
> +       if (!pdbg_target_compatible(thread, "ibm,power8-thread") &&
> +           !pdbg_target_compatible(thread, "ibm,power10-thread")) {
> +               PR_ERROR("GDBSERVER is only available on POWER8 and POWER10\n");
>                 return -1;
>         }
>
> --
> 2.23.0
>
> --
> Pdbg mailing list
> Pdbg@lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/pdbg
diff mbox series

Patch

diff --git a/src/pdbgproxy.c b/src/pdbgproxy.c
index e8aab70..b44aea4 100644
--- a/src/pdbgproxy.c
+++ b/src/pdbgproxy.c
@@ -104,6 +104,8 @@  static void detach(uint64_t *stack, void *priv)
 }
 
 #define POWER8_HID_ENABLE_ATTN			PPC_BIT(31)
+#define POWER10_HID_ENABLE_ATTN			PPC_BIT(3)
+#define POWER10_HID_FLUSH_ICACHE		PPC_BIT(2)
 
 static int set_attn(bool enable)
 {
@@ -122,6 +124,17 @@  static int set_attn(bool enable)
 				return 0;
 			hid &= ~POWER8_HID_ENABLE_ATTN;
 		}
+	} 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;
 	}
@@ -572,9 +585,12 @@  static int gdbserver(uint16_t port)
 	}
 
 	//
-	// 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");
+	// POWER9 appears to have problems with PSI interrupts when hitting
+	// an attn intstruction. Could just disallow breakpoints on P9.
+	//
+	if (!pdbg_target_compatible(thread, "ibm,power8-thread") &&
+	    !pdbg_target_compatible(thread, "ibm,power10-thread")) {
+		PR_ERROR("GDBSERVER is only available on POWER8 and POWER10\n");
 		return -1;
 	}