aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorAlexander Graf <agraf@suse.de>2014-06-16 07:58:11 -0400
committerAlexander Graf <agraf@suse.de>2014-07-28 09:22:16 -0400
commitf396df35188c59a5ecb83932190505ef297754e6 (patch)
tree38d15ca278876c07f013e6c2d9476bafaf811653 /arch
parentda166facd432d0edde509f941304915f9bed704d (diff)
KVM: PPC: Book3S PR: Fix sparse endian checks
While sending sparse with endian checks over the code base, it triggered at some places that were missing casts or had wrong types. Fix them up. Signed-off-by: Alexander Graf <agraf@suse.de>
Diffstat (limited to 'arch')
-rw-r--r--arch/powerpc/kvm/book3s_pr_papr.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/arch/powerpc/kvm/book3s_pr_papr.c b/arch/powerpc/kvm/book3s_pr_papr.c
index 52a63bfe3f07..f7c25c625a5b 100644
--- a/arch/powerpc/kvm/book3s_pr_papr.c
+++ b/arch/powerpc/kvm/book3s_pr_papr.c
@@ -40,8 +40,9 @@ static int kvmppc_h_pr_enter(struct kvm_vcpu *vcpu)
40{ 40{
41 long flags = kvmppc_get_gpr(vcpu, 4); 41 long flags = kvmppc_get_gpr(vcpu, 4);
42 long pte_index = kvmppc_get_gpr(vcpu, 5); 42 long pte_index = kvmppc_get_gpr(vcpu, 5);
43 unsigned long pteg[2 * 8]; 43 __be64 pteg[2 * 8];
44 unsigned long pteg_addr, i, *hpte; 44 __be64 *hpte;
45 unsigned long pteg_addr, i;
45 long int ret; 46 long int ret;
46 47
47 i = pte_index & 7; 48 i = pte_index & 7;
@@ -93,8 +94,8 @@ static int kvmppc_h_pr_remove(struct kvm_vcpu *vcpu)
93 pteg = get_pteg_addr(vcpu, pte_index); 94 pteg = get_pteg_addr(vcpu, pte_index);
94 mutex_lock(&vcpu->kvm->arch.hpt_mutex); 95 mutex_lock(&vcpu->kvm->arch.hpt_mutex);
95 copy_from_user(pte, (void __user *)pteg, sizeof(pte)); 96 copy_from_user(pte, (void __user *)pteg, sizeof(pte));
96 pte[0] = be64_to_cpu(pte[0]); 97 pte[0] = be64_to_cpu((__force __be64)pte[0]);
97 pte[1] = be64_to_cpu(pte[1]); 98 pte[1] = be64_to_cpu((__force __be64)pte[1]);
98 99
99 ret = H_NOT_FOUND; 100 ret = H_NOT_FOUND;
100 if ((pte[0] & HPTE_V_VALID) == 0 || 101 if ((pte[0] & HPTE_V_VALID) == 0 ||
@@ -171,8 +172,8 @@ static int kvmppc_h_pr_bulk_remove(struct kvm_vcpu *vcpu)
171 172
172 pteg = get_pteg_addr(vcpu, tsh & H_BULK_REMOVE_PTEX); 173 pteg = get_pteg_addr(vcpu, tsh & H_BULK_REMOVE_PTEX);
173 copy_from_user(pte, (void __user *)pteg, sizeof(pte)); 174 copy_from_user(pte, (void __user *)pteg, sizeof(pte));
174 pte[0] = be64_to_cpu(pte[0]); 175 pte[0] = be64_to_cpu((__force __be64)pte[0]);
175 pte[1] = be64_to_cpu(pte[1]); 176 pte[1] = be64_to_cpu((__force __be64)pte[1]);
176 177
177 /* tsl = AVPN */ 178 /* tsl = AVPN */
178 flags = (tsh & H_BULK_REMOVE_FLAGS) >> 26; 179 flags = (tsh & H_BULK_REMOVE_FLAGS) >> 26;
@@ -211,8 +212,8 @@ static int kvmppc_h_pr_protect(struct kvm_vcpu *vcpu)
211 pteg = get_pteg_addr(vcpu, pte_index); 212 pteg = get_pteg_addr(vcpu, pte_index);
212 mutex_lock(&vcpu->kvm->arch.hpt_mutex); 213 mutex_lock(&vcpu->kvm->arch.hpt_mutex);
213 copy_from_user(pte, (void __user *)pteg, sizeof(pte)); 214 copy_from_user(pte, (void __user *)pteg, sizeof(pte));
214 pte[0] = be64_to_cpu(pte[0]); 215 pte[0] = be64_to_cpu((__force __be64)pte[0]);
215 pte[1] = be64_to_cpu(pte[1]); 216 pte[1] = be64_to_cpu((__force __be64)pte[1]);
216 217
217 ret = H_NOT_FOUND; 218 ret = H_NOT_FOUND;
218 if ((pte[0] & HPTE_V_VALID) == 0 || 219 if ((pte[0] & HPTE_V_VALID) == 0 ||
@@ -231,8 +232,8 @@ static int kvmppc_h_pr_protect(struct kvm_vcpu *vcpu)
231 232
232 rb = compute_tlbie_rb(v, r, pte_index); 233 rb = compute_tlbie_rb(v, r, pte_index);
233 vcpu->arch.mmu.tlbie(vcpu, rb, rb & 1 ? true : false); 234 vcpu->arch.mmu.tlbie(vcpu, rb, rb & 1 ? true : false);
234 pte[0] = cpu_to_be64(pte[0]); 235 pte[0] = (__force u64)cpu_to_be64(pte[0]);
235 pte[1] = cpu_to_be64(pte[1]); 236 pte[1] = (__force u64)cpu_to_be64(pte[1]);
236 copy_to_user((void __user *)pteg, pte, sizeof(pte)); 237 copy_to_user((void __user *)pteg, pte, sizeof(pte));
237 ret = H_SUCCESS; 238 ret = H_SUCCESS;
238 239