From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alexander Graf Date: Thu, 20 Nov 2014 17:28:34 +0000 Subject: Re: [PATCH] KVM: PPC: Book3S HV: ptes are big endian Message-Id: <546E24C2.1090908@suse.de> List-Id: References: <1415028950-9654-1-git-send-email-clg@fr.ibm.com> In-Reply-To: <1415028950-9654-1-git-send-email-clg@fr.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit To: =?UTF-8?B?Q8OpZHJpYyBMZSBHb2F0ZXI=?= Cc: kvm-ppc@vger.kernel.org, kvm@vger.kernel.org, Paul Mackerras , Alexey Kardashevskiy , Gregory Kurz On 03.11.14 16:35, Cédric Le Goater wrote: > When being restored from qemu, the kvm_get_htab_header are in native > endian, but the ptes are big endian. > > This patch fixes restore on a KVM LE host. Qemu also needs a fix for > this : > > http://lists.nongnu.org/archive/html/qemu-ppc/2014-11/msg00008.html > > Signed-off-by: Cédric Le Goater > Cc: Paul Mackerras > Cc: Alexey Kardashevskiy > Cc: Gregory Kurz > > --- > > Tested on 3.17-rc7 with LE and BE host. > > > > arch/powerpc/kvm/book3s_64_mmu_hv.c | 2 ++ > 1 file changed, 2 insertions(+) > > Index: linux-3.18-hv.git/arch/powerpc/kvm/book3s_64_mmu_hv.c > =================================> --- linux-3.18-hv.git.orig/arch/powerpc/kvm/book3s_64_mmu_hv.c > +++ linux-3.18-hv.git/arch/powerpc/kvm/book3s_64_mmu_hv.c > @@ -1542,6 +1542,8 @@ static ssize_t kvm_htab_write(struct fil > err = -EFAULT; > if (__get_user(v, lbuf) || __get_user(r, lbuf + 1)) > goto out; > + v = be64_to_cpu(v); > + r = be64_to_cpu(r); This will trigger warnings with sparse. Please introduce new be64 variables that you do get_user on and that you then use as source for v and r. Alex From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alexander Graf Subject: Re: [PATCH] KVM: PPC: Book3S HV: ptes are big endian Date: Thu, 20 Nov 2014 18:28:34 +0100 Message-ID: <546E24C2.1090908@suse.de> References: <1415028950-9654-1-git-send-email-clg@fr.ibm.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: kvm-ppc@vger.kernel.org, kvm@vger.kernel.org, Paul Mackerras , Alexey Kardashevskiy , Gregory Kurz To: =?UTF-8?B?Q8OpZHJpYyBMZSBHb2F0ZXI=?= Return-path: In-Reply-To: <1415028950-9654-1-git-send-email-clg@fr.ibm.com> Sender: kvm-ppc-owner@vger.kernel.org List-Id: kvm.vger.kernel.org On 03.11.14 16:35, C=C3=A9dric Le Goater wrote: > When being restored from qemu, the kvm_get_htab_header are in native > endian, but the ptes are big endian.=20 >=20 > This patch fixes restore on a KVM LE host. Qemu also needs a fix for > this : >=20 > http://lists.nongnu.org/archive/html/qemu-ppc/2014-11/msg00008.h= tml >=20 > Signed-off-by: C=C3=A9dric Le Goater > Cc: Paul Mackerras > Cc: Alexey Kardashevskiy > Cc: Gregory Kurz >=20 > --- >=20 > Tested on 3.17-rc7 with LE and BE host. >=20 > =20 >=20 > arch/powerpc/kvm/book3s_64_mmu_hv.c | 2 ++ > 1 file changed, 2 insertions(+) >=20 > Index: linux-3.18-hv.git/arch/powerpc/kvm/book3s_64_mmu_hv.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > --- linux-3.18-hv.git.orig/arch/powerpc/kvm/book3s_64_mmu_hv.c > +++ linux-3.18-hv.git/arch/powerpc/kvm/book3s_64_mmu_hv.c > @@ -1542,6 +1542,8 @@ static ssize_t kvm_htab_write(struct fil > err =3D -EFAULT; > if (__get_user(v, lbuf) || __get_user(r, lbuf + 1)) > goto out; > + v =3D be64_to_cpu(v); > + r =3D be64_to_cpu(r); This will trigger warnings with sparse. Please introduce new be64 variables that you do get_user on and that you then use as source for v and r. Alex