]> git.karo-electronics.de Git - karo-tx-linux.git/blob - arch/arm64/include/uapi/asm/kvm.h
4e64570a20c9cc18ef9605d7a1f0f95304735090
[karo-tx-linux.git] / arch / arm64 / include / uapi / asm / kvm.h
1 /*
2  * Copyright (C) 2012,2013 - ARM Ltd
3  * Author: Marc Zyngier <marc.zyngier@arm.com>
4  *
5  * Derived from arch/arm/include/uapi/asm/kvm.h:
6  * Copyright (C) 2012 - Virtual Open Systems and Columbia University
7  * Author: Christoffer Dall <c.dall@virtualopensystems.com>
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License version 2 as
11  * published by the Free Software Foundation.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
20  */
21
22 #ifndef __ARM_KVM_H__
23 #define __ARM_KVM_H__
24
25 #define KVM_SPSR_EL1    0
26 #define KVM_NR_SPSR     1
27
28 #ifndef __ASSEMBLY__
29 #include <asm/types.h>
30 #include <asm/ptrace.h>
31
32 #define __KVM_HAVE_GUEST_DEBUG
33 #define __KVM_HAVE_IRQ_LINE
34
35 #define KVM_REG_SIZE(id)                                                \
36         (1U << (((id) & KVM_REG_SIZE_MASK) >> KVM_REG_SIZE_SHIFT))
37
38 struct kvm_regs {
39         struct user_pt_regs regs;       /* sp = sp_el0 */
40
41         __u64   sp_el1;
42         __u64   elr_el1;
43
44         __u64   spsr[KVM_NR_SPSR];
45
46         struct user_fpsimd_state fp_regs;
47 };
48
49 /* Supported Processor Types */
50 #define KVM_ARM_TARGET_AEM_V8           0
51 #define KVM_ARM_TARGET_FOUNDATION_V8    1
52 #define KVM_ARM_TARGET_CORTEX_A57       2
53
54 #define KVM_ARM_NUM_TARGETS             3
55
56 /* KVM_ARM_SET_DEVICE_ADDR ioctl id encoding */
57 #define KVM_ARM_DEVICE_TYPE_SHIFT       0
58 #define KVM_ARM_DEVICE_TYPE_MASK        (0xffff << KVM_ARM_DEVICE_TYPE_SHIFT)
59 #define KVM_ARM_DEVICE_ID_SHIFT         16
60 #define KVM_ARM_DEVICE_ID_MASK          (0xffff << KVM_ARM_DEVICE_ID_SHIFT)
61
62 /* Supported device IDs */
63 #define KVM_ARM_DEVICE_VGIC_V2          0
64
65 /* Supported VGIC address types  */
66 #define KVM_VGIC_V2_ADDR_TYPE_DIST      0
67 #define KVM_VGIC_V2_ADDR_TYPE_CPU       1
68
69 #define KVM_VGIC_V2_DIST_SIZE           0x1000
70 #define KVM_VGIC_V2_CPU_SIZE            0x2000
71
72 struct kvm_vcpu_init {
73         __u32 target;
74         __u32 features[7];
75 };
76
77 struct kvm_sregs {
78 };
79
80 struct kvm_fpu {
81 };
82
83 struct kvm_guest_debug_arch {
84 };
85
86 struct kvm_debug_exit_arch {
87 };
88
89 struct kvm_sync_regs {
90 };
91
92 struct kvm_arch_memory_slot {
93 };
94
95 /* KVM_IRQ_LINE irq field index values */
96 #define KVM_ARM_IRQ_TYPE_SHIFT          24
97 #define KVM_ARM_IRQ_TYPE_MASK           0xff
98 #define KVM_ARM_IRQ_VCPU_SHIFT          16
99 #define KVM_ARM_IRQ_VCPU_MASK           0xff
100 #define KVM_ARM_IRQ_NUM_SHIFT           0
101 #define KVM_ARM_IRQ_NUM_MASK            0xffff
102
103 /* irq_type field */
104 #define KVM_ARM_IRQ_TYPE_CPU            0
105 #define KVM_ARM_IRQ_TYPE_SPI            1
106 #define KVM_ARM_IRQ_TYPE_PPI            2
107
108 /* out-of-kernel GIC cpu interrupt injection irq_number field */
109 #define KVM_ARM_IRQ_CPU_IRQ             0
110 #define KVM_ARM_IRQ_CPU_FIQ             1
111
112 /* Highest supported SPI, from VGIC_NR_IRQS */
113 #define KVM_ARM_IRQ_GIC_MAX             127
114
115 #endif
116
117 #endif /* __ARM_KVM_H__ */