xref: /linux/arch/loongarch/include/asm/kvm_ipi.h (revision daee2f9cae5510ba1bd9eed6b0cf0ca8dc276118)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3  * Copyright (C) 2024 Loongson Technology Corporation Limited
4  */
5 
6 #ifndef __ASM_KVM_IPI_H
7 #define __ASM_KVM_IPI_H
8 
9 #include <kvm/iodev.h>
10 
11 #define LARCH_INT_IPI			12
12 
13 struct loongarch_ipi {
14 	spinlock_t lock;
15 	struct kvm *kvm;
16 	struct kvm_io_device device;
17 };
18 
19 struct ipi_state {
20 	spinlock_t lock;
21 	uint32_t status;
22 	uint32_t en;
23 	uint32_t set;
24 	uint32_t clear;
25 	uint64_t buf[4];
26 };
27 
28 #define IOCSR_IPI_BASE		0x1000
29 #define IOCSR_IPI_SIZE		0x160
30 
31 #define IOCSR_IPI_STATUS	0x000
32 #define IOCSR_IPI_EN		0x004
33 #define IOCSR_IPI_SET		0x008
34 #define IOCSR_IPI_CLEAR		0x00c
35 #define IOCSR_IPI_BUF_20	0x020
36 #define IOCSR_IPI_BUF_28	0x028
37 #define IOCSR_IPI_BUF_30	0x030
38 #define IOCSR_IPI_BUF_38	0x038
39 #define IOCSR_IPI_SEND		0x040
40 #define IOCSR_MAIL_SEND		0x048
41 #define IOCSR_ANY_SEND		0x158
42 
43 int kvm_loongarch_register_ipi_device(void);
44 
45 #endif
46