Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7dd6b334 authored by Michael Holzheu's avatar Michael Holzheu Committed by Heiko Carstens
Browse files

[S390] Add PSW restart shutdown trigger



With this patch a new S390 shutdown trigger "restart" is added. If under
z/VM "systerm restart" is entered or under the HMC the "PSW restart" button
is pressed, the PSW located at 0 (31 bit) or 0x1a0 (64 bit) bit is loaded.
Now we execute do_restart() that processes the restart action that is
defined under /sys/firmware/shutdown_actions/on_restart. Currently the
following actions are possible: reipl (default), stop, vmcmd, dump, and
dump_reipl.

Signed-off-by: default avatarMichael Holzheu <holzheu@linux.vnet.ibm.com>
Signed-off-by: default avatarHeiko Carstens <heiko.carstens@de.ibm.com>
parent 944291de
Loading
Loading
Loading
Loading
+9 −2
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@ void system_call(void);
void pgm_check_handler(void);
void mcck_int_handler(void);
void io_int_handler(void);
void psw_restart_int_handler(void);

#ifdef CONFIG_32BIT

@@ -150,7 +151,10 @@ struct _lowcore {
	 */
	__u32	ipib;				/* 0x0e00 */
	__u32	ipib_checksum;			/* 0x0e04 */
	__u8	pad_0x0e08[0x0f00-0x0e08];	/* 0x0e08 */

	/* 64 bit save area */
	__u64	save_area_64;			/* 0x0e08 */
	__u8	pad_0x0e10[0x0f00-0x0e10];	/* 0x0e10 */

	/* Extended facility list */
	__u64	stfle_fac_list[32];		/* 0x0f00 */
@@ -286,7 +290,10 @@ struct _lowcore {
	 */
	__u64	ipib;				/* 0x0e00 */
	__u32	ipib_checksum;			/* 0x0e08 */
	__u8	pad_0x0e0c[0x0f00-0x0e0c];	/* 0x0e0c */

	/* 64 bit save area */
	__u64	save_area_64;			/* 0x0e0c */
	__u8	pad_0x0e14[0x0f00-0x0e14];	/* 0x0e14 */

	/* Extended facility list */
	__u64	stfle_fac_list[32];		/* 0x0f00 */
+1 −0
Original line number Diff line number Diff line
@@ -113,6 +113,7 @@ extern void pfault_fini(void);

extern void cmma_init(void);
extern int memcpy_real(void *, void *, size_t);
extern void copy_to_absolute_zero(void *dest, void *src, size_t count);

#define finish_arch_switch(prev) do {					     \
	set_fs(current->thread.mm_segment);				     \
+1 −0
Original line number Diff line number Diff line
@@ -142,6 +142,7 @@ int main(void)
	DEFINE(__LC_FPREGS_SAVE_AREA, offsetof(struct _lowcore, floating_pt_save_area));
	DEFINE(__LC_GPREGS_SAVE_AREA, offsetof(struct _lowcore, gpregs_save_area));
	DEFINE(__LC_CREGS_SAVE_AREA, offsetof(struct _lowcore, cregs_save_area));
	DEFINE(__LC_SAVE_AREA_64, offsetof(struct _lowcore, save_area_64));
#ifdef CONFIG_32BIT
	DEFINE(SAVE_AREA_BASE, offsetof(struct _lowcore, extended_save_area_addr));
#else /* CONFIG_32BIT */
+28 −0
Original line number Diff line number Diff line
@@ -849,6 +849,34 @@ restart_crash:
restart_go:
#endif

#
# PSW restart interrupt handler
#
ENTRY(psw_restart_int_handler)
	st	%r15,__LC_SAVE_AREA_64(%r0)	# save r15
	basr	%r15,0
0:	l	%r15,.Lrestart_stack-0b(%r15)	# load restart stack
	l	%r15,0(%r15)
	ahi	%r15,-SP_SIZE			# make room for pt_regs
	stm	%r0,%r14,SP_R0(%r15)		# store gprs %r0-%r14 to stack
	mvc	SP_R15(4,%r15),__LC_SAVE_AREA_64(%r0)# store saved %r15 to stack
	mvc	SP_PSW(8,%r15),__LC_RST_OLD_PSW(%r0) # store restart old psw
	xc	__SF_BACKCHAIN(4,%r15),__SF_BACKCHAIN(%r15) # set backchain to 0
	basr	%r14,0
1:	l	%r14,.Ldo_restart-1b(%r14)
	basr	%r14,%r14

	basr	%r14,0				# load disabled wait PSW if
2:	lpsw	restart_psw_crash-2b(%r14)	# do_restart returns
	.align 4
.Ldo_restart:
	.long	do_restart
.Lrestart_stack:
	.long	restart_stack
	.align 8
restart_psw_crash:
	.long	0x000a0000,0x00000000 + restart_psw_crash

	.section .kprobes.text, "ax"

#ifdef CONFIG_CHECK_STACK
+20 −0
Original line number Diff line number Diff line
@@ -865,6 +865,26 @@ restart_crash:
restart_go:
#endif

#
# PSW restart interrupt handler
#
ENTRY(psw_restart_int_handler)
	stg	%r15,__LC_SAVE_AREA_64(%r0)	# save r15
	larl	%r15,restart_stack		# load restart stack
	lg	%r15,0(%r15)
	aghi	%r15,-SP_SIZE			# make room for pt_regs
	stmg	%r0,%r14,SP_R0(%r15)		# store gprs %r0-%r14 to stack
	mvc	SP_R15(8,%r15),__LC_SAVE_AREA_64(%r0)# store saved %r15 to stack
	mvc	SP_PSW(16,%r15),__LC_RST_OLD_PSW(%r0)# store restart old psw
	xc	__SF_BACKCHAIN(8,%r15),__SF_BACKCHAIN(%r15) # set backchain to 0
	brasl	%r14,do_restart

	larl	%r14,restart_psw_crash		# load disabled wait PSW if
	lpswe	0(%r14)				# do_restart returns
	.align 8
restart_psw_crash:
	.quad	0x0002000080000000,0x0000000000000000 + restart_psw_crash

	.section .kprobes.text, "ax"

#ifdef CONFIG_CHECK_STACK
Loading