aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/kvm/book3s_32_mmu_host.c
diff options
context:
space:
mode:
authorAlexander Graf <agraf@suse.de>2014-04-24 07:46:24 -0400
committerAlexander Graf <agraf@suse.de>2014-05-30 08:26:21 -0400
commit5deb8e7ad8ac7e3fcdfa042acff617f461b361c2 (patch)
treeccfc251ffbadfa4297aefcfe17dee807eba7ce73 /arch/powerpc/kvm/book3s_32_mmu_host.c
parent2743103f91e20d4c4d4f1a8d00821289c4c6ff62 (diff)
KVM: PPC: Make shared struct aka magic page guest endian
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, because some of the patch tricks only work with native endian load/store operations. Since we only share the structure with either host or guest in little endian on book3s_64 pr mode, we don't have to worry about booke or book3s hv. For booke, the shared struct stays big endian. For book3s_64 hv we maintain the struct in host native endian, since it never gets shared with the guest. For book3s_64 pr we introduce a variable that tells us which endianness the shared struct is in and route every access to it through helper inline functions that evaluate this variable. Signed-off-by: Alexander Graf <agraf@suse.de>
Diffstat (limited to 'arch/powerpc/kvm/book3s_32_mmu_host.c')
-rw-r--r--arch/powerpc/kvm/book3s_32_mmu_host.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/arch/powerpc/kvm/book3s_32_mmu_host.c b/arch/powerpc/kvm/book3s_32_mmu_host.c
index 5fac89dfe4cd..678e75370495 100644
--- a/arch/powerpc/kvm/book3s_32_mmu_host.c
+++ b/arch/powerpc/kvm/book3s_32_mmu_host.c
@@ -92,7 +92,7 @@ static struct kvmppc_sid_map *find_sid_vsid(struct kvm_vcpu *vcpu, u64 gvsid)
92 struct kvmppc_sid_map *map; 92 struct kvmppc_sid_map *map;
93 u16 sid_map_mask; 93 u16 sid_map_mask;
94 94
95 if (vcpu->arch.shared->msr & MSR_PR) 95 if (kvmppc_get_msr(vcpu) & MSR_PR)
96 gvsid |= VSID_PR; 96 gvsid |= VSID_PR;
97 97
98 sid_map_mask = kvmppc_sid_hash(vcpu, gvsid); 98 sid_map_mask = kvmppc_sid_hash(vcpu, gvsid);
@@ -279,7 +279,7 @@ static struct kvmppc_sid_map *create_sid_map(struct kvm_vcpu *vcpu, u64 gvsid)
279 u16 sid_map_mask; 279 u16 sid_map_mask;
280 static int backwards_map = 0; 280 static int backwards_map = 0;
281 281
282 if (vcpu->arch.shared->msr & MSR_PR) 282 if (kvmppc_get_msr(vcpu) & MSR_PR)
283 gvsid |= VSID_PR; 283 gvsid |= VSID_PR;
284 284
285 /* We might get collisions that trap in preceding order, so let's 285 /* We might get collisions that trap in preceding order, so let's