All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] powerpc/pseries: add definitions for new H_SIGNAL_SYS_RESET hcall
@ 2016-11-08  6:08 Nicholas Piggin
  2016-11-08  8:40 ` Michael Ellerman
  2016-12-03 11:28 ` Michael Ellerman
  0 siblings, 2 replies; 3+ messages in thread
From: Nicholas Piggin @ 2016-11-08  6:08 UTC (permalink / raw)
  To: Michael Ellerman; +Cc: Nicholas Piggin, linuxppc-dev

This has not made its way to a PAPR release yet, but we have an hcall
number assigned.

  H_SIGNAL_SYS_RESET = 0x380

  Syntax:
  hcall(uint64 H_SIGNAL_SYS_RESET, /* generate a system reset NMI on   */
                                   /* the threads indicated by target  */
        int64 target); /* thread target selection */
        /* -1 = target all online threads including the caller         */
        /* -2 = target all online threads except for the caller        */
        /* All other negative values: reserved                         */
        /* Positive values: The thread to be targeted,                 */
        /* obtained from the value of the "ibm,ppc-interrupt-server#s" */
        /* property of the CPU in the OF device tree                   */

  Semantics:
  - If the NMI handlers are not registered, terminate the partition.
  - Invalid target: return H_Parameter.
  - Otherwise: Generate a system reset NMI on target thread(s),
    return H_Success.

This will be used by crash/debug code to get stuck CPUs into a known state.

Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
---

I'll get the NMI stuff resubmitted soon, but just wanted to send
out this hcall addition now, for reference.

Thanks,
Nick

 arch/powerpc/include/asm/hvcall.h         | 8 +++++++-
 arch/powerpc/include/asm/plpar_wrappers.h | 5 +++++
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/arch/powerpc/include/asm/hvcall.h b/arch/powerpc/include/asm/hvcall.h
index 708edeb..d52ef28 100644
--- a/arch/powerpc/include/asm/hvcall.h
+++ b/arch/powerpc/include/asm/hvcall.h
@@ -275,7 +275,8 @@
 #define H_COP			0x304
 #define H_GET_MPP_X		0x314
 #define H_SET_MODE		0x31C
-#define MAX_HCALL_OPCODE	H_SET_MODE
+#define H_SIGNAL_SYS_RESET	0x380
+#define MAX_HCALL_OPCODE	H_SIGNAL_SYS_RESET
 
 /* H_VIOCTL functions */
 #define H_GET_VIOA_DUMP_SIZE	0x01
@@ -306,6 +307,11 @@
 #define H_SET_MODE_RESOURCE_ADDR_TRANS_MODE	3
 #define H_SET_MODE_RESOURCE_LE			4
 
+/* Values for argument to H_SIGNAL_SYS_RESET */
+#define H_SIGNAL_SYS_RESET_ALL			-1
+#define H_SIGNAL_SYS_RESET_ALLBUTSELF		-2
+/* >= 0 values are CPU number */
+
 #ifndef __ASSEMBLY__
 
 /**
diff --git a/arch/powerpc/include/asm/plpar_wrappers.h b/arch/powerpc/include/asm/plpar_wrappers.h
index 1b39424..9642ae8 100644
--- a/arch/powerpc/include/asm/plpar_wrappers.h
+++ b/arch/powerpc/include/asm/plpar_wrappers.h
@@ -340,4 +340,9 @@ static inline long plapr_set_watchpoint0(unsigned long dawr0, unsigned long dawr
 	return plpar_set_mode(0, H_SET_MODE_RESOURCE_SET_DAWR, dawr0, dawrx0);
 }
 
+static inline long plapr_signal_sys_reset(long cpu)
+{
+	return plpar_hcall_norets(H_SIGNAL_SYS_RESET, cpu);
+}
+
 #endif /* _ASM_POWERPC_PLPAR_WRAPPERS_H */
-- 
2.10.2

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] powerpc/pseries: add definitions for new H_SIGNAL_SYS_RESET hcall
  2016-11-08  6:08 [PATCH] powerpc/pseries: add definitions for new H_SIGNAL_SYS_RESET hcall Nicholas Piggin
@ 2016-11-08  8:40 ` Michael Ellerman
  2016-12-03 11:28 ` Michael Ellerman
  1 sibling, 0 replies; 3+ messages in thread
From: Michael Ellerman @ 2016-11-08  8:40 UTC (permalink / raw)
  To: Nicholas Piggin; +Cc: Nicholas Piggin, linuxppc-dev

Nicholas Piggin <npiggin@gmail.com> writes:

> This has not made its way to a PAPR release yet, but we have an hcall
> number assigned.
>
>   H_SIGNAL_SYS_RESET = 0x380
>
>   Syntax:
>   hcall(uint64 H_SIGNAL_SYS_RESET, /* generate a system reset NMI on   */
>                                    /* the threads indicated by target  */
>         int64 target); /* thread target selection */
>         /* -1 = target all online threads including the caller         */
>         /* -2 = target all online threads except for the caller        */
>         /* All other negative values: reserved                         */
>         /* Positive values: The thread to be targeted,                 */
>         /* obtained from the value of the "ibm,ppc-interrupt-server#s" */
>         /* property of the CPU in the OF device tree                   */
>
>   Semantics:
>   - If the NMI handlers are not registered, terminate the partition.

Are we sure about that part ie. "terminate the partition".

AFAIK we don't use the FWNMI handlers on KVM at all, so it's just wrong
there.

It also means we can't safely use this on PowerVM until we've registered
those handlers, which currently happens at setup_arch() time, which is
fairly late in boot.

cheers

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: powerpc/pseries: add definitions for new H_SIGNAL_SYS_RESET hcall
  2016-11-08  6:08 [PATCH] powerpc/pseries: add definitions for new H_SIGNAL_SYS_RESET hcall Nicholas Piggin
  2016-11-08  8:40 ` Michael Ellerman
@ 2016-12-03 11:28 ` Michael Ellerman
  1 sibling, 0 replies; 3+ messages in thread
From: Michael Ellerman @ 2016-12-03 11:28 UTC (permalink / raw)
  To: Nicholas Piggin; +Cc: linuxppc-dev, Nicholas Piggin

On Tue, 2016-11-08 at 06:08:06 UTC, Nicholas Piggin wrote:
> This has not made its way to a PAPR release yet, but we have an hcall
> number assigned.
> 
>   H_SIGNAL_SYS_RESET = 0x380
> 
>   Syntax:
>   hcall(uint64 H_SIGNAL_SYS_RESET, /* generate a system reset NMI on   */
>                                    /* the threads indicated by target  */
>         int64 target); /* thread target selection */
>         /* -1 = target all online threads including the caller         */
>         /* -2 = target all online threads except for the caller        */
>         /* All other negative values: reserved                         */
>         /* Positive values: The thread to be targeted,                 */
>         /* obtained from the value of the "ibm,ppc-interrupt-server#s" */
>         /* property of the CPU in the OF device tree                   */
> 
>   Semantics:
>   - If the NMI handlers are not registered, terminate the partition.
>   - Invalid target: return H_Parameter.
>   - Otherwise: Generate a system reset NMI on target thread(s),
>     return H_Success.
> 
> This will be used by crash/debug code to get stuck CPUs into a known state.
> 
> Signed-off-by: Nicholas Piggin <npiggin@gmail.com>

Applied to powerpc next, thanks.

https://git.kernel.org/powerpc/c/53ce299615e587e900548eb6b384c3

cheers

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-12-03 11:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-11-08  6:08 [PATCH] powerpc/pseries: add definitions for new H_SIGNAL_SYS_RESET hcall Nicholas Piggin
2016-11-08  8:40 ` Michael Ellerman
2016-12-03 11:28 ` Michael Ellerman

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.