xref: /kvm-unit-tests/s390x/snippets/asm/pv-diag-308.S (revision 90cacd85c6ad50f032a3fe95586fab4f2335b93d)
1/* SPDX-License-Identifier: GPL-2.0-only */
2/*
3 * Diagnose 0x308 snippet used for PV IPL and reset testing
4 *
5 * Copyright (c) 2023 IBM Corp
6 *
7 * Authors:
8 *  Janosch Frank <frankja@linux.ibm.com>
9 */
10#include <asm/asm-offsets.h>
11.section .text
12
13/*
14 * Entry
15 * Execute the diag500 which will set the diag 308 subcode in gr2
16 */
17diag	0, 0, 0x500
18
19/*
20 * A valid PGM new PSW can be a real problem since we never fall out
21 * of SIE and therefore effectively loop forever. 0 is a valid PSW
22 * therefore we re-use the reset_psw as this has the short PSW
23 * bit set which is invalid for a long PSW like the exception new
24 * PSWs.
25 *
26 * For subcode 0/1 there are no PGMs to consider.
27 */
28lgrl   %r5, reset_psw
29stg    %r5, GEN_LC_PGM_NEW_PSW
30
31/* Set up the reset psw at 0x0 */
32lgrl	%r5, reset_psw
33larl	%r6, done
34ogr	%r5, %r6
35stg	%r5, 0
36
37/* Diag 308, subcode is in gr2 */
38diag	%r0, %r2, 0x308
39
40/* Should never be executed because of the reset PSW */
41diag	0, 0, 0x44
42
43/* Pass on a special value indicating success */
44done:
45lghi	%r1, 42
46diag	%r1, 0, 0x9c
47
48
49	.align	8
50reset_psw:
51	.quad	0x0008000180000000
52