arm/arm64: dts: Fix remaining dtc 'unit_address_format' warnings
[linux-2.6-microblaze.git] / arch / x86 / include / asm / acrn.h
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _ASM_X86_ACRN_H
3 #define _ASM_X86_ACRN_H
4
5 /*
6  * This CPUID returns feature bitmaps in EAX.
7  * Guest VM uses this to detect the appropriate feature bit.
8  */
9 #define ACRN_CPUID_FEATURES             0x40000001
10 /* Bit 0 indicates whether guest VM is privileged */
11 #define ACRN_FEATURE_PRIVILEGED_VM      BIT(0)
12
13 void acrn_setup_intr_handler(void (*handler)(void));
14 void acrn_remove_intr_handler(void);
15
16 static inline u32 acrn_cpuid_base(void)
17 {
18         if (boot_cpu_has(X86_FEATURE_HYPERVISOR))
19                 return hypervisor_cpuid_base("ACRNACRNACRN", 0);
20
21         return 0;
22 }
23
24 /*
25  * Hypercalls for ACRN
26  *
27  * - VMCALL instruction is used to implement ACRN hypercalls.
28  * - ACRN hypercall ABI:
29  *   - Hypercall number is passed in R8 register.
30  *   - Up to 2 arguments are passed in RDI, RSI.
31  *   - Return value will be placed in RAX.
32  *
33  * Because GCC doesn't support R8 register as direct register constraints, use
34  * supported constraint as input with a explicit MOV to R8 in beginning of asm.
35  */
36 static inline long acrn_hypercall0(unsigned long hcall_id)
37 {
38         long result;
39
40         asm volatile("movl %1, %%r8d\n\t"
41                      "vmcall\n\t"
42                      : "=a" (result)
43                      : "g" (hcall_id)
44                      : "r8", "memory");
45
46         return result;
47 }
48
49 static inline long acrn_hypercall1(unsigned long hcall_id,
50                                    unsigned long param1)
51 {
52         long result;
53
54         asm volatile("movl %1, %%r8d\n\t"
55                      "vmcall\n\t"
56                      : "=a" (result)
57                      : "g" (hcall_id), "D" (param1)
58                      : "r8", "memory");
59
60         return result;
61 }
62
63 static inline long acrn_hypercall2(unsigned long hcall_id,
64                                    unsigned long param1,
65                                    unsigned long param2)
66 {
67         long result;
68
69         asm volatile("movl %1, %%r8d\n\t"
70                      "vmcall\n\t"
71                      : "=a" (result)
72                      : "g" (hcall_id), "D" (param1), "S" (param2)
73                      : "r8", "memory");
74
75         return result;
76 }
77
78 #endif /* _ASM_X86_ACRN_H */