aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/powerpc/include/asm/kvm_para.h21
-rw-r--r--arch/powerpc/kernel/kvm.c2
-rw-r--r--arch/powerpc/kvm/powerpc.c10
3 files changed, 17 insertions, 16 deletions
diff --git a/arch/powerpc/include/asm/kvm_para.h b/arch/powerpc/include/asm/kvm_para.h
index c18916bff689..a168ce37d85c 100644
--- a/arch/powerpc/include/asm/kvm_para.h
+++ b/arch/powerpc/include/asm/kvm_para.h
@@ -75,9 +75,10 @@ struct kvm_vcpu_arch_shared {
75}; 75};
76 76
77#define KVM_SC_MAGIC_R0 0x4b564d21 /* "KVM!" */ 77#define KVM_SC_MAGIC_R0 0x4b564d21 /* "KVM!" */
78#define HC_VENDOR_KVM (42 << 16) 78
79#define HC_EV_SUCCESS 0 79#define KVM_HCALL_TOKEN(num) _EV_HCALL_TOKEN(EV_KVM_VENDOR_ID, num)
80#define HC_EV_UNIMPLEMENTED 12 80
81#include <asm/epapr_hcalls.h>
81 82
82#define KVM_FEATURE_MAGIC_PAGE 1 83#define KVM_FEATURE_MAGIC_PAGE 1
83 84
@@ -121,7 +122,7 @@ static unsigned long kvm_hypercall(unsigned long *in,
121 unsigned long *out, 122 unsigned long *out,
122 unsigned long nr) 123 unsigned long nr)
123{ 124{
124 return HC_EV_UNIMPLEMENTED; 125 return EV_UNIMPLEMENTED;
125} 126}
126 127
127#endif 128#endif
@@ -132,7 +133,7 @@ static inline long kvm_hypercall0_1(unsigned int nr, unsigned long *r2)
132 unsigned long out[8]; 133 unsigned long out[8];
133 unsigned long r; 134 unsigned long r;
134 135
135 r = kvm_hypercall(in, out, nr | HC_VENDOR_KVM); 136 r = kvm_hypercall(in, out, KVM_HCALL_TOKEN(nr));
136 *r2 = out[0]; 137 *r2 = out[0];
137 138
138 return r; 139 return r;
@@ -143,7 +144,7 @@ static inline long kvm_hypercall0(unsigned int nr)
143 unsigned long in[8]; 144 unsigned long in[8];
144 unsigned long out[8]; 145 unsigned long out[8];
145 146
146 return kvm_hypercall(in, out, nr | HC_VENDOR_KVM); 147 return kvm_hypercall(in, out, KVM_HCALL_TOKEN(nr));
147} 148}
148 149
149static inline long kvm_hypercall1(unsigned int nr, unsigned long p1) 150static inline long kvm_hypercall1(unsigned int nr, unsigned long p1)
@@ -152,7 +153,7 @@ static inline long kvm_hypercall1(unsigned int nr, unsigned long p1)
152 unsigned long out[8]; 153 unsigned long out[8];
153 154
154 in[0] = p1; 155 in[0] = p1;
155 return kvm_hypercall(in, out, nr | HC_VENDOR_KVM); 156 return kvm_hypercall(in, out, KVM_HCALL_TOKEN(nr));
156} 157}
157 158
158static inline long kvm_hypercall2(unsigned int nr, unsigned long p1, 159static inline long kvm_hypercall2(unsigned int nr, unsigned long p1,
@@ -163,7 +164,7 @@ static inline long kvm_hypercall2(unsigned int nr, unsigned long p1,
163 164
164 in[0] = p1; 165 in[0] = p1;
165 in[1] = p2; 166 in[1] = p2;
166 return kvm_hypercall(in, out, nr | HC_VENDOR_KVM); 167 return kvm_hypercall(in, out, KVM_HCALL_TOKEN(nr));
167} 168}
168 169
169static inline long kvm_hypercall3(unsigned int nr, unsigned long p1, 170static inline long kvm_hypercall3(unsigned int nr, unsigned long p1,
@@ -175,7 +176,7 @@ static inline long kvm_hypercall3(unsigned int nr, unsigned long p1,
175 in[0] = p1; 176 in[0] = p1;
176 in[1] = p2; 177 in[1] = p2;
177 in[2] = p3; 178 in[2] = p3;
178 return kvm_hypercall(in, out, nr | HC_VENDOR_KVM); 179 return kvm_hypercall(in, out, KVM_HCALL_TOKEN(nr));
179} 180}
180 181
181static inline long kvm_hypercall4(unsigned int nr, unsigned long p1, 182static inline long kvm_hypercall4(unsigned int nr, unsigned long p1,
@@ -189,7 +190,7 @@ static inline long kvm_hypercall4(unsigned int nr, unsigned long p1,
189 in[1] = p2; 190 in[1] = p2;
190 in[2] = p3; 191 in[2] = p3;
191 in[3] = p4; 192 in[3] = p4;
192 return kvm_hypercall(in, out, nr | HC_VENDOR_KVM); 193 return kvm_hypercall(in, out, KVM_HCALL_TOKEN(nr));
193} 194}
194 195
195 196
diff --git a/arch/powerpc/kernel/kvm.c b/arch/powerpc/kernel/kvm.c
index 867db1de8949..a61b133c4f99 100644
--- a/arch/powerpc/kernel/kvm.c
+++ b/arch/powerpc/kernel/kvm.c
@@ -419,7 +419,7 @@ static void kvm_map_magic_page(void *data)
419 in[0] = KVM_MAGIC_PAGE; 419 in[0] = KVM_MAGIC_PAGE;
420 in[1] = KVM_MAGIC_PAGE; 420 in[1] = KVM_MAGIC_PAGE;
421 421
422 kvm_hypercall(in, out, HC_VENDOR_KVM | KVM_HC_PPC_MAP_MAGIC_PAGE); 422 kvm_hypercall(in, out, KVM_HCALL_TOKEN(KVM_HC_PPC_MAP_MAGIC_PAGE));
423 423
424 *features = out[0]; 424 *features = out[0];
425} 425}
diff --git a/arch/powerpc/kvm/powerpc.c b/arch/powerpc/kvm/powerpc.c
index 4d213b8b0fb5..0368a9391b21 100644
--- a/arch/powerpc/kvm/powerpc.c
+++ b/arch/powerpc/kvm/powerpc.c
@@ -67,18 +67,18 @@ int kvmppc_kvm_pv(struct kvm_vcpu *vcpu)
67 } 67 }
68 68
69 switch (nr) { 69 switch (nr) {
70 case HC_VENDOR_KVM | KVM_HC_PPC_MAP_MAGIC_PAGE: 70 case KVM_HCALL_TOKEN(KVM_HC_PPC_MAP_MAGIC_PAGE):
71 { 71 {
72 vcpu->arch.magic_page_pa = param1; 72 vcpu->arch.magic_page_pa = param1;
73 vcpu->arch.magic_page_ea = param2; 73 vcpu->arch.magic_page_ea = param2;
74 74
75 r2 = KVM_MAGIC_FEAT_SR | KVM_MAGIC_FEAT_MAS0_TO_SPRG7; 75 r2 = KVM_MAGIC_FEAT_SR | KVM_MAGIC_FEAT_MAS0_TO_SPRG7;
76 76
77 r = HC_EV_SUCCESS; 77 r = EV_SUCCESS;
78 break; 78 break;
79 } 79 }
80 case HC_VENDOR_KVM | KVM_HC_FEATURES: 80 case KVM_HCALL_TOKEN(KVM_HC_FEATURES):
81 r = HC_EV_SUCCESS; 81 r = EV_SUCCESS;
82#if defined(CONFIG_PPC_BOOK3S) || defined(CONFIG_KVM_E500V2) 82#if defined(CONFIG_PPC_BOOK3S) || defined(CONFIG_KVM_E500V2)
83 /* XXX Missing magic page on 44x */ 83 /* XXX Missing magic page on 44x */
84 r2 |= (1 << KVM_FEATURE_MAGIC_PAGE); 84 r2 |= (1 << KVM_FEATURE_MAGIC_PAGE);
@@ -87,7 +87,7 @@ int kvmppc_kvm_pv(struct kvm_vcpu *vcpu)
87 /* Second return value is in r4 */ 87 /* Second return value is in r4 */
88 break; 88 break;
89 default: 89 default:
90 r = HC_EV_UNIMPLEMENTED; 90 r = EV_UNIMPLEMENTED;
91 break; 91 break;
92 } 92 }
93 93