Remove redundant variables vma_shift and vfio_allow_any_uc from struct kvm_s2_fault as they are easily derived or checked when needed. Signed-off-by: Fuad Tabba --- arch/arm64/kvm/mmu.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/arch/arm64/kvm/mmu.c b/arch/arm64/kvm/mmu.c index 090a906d3a12..01f4f4bee155 100644 --- a/arch/arm64/kvm/mmu.c +++ b/arch/arm64/kvm/mmu.c @@ -1721,10 +1721,8 @@ struct kvm_s2_fault { bool mte_allowed; bool is_vma_cacheable; bool s2_force_noncacheable; - bool vfio_allow_any_uc; unsigned long mmu_seq; phys_addr_t ipa; - short vma_shift; gfn_t gfn; kvm_pfn_t pfn; bool logging_active; @@ -1749,9 +1747,9 @@ static int kvm_s2_fault_get_vma_info(struct kvm_s2_fault *fault) return -EFAULT; } - fault->vma_shift = kvm_s2_resolve_vma_size(vma, fault->hva, fault->memslot, fault->nested, - &fault->force_pte, &fault->ipa); - fault->vma_pagesize = 1UL << fault->vma_shift; + fault->vma_pagesize = 1UL << kvm_s2_resolve_vma_size(vma, fault->hva, fault->memslot, + fault->nested, &fault->force_pte, + &fault->ipa); /* * Both the canonical IPA and fault IPA must be aligned to the @@ -1764,8 +1762,6 @@ static int kvm_s2_fault_get_vma_info(struct kvm_s2_fault *fault) fault->gfn = fault->ipa >> PAGE_SHIFT; fault->mte_allowed = kvm_vma_mte_allowed(vma); - fault->vfio_allow_any_uc = vma->vm_flags & VM_ALLOW_ANY_UNCACHED; - fault->vm_flags = vma->vm_flags; fault->is_vma_cacheable = kvm_vma_is_cacheable(vma); @@ -1796,7 +1792,7 @@ static int kvm_s2_fault_pin_pfn(struct kvm_s2_fault *fault) fault->write_fault ? FOLL_WRITE : 0, &fault->writable, &fault->page); if (fault->pfn == KVM_PFN_ERR_HWPOISON) { - kvm_send_hwpoison_signal(fault->hva, fault->vma_shift); + kvm_send_hwpoison_signal(fault->hva, __ffs(fault->vma_pagesize)); return 0; } if (is_error_noslot_pfn(fault->pfn)) @@ -1874,7 +1870,7 @@ static int kvm_s2_fault_compute_prot(struct kvm_s2_fault *fault) fault->prot |= KVM_PGTABLE_PROT_X; if (fault->s2_force_noncacheable) { - if (fault->vfio_allow_any_uc) + if (fault->vm_flags & VM_ALLOW_ANY_UNCACHED) fault->prot |= KVM_PGTABLE_PROT_NORMAL_NC; else fault->prot |= KVM_PGTABLE_PROT_DEVICE; @@ -1978,7 +1974,6 @@ static int user_mem_abort(struct kvm_vcpu *vcpu, phys_addr_t fault_ipa, .logging_active = memslot_is_logging(memslot), .force_pte = memslot_is_logging(memslot), .s2_force_noncacheable = false, - .vfio_allow_any_uc = false, .prot = KVM_PGTABLE_PROT_R, }; struct kvm_s2_fault *fault = &fault_data; -- 2.53.0.473.g4a7958ca14-goog