KVM: arm64: Change kvm_handle_mmio_return() return polarity
authorFuad Tabba <tabba@google.com>
Tue, 23 Apr 2024 15:05:22 +0000 (16:05 +0100)
committerMarc Zyngier <maz@kernel.org>
Wed, 1 May 2024 15:48:14 +0000 (16:48 +0100)
Most exit handlers return <= 0 to indicate that the host needs to
handle the exit. Make kvm_handle_mmio_return() consistent with
the exit handlers in handle_exit(). This makes the code easier to
reason about, and makes it easier to add other handlers in future
patches.

No functional change intended.

Signed-off-by: Fuad Tabba <tabba@google.com>
Acked-by: Oliver Upton <oliver.upton@linux.dev>
Link: https://lore.kernel.org/r/20240423150538.2103045-15-tabba@google.com
Signed-off-by: Marc Zyngier <maz@kernel.org>
arch/arm64/kvm/arm.c
arch/arm64/kvm/mmio.c

index 66d8112da26802c45e840b3cfcf237efed401ba4..7f87fbb452c55d202dd26f1e2cb49684e3b047fd 100644 (file)
@@ -974,7 +974,7 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu)
 
        if (run->exit_reason == KVM_EXIT_MMIO) {
                ret = kvm_handle_mmio_return(vcpu);
-               if (ret)
+               if (ret <= 0)
                        return ret;
        }
 
index 200c8019a82a4380b6c338fe2ec0ac0c50d0512b..5e1ffb0d5363aff3a2533a008bd387815935eb45 100644 (file)
@@ -86,7 +86,7 @@ int kvm_handle_mmio_return(struct kvm_vcpu *vcpu)
 
        /* Detect an already handled MMIO return */
        if (unlikely(!vcpu->mmio_needed))
-               return 0;
+               return 1;
 
        vcpu->mmio_needed = 0;
 
@@ -117,7 +117,7 @@ int kvm_handle_mmio_return(struct kvm_vcpu *vcpu)
         */
        kvm_incr_pc(vcpu);
 
-       return 0;
+       return 1;
 }
 
 int io_mem_abort(struct kvm_vcpu *vcpu, phys_addr_t fault_ipa)