Subject: Re: [PATCH] powerpc/book3s: Fix the MCE code to use CONFIG_KVM_BOOK3S_HV_POSSIBLE

From: "Aneesh Kumar K.V" <[email-masked]>
Date: Wed, 07 Jan 2015 13:46:42 +0530

Mahesh J Salgaonkar <[email-masked]> writes:

> From: Mahesh Salgaonkar <[email-masked]>
>
> commit id 9975f5e added new config variable CONFIG_KVM_BOOK3S_HV_POSSIBLE
> that helps to select the relevant code in the kernel when HV and PR
> bits are built as separate modules. As part of that commit, all the
> instances of #ifdef CONFIG_KVM_BOOK3S_64_HV was replaced with
> CONFIG_KVM_BOOK3S_HV_POSSIBLE. But the MCE code still depends on
> CONFIG_KVM_BOOK3S_64_HV which is wrong. When HV bits are built as a
> separate module the relevent MCE code gets excluded. This patch fixes
> the MCE code to use CONFIG_KVM_BOOK3S_HV_POSSIBLE.
>
> Signed-off-by: Mahesh Salgaonkar <[email-masked]>
> ---
>  arch/powerpc/kernel/exceptions-64s.S |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/powerpc/kernel/exceptions-64s.S b/arch/powerpc/kernel/exceptions-64s.S
> index c2df815..7335857 100644
> --- a/arch/powerpc/kernel/exceptions-64s.S
> +++ b/arch/powerpc/kernel/exceptions-64s.S
> @@ -1408,7 +1408,7 @@ machine_check_handle_early:
>  	bne	9f			/* continue in V mode if we are. */
>
>  5:
> -#ifdef CONFIG_KVM_BOOK3S_64_HV
> +#ifdef CONFIG_KVM_BOOK3S_HV_POSSIBLE
>  	/*
>  	 * We are coming from kernel context. Check if we are coming from
>  	 * guest. if yes, then we can continue. We will fall through

Do we also need to update the HSTATE_IN_GUEST check to avoid checking
the PR guest mode ?ie, 

	lbz	r11,HSTATE_IN_GUEST(r13)
	cmpwi	r11,0			/* Check if coming from guest */

checking for 0 is what you want there ?

-aneesh