2 * Copyright 2013 Tilera Corporation. All Rights Reserved.
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.
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
15 #ifndef _UAPI_ASM_TILE_KVM_H
16 #define _UAPI_ASM_TILE_KVM_H
19 #include <linux/ptrace.h>
25 * For Hypervisor syscalls. Note this comes from the hv: syscall.h,
26 * with small modifications: Remove HV_SYS_fence_incoherent.
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
34 #define HV_SYS_install_context 1
36 #define HV_SYS_sysconf 2
38 #define HV_SYS_get_rtc 3
40 #define HV_SYS_set_rtc 4
42 #define HV_SYS_flush_asid 5
44 #define HV_SYS_flush_page 6
46 #define HV_SYS_flush_pages 7
48 #define HV_SYS_restart 8
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
58 #define HV_SYS_inquire_virtual 13
60 #define HV_SYS_inquire_asid 14
61 /* console_read_if_ready */
62 #define HV_SYS_console_read_if_ready 15
64 #define HV_SYS_console_write 16
66 #define HV_SYS_init 17
67 /* inquire_topology */
68 #define HV_SYS_inquire_topology 18
70 #define HV_SYS_fs_findfile 19
72 #define HV_SYS_fs_fstat 20
74 #define HV_SYS_fs_pread 21
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
82 #define HV_SYS_set_caching 25
84 #define HV_SYS_bzero_page 26
85 /* register_message_state */
86 #define HV_SYS_register_message_state 27
88 #define HV_SYS_send_message 28
90 #define HV_SYS_receive_message 29
92 #define HV_SYS_inquire_context 30
94 #define HV_SYS_start_all_tiles 31
96 #define HV_SYS_dev_open 32
98 #define HV_SYS_dev_close 33
100 #define HV_SYS_dev_pread 34
102 #define HV_SYS_dev_pwrite 35
104 #define HV_SYS_dev_poll 36
105 /* dev_poll_cancel */
106 #define HV_SYS_dev_poll_cancel 37
108 #define HV_SYS_dev_preada 38
110 #define HV_SYS_dev_pwritea 39
112 #define HV_SYS_flush_remote 40
114 #define HV_SYS_console_putc 41
116 #define HV_SYS_inquire_tiles 42
118 #define HV_SYS_confstr 43
120 #define HV_SYS_reexec 44
121 /* set_command_line */
122 #define HV_SYS_set_command_line 45
125 #define HV_SYS_store_mapping 52
127 #define HV_SYS_inquire_realpa 53
129 #define HV_SYS_flush_all 54
131 #define HV_SYS_get_ipi_pte 55
132 /* set_pte_super_shift */
133 #define HV_SYS_set_pte_super_shift 56
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
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.
150 #define KVM_OTHER_HCALL 128
152 /* Hypercall index for virtio. */
153 #define KVM_HCALL_virtio 128
155 /* One greater than the maximum hypercall number. */
156 #define KVM_NUM_HCALLS 256
158 #ifndef __ASSEMBLER__
164 #define FOR_EACH_GUEST_SPR(f) \
165 f(INTERRUPT_MASK_1); \
166 f(INTERRUPT_VECTOR_BASE_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); \
176 f(SINGLE_STEP_CONTROL_1); \
177 f(SINGLE_STEP_EN_1_1); \
180 #define DECLARE_SPR(f) unsigned long f
181 FOR_EACH_GUEST_SPR(DECLARE_SPR)
188 struct kvm_debug_exit_arch {
191 struct kvm_guest_debug_arch {
194 /* definition of registers in kvm_run */
195 struct kvm_sync_regs {
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,
205 #define USER_HCALL(name) [KVM_HCALL_##name] = qemu_handle_##name,
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) \
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) \
267 #endif /* _UAPI_ASM_TILE_KVM_H */