treewide: remove redundant IS_ERR() before error code check
[linux/fpc-iii.git] / arch / mips / include / asm / kvm_para.h
blobb57e978b0946ef8de9de15fd290196a22fae20a0
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _ASM_MIPS_KVM_PARA_H
3 #define _ASM_MIPS_KVM_PARA_H
5 #include <uapi/asm/kvm_para.h>
7 #define KVM_HYPERCALL ".word 0x42000028"
9 /*
10 * Hypercalls for KVM.
12 * Hypercall number is passed in v0.
13 * Return value will be placed in v0.
14 * Up to 3 arguments are passed in a0, a1, and a2.
16 static inline unsigned long kvm_hypercall0(unsigned long num)
18 register unsigned long n asm("v0");
19 register unsigned long r asm("v0");
21 n = num;
22 __asm__ __volatile__(
23 KVM_HYPERCALL
24 : "=r" (r) : "r" (n) : "memory"
27 return r;
30 static inline unsigned long kvm_hypercall1(unsigned long num,
31 unsigned long arg0)
33 register unsigned long n asm("v0");
34 register unsigned long r asm("v0");
35 register unsigned long a0 asm("a0");
37 n = num;
38 a0 = arg0;
39 __asm__ __volatile__(
40 KVM_HYPERCALL
41 : "=r" (r) : "r" (n), "r" (a0) : "memory"
44 return r;
47 static inline unsigned long kvm_hypercall2(unsigned long num,
48 unsigned long arg0, unsigned long arg1)
50 register unsigned long n asm("v0");
51 register unsigned long r asm("v0");
52 register unsigned long a0 asm("a0");
53 register unsigned long a1 asm("a1");
55 n = num;
56 a0 = arg0;
57 a1 = arg1;
58 __asm__ __volatile__(
59 KVM_HYPERCALL
60 : "=r" (r) : "r" (n), "r" (a0), "r" (a1) : "memory"
63 return r;
66 static inline unsigned long kvm_hypercall3(unsigned long num,
67 unsigned long arg0, unsigned long arg1, unsigned long arg2)
69 register unsigned long n asm("v0");
70 register unsigned long r asm("v0");
71 register unsigned long a0 asm("a0");
72 register unsigned long a1 asm("a1");
73 register unsigned long a2 asm("a2");
75 n = num;
76 a0 = arg0;
77 a1 = arg1;
78 a2 = arg2;
79 __asm__ __volatile__(
80 KVM_HYPERCALL
81 : "=r" (r) : "r" (n), "r" (a0), "r" (a1), "r" (a2) : "memory"
84 return r;
87 static inline bool kvm_check_and_clear_guest_paused(void)
89 return false;
92 static inline unsigned int kvm_arch_para_features(void)
94 return 0;
97 static inline unsigned int kvm_arch_para_hints(void)
99 return 0;
102 #ifdef CONFIG_MIPS_PARAVIRT
103 static inline bool kvm_para_available(void)
105 return true;
107 #else
108 static inline bool kvm_para_available(void)
110 return false;
112 #endif
115 #endif /* _ASM_MIPS_KVM_PARA_H */