提交 fdcf8bd7 编写于 作者: S Stuart Yoder 提交者: Alexander Graf

KVM: PPC: use definitions in epapr header for hcalls

Signed-off-by: NStuart Yoder <stuart.yoder@freescale.com>
Signed-off-by: NAlexander Graf <agraf@suse.de>
上级 e13dcc1a
...@@ -75,9 +75,10 @@ struct kvm_vcpu_arch_shared { ...@@ -75,9 +75,10 @@ struct kvm_vcpu_arch_shared {
}; };
#define KVM_SC_MAGIC_R0 0x4b564d21 /* "KVM!" */ #define KVM_SC_MAGIC_R0 0x4b564d21 /* "KVM!" */
#define HC_VENDOR_KVM (42 << 16)
#define HC_EV_SUCCESS 0 #define KVM_HCALL_TOKEN(num) _EV_HCALL_TOKEN(EV_KVM_VENDOR_ID, num)
#define HC_EV_UNIMPLEMENTED 12
#include <asm/epapr_hcalls.h>
#define KVM_FEATURE_MAGIC_PAGE 1 #define KVM_FEATURE_MAGIC_PAGE 1
...@@ -121,7 +122,7 @@ static unsigned long kvm_hypercall(unsigned long *in, ...@@ -121,7 +122,7 @@ static unsigned long kvm_hypercall(unsigned long *in,
unsigned long *out, unsigned long *out,
unsigned long nr) unsigned long nr)
{ {
return HC_EV_UNIMPLEMENTED; return EV_UNIMPLEMENTED;
} }
#endif #endif
...@@ -132,7 +133,7 @@ static inline long kvm_hypercall0_1(unsigned int nr, unsigned long *r2) ...@@ -132,7 +133,7 @@ static inline long kvm_hypercall0_1(unsigned int nr, unsigned long *r2)
unsigned long out[8]; unsigned long out[8];
unsigned long r; unsigned long r;
r = kvm_hypercall(in, out, nr | HC_VENDOR_KVM); r = kvm_hypercall(in, out, KVM_HCALL_TOKEN(nr));
*r2 = out[0]; *r2 = out[0];
return r; return r;
...@@ -143,7 +144,7 @@ static inline long kvm_hypercall0(unsigned int nr) ...@@ -143,7 +144,7 @@ static inline long kvm_hypercall0(unsigned int nr)
unsigned long in[8]; unsigned long in[8];
unsigned long out[8]; unsigned long out[8];
return kvm_hypercall(in, out, nr | HC_VENDOR_KVM); return kvm_hypercall(in, out, KVM_HCALL_TOKEN(nr));
} }
static inline long kvm_hypercall1(unsigned int nr, unsigned long p1) static 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,7 +153,7 @@ static inline long kvm_hypercall1(unsigned int nr, unsigned long p1)
unsigned long out[8]; unsigned long out[8];
in[0] = p1; in[0] = p1;
return kvm_hypercall(in, out, nr | HC_VENDOR_KVM); return kvm_hypercall(in, out, KVM_HCALL_TOKEN(nr));
} }
static inline long kvm_hypercall2(unsigned int nr, unsigned long p1, static 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,7 +164,7 @@ static inline long kvm_hypercall2(unsigned int nr, unsigned long p1,
in[0] = p1; in[0] = p1;
in[1] = p2; in[1] = p2;
return kvm_hypercall(in, out, nr | HC_VENDOR_KVM); return kvm_hypercall(in, out, KVM_HCALL_TOKEN(nr));
} }
static inline long kvm_hypercall3(unsigned int nr, unsigned long p1, static 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,7 +176,7 @@ static inline long kvm_hypercall3(unsigned int nr, unsigned long p1,
in[0] = p1; in[0] = p1;
in[1] = p2; in[1] = p2;
in[2] = p3; in[2] = p3;
return kvm_hypercall(in, out, nr | HC_VENDOR_KVM); return kvm_hypercall(in, out, KVM_HCALL_TOKEN(nr));
} }
static inline long kvm_hypercall4(unsigned int nr, unsigned long p1, static 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,7 +190,7 @@ static inline long kvm_hypercall4(unsigned int nr, unsigned long p1,
in[1] = p2; in[1] = p2;
in[2] = p3; in[2] = p3;
in[3] = p4; in[3] = p4;
return kvm_hypercall(in, out, nr | HC_VENDOR_KVM); return kvm_hypercall(in, out, KVM_HCALL_TOKEN(nr));
} }
......
...@@ -419,7 +419,7 @@ static void kvm_map_magic_page(void *data) ...@@ -419,7 +419,7 @@ static void kvm_map_magic_page(void *data)
in[0] = KVM_MAGIC_PAGE; in[0] = KVM_MAGIC_PAGE;
in[1] = KVM_MAGIC_PAGE; in[1] = KVM_MAGIC_PAGE;
kvm_hypercall(in, out, HC_VENDOR_KVM | KVM_HC_PPC_MAP_MAGIC_PAGE); kvm_hypercall(in, out, KVM_HCALL_TOKEN(KVM_HC_PPC_MAP_MAGIC_PAGE));
*features = out[0]; *features = out[0];
} }
......
...@@ -67,18 +67,18 @@ int kvmppc_kvm_pv(struct kvm_vcpu *vcpu) ...@@ -67,18 +67,18 @@ int kvmppc_kvm_pv(struct kvm_vcpu *vcpu)
} }
switch (nr) { switch (nr) {
case HC_VENDOR_KVM | KVM_HC_PPC_MAP_MAGIC_PAGE: case KVM_HCALL_TOKEN(KVM_HC_PPC_MAP_MAGIC_PAGE):
{ {
vcpu->arch.magic_page_pa = param1; vcpu->arch.magic_page_pa = param1;
vcpu->arch.magic_page_ea = param2; vcpu->arch.magic_page_ea = param2;
r2 = KVM_MAGIC_FEAT_SR | KVM_MAGIC_FEAT_MAS0_TO_SPRG7; r2 = KVM_MAGIC_FEAT_SR | KVM_MAGIC_FEAT_MAS0_TO_SPRG7;
r = HC_EV_SUCCESS; r = EV_SUCCESS;
break; break;
} }
case HC_VENDOR_KVM | KVM_HC_FEATURES: case KVM_HCALL_TOKEN(KVM_HC_FEATURES):
r = HC_EV_SUCCESS; r = EV_SUCCESS;
#if defined(CONFIG_PPC_BOOK3S) || defined(CONFIG_KVM_E500V2) #if defined(CONFIG_PPC_BOOK3S) || defined(CONFIG_KVM_E500V2)
/* XXX Missing magic page on 44x */ /* XXX Missing magic page on 44x */
r2 |= (1 << KVM_FEATURE_MAGIC_PAGE); r2 |= (1 << KVM_FEATURE_MAGIC_PAGE);
...@@ -87,7 +87,7 @@ int kvmppc_kvm_pv(struct kvm_vcpu *vcpu) ...@@ -87,7 +87,7 @@ int kvmppc_kvm_pv(struct kvm_vcpu *vcpu)
/* Second return value is in r4 */ /* Second return value is in r4 */
break; break;
default: default:
r = HC_EV_UNIMPLEMENTED; r = EV_UNIMPLEMENTED;
break; break;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册