]> git.baikalelectronics.ru Git - kernel.git/commit
KVM: PPC: Book3S: MMIO emulation support for little endian guests
authorCédric Le Goater <clg@fr.ibm.com>
Thu, 9 Jan 2014 10:51:16 +0000 (11:51 +0100)
committerAlexander Graf <agraf@suse.de>
Mon, 27 Jan 2014 15:00:39 +0000 (16:00 +0100)
commit701cd1a28ef5794d146e51d0772dd53d0581ef3c
treef8f11f7b4daf14e76e8e3d716c85f5a56a949476
parent646b717e18f26b74586d98ee52db43d4899fc565
KVM: PPC: Book3S: MMIO emulation support for little endian guests

MMIO emulation reads the last instruction executed by the guest
and then emulates. If the guest is running in Little Endian order,
or more generally in a different endian order of the host, the
instruction needs to be byte-swapped before being emulated.

This patch adds a helper routine which tests the endian order of
the host and the guest in order to decide whether a byteswap is
needed or not. It is then used to byteswap the last instruction
of the guest in the endian order of the host before MMIO emulation
is performed.

Finally, kvmppc_handle_load() of kvmppc_handle_store() are modified
to reverse the endianness of the MMIO if required.

Signed-off-by: Cédric Le Goater <clg@fr.ibm.com>
[agraf: add booke handling]
Signed-off-by: Alexander Graf <agraf@suse.de>
arch/powerpc/include/asm/kvm_book3s.h
arch/powerpc/include/asm/kvm_booke.h
arch/powerpc/include/asm/kvm_ppc.h
arch/powerpc/kvm/book3s_64_mmu_hv.c
arch/powerpc/kvm/emulate.c
arch/powerpc/kvm/powerpc.c