diff options
Diffstat (limited to 'arch/powerpc')
-rw-r--r-- | arch/powerpc/kvm/book3s_pr_papr.c | 21 |
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 | ||