On 16/12/2023 14.42, Nicholas Piggin wrote:
In preparation for improved SMP support, add stop-self support to the
harness. This is non-trivial because it requires an unlocked rtas
call: a CPU can't be holding a spin lock when it goes offline or it
will deadlock other CPUs. rtas permits stop-self to be called without
serialising all other rtas operations.

Signed-off-by: Nicholas Piggin <npig...@gmail.com>
---
  lib/powerpc/asm/rtas.h |  2 ++
  lib/powerpc/rtas.c     | 78 +++++++++++++++++++++++++++++++++---------
  2 files changed, 64 insertions(+), 16 deletions(-)
...
+void rtas_stop_self(void)
+{
+       struct rtas_args args;
+       uint32_t token;
+       int ret;
+
+       ret = rtas_token("stop-self", &token);
+       if (ret) {
+               puts("RTAS stop-self not available\n");
+               return;
+       }
+
+       ret = rtas_call_unlocked(&args, token, 0, 1, NULL);
+       printf("RTAS stop-self returnd %d\n", ret);

s/returnd/returned/

+}

With the typo fixed:

Reviewed-by: Thomas Huth <th...@redhat.com>

Reply via email to