]> git.baikalelectronics.ru Git - kernel.git/commitdiff
KVM: mips: Use kvm_get_vcpu() instead of open-coded access
authorMarc Zyngier <maz@kernel.org>
Tue, 16 Nov 2021 16:03:58 +0000 (16:03 +0000)
committerPaolo Bonzini <pbonzini@redhat.com>
Wed, 8 Dec 2021 09:24:13 +0000 (04:24 -0500)
As we are about to change the way vcpus are allocated, mandate
the use of kvm_get_vcpu() instead of open-coding the access.

Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Signed-off-by: Marc Zyngier <maz@kernel.org>
Message-Id: <20211116160403.4074052-3-maz@kernel.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/mips/kvm/loongson_ipi.c
arch/mips/kvm/mips.c

index 3681fc8fba383a01f56547d9003663bcee426f38..5d53f32d837c1271c95261734df5b6dddf0b0bdd 100644 (file)
@@ -120,7 +120,7 @@ static int loongson_vipi_write(struct loongson_kvm_ipi *ipi,
                s->status |= data;
                irq.cpu = id;
                irq.irq = 6;
-               kvm_vcpu_ioctl_interrupt(kvm->vcpus[id], &irq);
+               kvm_vcpu_ioctl_interrupt(kvm_get_vcpu(kvm, id), &irq);
                break;
 
        case CORE0_CLEAR_OFF:
@@ -128,7 +128,7 @@ static int loongson_vipi_write(struct loongson_kvm_ipi *ipi,
                if (!s->status) {
                        irq.cpu = id;
                        irq.irq = -6;
-                       kvm_vcpu_ioctl_interrupt(kvm->vcpus[id], &irq);
+                       kvm_vcpu_ioctl_interrupt(kvm_get_vcpu(kvm, id), &irq);
                }
                break;
 
index 6aa5e3771d05d094b5141878acf4b9a6abee1888..043204cd585f3770c1581d41c637795dcb5f7795 100644 (file)
@@ -479,7 +479,7 @@ int kvm_vcpu_ioctl_interrupt(struct kvm_vcpu *vcpu,
        if (irq->cpu == -1)
                dvcpu = vcpu;
        else
-               dvcpu = vcpu->kvm->vcpus[irq->cpu];
+               dvcpu = kvm_get_vcpu(vcpu->kvm, irq->cpu);
 
        if (intr == 2 || intr == 3 || intr == 4 || intr == 6) {
                kvm_mips_callbacks->queue_io_int(dvcpu, irq);