xref: /kvm-unit-tests/s390x/panic-loop-pgm.c (revision 8a078df4dde8f4a0113b9d45bb02140ea9c24ba5)
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3  * Program interrupt loop test
4  *
5  * Copyright IBM Corp. 2022
6  *
7  * Authors:
8  *  Nico Boehr <nrb@linux.ibm.com>
9  */
10 #include <libcflat.h>
11 #include <bitops.h>
12 #include <asm/interrupt.h>
13 #include <asm/barrier.h>
14 #include <hardware.h>
15 
main(void)16 int main(void)
17 {
18 	report_prefix_push("panic-loop-pgm");
19 
20 	if (!host_is_qemu() || host_is_tcg()) {
21 		report_skip("QEMU-KVM-only test");
22 		goto out;
23 	}
24 
25 	expect_pgm_int();
26 	/* bit 12 set is invalid */
27 	lowcore.pgm_new_psw.mask = extract_psw_mask() | BIT(63 - 12);
28 	mb();
29 
30 	/* cause a pgm int */
31 	psw_mask_set_bits(BIT(63 - 12));
32 
33 	report_fail("survived pgm int loop");
34 
35 out:
36 	report_prefix_pop();
37 	return report_summary();
38 }
39