xref: /OK3568_Linux_fs/kernel/arch/powerpc/include/asm/hmi.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun /* SPDX-License-Identifier: GPL-2.0-or-later */
2*4882a593Smuzhiyun /*
3*4882a593Smuzhiyun  * Hypervisor Maintenance Interrupt header file.
4*4882a593Smuzhiyun  *
5*4882a593Smuzhiyun  * Copyright 2015 IBM Corporation
6*4882a593Smuzhiyun  * Author: Mahesh Salgaonkar <mahesh@linux.vnet.ibm.com>
7*4882a593Smuzhiyun  */
8*4882a593Smuzhiyun 
9*4882a593Smuzhiyun #ifndef __ASM_PPC64_HMI_H__
10*4882a593Smuzhiyun #define __ASM_PPC64_HMI_H__
11*4882a593Smuzhiyun 
12*4882a593Smuzhiyun #ifdef CONFIG_KVM_BOOK3S_HV_POSSIBLE
13*4882a593Smuzhiyun 
14*4882a593Smuzhiyun #define	CORE_TB_RESYNC_REQ_BIT		63
15*4882a593Smuzhiyun #define MAX_SUBCORE_PER_CORE		4
16*4882a593Smuzhiyun 
17*4882a593Smuzhiyun /*
18*4882a593Smuzhiyun  * sibling_subcore_state structure is used to co-ordinate all threads
19*4882a593Smuzhiyun  * during HMI to avoid TB corruption. This structure is allocated once
20*4882a593Smuzhiyun  * per each core and shared by all threads on that core.
21*4882a593Smuzhiyun  */
22*4882a593Smuzhiyun struct sibling_subcore_state {
23*4882a593Smuzhiyun 	unsigned long	flags;
24*4882a593Smuzhiyun 	u8		in_guest[MAX_SUBCORE_PER_CORE];
25*4882a593Smuzhiyun };
26*4882a593Smuzhiyun 
27*4882a593Smuzhiyun extern void wait_for_subcore_guest_exit(void);
28*4882a593Smuzhiyun extern void wait_for_tb_resync(void);
29*4882a593Smuzhiyun #else
wait_for_subcore_guest_exit(void)30*4882a593Smuzhiyun static inline void wait_for_subcore_guest_exit(void) { }
wait_for_tb_resync(void)31*4882a593Smuzhiyun static inline void wait_for_tb_resync(void) { }
32*4882a593Smuzhiyun #endif
33*4882a593Smuzhiyun 
34*4882a593Smuzhiyun struct pt_regs;
35*4882a593Smuzhiyun extern long hmi_handle_debugtrig(struct pt_regs *regs);
36*4882a593Smuzhiyun 
37*4882a593Smuzhiyun #endif /* __ASM_PPC64_HMI_H__ */
38