1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _ASM_X86_ACRN_H
3 #define _ASM_X86_ACRN_H
6 * This CPUID returns feature bitmaps in EAX.
7 * Guest VM uses this to detect the appropriate feature bit.
9 #define ACRN_CPUID_FEATURES 0x40000001
10 /* Bit 0 indicates whether guest VM is privileged */
11 #define ACRN_FEATURE_PRIVILEGED_VM BIT(0)
13 void acrn_setup_intr_handler(void (*handler)(void));
14 void acrn_remove_intr_handler(void);
16 static inline u32 acrn_cpuid_base(void)
18 if (boot_cpu_has(X86_FEATURE_HYPERVISOR))
19 return hypervisor_cpuid_base("ACRNACRNACRN", 0);
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.
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.
36 static inline long acrn_hypercall0(unsigned long hcall_id)
40 asm volatile("movl %1, %%r8d\n\t"
49 static inline long acrn_hypercall1(unsigned long hcall_id,
54 asm volatile("movl %1, %%r8d\n\t"
57 : "g" (hcall_id), "D" (param1)
63 static inline long acrn_hypercall2(unsigned long hcall_id,
69 asm volatile("movl %1, %%r8d\n\t"
72 : "g" (hcall_id), "D" (param1), "S" (param2)
78 #endif /* _ASM_X86_ACRN_H */