]> git.karo-electronics.de Git - karo-tx-linux.git/blob - arch/tile/include/uapi/asm/kvm.h
Merge remote-tracking branch 'spi/for-next'
[karo-tx-linux.git] / arch / tile / include / uapi / asm / kvm.h
1 /*
2  * Copyright 2013 Tilera Corporation. All Rights Reserved.
3  *
4  *   This program is free software; you can redistribute it and/or
5  *   modify it under the terms of the GNU General Public License
6  *   as published by the Free Software Foundation, version 2.
7  *
8  *   This program is distributed in the hope that it will be useful, but
9  *   WITHOUT ANY WARRANTY; without even the implied warranty of
10  *   MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
11  *   NON INFRINGEMENT.  See the GNU General Public License for
12  *   more details.
13  */
14
15 #ifndef _UAPI_ASM_TILE_KVM_H
16 #define _UAPI_ASM_TILE_KVM_H
17
18 #ifndef __ASSEMBLER__
19 #include <linux/ptrace.h>
20 #endif
21
22 #include <arch/abi.h>
23
24 /*
25  * For Hypervisor syscalls. Note this comes from the hv: syscall.h,
26  * with small modifications: Remove HV_SYS_fence_incoherent.
27  */
28 /* Syscall allowed from guest PL bit mask. */
29 #define HV_SYS_GUEST_SHIFT                12
30 #define HV_SYS_GUEST_MASK                 (1 << HV_SYS_GUEST_SHIFT)
31 /* downcall_dispatch; this syscall number must be zero */
32 #define HV_SYS_downcall_dispatch          0
33 /* install_context */
34 #define HV_SYS_install_context            1
35 /* sysconf */
36 #define HV_SYS_sysconf                    2
37 /* get_rtc */
38 #define HV_SYS_get_rtc                    3
39 /* set_rtc */
40 #define HV_SYS_set_rtc                    4
41 /* flush_asid */
42 #define HV_SYS_flush_asid                 5
43 /* flush_page */
44 #define HV_SYS_flush_page                 6
45 /* flush_pages */
46 #define HV_SYS_flush_pages                7
47 /* restart */
48 #define HV_SYS_restart                    8
49 /* halt */
50 #define HV_SYS_halt                       9
51 /* power_off */
52 #define HV_SYS_power_off                 10
53 /* inquire_physical */
54 #define HV_SYS_inquire_physical          11
55 /* inquire_memory_controller */
56 #define HV_SYS_inquire_memory_controller 12
57 /* inquire_virtual */
58 #define HV_SYS_inquire_virtual           13
59 /* inquire_asid */
60 #define HV_SYS_inquire_asid              14
61 /* console_read_if_ready */
62 #define HV_SYS_console_read_if_ready     15
63 /* console_write */
64 #define HV_SYS_console_write             16
65 /* init */
66 #define HV_SYS_init                      17
67 /* inquire_topology */
68 #define HV_SYS_inquire_topology          18
69 /* fs_findfile */
70 #define HV_SYS_fs_findfile               19
71 /* fs_fstat */
72 #define HV_SYS_fs_fstat                  20
73 /* fs_pread */
74 #define HV_SYS_fs_pread                  21
75 /* physaddr_read64 */
76 #define HV_SYS_physaddr_read64           22
77 /* physaddr_write64 */
78 #define HV_SYS_physaddr_write64          23
79 /* get_command_line */
80 #define HV_SYS_get_command_line          24
81 /* set_caching */
82 #define HV_SYS_set_caching               25
83 /* bzero_page */
84 #define HV_SYS_bzero_page                26
85 /* register_message_state */
86 #define HV_SYS_register_message_state    27
87 /* send_message */
88 #define HV_SYS_send_message              28
89 /* receive_message */
90 #define HV_SYS_receive_message           29
91 /* inquire_context */
92 #define HV_SYS_inquire_context           30
93 /* start_all_tiles */
94 #define HV_SYS_start_all_tiles           31
95 /* dev_open */
96 #define HV_SYS_dev_open                  32
97 /* dev_close */
98 #define HV_SYS_dev_close                 33
99 /* dev_pread */
100 #define HV_SYS_dev_pread                 34
101 /* dev_pwrite */
102 #define HV_SYS_dev_pwrite                35
103 /* dev_poll */
104 #define HV_SYS_dev_poll                  36
105 /* dev_poll_cancel */
106 #define HV_SYS_dev_poll_cancel           37
107 /* dev_preada */
108 #define HV_SYS_dev_preada                38
109 /* dev_pwritea */
110 #define HV_SYS_dev_pwritea               39
111 /* flush_remote */
112 #define HV_SYS_flush_remote              40
113 /* console_putc */
114 #define HV_SYS_console_putc              41
115 /* inquire_tiles */
116 #define HV_SYS_inquire_tiles             42
117 /* confstr */
118 #define HV_SYS_confstr                   43
119 /* reexec */
120 #define HV_SYS_reexec                    44
121 /* set_command_line */
122 #define HV_SYS_set_command_line          45
123
124 /* store_mapping */
125 #define HV_SYS_store_mapping             52
126 /* inquire_realpa */
127 #define HV_SYS_inquire_realpa            53
128 /* flush_all */
129 #define HV_SYS_flush_all                 54
130 /* get_ipi_pte */
131 #define HV_SYS_get_ipi_pte               55
132 /* set_pte_super_shift */
133 #define HV_SYS_set_pte_super_shift       56
134 /* set_speed */
135 #define HV_SYS_set_speed                 57
136 /* install_virt_context */
137 #define HV_SYS_install_virt_context      58
138 /* inquire_virt_context */
139 #define HV_SYS_inquire_virt_context      59
140 /* inquire_guest_context */
141 #define HV_SYS_install_guest_context     60
142 /* inquire_guest_context */
143 #define HV_SYS_inquire_guest_context     61
144
145 /*
146  * Number of hypercall (from guest os to host os) other than hv_*().
147  * We leave the previous 128 entries to the usual hv_*() calls
148  * as defined in hypervisor.h.
149  */
150 #define KVM_OTHER_HCALL                  128
151
152 /* Hypercall index for virtio. */
153 #define KVM_HCALL_virtio                 128
154
155 /* One greater than the maximum hypercall number. */
156 #define KVM_NUM_HCALLS                   256
157
158 #ifndef __ASSEMBLER__
159
160 struct kvm_regs {
161         struct pt_regs regs;
162 };
163
164 #define FOR_EACH_GUEST_SPR(f)                   \
165         f(INTERRUPT_MASK_1);                    \
166         f(INTERRUPT_VECTOR_BASE_1);             \
167         f(EX_CONTEXT_1_0);                      \
168         f(EX_CONTEXT_1_1);                      \
169         f(SYSTEM_SAVE_1_0);                     \
170         f(SYSTEM_SAVE_1_1);                     \
171         f(SYSTEM_SAVE_1_2);                     \
172         f(SYSTEM_SAVE_1_3);                     \
173         f(INTCTRL_1_STATUS);                    \
174         f(IPI_MASK_1);                          \
175         f(IPI_EVENT_1);                         \
176         f(SINGLE_STEP_CONTROL_1);               \
177         f(SINGLE_STEP_EN_1_1);                  \
178
179 struct kvm_sregs {
180 #define DECLARE_SPR(f) unsigned long f
181         FOR_EACH_GUEST_SPR(DECLARE_SPR)
182 #undef DECLARE_SPR
183 };
184
185 struct kvm_fpu {
186 };
187
188 struct kvm_debug_exit_arch {
189 };
190
191 struct kvm_guest_debug_arch {
192 };
193
194 /* definition of registers in kvm_run */
195 struct kvm_sync_regs {
196 };
197
198 #ifndef __KERNEL__
199 /* For hv_*() */
200 #define KVM_EMULATE(name) [HV_SYS_##name] = qemu_emulate_illegal,
201 #define USER_EMULATE(name) [HV_SYS_##name] = qemu_emulate_hv_##name,
202 #define NO_EMULATE(name) [HV_SYS_##name] = qemu_emulate_illegal,
203 #define BOTH_EMULATE(name) [HV_SYS_##name] = qemu_emulate_hv_##name,
204 /* For others */
205 #define USER_HCALL(name) [KVM_HCALL_##name] = qemu_handle_##name,
206 #endif
207
208 #define HCALL_DEFS \
209         /* For hv_*() */ \
210         KVM_EMULATE(init) \
211         NO_EMULATE(install_context) \
212         KVM_EMULATE(sysconf) \
213         KVM_EMULATE(get_rtc) \
214         KVM_EMULATE(set_rtc) \
215         NO_EMULATE(flush_asid) \
216         NO_EMULATE(flush_page) \
217         NO_EMULATE(flush_pages) \
218         USER_EMULATE(restart) \
219         USER_EMULATE(halt) \
220         USER_EMULATE(power_off) \
221         USER_EMULATE(inquire_physical) \
222         USER_EMULATE(inquire_memory_controller) \
223         KVM_EMULATE(inquire_virtual) \
224         KVM_EMULATE(inquire_asid) \
225         NO_EMULATE(console_read_if_ready) \
226         NO_EMULATE(console_write) \
227         NO_EMULATE(downcall_dispatch) \
228         KVM_EMULATE(inquire_topology) \
229         USER_EMULATE(fs_findfile) \
230         USER_EMULATE(fs_fstat) \
231         USER_EMULATE(fs_pread) \
232         KVM_EMULATE(physaddr_read64) \
233         KVM_EMULATE(physaddr_write64) \
234         USER_EMULATE(get_command_line) \
235         USER_EMULATE(set_caching) \
236         NO_EMULATE(bzero_page) \
237         KVM_EMULATE(register_message_state) \
238         KVM_EMULATE(send_message) \
239         KVM_EMULATE(receive_message) \
240         KVM_EMULATE(inquire_context) \
241         KVM_EMULATE(start_all_tiles) \
242         USER_EMULATE(dev_open) \
243         USER_EMULATE(dev_close) \
244         USER_EMULATE(dev_pread) \
245         USER_EMULATE(dev_pwrite) \
246         USER_EMULATE(dev_poll) \
247         USER_EMULATE(dev_poll_cancel) \
248         USER_EMULATE(dev_preada) \
249         USER_EMULATE(dev_pwritea) \
250         USER_EMULATE(flush_remote) \
251         NO_EMULATE(console_putc) \
252         KVM_EMULATE(inquire_tiles) \
253         KVM_EMULATE(confstr) \
254         USER_EMULATE(reexec) \
255         USER_EMULATE(set_command_line) \
256         USER_EMULATE(store_mapping) \
257         NO_EMULATE(inquire_realpa) \
258         NO_EMULATE(flush_all) \
259         KVM_EMULATE(get_ipi_pte) \
260         KVM_EMULATE(set_pte_super_shift) \
261         KVM_EMULATE(set_speed) \
262         /* For others */ \
263         USER_HCALL(virtio)
264
265 #endif
266
267 #endif /* _UAPI_ASM_TILE_KVM_H */