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

Scott Wood scottwood at freescale.com
Wed Mar 27 09:48:31 EST 2013


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>
> 
> +#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


More information about the Linuxppc-dev mailing list