diff mbox

Re: [PATCH 6/6] kvm: ppc: Add SPRN_SPR get helper function

Message ID f090edc8b237454baf54bdd90128c21c@BLUPR03MB566.namprd03.prod.outlook.com
State New, archived
Headers show

Commit Message

Bharat Bhushan July 16, 2014, 4:21 a.m. UTC
> -----Original Message-----
> From: Caraman Mihai Claudiu-B02008
> Sent: Tuesday, July 15, 2014 10:20 PM
> To: Alexander Graf
> Cc: Bhushan Bharat-R65777; kvm-ppc@vger.kernel.org
> Subject: Re: [PATCH 6/6] kvm: ppc: Add SPRN_SPR 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>
> > ---
> >  arch/powerpc/include/asm/kvm_ppc.h |  9 +++++++++
> >  arch/powerpc/kvm/booke.c           | 11 +----------
> > 2 files changed, 10 insertions(+), 10 deletions(-)
> 
> This patch which is already applied on kvm-ppc-queue breaks book3s.
> I get these errors with g5_defconfig:
> 
> In file included from arch/powerpc/kernel/asm-offsets.c:57:0:
> ./arch/powerpc/include/asm/kvm_ppc.h: In function 'kvmppc_get_epr':
> ./arch/powerpc/include/asm/kvm_ppc.h:400:19: error: 'struct kvm_vcpu_arch' has
> no member named 'epr'
> ./arch/powerpc/include/asm/kvm_ppc.h: In function 'kvmppc_get_sprg0':
> ./arch/powerpc/include/asm/kvm_ppc.h:522:1: error: 'SPRN_GSPRG0' undeclared
> (first use in this function)
> ./arch/powerpc/include/asm/kvm_ppc.h:522:1: note: each undeclared identifier is
> reported only once for each function it appears in
> ...

I am sorry, I forgot to compile for book3s.

Should we squash below change to fix these errors.


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

Comments

Alexander Graf July 17, 2014, 8:17 a.m. UTC | #1
On 16.07.14 06:21, Bharat.Bhushan@freescale.com wrote:
>
>> -----Original Message-----
>> From: Caraman Mihai Claudiu-B02008
>> Sent: Tuesday, July 15, 2014 10:20 PM
>> To: Alexander Graf
>> Cc: Bhushan Bharat-R65777; kvm-ppc@vger.kernel.org
>> Subject: Re: [PATCH 6/6] kvm: ppc: Add SPRN_SPR 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>
>>> ---
>>>   arch/powerpc/include/asm/kvm_ppc.h |  9 +++++++++
>>>   arch/powerpc/kvm/booke.c           | 11 +----------
>>> 2 files changed, 10 insertions(+), 10 deletions(-)
>> This patch which is already applied on kvm-ppc-queue breaks book3s.
>> I get these errors with g5_defconfig:
>>
>> In file included from arch/powerpc/kernel/asm-offsets.c:57:0:
>> ./arch/powerpc/include/asm/kvm_ppc.h: In function 'kvmppc_get_epr':
>> ./arch/powerpc/include/asm/kvm_ppc.h:400:19: error: 'struct kvm_vcpu_arch' has
>> no member named 'epr'
>> ./arch/powerpc/include/asm/kvm_ppc.h: In function 'kvmppc_get_sprg0':
>> ./arch/powerpc/include/asm/kvm_ppc.h:522:1: error: 'SPRN_GSPRG0' undeclared
>> (first use in this function)
>> ./arch/powerpc/include/asm/kvm_ppc.h:522:1: note: each undeclared identifier is
>> reported only once for each function it appears in
>> ...
> I am sorry, I forgot to compile for book3s.
>
> Should we squash below change to fix these errors.

While trying to squash them in I realized that things become very ugly 
here. If we have to explicitly #ifdef the generators, why don't we just 
call a new macro for the SPRN_G access and #ifdef on CONFIG_KVM_BOOKE_HV?

#ifdef CONFIG_KVM_BOOKE_HV
SPRNG_WRAPPER(sprg0, SPRN_GSPRG0)
...
#else
SHARED_WRAPPER(sprg0, SPRN_GSPRG0)
#endif

that way the code flow is at least reasonably obvious :). I'll remove 
the patches from my queue for now.


Alex

--
To unsubscribe from this list: send the line "unsubscribe kvm-ppc" 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 ad14d26..7ad4730 100644
--- a/arch/powerpc/include/asm/kvm_ppc.h
+++ b/arch/powerpc/include/asm/kvm_ppc.h
@@ -399,7 +399,7 @@  static inline unsigned long kvmppc_get_epr(struct kvm_vcpu *vcpu)
 {
 #ifdef CONFIG_KVM_BOOKE_HV
        return mfspr(SPRN_GEPR);
-#else
+#elif defined(CONFIG_BOOKE)
        return vcpu->arch.epr;
 #endif
 }
@@ -522,6 +522,7 @@  static inline void kvmppc_set_##reg(struct kvm_vcpu *vcpu, u##size val)     \
        SHARED_WRAPPER_SET(reg, size, e500hv_spr)                       \
 
 SHARED_WRAPPER(critical, 64, 0)
+#ifdef CONFIG_BOOKE
 SHARED_WRAPPER(sprg0, 64, SPRN_GSPRG0)
 SHARED_WRAPPER(sprg1, 64, SPRN_GSPRG1)
 SHARED_WRAPPER(sprg2, 64, SPRN_GSPRG2)
@@ -530,6 +531,16 @@  SHARED_WRAPPER(srr0, 64, SPRN_GSRR0)
 SHARED_WRAPPER(srr1, 64, SPRN_GSRR1)
 SHARED_WRAPPER(dar, 64, SPRN_GDEAR)
 SHARED_WRAPPER(esr, 64, SPRN_GESR)
+#else
+SHARED_WRAPPER(sprg0, 64, 0)
+SHARED_WRAPPER(sprg1, 64, 0)
+SHARED_WRAPPER(sprg2, 64, 0)
+SHARED_WRAPPER(sprg3, 64, 0)
+SHARED_WRAPPER(srr0, 64, 0)
+SHARED_WRAPPER(srr1, 64, 0)
+SHARED_WRAPPER(dar, 64, 0)
+SHARED_WRAPPER(esr, 64, 0)
+#endif
 SHARED_WRAPPER_GET(msr, 64, 0)
 static inline void kvmppc_set_msr_fast(struct kvm_vcpu *vcpu, u64 val)
 {