diff options
author | Alexander Graf <agraf@suse.de> | 2014-04-24 06:54:54 -0400 |
---|---|---|
committer | Alexander Graf <agraf@suse.de> | 2014-05-30 08:26:19 -0400 |
commit | 4e509af9f83debe296661d2e09a8a214850efe3c (patch) | |
tree | 7876a46c921fce704c1178cc7e2a05ab7d200ae3 /arch/powerpc/kvm/book3s_64_mmu.c | |
parent | 860540bc50a174c2dff5e11821375475a5da5f4e (diff) |
KVM: PPC: Book3S_64 PR: Access HTAB in big endian
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 <agraf@suse.de>
Diffstat (limited to 'arch/powerpc/kvm/book3s_64_mmu.c')
-rw-r--r-- | arch/powerpc/kvm/book3s_64_mmu.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/arch/powerpc/kvm/book3s_64_mmu.c b/arch/powerpc/kvm/book3s_64_mmu.c index 171e5caf2b88..b93c2456253d 100644 --- a/arch/powerpc/kvm/book3s_64_mmu.c +++ b/arch/powerpc/kvm/book3s_64_mmu.c | |||
@@ -275,12 +275,15 @@ do_second: | |||
275 | key = 4; | 275 | key = 4; |
276 | 276 | ||
277 | for (i=0; i<16; i+=2) { | 277 | for (i=0; i<16; i+=2) { |
278 | u64 pte0 = be64_to_cpu(pteg[i]); | ||
279 | u64 pte1 = be64_to_cpu(pteg[i + 1]); | ||
280 | |||
278 | /* Check all relevant fields of 1st dword */ | 281 | /* Check all relevant fields of 1st dword */ |
279 | if ((pteg[i] & v_mask) == v_val) { | 282 | if ((pte0 & v_mask) == v_val) { |
280 | /* If large page bit is set, check pgsize encoding */ | 283 | /* If large page bit is set, check pgsize encoding */ |
281 | if (slbe->large && | 284 | if (slbe->large && |
282 | (vcpu->arch.hflags & BOOK3S_HFLAG_MULTI_PGSIZE)) { | 285 | (vcpu->arch.hflags & BOOK3S_HFLAG_MULTI_PGSIZE)) { |
283 | pgsize = decode_pagesize(slbe, pteg[i+1]); | 286 | pgsize = decode_pagesize(slbe, pte1); |
284 | if (pgsize < 0) | 287 | if (pgsize < 0) |
285 | continue; | 288 | continue; |
286 | } | 289 | } |
@@ -297,8 +300,8 @@ do_second: | |||
297 | goto do_second; | 300 | goto do_second; |
298 | } | 301 | } |
299 | 302 | ||
300 | v = pteg[i]; | 303 | v = be64_to_cpu(pteg[i]); |
301 | r = pteg[i+1]; | 304 | r = be64_to_cpu(pteg[i+1]); |
302 | pp = (r & HPTE_R_PP) | key; | 305 | pp = (r & HPTE_R_PP) | key; |
303 | if (r & HPTE_R_PP0) | 306 | if (r & HPTE_R_PP0) |
304 | pp |= 8; | 307 | pp |= 8; |