Re: [PATCH v10 2/5] KVM: PPC: use definitions in epapr header for hcalls

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 15.03.2012, at 21:52, Stuart Yoder wrote:

> From: Stuart Yoder <stuart.yoder@xxxxxxxxxxxxx>
> 
> Signed-off-by: Stuart Yoder <stuart.yoder@xxxxxxxxxxxxx>
> ---
> arch/powerpc/include/asm/kvm_para.h |   19 +++++++++----------
> arch/powerpc/kernel/kvm.c           |    2 +-
> arch/powerpc/kvm/powerpc.c          |   10 +++++-----
> 3 files changed, 15 insertions(+), 16 deletions(-)
> 
> diff --git a/arch/powerpc/include/asm/kvm_para.h b/arch/powerpc/include/asm/kvm_para.h
> index c18916b..7d4a870 100644
> --- a/arch/powerpc/include/asm/kvm_para.h
> +++ b/arch/powerpc/include/asm/kvm_para.h
> @@ -75,9 +75,8 @@ struct kvm_vcpu_arch_shared {
> };
> 
> #define KVM_SC_MAGIC_R0		0x4b564d21 /* "KVM!" */
> -#define HC_VENDOR_KVM		(42 << 16)
> -#define HC_EV_SUCCESS		0
> -#define HC_EV_UNIMPLEMENTED	12
> +
> +#include <asm/epapr_hcalls.h>
> 
> #define KVM_FEATURE_MAGIC_PAGE	1
> 
> @@ -121,7 +120,7 @@ static unsigned long kvm_hypercall(unsigned long *in,
> 				   unsigned long *out,
> 				   unsigned long nr)
> {
> -	return HC_EV_UNIMPLEMENTED;
> +	return EV_UNIMPLEMENTED;
> }
> 
> #endif
> @@ -132,7 +131,7 @@ static inline long kvm_hypercall0_1(unsigned int nr, unsigned long *r2)
> 	unsigned long out[8];
> 	unsigned long r;
> 
> -	r = kvm_hypercall(in, out, nr | HC_VENDOR_KVM);
> +	r = kvm_hypercall(in, out, nr | EV_KVM_VENDOR_ID);

#define EV_KVM_VENDOR_ID                42      /* KVM */

This is different from (42 << 16). We need to shift the value again :). I guess that one needs _EV_HCALL_TOKEN?


> 	*r2 = out[0];
> 
> 	return r;
> @@ -143,7 +142,7 @@ static inline long kvm_hypercall0(unsigned int nr)
> 	unsigned long in[8];
> 	unsigned long out[8];
> 
> -	return kvm_hypercall(in, out, nr | HC_VENDOR_KVM);
> +	return kvm_hypercall(in, out, nr | EV_KVM_VENDOR_ID);
> }
> 
> static inline long kvm_hypercall1(unsigned int nr, unsigned long p1)
> @@ -152,7 +151,7 @@ static inline long kvm_hypercall1(unsigned int nr, unsigned long p1)
> 	unsigned long out[8];
> 
> 	in[0] = p1;
> -	return kvm_hypercall(in, out, nr | HC_VENDOR_KVM);
> +	return kvm_hypercall(in, out, nr | EV_KVM_VENDOR_ID);
> }
> 
> static inline long kvm_hypercall2(unsigned int nr, unsigned long p1,
> @@ -163,7 +162,7 @@ static inline long kvm_hypercall2(unsigned int nr, unsigned long p1,
> 
> 	in[0] = p1;
> 	in[1] = p2;
> -	return kvm_hypercall(in, out, nr | HC_VENDOR_KVM);
> +	return kvm_hypercall(in, out, nr | EV_KVM_VENDOR_ID);
> }
> 
> static inline long kvm_hypercall3(unsigned int nr, unsigned long p1,
> @@ -175,7 +174,7 @@ static inline long kvm_hypercall3(unsigned int nr, unsigned long p1,
> 	in[0] = p1;
> 	in[1] = p2;
> 	in[2] = p3;
> -	return kvm_hypercall(in, out, nr | HC_VENDOR_KVM);
> +	return kvm_hypercall(in, out, nr | EV_KVM_VENDOR_ID);
> }
> 
> static inline long kvm_hypercall4(unsigned int nr, unsigned long p1,
> @@ -189,7 +188,7 @@ static inline long kvm_hypercall4(unsigned int nr, unsigned long p1,
> 	in[1] = p2;
> 	in[2] = p3;
> 	in[3] = p4;
> -	return kvm_hypercall(in, out, nr | HC_VENDOR_KVM);
> +	return kvm_hypercall(in, out, nr | EV_KVM_VENDOR_ID);
> }
> 
> 
> diff --git a/arch/powerpc/kernel/kvm.c b/arch/powerpc/kernel/kvm.c
> index 1c13307..b5ba561 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)
> 	in[0] = 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, _EV_HCALL_TOKEN(EV_KVM_VENDOR_ID, KVM_HC_PPC_MAP_MAGIC_PAGE));

Ah, here you're using the macro :). Please also make sure to not exceed 80 chars per line :).

> 
> 	*features = out[0];
> }
> diff --git a/arch/powerpc/kvm/powerpc.c b/arch/powerpc/kvm/powerpc.c
> index 58ad860..d738626 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)
> 	}
> 
> 	switch (nr) {
> -	case HC_VENDOR_KVM | KVM_HC_PPC_MAP_MAGIC_PAGE:
> +	case _EV_HCALL_TOKEN(EV_KVM_VENDOR_ID, KVM_HC_PPC_MAP_MAGIC_PAGE):
> 	{
> 		vcpu->arch.magic_page_pa = param1;
> 		vcpu->arch.magic_page_ea = param2;
> 
> 		r2 = KVM_MAGIC_FEAT_SR | KVM_MAGIC_FEAT_MAS0_TO_SPRG7;
> 
> -		r = HC_EV_SUCCESS;
> +		r = 0;  /* success */
> 		break;
> 	}
> -	case HC_VENDOR_KVM | KVM_HC_FEATURES:
> -		r = HC_EV_SUCCESS;
> +	case _EV_HCALL_TOKEN(EV_KVM_VENDOR_ID, KVM_HC_FEATURES):
> +		r = 0;  /* success */

There's no define for success? Wouldn't it be better to just add one?


Alex

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux