Merge tag 'sched-urgent-2020-12-27' of git://git.kernel.org/pub/scm/linux/kernel...
[linux/fpc-iii.git] / arch / hexagon / include / asm / hexagon_vm.h
blob9aa2493fe78630b349c56f6a12cf683f889e8443
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3 * Declarations for to Hexagon Virtal Machine.
5 * Copyright (c) 2010-2013, The Linux Foundation. All rights reserved.
6 */
8 #ifndef ASM_HEXAGON_VM_H
9 #define ASM_HEXAGON_VM_H
12 * In principle, a Linux kernel for the VM could
13 * selectively define the virtual instructions
14 * as inline assembler macros, but for a first pass,
15 * we'll use subroutines for both the VM and the native
16 * kernels. It's costing a subroutine call/return,
17 * but it makes for a single set of entry points
18 * for tracing/debugging.
21 #define HVM_TRAP1_VMVERSION 0
22 #define HVM_TRAP1_VMRTE 1
23 #define HVM_TRAP1_VMSETVEC 2
24 #define HVM_TRAP1_VMSETIE 3
25 #define HVM_TRAP1_VMGETIE 4
26 #define HVM_TRAP1_VMINTOP 5
27 #define HVM_TRAP1_VMCLRMAP 10
28 #define HVM_TRAP1_VMNEWMAP 11
29 #define HVM_TRAP1_FORMERLY_VMWIRE 12
30 #define HVM_TRAP1_VMCACHE 13
31 #define HVM_TRAP1_VMGETTIME 14
32 #define HVM_TRAP1_VMSETTIME 15
33 #define HVM_TRAP1_VMWAIT 16
34 #define HVM_TRAP1_VMYIELD 17
35 #define HVM_TRAP1_VMSTART 18
36 #define HVM_TRAP1_VMSTOP 19
37 #define HVM_TRAP1_VMVPID 20
38 #define HVM_TRAP1_VMSETREGS 21
39 #define HVM_TRAP1_VMGETREGS 22
40 #define HVM_TRAP1_VMTIMEROP 24
42 #ifndef __ASSEMBLY__
44 enum VM_CACHE_OPS {
45 hvmc_ickill,
46 hvmc_dckill,
47 hvmc_l2kill,
48 hvmc_dccleaninva,
49 hvmc_icinva,
50 hvmc_idsync,
51 hvmc_fetch_cfg
54 enum VM_INT_OPS {
55 hvmi_nop,
56 hvmi_globen,
57 hvmi_globdis,
58 hvmi_locen,
59 hvmi_locdis,
60 hvmi_affinity,
61 hvmi_get,
62 hvmi_peek,
63 hvmi_status,
64 hvmi_post,
65 hvmi_clear
68 extern void _K_VM_event_vector(void);
70 void __vmrte(void);
71 long __vmsetvec(void *);
72 long __vmsetie(long);
73 long __vmgetie(void);
74 long __vmintop(enum VM_INT_OPS, long, long, long, long);
75 long __vmclrmap(void *, unsigned long);
76 long __vmnewmap(void *);
77 long __vmcache(enum VM_CACHE_OPS op, unsigned long addr, unsigned long len);
78 unsigned long long __vmgettime(void);
79 long __vmsettime(unsigned long long);
80 long __vmstart(void *, void *);
81 void __vmstop(void);
82 long __vmwait(void);
83 void __vmyield(void);
84 long __vmvpid(void);
86 static inline long __vmcache_ickill(void)
88 return __vmcache(hvmc_ickill, 0, 0);
91 static inline long __vmcache_dckill(void)
93 return __vmcache(hvmc_dckill, 0, 0);
96 static inline long __vmcache_l2kill(void)
98 return __vmcache(hvmc_l2kill, 0, 0);
101 static inline long __vmcache_dccleaninva(unsigned long addr, unsigned long len)
103 return __vmcache(hvmc_dccleaninva, addr, len);
106 static inline long __vmcache_icinva(unsigned long addr, unsigned long len)
108 return __vmcache(hvmc_icinva, addr, len);
111 static inline long __vmcache_idsync(unsigned long addr,
112 unsigned long len)
114 return __vmcache(hvmc_idsync, addr, len);
117 static inline long __vmcache_fetch_cfg(unsigned long val)
119 return __vmcache(hvmc_fetch_cfg, val, 0);
122 /* interrupt operations */
124 static inline long __vmintop_nop(void)
126 return __vmintop(hvmi_nop, 0, 0, 0, 0);
129 static inline long __vmintop_globen(long i)
131 return __vmintop(hvmi_globen, i, 0, 0, 0);
134 static inline long __vmintop_globdis(long i)
136 return __vmintop(hvmi_globdis, i, 0, 0, 0);
139 static inline long __vmintop_locen(long i)
141 return __vmintop(hvmi_locen, i, 0, 0, 0);
144 static inline long __vmintop_locdis(long i)
146 return __vmintop(hvmi_locdis, i, 0, 0, 0);
149 static inline long __vmintop_affinity(long i, long cpu)
151 return __vmintop(hvmi_affinity, i, cpu, 0, 0);
154 static inline long __vmintop_get(void)
156 return __vmintop(hvmi_get, 0, 0, 0, 0);
159 static inline long __vmintop_peek(void)
161 return __vmintop(hvmi_peek, 0, 0, 0, 0);
164 static inline long __vmintop_status(long i)
166 return __vmintop(hvmi_status, i, 0, 0, 0);
169 static inline long __vmintop_post(long i)
171 return __vmintop(hvmi_post, i, 0, 0, 0);
174 static inline long __vmintop_clear(long i)
176 return __vmintop(hvmi_clear, i, 0, 0, 0);
179 #else /* Only assembly code should reference these */
181 #endif /* __ASSEMBLY__ */
184 * Constants for virtual instruction parameters and return values
187 /* vmnewmap arguments */
189 #define VM_TRANS_TYPE_LINEAR 0
190 #define VM_TRANS_TYPE_TABLE 1
191 #define VM_TLB_INVALIDATE_FALSE 0
192 #define VM_TLB_INVALIDATE_TRUE 1
194 /* vmsetie arguments */
196 #define VM_INT_DISABLE 0
197 #define VM_INT_ENABLE 1
199 /* vmsetimask arguments */
201 #define VM_INT_UNMASK 0
202 #define VM_INT_MASK 1
204 #define VM_NEWMAP_TYPE_LINEAR 0
205 #define VM_NEWMAP_TYPE_PGTABLES 1
209 * Event Record definitions useful to both C and Assembler
212 /* VMEST Layout */
214 #define HVM_VMEST_UM_SFT 31
215 #define HVM_VMEST_UM_MSK 1
216 #define HVM_VMEST_IE_SFT 30
217 #define HVM_VMEST_IE_MSK 1
218 #define HVM_VMEST_SS_SFT 29
219 #define HVM_VMEST_SS_MSK 1
220 #define HVM_VMEST_EVENTNUM_SFT 16
221 #define HVM_VMEST_EVENTNUM_MSK 0xff
222 #define HVM_VMEST_CAUSE_SFT 0
223 #define HVM_VMEST_CAUSE_MSK 0xffff
226 * The initial program gets to find a system environment descriptor
227 * on its stack when it begins execution. The first word is a version
228 * code to indicate what is there. Zero means nothing more.
231 #define HEXAGON_VM_SED_NULL 0
234 * Event numbers for vector binding
237 #define HVM_EV_RESET 0
238 #define HVM_EV_MACHCHECK 1
239 #define HVM_EV_GENEX 2
240 #define HVM_EV_TRAP 8
241 #define HVM_EV_INTR 15
242 /* These shoud be nuked as soon as we know the VM is up to spec v0.1.1 */
243 #define HVM_EV_INTR_0 16
244 #define HVM_MAX_INTR 240
247 * Cause values for General Exception
250 #define HVM_GE_C_BUS 0x01
251 #define HVM_GE_C_XPROT 0x11
252 #define HVM_GE_C_XUSER 0x14
253 #define HVM_GE_C_INVI 0x15
254 #define HVM_GE_C_PRIVI 0x1B
255 #define HVM_GE_C_XMAL 0x1C
256 #define HVM_GE_C_WREG 0x1D
257 #define HVM_GE_C_PCAL 0x1E
258 #define HVM_GE_C_RMAL 0x20
259 #define HVM_GE_C_WMAL 0x21
260 #define HVM_GE_C_RPROT 0x22
261 #define HVM_GE_C_WPROT 0x23
262 #define HVM_GE_C_RUSER 0x24
263 #define HVM_GE_C_WUSER 0x25
264 #define HVM_GE_C_CACHE 0x28
267 * Cause codes for Machine Check
270 #define HVM_MCHK_C_DOWN 0x00
271 #define HVM_MCHK_C_BADSP 0x01
272 #define HVM_MCHK_C_BADEX 0x02
273 #define HVM_MCHK_C_BADPT 0x03
274 #define HVM_MCHK_C_REGWR 0x29
276 #endif