Subject: Re: [PATCH 3/7 v2] KVM: PPC: e500: Add support for TLBnPS registers

From: Scott Wood <[email-masked]>
Date: Tue, 26 Mar 2013 17:48:31 -0500

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 <asm/mmu-book3e.h>
>  #include <asm/tlb.h>
>=20
> +#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
>=20
> @@ -299,4 +301,18 @@ static inline unsigned int =20
> get_tlbmiss_tid(struct kvm_vcpu *vcpu)
>  #define get_tlb_sts(gtlbe)              (MAS1_TS)
>  #endif /* !BOOKE_HV */
>=20
> +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 =3D ((vcpu->arch.mmucfg & MMUCFG_MAVN) =3D=3D =20
> MMUCFG_MAVN_V2);
> +		break;
> +	default:
> +		has_ftr =3D false;
> +	}
> +	return has_ftr;
> +}

vcpu_has_feature()

Can simplify by replacing has_ftr with "return true" and "return false".

-Scott=