xref: /kvm-unit-tests/lib/s390x/asm/interrupt.h (revision 2652cb00476d4a8061cd5f86ec817e90411f0cc8)
16c9f99dfSJanosch Frank /* SPDX-License-Identifier: GPL-2.0-only */
24da93626SDavid Hildenbrand /*
34da93626SDavid Hildenbrand  * Copyright (c) 2017 Red Hat Inc
44da93626SDavid Hildenbrand  *
54da93626SDavid Hildenbrand  * Authors:
64da93626SDavid Hildenbrand  *  David Hildenbrand <david@redhat.com>
74da93626SDavid Hildenbrand  */
84da93626SDavid Hildenbrand #ifndef _ASMS390X_IRQ_H_
94da93626SDavid Hildenbrand #define _ASMS390X_IRQ_H_
104da93626SDavid Hildenbrand #include <asm/arch_def.h>
114da93626SDavid Hildenbrand 
12df121a0cSJanosch Frank #define EXT_IRQ_EMERGENCY_SIG	0x1201
13df121a0cSJanosch Frank #define EXT_IRQ_EXTERNAL_CALL	0x1202
148ead801eSJanosch Frank #define EXT_IRQ_SERVICE_SIG	0x2401
158ead801eSJanosch Frank 
16*2652cb00SClaudio Imbrenda #define TEID_ASCE_PRIMARY	0
17*2652cb00SClaudio Imbrenda #define TEID_ASCE_AR		1
18*2652cb00SClaudio Imbrenda #define TEID_ASCE_SECONDARY	2
19*2652cb00SClaudio Imbrenda #define TEID_ASCE_HOME		3
20*2652cb00SClaudio Imbrenda 
21*2652cb00SClaudio Imbrenda union teid {
22*2652cb00SClaudio Imbrenda 	unsigned long val;
23*2652cb00SClaudio Imbrenda 	struct {
24*2652cb00SClaudio Imbrenda 		unsigned long addr:52;
25*2652cb00SClaudio Imbrenda 		unsigned long fetch:1;
26*2652cb00SClaudio Imbrenda 		unsigned long store:1;
27*2652cb00SClaudio Imbrenda 		unsigned long reserved:6;
28*2652cb00SClaudio Imbrenda 		unsigned long acc_list_prot:1;
29*2652cb00SClaudio Imbrenda 		/*
30*2652cb00SClaudio Imbrenda 		 * depending on the exception and the installed facilities,
31*2652cb00SClaudio Imbrenda 		 * the m field can indicate several different things,
32*2652cb00SClaudio Imbrenda 		 * including whether the exception was triggered by a MVPG
33*2652cb00SClaudio Imbrenda 		 * instruction, or whether the addr field is meaningful
34*2652cb00SClaudio Imbrenda 		 */
35*2652cb00SClaudio Imbrenda 		unsigned long m:1;
36*2652cb00SClaudio Imbrenda 		unsigned long asce_id:2;
37*2652cb00SClaudio Imbrenda 	};
38*2652cb00SClaudio Imbrenda };
39*2652cb00SClaudio Imbrenda 
40cc7bed1bSJanosch Frank void register_pgm_cleanup_func(void (*f)(void));
4136cfc0b7SJanosch Frank void handle_pgm_int(struct stack_frame_int *stack);
4236cfc0b7SJanosch Frank void handle_ext_int(struct stack_frame_int *stack);
430f87a91aSJanosch Frank void handle_mcck_int(void);
440f87a91aSJanosch Frank void handle_io_int(void);
450f87a91aSJanosch Frank void handle_svc_int(void);
464da93626SDavid Hildenbrand void expect_pgm_int(void);
47df121a0cSJanosch Frank void expect_ext_int(void);
483db880b6SDavid Hildenbrand uint16_t clear_pgm_int(void);
494da93626SDavid Hildenbrand void check_pgm_int_code(uint16_t code);
504da93626SDavid Hildenbrand 
512667b05eSThomas Huth /* Activate low-address protection */
522667b05eSThomas Huth static inline void low_prot_enable(void)
532667b05eSThomas Huth {
541b2c0437SClaudio Imbrenda 	ctl_set_bit(0, CTL0_LOW_ADDR_PROT);
552667b05eSThomas Huth }
562667b05eSThomas Huth 
572667b05eSThomas Huth /* Disable low-address protection */
582667b05eSThomas Huth static inline void low_prot_disable(void)
592667b05eSThomas Huth {
601b2c0437SClaudio Imbrenda 	ctl_clear_bit(0, CTL0_LOW_ADDR_PROT);
612667b05eSThomas Huth }
622667b05eSThomas Huth 
634da93626SDavid Hildenbrand #endif
64