qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 0/2] PPC: KVM: fix set_one_reg
@ 2014-01-06  5:36 Alexey Kardashevskiy
  2014-01-06  5:36 ` [Qemu-devel] [PATCH 1/2] target-ppc: fix Authority Mask Register init value Alexey Kardashevskiy
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Alexey Kardashevskiy @ 2014-01-06  5:36 UTC (permalink / raw)
  To: qemu-devel; +Cc: Alexey Kardashevskiy, qemu-ppc, Alexander Graf

This fixes set-one-register mechanism in KVM and a bug with AMR occured after fixing it.

Alexey Kardashevskiy (2):
  target-ppc: fix Authority Mask Register init value
  PPC: KVM: fix "set one register"

 target-ppc/translate_init.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

-- 
1.8.4.rc4

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Qemu-devel] [PATCH 1/2] target-ppc: fix Authority Mask Register init value
  2014-01-06  5:36 [Qemu-devel] [PATCH 0/2] PPC: KVM: fix set_one_reg Alexey Kardashevskiy
@ 2014-01-06  5:36 ` Alexey Kardashevskiy
  2014-01-06 17:29   ` [Qemu-devel] [Qemu-ppc] " Greg Kurz
  2014-01-06  5:36 ` [Qemu-devel] [PATCH 2/2] PPC: KVM: fix "set one register" Alexey Kardashevskiy
  2014-01-09 12:59 ` [Qemu-devel] [PATCH 0/2] PPC: KVM: fix set_one_reg Alexander Graf
  2 siblings, 1 reply; 9+ messages in thread
From: Alexey Kardashevskiy @ 2014-01-06  5:36 UTC (permalink / raw)
  To: qemu-devel; +Cc: Alexey Kardashevskiy, qemu-ppc, Alexander Graf

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(-)

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,
-- 
1.8.4.rc4

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [Qemu-devel] [PATCH 2/2] PPC: KVM: fix "set one register"
  2014-01-06  5:36 [Qemu-devel] [PATCH 0/2] PPC: KVM: fix set_one_reg Alexey Kardashevskiy
  2014-01-06  5:36 ` [Qemu-devel] [PATCH 1/2] target-ppc: fix Authority Mask Register init value Alexey Kardashevskiy
@ 2014-01-06  5:36 ` Alexey Kardashevskiy
  2014-01-06  6:40   ` Alexey Kardashevskiy
  2014-01-06 17:30   ` [Qemu-devel] [Qemu-ppc] [PATCH 2/2] PPC: KVM: fix "set one register" Greg Kurz
  2014-01-09 12:59 ` [Qemu-devel] [PATCH 0/2] PPC: KVM: fix set_one_reg Alexander Graf
  2 siblings, 2 replies; 9+ messages in thread
From: Alexey Kardashevskiy @ 2014-01-06  5:36 UTC (permalink / raw)
  To: qemu-devel; +Cc: Alexey Kardashevskiy, qemu-ppc, Alexander Graf

Due to missing @one_reg_id assignment in _spr_register(),
the kvm_get_one_reg/kvm_set_one_reg API has never really been working.

This enabled the API and removes use of the API for LPCR as
kvm_arch_get_registers/kvm_arch_put_registers run a loop for all 1024 SPR
and LPCR is one of them.

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
---
 target-ppc/translate_init.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/target-ppc/translate_init.c b/target-ppc/translate_init.c
index 144de3d..149a932 100644
--- a/target-ppc/translate_init.c
+++ b/target-ppc/translate_init.c
@@ -628,6 +628,9 @@ static inline void _spr_register(CPUPPCState *env, int num,
     spr->oea_read = oea_read;
     spr->oea_write = oea_write;
 #endif
+#if defined(CONFIG_KVM)
+    spr->one_reg_id = one_reg_id,
+#endif
     env->spr[num] = initial_value;
 }
 
-- 
1.8.4.rc4

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [Qemu-devel] [PATCH 2/2] PPC: KVM: fix "set one register"
  2014-01-06  5:36 ` [Qemu-devel] [PATCH 2/2] PPC: KVM: fix "set one register" Alexey Kardashevskiy
@ 2014-01-06  6:40   ` Alexey Kardashevskiy
  2014-01-06 18:23     ` [Qemu-devel] [RFC] PPC: KVM: add support for LPCR Greg Kurz
  2014-01-06 17:30   ` [Qemu-devel] [Qemu-ppc] [PATCH 2/2] PPC: KVM: fix "set one register" Greg Kurz
  1 sibling, 1 reply; 9+ messages in thread
From: Alexey Kardashevskiy @ 2014-01-06  6:40 UTC (permalink / raw)
  To: qemu-devel; +Cc: Alexey Kardashevskiy, qemu-ppc, Alexander Graf

On 01/06/2014 04:36 PM, Alexey Kardashevskiy wrote:
> Due to missing @one_reg_id assignment in _spr_register(),
> the kvm_get_one_reg/kvm_set_one_reg API has never really been working.
> 
> This enabled the API and removes use of the API for LPCR as
> kvm_arch_get_registers/kvm_arch_put_registers run a loop for all 1024 SPR
> and LPCR is one of them.

Agrh.

The commit message must be:
===
Due to missing @one_reg_id assignment in _spr_register(),
the kvm_get_one_reg/kvm_set_one_reg API has never really been working.

This reenables the API by assigning the @one_reg_id field in the SPR
descriptor.
===

Repost?


> 
> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
> ---
>  target-ppc/translate_init.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/target-ppc/translate_init.c b/target-ppc/translate_init.c
> index 144de3d..149a932 100644
> --- a/target-ppc/translate_init.c
> +++ b/target-ppc/translate_init.c
> @@ -628,6 +628,9 @@ static inline void _spr_register(CPUPPCState *env, int num,
>      spr->oea_read = oea_read;
>      spr->oea_write = oea_write;
>  #endif
> +#if defined(CONFIG_KVM)
> +    spr->one_reg_id = one_reg_id,
> +#endif
>      env->spr[num] = initial_value;
>  }
>  
> 


-- 
Alexey

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Qemu-devel] [Qemu-ppc] [PATCH 1/2] target-ppc: fix Authority Mask Register init value
  2014-01-06  5:36 ` [Qemu-devel] [PATCH 1/2] target-ppc: fix Authority Mask Register init value Alexey Kardashevskiy
@ 2014-01-06 17:29   ` Greg Kurz
  0 siblings, 0 replies; 9+ messages in thread
From: Greg Kurz @ 2014-01-06 17:29 UTC (permalink / raw)
  To: Alexey Kardashevskiy; +Cc: qemu-ppc, qemu-devel

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,



-- 
Gregory Kurz                                     kurzgreg@fr.ibm.com
                                                 gkurz@linux.vnet.ibm.com
Software Engineer @ IBM/Meiosys                  http://www.ibm.com
Tel +33 (0)562 165 496

"Anarchy is about taking complete responsibility for yourself."
        Alan Moore.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Qemu-devel] [Qemu-ppc] [PATCH 2/2] PPC: KVM: fix "set one register"
  2014-01-06  5:36 ` [Qemu-devel] [PATCH 2/2] PPC: KVM: fix "set one register" Alexey Kardashevskiy
  2014-01-06  6:40   ` Alexey Kardashevskiy
@ 2014-01-06 17:30   ` Greg Kurz
  1 sibling, 0 replies; 9+ messages in thread
From: Greg Kurz @ 2014-01-06 17:30 UTC (permalink / raw)
  To: Alexey Kardashevskiy; +Cc: qemu-ppc, qemu-devel

On Mon,  6 Jan 2014 16:36:40 +1100
Alexey Kardashevskiy <aik@ozlabs.ru> wrote:

> Due to missing @one_reg_id assignment in _spr_register(),
> the kvm_get_one_reg/kvm_set_one_reg API has never really been working.
> 
> This enabled the API and removes use of the API for LPCR as
> kvm_arch_get_registers/kvm_arch_put_registers run a loop for all 1024 SPR
> and LPCR is one of them.
> 
> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>

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

> ---
>  target-ppc/translate_init.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/target-ppc/translate_init.c b/target-ppc/translate_init.c
> index 144de3d..149a932 100644
> --- a/target-ppc/translate_init.c
> +++ b/target-ppc/translate_init.c
> @@ -628,6 +628,9 @@ static inline void _spr_register(CPUPPCState *env,
> int num, spr->oea_read = oea_read;
>      spr->oea_write = oea_write;
>  #endif
> +#if defined(CONFIG_KVM)
> +    spr->one_reg_id = one_reg_id,
> +#endif
>      env->spr[num] = initial_value;
>  }
> 



-- 
Gregory Kurz                                     kurzgreg@fr.ibm.com
                                                 gkurz@linux.vnet.ibm.com
Software Engineer @ IBM/Meiosys                  http://www.ibm.com
Tel +33 (0)562 165 496

"Anarchy is about taking complete responsibility for yourself."
        Alan Moore.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Qemu-devel] [RFC] PPC: KVM: add support for LPCR
  2014-01-06  6:40   ` Alexey Kardashevskiy
@ 2014-01-06 18:23     ` Greg Kurz
  2014-01-09 13:02       ` [Qemu-devel] [Qemu-ppc] " Alexander Graf
  0 siblings, 1 reply; 9+ messages in thread
From: Greg Kurz @ 2014-01-06 18:23 UTC (permalink / raw)
  To: qemu-ppc, qemu-devel; +Cc: aik

The LPCR special purpose register was introduced with the PowerPC 970MP family.

This patch initializes LPCR for the following families:
- 970 MP
- POWER5+
- POWER7
- POWER8

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

Along with Alexey's fixes for the get/put one reg API, I could drop
the target-ppc/kvm.c bits from:

http://patchwork.ozlabs.org/patch/300210/

and have cross-endian virtio working.

Thanks Alexey. :)

 target-ppc/translate_init.c |   16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/target-ppc/translate_init.c b/target-ppc/translate_init.c
index 149a932..35470d4 100644
--- a/target-ppc/translate_init.c
+++ b/target-ppc/translate_init.c
@@ -2582,7 +2582,6 @@ static void gen_spr_8xx (CPUPPCState *env)
  * HSRR0   => SPR 314 (Power 2.04 hypv)
  * HSRR1   => SPR 315 (Power 2.04 hypv)
  * LPIDR   => SPR 317 (970)
- * LPCR    => SPR 318 (970)
  * EPR     => SPR 702 (Power 2.04 emb)
  * perf    => 768-783 (Power 2.04)
  * perf    => 784-799 (Power 2.04)
@@ -6831,6 +6830,11 @@ static void init_proc_970MP (CPUPPCState *env)
                  SPR_NOACCESS, SPR_NOACCESS,
                  &spr_read_hior, &spr_write_hior,
                  0x00000000);
+    /* Logical partitionning */
+    spr_register_kvm(env, SPR_LPCR, "LPCR",
+                     SPR_NOACCESS, SPR_NOACCESS,
+                     &spr_read_generic, &spr_write_generic,
+                     KVM_REG_PPC_LPCR, 0x00000000);
 #if !defined(CONFIG_USER_ONLY)
     env->slb_nr = 32;
 #endif
@@ -6915,6 +6919,11 @@ static void init_proc_power5plus(CPUPPCState *env)
                  &spr_read_generic, &spr_write_generic,
                  &spr_read_generic, &spr_write_generic,
                  0x00000000);
+    /* Logical partitionning */
+    spr_register_kvm(env, SPR_LPCR, "LPCR",
+                     SPR_NOACCESS, SPR_NOACCESS,
+                     &spr_read_generic, &spr_write_generic,
+                     KVM_REG_PPC_LPCR, 0x00000000);
 #if !defined(CONFIG_USER_ONLY)
     env->slb_nr = 64;
 #endif
@@ -7019,6 +7028,11 @@ static void init_proc_POWER7 (CPUPPCState *env)
                  &spr_read_generic, &spr_write_generic,
                  &spr_read_generic, &spr_write_generic,
                  0x00000000);
+    /* Logical partitionning */
+    spr_register_kvm(env, SPR_LPCR, "LPCR",
+                     SPR_NOACCESS, SPR_NOACCESS,
+                     &spr_read_generic, &spr_write_generic,
+                     KVM_REG_PPC_LPCR, 0x00000000);
 #if !defined(CONFIG_USER_ONLY)
     env->slb_nr = 32;
 #endif

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [Qemu-devel] [PATCH 0/2] PPC: KVM: fix set_one_reg
  2014-01-06  5:36 [Qemu-devel] [PATCH 0/2] PPC: KVM: fix set_one_reg Alexey Kardashevskiy
  2014-01-06  5:36 ` [Qemu-devel] [PATCH 1/2] target-ppc: fix Authority Mask Register init value Alexey Kardashevskiy
  2014-01-06  5:36 ` [Qemu-devel] [PATCH 2/2] PPC: KVM: fix "set one register" Alexey Kardashevskiy
@ 2014-01-09 12:59 ` Alexander Graf
  2 siblings, 0 replies; 9+ messages in thread
From: Alexander Graf @ 2014-01-09 12:59 UTC (permalink / raw)
  To: Alexey Kardashevskiy; +Cc: qemu-ppc, QEMU Developers


On 06.01.2014, at 06:36, Alexey Kardashevskiy <aik@ozlabs.ru> wrote:

> This fixes set-one-register mechanism in KVM and a bug with AMR occured after fixing it.

Thanks, applied to ppc-next (with fixed commit message for 2/2).


Alex

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Qemu-devel] [Qemu-ppc] [RFC] PPC: KVM: add support for LPCR
  2014-01-06 18:23     ` [Qemu-devel] [RFC] PPC: KVM: add support for LPCR Greg Kurz
@ 2014-01-09 13:02       ` Alexander Graf
  0 siblings, 0 replies; 9+ messages in thread
From: Alexander Graf @ 2014-01-09 13:02 UTC (permalink / raw)
  To: Greg Kurz; +Cc: qemu-ppc, QEMU Developers


On 06.01.2014, at 19:23, Greg Kurz <gkurz@linux.vnet.ibm.com> wrote:

> The LPCR special purpose register was introduced with the PowerPC 970MP family.
> 
> This patch initializes LPCR for the following families:
> - 970 MP
> - POWER5+
> - POWER7
> - POWER8
> 
> Signed-off-by: Greg Kurz <gkurz@linux.vnet.ibm.com>

Very nice and simple. Thanks, applied to ppc-next.


Alex

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2014-01-09 13:02 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-06  5:36 [Qemu-devel] [PATCH 0/2] PPC: KVM: fix set_one_reg Alexey Kardashevskiy
2014-01-06  5:36 ` [Qemu-devel] [PATCH 1/2] target-ppc: fix Authority Mask Register init value Alexey Kardashevskiy
2014-01-06 17:29   ` [Qemu-devel] [Qemu-ppc] " Greg Kurz
2014-01-06  5:36 ` [Qemu-devel] [PATCH 2/2] PPC: KVM: fix "set one register" Alexey Kardashevskiy
2014-01-06  6:40   ` Alexey Kardashevskiy
2014-01-06 18:23     ` [Qemu-devel] [RFC] PPC: KVM: add support for LPCR Greg Kurz
2014-01-09 13:02       ` [Qemu-devel] [Qemu-ppc] " Alexander Graf
2014-01-06 17:30   ` [Qemu-devel] [Qemu-ppc] [PATCH 2/2] PPC: KVM: fix "set one register" Greg Kurz
2014-01-09 12:59 ` [Qemu-devel] [PATCH 0/2] PPC: KVM: fix set_one_reg Alexander Graf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).