Patchwork [1/2] target-ppc: fix Authority Mask Register init value

login
register
mail settings
Submitter Alexey Kardashevskiy
Date Jan. 6, 2014, 5:36 a.m.
Message ID <1388986600-26301-2-git-send-email-aik@ozlabs.ru>
Download mbox | patch
Permalink /patch/307110/
State New
Headers show

Comments

Alexey Kardashevskiy - Jan. 6, 2014, 5:36 a.m.
The existing default value (-1) of the AMR register forbids data access
to all 32 classes. Since the guest linux does not change this register,
we end up with the guest hanging right after switching from the real to
protected mode.

This sets the default AMR value to zero what enables data access for all
classes.

The only reason for not hitting this bug before is that
kvm_arch_put_registers() did not put any SPR to KVM due to missing
assignment of @one_reg_id in _spr_register() (which is going to be fixed
by a separate patch).

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
---
 target-ppc/translate_init.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Greg Kurz - Jan. 6, 2014, 5:29 p.m.
On Mon,  6 Jan 2014 16:36:39 +1100
Alexey Kardashevskiy <aik@ozlabs.ru> wrote:
> The existing default value (-1) of the AMR register forbids data access
> to all 32 classes. Since the guest linux does not change this register,
> we end up with the guest hanging right after switching from the real to
> protected mode.
> 
> This sets the default AMR value to zero what enables data access for all
> classes.
> 
> The only reason for not hitting this bug before is that
> kvm_arch_put_registers() did not put any SPR to KVM due to missing
> assignment of @one_reg_id in _spr_register() (which is going to be fixed
> by a separate patch).
> 
> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>

Reviewed-by: Greg Kurz <gkurz@linux.vnet.ibm.com>

> ---
>  target-ppc/translate_init.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/target-ppc/translate_init.c b/target-ppc/translate_init.c
> index 93ad762..144de3d 100644
> --- a/target-ppc/translate_init.c
> +++ b/target-ppc/translate_init.c
> @@ -1064,7 +1064,7 @@ static void gen_spr_amr (CPUPPCState *env)
>      spr_register_kvm(env, SPR_AMR, "AMR",
>                       SPR_NOACCESS, SPR_NOACCESS,
>                       &spr_read_generic, &spr_write_generic,
> -                     KVM_REG_PPC_AMR, 0xffffffffffffffffULL);
> +                     KVM_REG_PPC_AMR, 0);
>      spr_register_kvm(env, SPR_UAMOR, "UAMOR",
>                       SPR_NOACCESS, SPR_NOACCESS,
>                       &spr_read_generic, &spr_write_generic,

Patch

diff --git a/target-ppc/translate_init.c b/target-ppc/translate_init.c
index 93ad762..144de3d 100644
--- a/target-ppc/translate_init.c
+++ b/target-ppc/translate_init.c
@@ -1064,7 +1064,7 @@  static void gen_spr_amr (CPUPPCState *env)
     spr_register_kvm(env, SPR_AMR, "AMR",
                      SPR_NOACCESS, SPR_NOACCESS,
                      &spr_read_generic, &spr_write_generic,
-                     KVM_REG_PPC_AMR, 0xffffffffffffffffULL);
+                     KVM_REG_PPC_AMR, 0);
     spr_register_kvm(env, SPR_UAMOR, "UAMOR",
                      SPR_NOACCESS, SPR_NOACCESS,
                      &spr_read_generic, &spr_write_generic,