Commit f396df35 authored by Alexander Graf's avatar Alexander Graf

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: default avatarAlexander Graf <agraf@suse.de>
parent da166fac
...@@ -40,8 +40,9 @@ static int kvmppc_h_pr_enter(struct kvm_vcpu *vcpu) ...@@ -40,8 +40,9 @@ static int kvmppc_h_pr_enter(struct kvm_vcpu *vcpu)
{ {
long flags = kvmppc_get_gpr(vcpu, 4); long flags = kvmppc_get_gpr(vcpu, 4);
long pte_index = kvmppc_get_gpr(vcpu, 5); long pte_index = kvmppc_get_gpr(vcpu, 5);
unsigned long pteg[2 * 8]; __be64 pteg[2 * 8];
unsigned long pteg_addr, i, *hpte; __be64 *hpte;
unsigned long pteg_addr, i;
long int ret; long int ret;
i = pte_index & 7; i = pte_index & 7;
...@@ -93,8 +94,8 @@ static int kvmppc_h_pr_remove(struct kvm_vcpu *vcpu) ...@@ -93,8 +94,8 @@ static int kvmppc_h_pr_remove(struct kvm_vcpu *vcpu)
pteg = get_pteg_addr(vcpu, pte_index); pteg = get_pteg_addr(vcpu, pte_index);
mutex_lock(&vcpu->kvm->arch.hpt_mutex); mutex_lock(&vcpu->kvm->arch.hpt_mutex);
copy_from_user(pte, (void __user *)pteg, sizeof(pte)); copy_from_user(pte, (void __user *)pteg, sizeof(pte));
pte[0] = be64_to_cpu(pte[0]); pte[0] = be64_to_cpu((__force __be64)pte[0]);
pte[1] = be64_to_cpu(pte[1]); pte[1] = be64_to_cpu((__force __be64)pte[1]);
ret = H_NOT_FOUND; ret = H_NOT_FOUND;
if ((pte[0] & HPTE_V_VALID) == 0 || if ((pte[0] & HPTE_V_VALID) == 0 ||
...@@ -171,8 +172,8 @@ static int kvmppc_h_pr_bulk_remove(struct kvm_vcpu *vcpu) ...@@ -171,8 +172,8 @@ static int kvmppc_h_pr_bulk_remove(struct kvm_vcpu *vcpu)
pteg = get_pteg_addr(vcpu, tsh & H_BULK_REMOVE_PTEX); pteg = get_pteg_addr(vcpu, tsh & H_BULK_REMOVE_PTEX);
copy_from_user(pte, (void __user *)pteg, sizeof(pte)); copy_from_user(pte, (void __user *)pteg, sizeof(pte));
pte[0] = be64_to_cpu(pte[0]); pte[0] = be64_to_cpu((__force __be64)pte[0]);
pte[1] = be64_to_cpu(pte[1]); pte[1] = be64_to_cpu((__force __be64)pte[1]);
/* tsl = AVPN */ /* tsl = AVPN */
flags = (tsh & H_BULK_REMOVE_FLAGS) >> 26; flags = (tsh & H_BULK_REMOVE_FLAGS) >> 26;
...@@ -211,8 +212,8 @@ static int kvmppc_h_pr_protect(struct kvm_vcpu *vcpu) ...@@ -211,8 +212,8 @@ static int kvmppc_h_pr_protect(struct kvm_vcpu *vcpu)
pteg = get_pteg_addr(vcpu, pte_index); pteg = get_pteg_addr(vcpu, pte_index);
mutex_lock(&vcpu->kvm->arch.hpt_mutex); mutex_lock(&vcpu->kvm->arch.hpt_mutex);
copy_from_user(pte, (void __user *)pteg, sizeof(pte)); copy_from_user(pte, (void __user *)pteg, sizeof(pte));
pte[0] = be64_to_cpu(pte[0]); pte[0] = be64_to_cpu((__force __be64)pte[0]);
pte[1] = be64_to_cpu(pte[1]); pte[1] = be64_to_cpu((__force __be64)pte[1]);
ret = H_NOT_FOUND; ret = H_NOT_FOUND;
if ((pte[0] & HPTE_V_VALID) == 0 || if ((pte[0] & HPTE_V_VALID) == 0 ||
...@@ -231,8 +232,8 @@ static int kvmppc_h_pr_protect(struct kvm_vcpu *vcpu) ...@@ -231,8 +232,8 @@ static int kvmppc_h_pr_protect(struct kvm_vcpu *vcpu)
rb = compute_tlbie_rb(v, r, pte_index); rb = compute_tlbie_rb(v, r, pte_index);
vcpu->arch.mmu.tlbie(vcpu, rb, rb & 1 ? true : false); vcpu->arch.mmu.tlbie(vcpu, rb, rb & 1 ? true : false);
pte[0] = cpu_to_be64(pte[0]); pte[0] = (__force u64)cpu_to_be64(pte[0]);
pte[1] = cpu_to_be64(pte[1]); pte[1] = (__force u64)cpu_to_be64(pte[1]);
copy_to_user((void __user *)pteg, pte, sizeof(pte)); copy_to_user((void __user *)pteg, pte, sizeof(pte));
ret = H_SUCCESS; ret = H_SUCCESS;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment