qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] PPC: KVM: Fix BAT put
@ 2012-10-05  2:36 Alexander Graf
  2012-10-05  3:29 ` [Qemu-devel] [Qemu-ppc] " David Gibson
  2012-10-06 18:35 ` [Qemu-devel] " Aurelien Jarno
  0 siblings, 2 replies; 4+ messages in thread
From: Alexander Graf @ 2012-10-05  2:36 UTC (permalink / raw)
  To: qemu-devel qemu-devel; +Cc: qemu-ppc@nongnu.org List

In the sregs API, upper and lower 32bit segments of the BAT registers
are swapped when doing a set. Since we need to support old kernels out
there, don't bother to fix it in the kernel, but instead work around
the problem in QEMU by swapping on put.

Signed-off-by: Alexander Graf <agraf@suse.de>
---
 target-ppc/kvm.c |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/target-ppc/kvm.c b/target-ppc/kvm.c
index 1975323..93c5bb7 100644
--- a/target-ppc/kvm.c
+++ b/target-ppc/kvm.c
@@ -493,10 +493,11 @@ int kvm_arch_put_registers(CPUPPCState *env, int level)
 
         /* Sync BATs */
         for (i = 0; i < 8; i++) {
-            sregs.u.s.ppc32.dbat[i] = ((uint64_t)env->DBAT[1][i] << 32)
-                | env->DBAT[0][i];
-            sregs.u.s.ppc32.ibat[i] = ((uint64_t)env->IBAT[1][i] << 32)
-                | env->IBAT[0][i];
+            /* Beware. We have to swap upper and lower bits here */
+            sregs.u.s.ppc32.dbat[i] = ((uint64_t)env->DBAT[0][i] << 32)
+                | env->DBAT[1][i];
+            sregs.u.s.ppc32.ibat[i] = ((uint64_t)env->IBAT[0][i] << 32)
+                | env->IBAT[1][i];
         }
 
         ret = kvm_vcpu_ioctl(env, KVM_SET_SREGS, &sregs);
-- 
1.6.0.2

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

* Re: [Qemu-devel] [Qemu-ppc] [PATCH] PPC: KVM: Fix BAT put
  2012-10-05  2:36 [Qemu-devel] [PATCH] PPC: KVM: Fix BAT put Alexander Graf
@ 2012-10-05  3:29 ` David Gibson
  2012-10-05 10:19   ` Alexander Graf
  2012-10-06 18:35 ` [Qemu-devel] " Aurelien Jarno
  1 sibling, 1 reply; 4+ messages in thread
From: David Gibson @ 2012-10-05  3:29 UTC (permalink / raw)
  To: Alexander Graf; +Cc: qemu-ppc@nongnu.org List, qemu-devel qemu-devel

On Fri, Oct 05, 2012 at 04:36:46AM +0200, Alexander Graf wrote:
> In the sregs API, upper and lower 32bit segments of the BAT registers
> are swapped when doing a set. Since we need to support old kernels out
> there, don't bother to fix it in the kernel, but instead work around
> the problem in QEMU by swapping on put.
> 
> Signed-off-by: Alexander Graf <agraf@suse.de>

We should probably at least add warning comments to the kernel
headers.

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

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

* Re: [Qemu-devel] [Qemu-ppc] [PATCH] PPC: KVM: Fix BAT put
  2012-10-05  3:29 ` [Qemu-devel] [Qemu-ppc] " David Gibson
@ 2012-10-05 10:19   ` Alexander Graf
  0 siblings, 0 replies; 4+ messages in thread
From: Alexander Graf @ 2012-10-05 10:19 UTC (permalink / raw)
  To: David Gibson; +Cc: qemu-ppc@nongnu.org List, qemu-devel qemu-devel



On 05.10.2012, at 05:29, David Gibson <david@gibson.dropbear.id.au> wrote:

> On Fri, Oct 05, 2012 at 04:36:46AM +0200, Alexander Graf wrote:
>> In the sregs API, upper and lower 32bit segments of the BAT registers
>> are swapped when doing a set. Since we need to support old kernels out
>> there, don't bother to fix it in the kernel, but instead work around
>> the problem in QEMU by swapping on put.
>> 
>> Signed-off-by: Alexander Graf <agraf@suse.de>
> 
> We should probably at least add warning comments to the kernel
> headers.

I would prefer to switch all of the sregs mess to one_reg and declare it deprecated then :).

Alex

> 
> -- 
> David Gibson            | I'll have my music baroque, and my code
> david AT gibson.dropbear.id.au    | minimalist, thank you.  NOT _the_ _other_
>                | _way_ _around_!
> http://www.ozlabs.org/~dgibson

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

* Re: [Qemu-devel] [PATCH] PPC: KVM: Fix BAT put
  2012-10-05  2:36 [Qemu-devel] [PATCH] PPC: KVM: Fix BAT put Alexander Graf
  2012-10-05  3:29 ` [Qemu-devel] [Qemu-ppc] " David Gibson
@ 2012-10-06 18:35 ` Aurelien Jarno
  1 sibling, 0 replies; 4+ messages in thread
From: Aurelien Jarno @ 2012-10-06 18:35 UTC (permalink / raw)
  To: Alexander Graf; +Cc: qemu-ppc@nongnu.org List, qemu-devel qemu-devel

On Fri, Oct 05, 2012 at 04:36:46AM +0200, Alexander Graf wrote:
> In the sregs API, upper and lower 32bit segments of the BAT registers
> are swapped when doing a set. Since we need to support old kernels out
> there, don't bother to fix it in the kernel, but instead work around
> the problem in QEMU by swapping on put.
> 
> Signed-off-by: Alexander Graf <agraf@suse.de>
> ---
>  target-ppc/kvm.c |    9 +++++----
>  1 files changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/target-ppc/kvm.c b/target-ppc/kvm.c
> index 1975323..93c5bb7 100644
> --- a/target-ppc/kvm.c
> +++ b/target-ppc/kvm.c
> @@ -493,10 +493,11 @@ int kvm_arch_put_registers(CPUPPCState *env, int level)
>  
>          /* Sync BATs */
>          for (i = 0; i < 8; i++) {
> -            sregs.u.s.ppc32.dbat[i] = ((uint64_t)env->DBAT[1][i] << 32)
> -                | env->DBAT[0][i];
> -            sregs.u.s.ppc32.ibat[i] = ((uint64_t)env->IBAT[1][i] << 32)
> -                | env->IBAT[0][i];
> +            /* Beware. We have to swap upper and lower bits here */
> +            sregs.u.s.ppc32.dbat[i] = ((uint64_t)env->DBAT[0][i] << 32)
> +                | env->DBAT[1][i];
> +            sregs.u.s.ppc32.ibat[i] = ((uint64_t)env->IBAT[0][i] << 32)
> +                | env->IBAT[1][i];
>          }
>  
>          ret = kvm_vcpu_ioctl(env, KVM_SET_SREGS, &sregs);

Applied (actually as part of the PPC pull).

-- 
Aurelien Jarno                          GPG: 1024D/F1BCDB73
aurelien@aurel32.net                 http://www.aurel32.net

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

end of thread, other threads:[~2012-10-06 18:35 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-10-05  2:36 [Qemu-devel] [PATCH] PPC: KVM: Fix BAT put Alexander Graf
2012-10-05  3:29 ` [Qemu-devel] [Qemu-ppc] " David Gibson
2012-10-05 10:19   ` Alexander Graf
2012-10-06 18:35 ` [Qemu-devel] " Aurelien Jarno

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