~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/arch/x86/include/asm/acrn.h

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  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 /*
 14  * Timing Information.
 15  * This leaf returns the current TSC frequency in kHz.
 16  *
 17  * EAX: (Virtual) TSC frequency in kHz.
 18  * EBX, ECX, EDX: RESERVED (reserved fields are set to zero).
 19  */
 20 #define ACRN_CPUID_TIMING_INFO          0x40000010
 21 
 22 void acrn_setup_intr_handler(void (*handler)(void));
 23 void acrn_remove_intr_handler(void);
 24 
 25 static inline u32 acrn_cpuid_base(void)
 26 {
 27         if (boot_cpu_has(X86_FEATURE_HYPERVISOR))
 28                 return hypervisor_cpuid_base("ACRNACRNACRN", 0);
 29 
 30         return 0;
 31 }
 32 
 33 static inline unsigned long acrn_get_tsc_khz(void)
 34 {
 35         return cpuid_eax(ACRN_CPUID_TIMING_INFO);
 36 }
 37 
 38 /*
 39  * Hypercalls for ACRN
 40  *
 41  * - VMCALL instruction is used to implement ACRN hypercalls.
 42  * - ACRN hypercall ABI:
 43  *   - Hypercall number is passed in R8 register.
 44  *   - Up to 2 arguments are passed in RDI, RSI.
 45  *   - Return value will be placed in RAX.
 46  *
 47  * Because GCC doesn't support R8 register as direct register constraints, use
 48  * supported constraint as input with a explicit MOV to R8 in beginning of asm.
 49  */
 50 static inline long acrn_hypercall0(unsigned long hcall_id)
 51 {
 52         long result;
 53 
 54         asm volatile("movl %1, %%r8d\n\t"
 55                      "vmcall\n\t"
 56                      : "=a" (result)
 57                      : "g" (hcall_id)
 58                      : "r8", "memory");
 59 
 60         return result;
 61 }
 62 
 63 static inline long acrn_hypercall1(unsigned long hcall_id,
 64                                    unsigned long param1)
 65 {
 66         long result;
 67 
 68         asm volatile("movl %1, %%r8d\n\t"
 69                      "vmcall\n\t"
 70                      : "=a" (result)
 71                      : "g" (hcall_id), "D" (param1)
 72                      : "r8", "memory");
 73 
 74         return result;
 75 }
 76 
 77 static inline long acrn_hypercall2(unsigned long hcall_id,
 78                                    unsigned long param1,
 79                                    unsigned long param2)
 80 {
 81         long result;
 82 
 83         asm volatile("movl %1, %%r8d\n\t"
 84                      "vmcall\n\t"
 85                      : "=a" (result)
 86                      : "g" (hcall_id), "D" (param1), "S" (param2)
 87                      : "r8", "memory");
 88 
 89         return result;
 90 }
 91 
 92 #endif /* _ASM_X86_ACRN_H */
 93 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php