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

TOMOYO Linux Cross Reference
Linux/arch/s390/include/asm/kvm_para.h

Version: ~ [ linux-6.11-rc3 ] ~ [ linux-6.10.4 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.45 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.104 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.164 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.223 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.281 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.319 ] ~ [ 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.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /* SPDX-License-Identifier: GPL-2.0 */
  2 /*
  3  * definition for paravirtual devices on s390
  4  *
  5  * Copyright IBM Corp. 2008
  6  *
  7  *    Author(s): Christian Borntraeger <borntraeger@de.ibm.com>
  8  */
  9 /*
 10  * Hypercalls for KVM on s390. The calling convention is similar to the
 11  * s390 ABI, so we use R2-R6 for parameters 1-5. In addition we use R1
 12  * as hypercall number and R7 as parameter 6. The return value is
 13  * written to R2. We use the diagnose instruction as hypercall. To avoid
 14  * conflicts with existing diagnoses for LPAR and z/VM, we do not use
 15  * the instruction encoded number, but specify the number in R1 and
 16  * use 0x500 as KVM hypercall
 17  *
 18  * Copyright IBM Corp. 2007,2008
 19  * Author(s): Christian Borntraeger <borntraeger@de.ibm.com>
 20  */
 21 #ifndef __S390_KVM_PARA_H
 22 #define __S390_KVM_PARA_H
 23 
 24 #include <uapi/asm/kvm_para.h>
 25 #include <asm/diag.h>
 26 
 27 #define HYPERCALL_FMT_0
 28 #define HYPERCALL_FMT_1 , "" (r2)
 29 #define HYPERCALL_FMT_2 , "d" (r3) HYPERCALL_FMT_1
 30 #define HYPERCALL_FMT_3 , "d" (r4) HYPERCALL_FMT_2
 31 #define HYPERCALL_FMT_4 , "d" (r5) HYPERCALL_FMT_3
 32 #define HYPERCALL_FMT_5 , "d" (r6) HYPERCALL_FMT_4
 33 #define HYPERCALL_FMT_6 , "d" (r7) HYPERCALL_FMT_5
 34 
 35 #define HYPERCALL_PARM_0
 36 #define HYPERCALL_PARM_1 , unsigned long arg1
 37 #define HYPERCALL_PARM_2 HYPERCALL_PARM_1, unsigned long arg2
 38 #define HYPERCALL_PARM_3 HYPERCALL_PARM_2, unsigned long arg3
 39 #define HYPERCALL_PARM_4 HYPERCALL_PARM_3, unsigned long arg4
 40 #define HYPERCALL_PARM_5 HYPERCALL_PARM_4, unsigned long arg5
 41 #define HYPERCALL_PARM_6 HYPERCALL_PARM_5, unsigned long arg6
 42 
 43 #define HYPERCALL_REGS_0
 44 #define HYPERCALL_REGS_1                                                \
 45         register unsigned long r2 asm("2") = arg1
 46 #define HYPERCALL_REGS_2                                                \
 47         HYPERCALL_REGS_1;                                               \
 48         register unsigned long r3 asm("3") = arg2
 49 #define HYPERCALL_REGS_3                                                \
 50         HYPERCALL_REGS_2;                                               \
 51         register unsigned long r4 asm("4") = arg3
 52 #define HYPERCALL_REGS_4                                                \
 53         HYPERCALL_REGS_3;                                               \
 54         register unsigned long r5 asm("5") = arg4
 55 #define HYPERCALL_REGS_5                                                \
 56         HYPERCALL_REGS_4;                                               \
 57         register unsigned long r6 asm("6") = arg5
 58 #define HYPERCALL_REGS_6                                                \
 59         HYPERCALL_REGS_5;                                               \
 60         register unsigned long r7 asm("7") = arg6
 61 
 62 #define HYPERCALL_ARGS_0
 63 #define HYPERCALL_ARGS_1 , arg1
 64 #define HYPERCALL_ARGS_2 HYPERCALL_ARGS_1, arg2
 65 #define HYPERCALL_ARGS_3 HYPERCALL_ARGS_2, arg3
 66 #define HYPERCALL_ARGS_4 HYPERCALL_ARGS_3, arg4
 67 #define HYPERCALL_ARGS_5 HYPERCALL_ARGS_4, arg5
 68 #define HYPERCALL_ARGS_6 HYPERCALL_ARGS_5, arg6
 69 
 70 #define GENERATE_KVM_HYPERCALL_FUNC(args)                               \
 71 static inline                                                           \
 72 long __kvm_hypercall##args(unsigned long nr HYPERCALL_PARM_##args)      \
 73 {                                                                       \
 74         register unsigned long __nr asm("1") = nr;                      \
 75         register long __rc asm("2");                                    \
 76         HYPERCALL_REGS_##args;                                          \
 77                                                                         \
 78         asm volatile (                                                  \
 79                 "       diag    2,4,0x500\n"                            \
 80                 : "=d" (__rc)                                           \
 81                 : "d" (__nr) HYPERCALL_FMT_##args                       \
 82                 : "memory", "cc");                                      \
 83         return __rc;                                                    \
 84 }                                                                       \
 85                                                                         \
 86 static inline                                                           \
 87 long kvm_hypercall##args(unsigned long nr HYPERCALL_PARM_##args)        \
 88 {                                                                       \
 89         diag_stat_inc(DIAG_STAT_X500);                                  \
 90         return __kvm_hypercall##args(nr HYPERCALL_ARGS_##args);         \
 91 }
 92 
 93 GENERATE_KVM_HYPERCALL_FUNC(0)
 94 GENERATE_KVM_HYPERCALL_FUNC(1)
 95 GENERATE_KVM_HYPERCALL_FUNC(2)
 96 GENERATE_KVM_HYPERCALL_FUNC(3)
 97 GENERATE_KVM_HYPERCALL_FUNC(4)
 98 GENERATE_KVM_HYPERCALL_FUNC(5)
 99 GENERATE_KVM_HYPERCALL_FUNC(6)
100 
101 /* kvm on s390 is always paravirtualization enabled */
102 static inline int kvm_para_available(void)
103 {
104         return 1;
105 }
106 
107 /* No feature bits are currently assigned for kvm on s390 */
108 static inline unsigned int kvm_arch_para_features(void)
109 {
110         return 0;
111 }
112 
113 static inline unsigned int kvm_arch_para_hints(void)
114 {
115         return 0;
116 }
117 
118 static inline bool kvm_check_and_clear_guest_paused(void)
119 {
120         return false;
121 }
122 
123 #endif /* __S390_KVM_PARA_H */
124 

~ [ 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