xref: /kvm-unit-tests/lib/s390x/asm/interrupt.h (revision 2c96b77ec9d3b1fcec7525174e23a6240ee05949)
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3  * Copyright (c) 2017 Red Hat Inc
4  *
5  * Authors:
6  *  David Hildenbrand <david@redhat.com>
7  */
8 #ifndef _ASMS390X_IRQ_H_
9 #define _ASMS390X_IRQ_H_
10 #include <asm/arch_def.h>
11 
12 #define EXT_IRQ_EMERGENCY_SIG	0x1201
13 #define EXT_IRQ_EXTERNAL_CALL	0x1202
14 #define EXT_IRQ_SERVICE_SIG	0x2401
15 
16 #define TEID_ASCE_PRIMARY	0
17 #define TEID_ASCE_AR		1
18 #define TEID_ASCE_SECONDARY	2
19 #define TEID_ASCE_HOME		3
20 
21 union teid {
22 	unsigned long val;
23 	struct {
24 		unsigned long addr:52;
25 		unsigned long fetch:1;
26 		unsigned long store:1;
27 		unsigned long reserved:6;
28 		unsigned long acc_list_prot:1;
29 		/*
30 		 * depending on the exception and the installed facilities,
31 		 * the m field can indicate several different things,
32 		 * including whether the exception was triggered by a MVPG
33 		 * instruction, or whether the addr field is meaningful
34 		 */
35 		unsigned long m:1;
36 		unsigned long asce_id:2;
37 	};
38 };
39 
40 void register_pgm_cleanup_func(void (*f)(void));
41 void handle_pgm_int(struct stack_frame_int *stack);
42 void handle_ext_int(struct stack_frame_int *stack);
43 void handle_mcck_int(void);
44 void handle_io_int(void);
45 void handle_svc_int(void);
46 void expect_pgm_int(void);
47 void expect_ext_int(void);
48 uint16_t clear_pgm_int(void);
49 void check_pgm_int_code(uint16_t code);
50 
51 /* Activate low-address protection */
52 static inline void low_prot_enable(void)
53 {
54 	ctl_set_bit(0, CTL0_LOW_ADDR_PROT);
55 }
56 
57 /* Disable low-address protection */
58 static inline void low_prot_disable(void)
59 {
60 	ctl_clear_bit(0, CTL0_LOW_ADDR_PROT);
61 }
62 
63 #endif
64