Re: [PATCH 1/6 v2] kvm: ppc: bookehv: Added wrapper macros for shadow registers

Scott Wood
2014-07-18T00:55:53Z

On Thu, 2014-07-17 at 17:01 +0530, Bharat Bhushan wrote:
> There are shadow registers like, GSPRG[0-3], GSRR0, GSRR1 etc on
> BOOKE-HV and these shadow registers are guest accessible.
> So these shadow registers needs to be updated on BOOKE-HV.
> This patch adds new macro for get/set helper of shadow register .
>
> Signed-off-by: Bharat Bhushan <Bharat.Bhushan@freescale.com>
> ---
> v1->v2
> - Fix compilation for book3s (separate macro etc)
>
> arch/powerpc/include/asm/kvm_ppc.h | 44 +++++++++++++++++++++++++++++++-------
> 1 file changed, 36 insertions(+), 8 deletions(-)
>
> diff --git a/arch/powerpc/include/asm/kvm_ppc.h b/arch/powerpc/include/asm/kvm_ppc.h
> index f3f7611..7646994 100644
> --- a/arch/powerpc/include/asm/kvm_ppc.h
> +++ b/arch/powerpc/include/asm/kvm_ppc.h
> @@ -475,8 +475,20 @@ static inline bool kvmppc_shared_big_endian(struct kvm_vcpu *vcpu)
> #endif
> }
>
> +#define SPRNG_WRAPPER_GET(reg, e500hv_spr) \
> +static inline ulong kvmppc_get_##reg(struct kvm_vcpu *vcpu) \
> +{ \
> + return mfspr(e500hv_spr); \
> +} \
> +
> +#define SPRNG_WRAPPER_SET(reg, e500hv_spr) \
> +static inline void kvmppc_set_##reg(struct kvm_vcpu *vcpu, ulong val) \
> +{ \
> + mtspr(e500hv_spr, val); \
> +} \

Why "e500hv" rather than "bookehv"?

-Scott