diff mbox series

[05/14] gdbclient: use standard compatibility test calls

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

Commit Message

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

Comments

Joel Stanley March 15, 2022, 11:13 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>
> ---
>  src/pdbgproxy.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/src/pdbgproxy.c b/src/pdbgproxy.c
> index 5a8b5f9..906ed2f 100644
> --- a/src/pdbgproxy.c
> +++ b/src/pdbgproxy.c
> @@ -532,8 +532,8 @@ static int gdbserver(uint16_t port)
>
>         //
>         // Temporary until I can get this working a bit smoother on p9
> -       if (strcmp(thread->compatible, "ibm,power8-thread")) {
> -               PR_ERROR("GDBSERVER is only tested on POWER8\n");
> +       if (!pdbg_target_compatible(thread, "ibm,power8-thread")) {

This calls through a lot more code to do what looks like the same
thing. I assume it's the correct thing to do though.


> +               PR_ERROR("GDBSERVER is only available on POWER8\n");
>                 return -1;
>         }
>
> --
> 2.23.0
>
> --
> Pdbg mailing list
> Pdbg@lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/pdbg
Nicholas Piggin March 29, 2022, 8:51 a.m. UTC | #2
Excerpts from Joel Stanley's message of March 16, 2022 9:13 am:
> On Mon, 14 Mar 2022 at 04:18, Nicholas Piggin <npiggin@gmail.com> wrote:
>>
>> Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
>> ---
>>  src/pdbgproxy.c | 4 ++--
>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/src/pdbgproxy.c b/src/pdbgproxy.c
>> index 5a8b5f9..906ed2f 100644
>> --- a/src/pdbgproxy.c
>> +++ b/src/pdbgproxy.c
>> @@ -532,8 +532,8 @@ static int gdbserver(uint16_t port)
>>
>>         //
>>         // Temporary until I can get this working a bit smoother on p9
>> -       if (strcmp(thread->compatible, "ibm,power8-thread")) {
>> -               PR_ERROR("GDBSERVER is only tested on POWER8\n");
>> +       if (!pdbg_target_compatible(thread, "ibm,power8-thread")) {
> 
> This calls through a lot more code to do what looks like the same
> thing. I assume it's the correct thing to do though.

Yeah, I changed it because the p10 dts has

   compatible = "ibm,power-thread", "ibm,power10-thread";

So you don't end up matching if you follow the power8 code. Maybe I 
should mention that in the changelog.

find_driver() in hwunit.c looks like another place that does a strcmp
on compatible... I wonder if that should be changed as well? The
pdbg_target_compatible is doing case insensitive matching too...

Thanks,
Nick
diff mbox series

Patch

diff --git a/src/pdbgproxy.c b/src/pdbgproxy.c
index 5a8b5f9..906ed2f 100644
--- a/src/pdbgproxy.c
+++ b/src/pdbgproxy.c
@@ -532,8 +532,8 @@  static int gdbserver(uint16_t port)
 
 	//
 	// Temporary until I can get this working a bit smoother on p9
-	if (strcmp(thread->compatible, "ibm,power8-thread")) {
-		PR_ERROR("GDBSERVER is only tested on POWER8\n");
+	if (!pdbg_target_compatible(thread, "ibm,power8-thread")) {
+		PR_ERROR("GDBSERVER is only available on POWER8\n");
 		return -1;
 	}