[PATCH 12/13] KVM: PPC: Book3S PR: Do dcbz32 patching with big endian instructions

2014-04-24 Thread Alexander Graf
When the host CPU we're running on doesn't support dcbz32 itself, but the guest wants to have dcbz only clear 32 bytes of data, we loop through every executable mapped page to search for dcbz instructions and patch them with a special privileged instruction that we emulate as dcbz32. The only

[PATCH 03/13] KVM: PPC: Book3S_32: PR: Access HTAB in big endian

2014-04-24 Thread Alexander Graf
The HTAB is always big endian. We access the guest's HTAB using copy_from/to_user, but don't yet take care of the fact that we might be running on an LE host. Wrap all accesses to the guest HTAB with big endian accessors. Signed-off-by: Alexander Graf ag...@suse.de ---

[PATCH 06/13] KVM: PPC: Book3S PR: Give guest control over MSR_LE

2014-04-24 Thread Alexander Graf
When we calculate the actual MSR that the guest is running with when in guest context, we take a few MSR bits from the MSR the guest thinks it's using. Add MSR_LE to these bits, so the guest gets full control over its own endianness setting. Signed-off-by: Alexander Graf ag...@suse.de ---

[PATCH 13/13] KVM: PPC: Book3S: Move little endian conflict to HV KVM

2014-04-24 Thread Alexander Graf
With the previous patches applied, we can now successfully use PR KVM on little endian hosts which means we can now allow users to select it. However, HV KVM still needs some work, so let's keep the kconfig conflict on that one. Signed-off-by: Alexander Graf ag...@suse.de ---

[PATCH 05/13] KVM: PPC: Book3S_64 PR: Access shadow slb in big endian

2014-04-24 Thread Alexander Graf
The shadow SLB in the PACA is shared with the hypervisor, so it has to be big endian. We access the shadow SLB during world switch, so let's make sure we access it in big endian even when we're on a little endian host. Signed-off-by: Alexander Graf ag...@suse.de ---

[PATCH 00/13] PPC: KVM: Enable PR KVM on ppc64le

2014-04-24 Thread Alexander Graf
During the enablement of ppc64le KVM has been kept unfixed. This patch set is the initial attempt to make all of KVM work on ppc64le hosts. It starts the effort by bringing PR KVM over. With this patch set I am successfully able to run book3s_32 (BE) and book3s_64 (BE, LE) guests on a host

[PATCH 10/13] KVM: PPC: PR: Fill pvinfo hcall instructions in big endian

2014-04-24 Thread Alexander Graf
We expose a blob of hypercall instructions to user space that it gives to the guest via device tree again. That blob should contain a stream of instructions necessary to do a hypercall in big endian, as it just gets passed into the guest and old guests use them straight away. Signed-off-by:

[PATCH 08/13] KVM: PPC: Book3S PR: PAPR: Access HTAB in big endian

2014-04-24 Thread Alexander Graf
The HTAB on PPC is always in big endian. When we access it via hypercalls on behalf of the guest and we're running on a little endian host, we need to make sure we swap the bits accordingly. Signed-off-by: Alexander Graf ag...@suse.de --- arch/powerpc/kvm/book3s_pr_papr.c | 14 +++--- 1

[PATCH 11/13] KVM: PPC: Make shared struct aka magic page guest endian

2014-04-24 Thread Alexander Graf
The shared (magic) page is a data structure that contains often used supervisor privileged SPRs accessible via memory to the user to reduce the number of exits we have to take to read/write them. When we actually share this structure with the guest we have to maintain it in guest endianness,

[PATCH 04/13] KVM: PPC: Book3S_64 PR: Access HTAB in big endian

2014-04-24 Thread Alexander Graf
The HTAB is always big endian. We access the guest's HTAB using copy_from/to_user, but don't yet take care of the fact that we might be running on an LE host. Wrap all accesses to the guest HTAB with big endian accessors. Signed-off-by: Alexander Graf ag...@suse.de ---

[PATCH 07/13] KVM: PPC: Book3S PR: Default to big endian guest

2014-04-24 Thread Alexander Graf
The default MSR when user space does not define anything should be identical on little and big endian hosts, so remove MSR_LE from it. Signed-off-by: Alexander Graf ag...@suse.de --- arch/powerpc/kvm/book3s_pr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git

[PATCH 01/13] KVM: PPC: Book3S PR: Implement LPCR ONE_REG

2014-04-24 Thread Alexander Graf
To control whether we should inject interrupts in little or big endian mode, user space sets the LPCR.ILE bit accordingly via ONE_REG. Let's implement it, so we are able to trigger interrupts in LE mode. Signed-off-by: Alexander Graf ag...@suse.de --- arch/powerpc/include/asm/kvm_book3s.h | 1 +

[PATCH 09/13] KVM: PPC: Book3S PR: PAPR: Access RTAS in big endian

2014-04-24 Thread Alexander Graf
When the guest does an RTAS hypercall it keeps all RTAS variables inside a big endian data structure. To make sure we don't have to bother about endianness inside the actual RTAS handlers, let's just convert the whole structure to host endian before we call our RTAS handlers and back to big