diff mbox

[6/6,v2] kvm: ppc: Add SPRN_EPR get helper function

Message ID 1405596700-2699-7-git-send-email-Bharat.Bhushan@freescale.com (mailing list archive)
State New, archived
Headers show

Commit Message

Bharat Bhushan July 17, 2014, 11:31 a.m. UTC
kvmppc_set_epr() is already defined in asm/kvm_ppc.h, So
rename and move get_epr helper function to same file.

Signed-off-by: Bharat Bhushan <Bharat.Bhushan@freescale.com>
---
v1->v2
 - vcpu->arch.epr under CONFIG_BOOKE

 arch/powerpc/include/asm/kvm_ppc.h | 10 ++++++++++
 arch/powerpc/kvm/booke.c           | 11 +----------
 2 files changed, 11 insertions(+), 10 deletions(-)

Comments

Alexander Graf July 17, 2014, 1:44 p.m. UTC | #1
On 17.07.14 13:31, Bharat Bhushan wrote:
> kvmppc_set_epr() is already defined in asm/kvm_ppc.h, So
> rename and move get_epr helper function to same file.
>
> Signed-off-by: Bharat Bhushan <Bharat.Bhushan@freescale.com>
> ---
> v1->v2
>   - vcpu->arch.epr under CONFIG_BOOKE
>
>   arch/powerpc/include/asm/kvm_ppc.h | 10 ++++++++++
>   arch/powerpc/kvm/booke.c           | 11 +----------
>   2 files changed, 11 insertions(+), 10 deletions(-)
>
> diff --git a/arch/powerpc/include/asm/kvm_ppc.h b/arch/powerpc/include/asm/kvm_ppc.h
> index 58a5202..14e2d87 100644
> --- a/arch/powerpc/include/asm/kvm_ppc.h
> +++ b/arch/powerpc/include/asm/kvm_ppc.h
> @@ -395,6 +395,16 @@ static inline int kvmppc_xics_hcall(struct kvm_vcpu *vcpu, u32 cmd)
>   	{ return 0; }
>   #endif
>   
> +static inline unsigned long kvmppc_get_epr(struct kvm_vcpu *vcpu)
> +{
> +#ifdef CONFIG_KVM_BOOKE_HV
> +	return mfspr(SPRN_GEPR);
> +#elif defined(CONFIG_BOOKE)
> +	return vcpu->arch.epr;
> +#endif
> +	return 0;

Let me change that to

#else
   return 0;
#endif


Alex

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Mihai Caraman July 17, 2014, 1:51 p.m. UTC | #2
> -----Original Message-----
> From: kvm-ppc-owner@vger.kernel.org [mailto:kvm-ppc-
> owner@vger.kernel.org] On Behalf Of Bharat Bhushan
> Sent: Thursday, July 17, 2014 2:32 PM
> To: agraf@suse.de; kvm-ppc@vger.kernel.org
> Cc: kvm@vger.kernel.org; Wood Scott-B07421; Yoder Stuart-B08248; Bhushan
> Bharat-R65777
> Subject: [PATCH 6/6 v2] kvm: ppc: Add SPRN_EPR get helper function
> 
> kvmppc_set_epr() is already defined in asm/kvm_ppc.h, So
> rename and move get_epr helper function to same file.
> 
> Signed-off-by: Bharat Bhushan <Bharat.Bhushan@freescale.com>
> ---
> v1->v2
>  - vcpu->arch.epr under CONFIG_BOOKE
> 
>  arch/powerpc/include/asm/kvm_ppc.h | 10 ++++++++++
>  arch/powerpc/kvm/booke.c           | 11 +----------
>  2 files changed, 11 insertions(+), 10 deletions(-)
> 
> diff --git a/arch/powerpc/include/asm/kvm_ppc.h
> b/arch/powerpc/include/asm/kvm_ppc.h
> index 58a5202..14e2d87 100644
> --- a/arch/powerpc/include/asm/kvm_ppc.h
> +++ b/arch/powerpc/include/asm/kvm_ppc.h
> @@ -395,6 +395,16 @@ static inline int kvmppc_xics_hcall(struct kvm_vcpu
> *vcpu, u32 cmd)
>  	{ return 0; }
>  #endif
> 
> +static inline unsigned long kvmppc_get_epr(struct kvm_vcpu *vcpu)
> +{
> +#ifdef CONFIG_KVM_BOOKE_HV
> +	return mfspr(SPRN_GEPR);
> +#elif defined(CONFIG_BOOKE)
> +	return vcpu->arch.epr;
> +#endif
> +	return 0;
> +}
> +
>  static inline void kvmppc_set_epr(struct kvm_vcpu *vcpu, u32 epr)
>  {
>  #ifdef CONFIG_KVM_BOOKE_HV

EPR is a BookE resource, why don't we move the helpers to kvm_booke.h?

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

Patch

diff --git a/arch/powerpc/include/asm/kvm_ppc.h b/arch/powerpc/include/asm/kvm_ppc.h
index 58a5202..14e2d87 100644
--- a/arch/powerpc/include/asm/kvm_ppc.h
+++ b/arch/powerpc/include/asm/kvm_ppc.h
@@ -395,6 +395,16 @@  static inline int kvmppc_xics_hcall(struct kvm_vcpu *vcpu, u32 cmd)
 	{ return 0; }
 #endif
 
+static inline unsigned long kvmppc_get_epr(struct kvm_vcpu *vcpu)
+{
+#ifdef CONFIG_KVM_BOOKE_HV
+	return mfspr(SPRN_GEPR);
+#elif defined(CONFIG_BOOKE)
+	return vcpu->arch.epr;
+#endif
+	return 0;
+}
+
 static inline void kvmppc_set_epr(struct kvm_vcpu *vcpu, u32 epr)
 {
 #ifdef CONFIG_KVM_BOOKE_HV
diff --git a/arch/powerpc/kvm/booke.c b/arch/powerpc/kvm/booke.c
index 9606139..5e9a380 100644
--- a/arch/powerpc/kvm/booke.c
+++ b/arch/powerpc/kvm/booke.c
@@ -302,15 +302,6 @@  static void set_guest_mcsrr(struct kvm_vcpu *vcpu, unsigned long srr0, u32 srr1)
 	vcpu->arch.mcsrr1 = srr1;
 }
 
-static unsigned long get_guest_epr(struct kvm_vcpu *vcpu)
-{
-#ifdef CONFIG_KVM_BOOKE_HV
-	return mfspr(SPRN_GEPR);
-#else
-	return vcpu->arch.epr;
-#endif
-}
-
 /* Deliver the interrupt of the corresponding priority, if possible. */
 static int kvmppc_booke_irqprio_deliver(struct kvm_vcpu *vcpu,
                                         unsigned int priority)
@@ -1483,7 +1474,7 @@  int kvm_vcpu_ioctl_get_one_reg(struct kvm_vcpu *vcpu, struct kvm_one_reg *reg)
 		val = get_reg_val(reg->id, vcpu->arch.dbg_reg.dac2);
 		break;
 	case KVM_REG_PPC_EPR: {
-		u32 epr = get_guest_epr(vcpu);
+		u32 epr = kvmppc_get_epr(vcpu);
 		val = get_reg_val(reg->id, epr);
 		break;
 	}