aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc
diff options
context:
space:
mode:
authorCédric Le Goater <clg@fr.ibm.com>2014-11-20 18:45:59 -0500
committerAlexander Graf <agraf@suse.de>2014-12-15 07:27:24 -0500
commitffada016fb22fbbb9849d3cc5ec72ca8f0377681 (patch)
tree2c66e15af4714d827103f9ca95aef1657526b11e /arch/powerpc
parent5b88cda665bc6ae92c9bd12060c9fd0840211eb7 (diff)
KVM: PPC: Book3S HV: ptes are big endian
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 <clg@fr.ibm.com> Signed-off-by: Alexander Graf <agraf@suse.de>
Diffstat (limited to 'arch/powerpc')
-rw-r--r--arch/powerpc/kvm/book3s_64_mmu_hv.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/arch/powerpc/kvm/book3s_64_mmu_hv.c b/arch/powerpc/kvm/book3s_64_mmu_hv.c
index 41f96c51dfca..59425f143c6d 100644
--- a/arch/powerpc/kvm/book3s_64_mmu_hv.c
+++ b/arch/powerpc/kvm/book3s_64_mmu_hv.c
@@ -1542,9 +1542,15 @@ static ssize_t kvm_htab_write(struct file *file, const char __user *buf,
1542 hptp = (__be64 *)(kvm->arch.hpt_virt + (i * HPTE_SIZE)); 1542 hptp = (__be64 *)(kvm->arch.hpt_virt + (i * HPTE_SIZE));
1543 lbuf = (unsigned long __user *)buf; 1543 lbuf = (unsigned long __user *)buf;
1544 for (j = 0; j < hdr.n_valid; ++j) { 1544 for (j = 0; j < hdr.n_valid; ++j) {
1545 __be64 hpte_v;
1546 __be64 hpte_r;
1547
1545 err = -EFAULT; 1548 err = -EFAULT;
1546 if (__get_user(v, lbuf) || __get_user(r, lbuf + 1)) 1549 if (__get_user(hpte_v, lbuf) ||
1550 __get_user(hpte_r, lbuf + 1))
1547 goto out; 1551 goto out;
1552 v = be64_to_cpu(hpte_v);
1553 r = be64_to_cpu(hpte_r);
1548 err = -EINVAL; 1554 err = -EINVAL;
1549 if (!(v & HPTE_V_VALID)) 1555 if (!(v & HPTE_V_VALID))
1550 goto out; 1556 goto out;