From mboxrd@z Thu Jan 1 00:00:00 1970 From: Scott Wood Date: Tue, 26 Mar 2013 22:48:31 +0000 Subject: Re: [PATCH 3/7 v2] KVM: PPC: e500: Add support for TLBnPS registers Message-Id: <1364338111.469.17@snotra> List-Id: References: <1364335512-28426-4-git-send-email-mihai.caraman@freescale.com> In-Reply-To: <1364335512-28426-4-git-send-email-mihai.caraman@freescale.com> (from mihai.caraman@freescale.com on Tue Mar 26 17:05:08 2013) MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Mihai Caraman Cc: Mihai Caraman , linuxppc-dev@lists.ozlabs.org, kvm@vger.kernel.org, kvm-ppc@vger.kernel.org On 03/26/2013 05:05:08 PM, Mihai Caraman wrote: > diff --git a/arch/powerpc/kvm/e500.h b/arch/powerpc/kvm/e500.h > index b73ca7a..795934d 100644 > --- a/arch/powerpc/kvm/e500.h > +++ b/arch/powerpc/kvm/e500.h > @@ -23,6 +23,8 @@ > #include > #include > > +#define VCPU_FTR_MMU_V2 0 enum? We don't care about the actual value here. > #define E500_PID_NUM 3 > #define E500_TLB_NUM 2 > > @@ -299,4 +301,18 @@ static inline unsigned int > get_tlbmiss_tid(struct kvm_vcpu *vcpu) > #define get_tlb_sts(gtlbe) (MAS1_TS) > #endif /* !BOOKE_HV */ > > +static inline bool has_feature(const struct kvm_vcpu *vcpu, > + unsigned long vcpu_ftr) > +{ > + bool has_ftr; > + switch (vcpu_ftr) { > + case VCPU_FTR_MMU_V2: > + has_ftr = ((vcpu->arch.mmucfg & MMUCFG_MAVN) = > MMUCFG_MAVN_V2); > + break; > + default: > + has_ftr = false; > + } > + return has_ftr; > +} vcpu_has_feature() Can simplify by replacing has_ftr with "return true" and "return false". -Scott