KVM: Use 'unsigned long' as kvm_for_each_vcpu()'s index
authorMarc Zyngier <maz@kernel.org>
Tue, 16 Nov 2021 16:04:02 +0000 (16:04 +0000)
committerPaolo Bonzini <pbonzini@redhat.com>
Wed, 8 Dec 2021 09:24:15 +0000 (04:24 -0500)
Everywhere we use kvm_for_each_vpcu(), we use an int as the vcpu
index. Unfortunately, we're about to move rework the iterator,
which requires this to be upgrade to an unsigned long.

Let's bite the bullet and repaint all of it in one go.

Signed-off-by: Marc Zyngier <maz@kernel.org>
Message-Id: <20211116160403.4074052-7-maz@kernel.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
39 files changed:
arch/arm64/kvm/arch_timer.c
arch/arm64/kvm/arm.c
arch/arm64/kvm/pmu-emul.c
arch/arm64/kvm/psci.c
arch/arm64/kvm/reset.c
arch/arm64/kvm/vgic/vgic-init.c
arch/arm64/kvm/vgic/vgic-kvm-device.c
arch/arm64/kvm/vgic/vgic-mmio-v2.c
arch/arm64/kvm/vgic/vgic-mmio-v3.c
arch/arm64/kvm/vgic/vgic-v3.c
arch/arm64/kvm/vgic/vgic-v4.c
arch/arm64/kvm/vgic/vgic.c
arch/powerpc/kvm/book3s_32_mmu.c
arch/powerpc/kvm/book3s_64_mmu.c
arch/powerpc/kvm/book3s_hv.c
arch/powerpc/kvm/book3s_pr.c
arch/powerpc/kvm/book3s_xics.c
arch/powerpc/kvm/book3s_xics.h
arch/powerpc/kvm/book3s_xive.c
arch/powerpc/kvm/book3s_xive.h
arch/powerpc/kvm/book3s_xive_native.c
arch/powerpc/kvm/e500_emulate.c
arch/riscv/kvm/vcpu_sbi.c
arch/riscv/kvm/vmid.c
arch/s390/kvm/interrupt.c
arch/s390/kvm/kvm-s390.c
arch/s390/kvm/kvm-s390.h
arch/x86/kvm/hyperv.c
arch/x86/kvm/i8254.c
arch/x86/kvm/i8259.c
arch/x86/kvm/ioapic.c
arch/x86/kvm/irq_comm.c
arch/x86/kvm/kvm_onhyperv.c
arch/x86/kvm/lapic.c
arch/x86/kvm/svm/avic.c
arch/x86/kvm/svm/sev.c
arch/x86/kvm/x86.c
include/linux/kvm_host.h
virt/kvm/kvm_main.c

index 3df67c127489813b8c2e5cb7e1c5285fec5388fb..d6f4114f1d11cd82723879506c680b31068f1561 100644 (file)
@@ -750,7 +750,7 @@ int kvm_timer_vcpu_reset(struct kvm_vcpu *vcpu)
 /* Make the updates of cntvoff for all vtimer contexts atomic */
 static void update_vtimer_cntvoff(struct kvm_vcpu *vcpu, u64 cntvoff)
 {
-       int i;
+       unsigned long i;
        struct kvm *kvm = vcpu->kvm;
        struct kvm_vcpu *tmp;
 
@@ -1189,8 +1189,8 @@ void kvm_timer_vcpu_terminate(struct kvm_vcpu *vcpu)
 
 static bool timer_irqs_are_valid(struct kvm_vcpu *vcpu)
 {
-       int vtimer_irq, ptimer_irq;
-       int i, ret;
+       int vtimer_irq, ptimer_irq, ret;
+       unsigned long i;
 
        vtimer_irq = vcpu_vtimer(vcpu)->irq.irq;
        ret = kvm_vgic_set_owner(vcpu, vtimer_irq, vcpu_vtimer(vcpu));
@@ -1297,7 +1297,7 @@ void kvm_timer_init_vhe(void)
 static void set_timer_irqs(struct kvm *kvm, int vtimer_irq, int ptimer_irq)
 {
        struct kvm_vcpu *vcpu;
-       int i;
+       unsigned long i;
 
        kvm_for_each_vcpu(i, vcpu, kvm) {
                vcpu_vtimer(vcpu)->irq.irq = vtimer_irq;
index 362b10cb992c4e4b23e5ec47185ff7b6f70bfad0..b6e65c6eb1d35acc4d65bd253a02a5856516607b 100644 (file)
@@ -631,7 +631,7 @@ bool kvm_arch_intc_initialized(struct kvm *kvm)
 
 void kvm_arm_halt_guest(struct kvm *kvm)
 {
-       int i;
+       unsigned long i;
        struct kvm_vcpu *vcpu;
 
        kvm_for_each_vcpu(i, vcpu, kvm)
@@ -641,7 +641,7 @@ void kvm_arm_halt_guest(struct kvm *kvm)
 
 void kvm_arm_resume_guest(struct kvm *kvm)
 {
-       int i;
+       unsigned long i;
        struct kvm_vcpu *vcpu;
 
        kvm_for_each_vcpu(i, vcpu, kvm) {
@@ -2027,7 +2027,7 @@ static int finalize_hyp_mode(void)
 struct kvm_vcpu *kvm_mpidr_to_vcpu(struct kvm *kvm, unsigned long mpidr)
 {
        struct kvm_vcpu *vcpu;
-       int i;
+       unsigned long i;
 
        mpidr &= MPIDR_HWID_BITMASK;
        kvm_for_each_vcpu(i, vcpu, kvm) {
index a5e4bbf5e68f9afc5a5d415bdb4788329b96920e..0404357705a80d7211a73d6fe13c639d5772dabc 100644 (file)
@@ -900,7 +900,7 @@ static int kvm_arm_pmu_v3_init(struct kvm_vcpu *vcpu)
  */
 static bool pmu_irq_is_valid(struct kvm *kvm, int irq)
 {
-       int i;
+       unsigned long i;
        struct kvm_vcpu *vcpu;
 
        kvm_for_each_vcpu(i, vcpu, kvm) {
index 74c47d420253443c8c116e5f4fab182e37d3019f..ed675fce8fb791121aa00bdba8d25bd1d0901743 100644 (file)
@@ -121,8 +121,8 @@ static unsigned long kvm_psci_vcpu_on(struct kvm_vcpu *source_vcpu)
 
 static unsigned long kvm_psci_vcpu_affinity_info(struct kvm_vcpu *vcpu)
 {
-       int i, matching_cpus = 0;
-       unsigned long mpidr;
+       int matching_cpus = 0;
+       unsigned long i, mpidr;
        unsigned long target_affinity;
        unsigned long target_affinity_mask;
        unsigned long lowest_affinity_level;
@@ -164,7 +164,7 @@ static unsigned long kvm_psci_vcpu_affinity_info(struct kvm_vcpu *vcpu)
 
 static void kvm_prepare_system_event(struct kvm_vcpu *vcpu, u32 type)
 {
-       int i;
+       unsigned long i;
        struct kvm_vcpu *tmp;
 
        /*
index 426bd7fbc3fd5620897f5b5cc5952ea20ae4174a..97de30a79770b19f474bd0b0ffebb49801cede7d 100644 (file)
@@ -170,7 +170,7 @@ static bool vcpu_allowed_register_width(struct kvm_vcpu *vcpu)
 {
        struct kvm_vcpu *tmp;
        bool is32bit;
-       int i;
+       unsigned long i;
 
        is32bit = vcpu_has_feature(vcpu, KVM_ARM_VCPU_EL1_32BIT);
        if (!cpus_have_const_cap(ARM64_HAS_32BIT_EL1) && is32bit)
index 0a06d0648970909f9e46245a4d13657ce9aa2bfa..a7382bda967687ba7a3ddca5435d8bde098433cf 100644 (file)
@@ -70,8 +70,9 @@ void kvm_vgic_early_init(struct kvm *kvm)
  */
 int kvm_vgic_create(struct kvm *kvm, u32 type)
 {
-       int i, ret;
        struct kvm_vcpu *vcpu;
+       unsigned long i;
+       int ret;
 
        if (irqchip_in_kernel(kvm))
                return -EEXIST;
@@ -255,7 +256,8 @@ int vgic_init(struct kvm *kvm)
 {
        struct vgic_dist *dist = &kvm->arch.vgic;
        struct kvm_vcpu *vcpu;
-       int ret = 0, i, idx;
+       int ret = 0, i;
+       unsigned long idx;
 
        if (vgic_initialized(kvm))
                return 0;
@@ -308,7 +310,7 @@ int vgic_init(struct kvm *kvm)
                        goto out;
        }
 
-       kvm_for_each_vcpu(i, vcpu, kvm)
+       kvm_for_each_vcpu(idx, vcpu, kvm)
                kvm_vgic_vcpu_enable(vcpu);
 
        ret = kvm_vgic_setup_default_irq_routing(kvm);
@@ -370,7 +372,7 @@ void kvm_vgic_vcpu_destroy(struct kvm_vcpu *vcpu)
 static void __kvm_vgic_destroy(struct kvm *kvm)
 {
        struct kvm_vcpu *vcpu;
-       int i;
+       unsigned long i;
 
        vgic_debug_destroy(kvm);
 
index 0d000d2fe8d284f02f9641332ada7e6ddd9c3649..c6d52a1fd9c88b72939618de217fc5cef4f2f0eb 100644 (file)
@@ -325,7 +325,7 @@ void unlock_all_vcpus(struct kvm *kvm)
 bool lock_all_vcpus(struct kvm *kvm)
 {
        struct kvm_vcpu *tmp_vcpu;
-       int c;
+       unsigned long c;
 
        /*
         * Any time a vcpu is run, vcpu_load is called which tries to grab the
index 5f9014ae595b72a12bd6c9aaa200097d9d5bfe31..12e4c223e6b8cdfa86d395d19b4b64a4f7ea36b6 100644 (file)
@@ -113,9 +113,8 @@ static void vgic_mmio_write_sgir(struct kvm_vcpu *source_vcpu,
        int intid = val & 0xf;
        int targets = (val >> 16) & 0xff;
        int mode = (val >> 24) & 0x03;
-       int c;
        struct kvm_vcpu *vcpu;
-       unsigned long flags;
+       unsigned long flags, c;
 
        switch (mode) {
        case 0x0:               /* as specified by targets */
index bf7ec4a78497c9da44b49062fd5bc3e14f2967c1..82906cb3f7131103325ee3b9399a8797c4fc0ff2 100644 (file)
@@ -754,7 +754,8 @@ static void vgic_unregister_redist_iodev(struct kvm_vcpu *vcpu)
 static int vgic_register_all_redist_iodevs(struct kvm *kvm)
 {
        struct kvm_vcpu *vcpu;
-       int c, ret = 0;
+       unsigned long c;
+       int ret = 0;
 
        kvm_for_each_vcpu(c, vcpu, kvm) {
                ret = vgic_register_redist_iodev(vcpu);
@@ -995,10 +996,10 @@ void vgic_v3_dispatch_sgi(struct kvm_vcpu *vcpu, u64 reg, bool allow_group1)
        struct kvm_vcpu *c_vcpu;
        u16 target_cpus;
        u64 mpidr;
-       int sgi, c;
+       int sgi;
        int vcpu_id = vcpu->vcpu_id;
        bool broadcast;
-       unsigned long flags;
+       unsigned long c, flags;
 
        sgi = (reg & ICC_SGI1R_SGI_ID_MASK) >> ICC_SGI1R_SGI_ID_SHIFT;
        broadcast = reg & BIT_ULL(ICC_SGI1R_IRQ_ROUTING_MODE_BIT);
index 04f62c4b07fb5f590849261107c2b83aaed07767..5fedaee15e725812bb182728cdf831e87b25a2eb 100644 (file)
@@ -542,13 +542,13 @@ int vgic_v3_map_resources(struct kvm *kvm)
        struct vgic_dist *dist = &kvm->arch.vgic;
        struct kvm_vcpu *vcpu;
        int ret = 0;
-       int c;
+       unsigned long c;
 
        kvm_for_each_vcpu(c, vcpu, kvm) {
                struct vgic_cpu *vgic_cpu = &vcpu->arch.vgic_cpu;
 
                if (IS_VGIC_ADDR_UNDEF(vgic_cpu->rd_iodev.base_addr)) {
-                       kvm_debug("vcpu %d redistributor base not set\n", c);
+                       kvm_debug("vcpu %ld redistributor base not set\n", c);
                        return -ENXIO;
                }
        }
index 772dd15a22c7ccd32f9faf1f621f7d0616dbb5d9..ad06ba6c9b0091c911c84903d455cfa53e056b8e 100644 (file)
@@ -189,7 +189,7 @@ void vgic_v4_configure_vsgis(struct kvm *kvm)
 {
        struct vgic_dist *dist = &kvm->arch.vgic;
        struct kvm_vcpu *vcpu;
-       int i;
+       unsigned long i;
 
        kvm_arm_halt_guest(kvm);
 
@@ -235,7 +235,8 @@ int vgic_v4_init(struct kvm *kvm)
 {
        struct vgic_dist *dist = &kvm->arch.vgic;
        struct kvm_vcpu *vcpu;
-       int i, nr_vcpus, ret;
+       int nr_vcpus, ret;
+       unsigned long i;
 
        if (!kvm_vgic_global_state.has_gicv4)
                return 0; /* Nothing to see here... move along. */
index 5dad4996cfb22bd6d71940bb86ccc3c5e38167a9..9b98876a8a93891c89e2153c5d4f3b7d120b3427 100644 (file)
@@ -990,7 +990,7 @@ int kvm_vgic_vcpu_pending_irq(struct kvm_vcpu *vcpu)
 void vgic_kick_vcpus(struct kvm *kvm)
 {
        struct kvm_vcpu *vcpu;
-       int c;
+       unsigned long c;
 
        /*
         * We've injected an interrupt, time to find out who deserves
index 3fbd570f9c1ecb8b5c87f4aa2416913045ad376c..0215f32932a930bd0809010bb83e45f2ade71558 100644 (file)
@@ -337,7 +337,7 @@ static void kvmppc_mmu_book3s_32_mtsrin(struct kvm_vcpu *vcpu, u32 srnum,
 
 static void kvmppc_mmu_book3s_32_tlbie(struct kvm_vcpu *vcpu, ulong ea, bool large)
 {
-       int i;
+       unsigned long i;
        struct kvm_vcpu *v;
 
        /* flush this VA on all cpus */
index feee40cb2ba1b3ff9cf32241656543c06119748a..61290282fd9ebfd107648851aa85846bef041718 100644 (file)
@@ -530,7 +530,7 @@ static void kvmppc_mmu_book3s_64_tlbie(struct kvm_vcpu *vcpu, ulong va,
                                       bool large)
 {
        u64 mask = 0xFFFFFFFFFULL;
-       long i;
+       unsigned long i;
        struct kvm_vcpu *v;
 
        dprintk("KVM MMU: tlbie(0x%lx)\n", va);
index 7b74fc0a986b88b0f04b6ee8d4cdb482acfc1c5f..32873c6985f9a36b258f997f1625700784711bfb 100644 (file)
@@ -1993,7 +1993,7 @@ static void kvmppc_set_lpcr(struct kvm_vcpu *vcpu, u64 new_lpcr,
         */
        if ((new_lpcr & LPCR_ILE) != (vc->lpcr & LPCR_ILE)) {
                struct kvm_vcpu *vcpu;
-               int i;
+               unsigned long i;
 
                kvm_for_each_vcpu(i, vcpu, kvm) {
                        if (vcpu->arch.vcore != vc)
@@ -4786,8 +4786,8 @@ static int kvm_vm_ioctl_get_dirty_log_hv(struct kvm *kvm,
 {
        struct kvm_memslots *slots;
        struct kvm_memory_slot *memslot;
-       int i, r;
-       unsigned long n;
+       int r;
+       unsigned long n, i;
        unsigned long *buf, *p;
        struct kvm_vcpu *vcpu;
 
@@ -5861,7 +5861,7 @@ static int kvmhv_svm_off(struct kvm *kvm)
        int mmu_was_ready;
        int srcu_idx;
        int ret = 0;
-       int i;
+       unsigned long i;
 
        if (!(kvm->arch.secure_guest & KVMPPC_SECURE_INIT_START))
                return ret;
index 6bc9425acb322768e7c1b75f88314d83b295341a..bb0612c49b92b1029bb78fedda2c9316b549ae53 100644 (file)
@@ -428,7 +428,7 @@ static int kvmppc_core_check_requests_pr(struct kvm_vcpu *vcpu)
 /************* MMU Notifiers *************/
 static bool do_kvm_unmap_gfn(struct kvm *kvm, struct kvm_gfn_range *range)
 {
-       long i;
+       unsigned long i;
        struct kvm_vcpu *vcpu;
 
        kvm_for_each_vcpu(i, vcpu, kvm)
index ebd5d920de8c1ef3db90ab320185381ddc003ef6..9cc466006e8bb57331d3564c6c5043746ccd7591 100644 (file)
@@ -942,8 +942,8 @@ static int xics_debug_show(struct seq_file *m, void *private)
        struct kvmppc_xics *xics = m->private;
        struct kvm *kvm = xics->kvm;
        struct kvm_vcpu *vcpu;
-       int icsid, i;
-       unsigned long flags;
+       int icsid;
+       unsigned long flags, i;
        unsigned long t_rm_kick_vcpu, t_rm_check_resend;
        unsigned long t_rm_notify_eoi;
        unsigned long t_reject, t_check_resend;
@@ -1340,7 +1340,7 @@ static int xics_has_attr(struct kvm_device *dev, struct kvm_device_attr *attr)
 static void kvmppc_xics_release(struct kvm_device *dev)
 {
        struct kvmppc_xics *xics = dev->private;
-       int i;
+       unsigned long i;
        struct kvm *kvm = xics->kvm;
        struct kvm_vcpu *vcpu;
 
index 6231f76bdd66b9278f1fe0085aaf5125cc79e063..8e4c79e2fcd84a8b9f80c8c9ddab3cd541b15fe3 100644 (file)
@@ -116,7 +116,7 @@ static inline struct kvmppc_icp *kvmppc_xics_find_server(struct kvm *kvm,
                                                         u32 nr)
 {
        struct kvm_vcpu *vcpu = NULL;
-       int i;
+       unsigned long i;
 
        kvm_for_each_vcpu(i, vcpu, kvm) {
                if (vcpu->arch.icp && nr == vcpu->arch.icp->server_num)
index 225008882958bb336ea8e4aceeedcd85ccf2e8cc..e216c068075d7d69ea1bd623c5532b80cdcc2c90 100644 (file)
@@ -368,7 +368,8 @@ static int xive_check_provisioning(struct kvm *kvm, u8 prio)
 {
        struct kvmppc_xive *xive = kvm->arch.xive;
        struct kvm_vcpu *vcpu;
-       int i, rc;
+       unsigned long i;
+       int rc;
 
        lockdep_assert_held(&xive->lock);
 
@@ -439,7 +440,8 @@ static int xive_try_pick_queue(struct kvm_vcpu *vcpu, u8 prio)
 int kvmppc_xive_select_target(struct kvm *kvm, u32 *server, u8 prio)
 {
        struct kvm_vcpu *vcpu;
-       int i, rc;
+       unsigned long i;
+       int rc;
 
        /* Locate target server */
        vcpu = kvmppc_xive_find_server(kvm, *server);
@@ -1519,7 +1521,8 @@ static void xive_pre_save_queue(struct kvmppc_xive *xive, struct xive_q *q)
 static void xive_pre_save_scan(struct kvmppc_xive *xive)
 {
        struct kvm_vcpu *vcpu = NULL;
-       int i, j;
+       unsigned long i;
+       int j;
 
        /*
         * See comment in xive_get_source() about how this
@@ -1700,7 +1703,7 @@ static bool xive_check_delayed_irq(struct kvmppc_xive *xive, u32 irq)
 {
        struct kvm *kvm = xive->kvm;
        struct kvm_vcpu *vcpu = NULL;
-       int i;
+       unsigned long i;
 
        kvm_for_each_vcpu(i, vcpu, kvm) {
                struct kvmppc_xive_vcpu *xc = vcpu->arch.xive_vcpu;
@@ -2037,7 +2040,7 @@ static void kvmppc_xive_release(struct kvm_device *dev)
        struct kvmppc_xive *xive = dev->private;
        struct kvm *kvm = xive->kvm;
        struct kvm_vcpu *vcpu;
-       int i;
+       unsigned long i;
 
        pr_devel("Releasing xive device\n");
 
@@ -2291,7 +2294,7 @@ static int xive_debug_show(struct seq_file *m, void *private)
        u64 t_vm_h_cppr = 0;
        u64 t_vm_h_eoi = 0;
        u64 t_vm_h_ipi = 0;
-       unsigned int i;
+       unsigned long i;
 
        if (!kvm)
                return 0;
index e6a9651c6f1e2c04a1414231629700495cee00d0..09d0657596c329b9aeb334816f04b9fac4bdca81 100644 (file)
@@ -199,7 +199,7 @@ struct kvmppc_xive_vcpu {
 static inline struct kvm_vcpu *kvmppc_xive_find_server(struct kvm *kvm, u32 nr)
 {
        struct kvm_vcpu *vcpu = NULL;
-       int i;
+       unsigned long i;
 
        kvm_for_each_vcpu(i, vcpu, kvm) {
                if (vcpu->arch.xive_vcpu && nr == vcpu->arch.xive_vcpu->server_num)
@@ -240,7 +240,7 @@ static inline u32 kvmppc_xive_vp(struct kvmppc_xive *xive, u32 server)
 static inline bool kvmppc_xive_vp_in_use(struct kvm *kvm, u32 vp_id)
 {
        struct kvm_vcpu *vcpu = NULL;
-       int i;
+       unsigned long i;
 
        kvm_for_each_vcpu(i, vcpu, kvm) {
                if (vcpu->arch.xive_vcpu && vp_id == vcpu->arch.xive_vcpu->vp_id)
index 99db9ac49901b853d3b01ba3049b2b1244e3fdaa..561a5bfe0468f1c8ea52ee537e0dbf193df6062f 100644 (file)
@@ -807,7 +807,7 @@ static int kvmppc_xive_reset(struct kvmppc_xive *xive)
 {
        struct kvm *kvm = xive->kvm;
        struct kvm_vcpu *vcpu;
-       unsigned int i;
+       unsigned long i;
 
        pr_devel("%s\n", __func__);
 
@@ -916,7 +916,7 @@ static int kvmppc_xive_native_eq_sync(struct kvmppc_xive *xive)
 {
        struct kvm *kvm = xive->kvm;
        struct kvm_vcpu *vcpu;
-       unsigned int i;
+       unsigned long i;
 
        pr_devel("%s\n", __func__);
 
@@ -1017,7 +1017,7 @@ static void kvmppc_xive_native_release(struct kvm_device *dev)
        struct kvmppc_xive *xive = dev->private;
        struct kvm *kvm = xive->kvm;
        struct kvm_vcpu *vcpu;
-       int i;
+       unsigned long i;
 
        pr_devel("Releasing xive native device\n");
 
@@ -1214,7 +1214,7 @@ static int xive_native_debug_show(struct seq_file *m, void *private)
        struct kvmppc_xive *xive = m->private;
        struct kvm *kvm = xive->kvm;
        struct kvm_vcpu *vcpu;
-       unsigned int i;
+       unsigned long i;
 
        if (!kvm)
                return 0;
index 64eb833e9f0234d32cd1360f9215080310d5815a..051102d50c314a1347b71159ad340810aa4a5681 100644 (file)
@@ -65,7 +65,7 @@ static int kvmppc_e500_emul_msgsnd(struct kvm_vcpu *vcpu, int rb)
        ulong param = vcpu->arch.regs.gpr[rb];
        int prio = dbell2prio(rb);
        int pir = param & PPC_DBELL_PIR_MASK;
-       int i;
+       unsigned long i;
        struct kvm_vcpu *cvcpu;
 
        if (prio < 0)
index 3b0e703d22cfb2da3b41f5cf6bb1ae7789888f02..d0d2bcab2f7b1e8c6aed8c9248646a2982457ae3 100644 (file)
@@ -60,7 +60,7 @@ int kvm_riscv_vcpu_sbi_return(struct kvm_vcpu *vcpu, struct kvm_run *run)
 static void kvm_sbi_system_shutdown(struct kvm_vcpu *vcpu,
                                    struct kvm_run *run, u32 type)
 {
-       int i;
+       unsigned long i;
        struct kvm_vcpu *tmp;
 
        kvm_for_each_vcpu(i, tmp, vcpu->kvm)
index 2c6253b293bcb5a1a7a1d4aa212816e659f30bd5..807228f8f409662b285e3f334115ba7cb2b14bc6 100644 (file)
@@ -65,7 +65,7 @@ bool kvm_riscv_stage2_vmid_ver_changed(struct kvm_vmid *vmid)
 
 void kvm_riscv_stage2_vmid_update(struct kvm_vcpu *vcpu)
 {
-       int i;
+       unsigned long i;
        struct kvm_vcpu *v;
        struct cpumask hmask;
        struct kvm_vmid *vmid = &vcpu->kvm->arch.vmid;
index c3bd993fdd0cf2987c19cf57ee3e1bc009efcdc9..1aa094810f6d8c9e2cc9778d27416fab936495fb 100644 (file)
@@ -2659,7 +2659,7 @@ static int flic_ais_mode_set_all(struct kvm *kvm, struct kvm_device_attr *attr)
 static int flic_set_attr(struct kvm_device *dev, struct kvm_device_attr *attr)
 {
        int r = 0;
-       unsigned int i;
+       unsigned long i;
        struct kvm_vcpu *vcpu;
 
        switch (attr->group) {
index 7a0f5abaa4846102916d14c0a5f1498deec3d3ac..fd5f4ec1b4b99584e0153d4da863507724012d74 100644 (file)
@@ -295,7 +295,7 @@ static int kvm_clock_sync(struct notifier_block *notifier, unsigned long val,
 {
        struct kvm *kvm;
        struct kvm_vcpu *vcpu;
-       int i;
+       unsigned long i;
        unsigned long long *delta = v;
 
        list_for_each_entry(kvm, &vm_list, vm_list) {
@@ -682,7 +682,7 @@ out:
 
 static void icpt_operexc_on_all_vcpus(struct kvm *kvm)
 {
-       unsigned int i;
+       unsigned long i;
        struct kvm_vcpu *vcpu;
 
        kvm_for_each_vcpu(i, vcpu, kvm) {
@@ -936,7 +936,7 @@ static void kvm_s390_vcpu_crypto_setup(struct kvm_vcpu *vcpu);
 void kvm_s390_vcpu_crypto_reset_all(struct kvm *kvm)
 {
        struct kvm_vcpu *vcpu;
-       int i;
+       unsigned long i;
 
        kvm_s390_vcpu_block_all(kvm);
 
@@ -1021,7 +1021,7 @@ static int kvm_s390_vm_set_crypto(struct kvm *kvm, struct kvm_device_attr *attr)
 
 static void kvm_s390_sync_request_broadcast(struct kvm *kvm, int req)
 {
-       int cx;
+       unsigned long cx;
        struct kvm_vcpu *vcpu;
 
        kvm_for_each_vcpu(cx, vcpu, kvm)
@@ -2206,7 +2206,7 @@ static int kvm_s390_cpus_from_pv(struct kvm *kvm, u16 *rcp, u16 *rrcp)
        struct kvm_vcpu *vcpu;
        u16 rc, rrc;
        int ret = 0;
-       int i;
+       unsigned long i;
 
        /*
         * We ignore failures and try to destroy as many CPUs as possible.
@@ -2230,7 +2230,8 @@ static int kvm_s390_cpus_from_pv(struct kvm *kvm, u16 *rcp, u16 *rrcp)
 
 static int kvm_s390_cpus_to_pv(struct kvm *kvm, u16 *rc, u16 *rrc)
 {
-       int i, r = 0;
+       unsigned long i;
+       int r = 0;
        u16 dummy;
 
        struct kvm_vcpu *vcpu;
@@ -2929,7 +2930,7 @@ static int sca_switch_to_extended(struct kvm *kvm)
        struct bsca_block *old_sca = kvm->arch.sca;
        struct esca_block *new_sca;
        struct kvm_vcpu *vcpu;
-       unsigned int vcpu_idx;
+       unsigned long vcpu_idx;
        u32 scaol, scaoh;
 
        if (kvm->arch.use_esca)
@@ -3411,7 +3412,7 @@ static void kvm_gmap_notifier(struct gmap *gmap, unsigned long start,
        struct kvm *kvm = gmap->private;
        struct kvm_vcpu *vcpu;
        unsigned long prefix;
-       int i;
+       unsigned long i;
 
        if (gmap_is_shadow(gmap))
                return;
@@ -3904,7 +3905,7 @@ void kvm_s390_set_tod_clock(struct kvm *kvm,
 {
        struct kvm_vcpu *vcpu;
        union tod_clock clk;
-       int i;
+       unsigned long i;
 
        mutex_lock(&kvm->lock);
        preempt_disable();
@@ -4536,7 +4537,7 @@ static void __disable_ibs_on_vcpu(struct kvm_vcpu *vcpu)
 
 static void __disable_ibs_on_all_vcpus(struct kvm *kvm)
 {
-       unsigned int i;
+       unsigned long i;
        struct kvm_vcpu *vcpu;
 
        kvm_for_each_vcpu(i, vcpu, kvm) {
index c07a050d757d3c5450b76d6f6dd84672d328c2bb..b887fe7a7064b93239328aadeded211b0e042a8e 100644 (file)
@@ -357,7 +357,7 @@ int kvm_s390_handle_diag(struct kvm_vcpu *vcpu);
 
 static inline void kvm_s390_vcpu_block_all(struct kvm *kvm)
 {
-       int i;
+       unsigned long i;
        struct kvm_vcpu *vcpu;
 
        WARN_ON(!mutex_is_locked(&kvm->lock));
@@ -367,7 +367,7 @@ static inline void kvm_s390_vcpu_block_all(struct kvm *kvm)
 
 static inline void kvm_s390_vcpu_unblock_all(struct kvm *kvm)
 {
-       int i;
+       unsigned long i;
        struct kvm_vcpu *vcpu;
 
        kvm_for_each_vcpu(i, vcpu, kvm)
index 5e19e6e4c2ce0b5d357ce04eccb5a7cecf9c478b..7179fa645edaa99cb6c6423f1063f30b3223f6ca 100644 (file)
@@ -164,7 +164,7 @@ static int synic_set_sint(struct kvm_vcpu_hv_synic *synic, int sint,
 static struct kvm_vcpu *get_vcpu_by_vpidx(struct kvm *kvm, u32 vpidx)
 {
        struct kvm_vcpu *vcpu = NULL;
-       int i;
+       unsigned long i;
 
        if (vpidx >= KVM_MAX_VCPUS)
                return NULL;
@@ -1716,7 +1716,8 @@ static __always_inline unsigned long *sparse_set_to_vcpu_mask(
 {
        struct kvm_hv *hv = to_kvm_hv(kvm);
        struct kvm_vcpu *vcpu;
-       int i, bank, sbank = 0;
+       int bank, sbank = 0;
+       unsigned long i;
 
        memset(vp_bitmap, 0,
               KVM_HV_MAX_SPARSE_VCPU_SET_BITS * sizeof(*vp_bitmap));
@@ -1863,7 +1864,7 @@ static void kvm_send_ipi_to_many(struct kvm *kvm, u32 vector,
                .vector = vector
        };
        struct kvm_vcpu *vcpu;
-       int i;
+       unsigned long i;
 
        kvm_for_each_vcpu(i, vcpu, kvm) {
                if (vcpu_bitmap && !test_bit(i, vcpu_bitmap))
index 5a69cce4d72d7e12ac936cd2f9a9ef35421133ac..0b65a764ed3a1741b6fa550ecb469f800621d327 100644 (file)
@@ -242,7 +242,7 @@ static void pit_do_work(struct kthread_work *work)
        struct kvm_pit *pit = container_of(work, struct kvm_pit, expired);
        struct kvm *kvm = pit->kvm;
        struct kvm_vcpu *vcpu;
-       int i;
+       unsigned long i;
        struct kvm_kpit_state *ps = &pit->pit_state;
 
        if (atomic_read(&ps->reinject) && !atomic_xchg(&ps->irq_ack, 0))
index 0b80263d46d85ddace074f055d946cb3b5ab14a4..814064d06016c40470638e6005c4850e96fc543c 100644 (file)
@@ -50,7 +50,7 @@ static void pic_unlock(struct kvm_pic *s)
 {
        bool wakeup = s->wakeup_needed;
        struct kvm_vcpu *vcpu;
-       int i;
+       unsigned long i;
 
        s->wakeup_needed = false;
 
@@ -270,7 +270,8 @@ int kvm_pic_read_irq(struct kvm *kvm)
 
 static void kvm_pic_reset(struct kvm_kpic_state *s)
 {
-       int irq, i;
+       int irq;
+       unsigned long i;
        struct kvm_vcpu *vcpu;
        u8 edge_irr = s->irr & ~s->elcr;
        bool found = false;
index 816a82515dcd86ad25229243ad9b935dcf633340..decfa36b7891d90035f9844e39faa3b5f8576e64 100644 (file)
@@ -149,7 +149,7 @@ void kvm_rtc_eoi_tracking_restore_one(struct kvm_vcpu *vcpu)
 static void kvm_rtc_eoi_tracking_restore_all(struct kvm_ioapic *ioapic)
 {
        struct kvm_vcpu *vcpu;
-       int i;
+       unsigned long i;
 
        if (RTC_GSI >= IOAPIC_NUM_PINS)
                return;
@@ -184,7 +184,7 @@ static bool rtc_irq_check_coalesced(struct kvm_ioapic *ioapic)
 
 static void ioapic_lazy_update_eoi(struct kvm_ioapic *ioapic, int irq)
 {
-       int i;
+       unsigned long i;
        struct kvm_vcpu *vcpu;
        union kvm_ioapic_redirect_entry *entry = &ioapic->redirtbl[irq];
 
index d5b72a08e566ca9faeff77d672d228669b47b452..39ad02d6dc63fbbca6350972365688e8d72ad771 100644 (file)
@@ -45,9 +45,9 @@ static int kvm_set_ioapic_irq(struct kvm_kernel_irq_routing_entry *e,
 int kvm_irq_delivery_to_apic(struct kvm *kvm, struct kvm_lapic *src,
                struct kvm_lapic_irq *irq, struct dest_map *dest_map)
 {
-       int i, r = -1;
+       int r = -1;
        struct kvm_vcpu *vcpu, *lowest = NULL;
-       unsigned long dest_vcpu_bitmap[BITS_TO_LONGS(KVM_MAX_VCPUS)];
+       unsigned long i, dest_vcpu_bitmap[BITS_TO_LONGS(KVM_MAX_VCPUS)];
        unsigned int dest_vcpus = 0;
 
        if (kvm_irq_delivery_to_apic_fast(kvm, src, irq, &r, dest_map))
@@ -320,7 +320,8 @@ int kvm_set_routing_entry(struct kvm *kvm,
 bool kvm_intr_is_single_vcpu(struct kvm *kvm, struct kvm_lapic_irq *irq,
                             struct kvm_vcpu **dest_vcpu)
 {
-       int i, r = 0;
+       int r = 0;
+       unsigned long i;
        struct kvm_vcpu *vcpu;
 
        if (kvm_intr_is_single_vcpu_fast(kvm, irq, dest_vcpu))
index c7db2df50a7abb9ba9bd8692815d5d989cf51912..b469f45e3fe4a039075dd0253f3d8f75c1264c02 100644 (file)
@@ -33,7 +33,8 @@ int hv_remote_flush_tlb_with_range(struct kvm *kvm,
 {
        struct kvm_arch *kvm_arch = &kvm->arch;
        struct kvm_vcpu *vcpu;
-       int ret = 0, i, nr_unique_valid_roots;
+       int ret = 0, nr_unique_valid_roots;
+       unsigned long i;
        hpa_t root;
 
        spin_lock(&kvm_arch->hv_root_tdp_lock);
index f206fc35deff6ef4d0a236eddd4476635d4e5b1f..451e80306b51578c684db8f35d32ade0543ee270 100644 (file)
@@ -185,7 +185,7 @@ void kvm_recalculate_apic_map(struct kvm *kvm)
 {
        struct kvm_apic_map *new, *old = NULL;
        struct kvm_vcpu *vcpu;
-       int i;
+       unsigned long i;
        u32 max_id = 255; /* enough space for any xAPIC ID */
 
        /* Read kvm->arch.apic_map_dirty before kvm->arch.apic_map.  */
@@ -1172,8 +1172,8 @@ void kvm_bitmap_or_dest_vcpus(struct kvm *kvm, struct kvm_lapic_irq *irq,
        struct kvm_lapic *src = NULL;
        struct kvm_apic_map *map;
        struct kvm_vcpu *vcpu;
-       unsigned long bitmap;
-       int i, vcpu_idx;
+       unsigned long bitmap, i;
+       int vcpu_idx;
        bool ret;
 
        rcu_read_lock();
index 8f9af7b7dbbe479fbf914d7c27afdb2d77eb7513..b7200595cbd4316d56e136eac2863a5b29413abc 100644 (file)
@@ -293,7 +293,7 @@ static void avic_kick_target_vcpus(struct kvm *kvm, struct kvm_lapic *source,
                                   u32 icrl, u32 icrh)
 {
        struct kvm_vcpu *vcpu;
-       int i;
+       unsigned long i;
 
        kvm_for_each_vcpu(i, vcpu, kvm) {
                bool m = kvm_apic_match_dest(vcpu, source,
index 7656a2c5662a68425716469b4f94cb164368cb01..3225533222024b294173fc673273c96af82f912c 100644 (file)
@@ -636,7 +636,8 @@ static int __sev_launch_update_vmsa(struct kvm *kvm, struct kvm_vcpu *vcpu,
 static int sev_launch_update_vmsa(struct kvm *kvm, struct kvm_sev_cmd *argp)
 {
        struct kvm_vcpu *vcpu;
-       int i, ret;
+       unsigned long i;
+       int ret;
 
        if (!sev_es_guest(kvm))
                return -ENOTTY;
@@ -1593,7 +1594,7 @@ static void sev_unlock_two_vms(struct kvm *dst_kvm, struct kvm *src_kvm)
 static int sev_lock_vcpus_for_migration(struct kvm *kvm)
 {
        struct kvm_vcpu *vcpu;
-       int i, j;
+       unsigned long i, j;
 
        kvm_for_each_vcpu(i, vcpu, kvm) {
                if (mutex_lock_killable(&vcpu->mutex))
@@ -1615,7 +1616,7 @@ out_unlock:
 static void sev_unlock_vcpus_for_migration(struct kvm *kvm)
 {
        struct kvm_vcpu *vcpu;
-       int i;
+       unsigned long i;
 
        kvm_for_each_vcpu(i, vcpu, kvm) {
                mutex_unlock(&vcpu->mutex);
@@ -1642,7 +1643,7 @@ static void sev_migrate_from(struct kvm_sev_info *dst,
 
 static int sev_es_migrate_from(struct kvm *dst, struct kvm *src)
 {
-       int i;
+       unsigned long i;
        struct kvm_vcpu *dst_vcpu, *src_vcpu;
        struct vcpu_svm *dst_svm, *src_svm;
 
index 0e6d11a726cd94743c1cac3ecfd970fcabad10cd..96bcf2035bdcd6c94a260ac969c41c1141c3d22c 100644 (file)
@@ -2816,7 +2816,7 @@ static void kvm_end_pvclock_update(struct kvm *kvm)
 {
        struct kvm_arch *ka = &kvm->arch;
        struct kvm_vcpu *vcpu;
-       int i;
+       unsigned long i;
 
        write_seqcount_end(&ka->pvclock_sc);
        raw_spin_unlock_irq(&ka->tsc_write_lock);
@@ -3065,7 +3065,7 @@ static int kvm_guest_time_update(struct kvm_vcpu *v)
 
 static void kvmclock_update_fn(struct work_struct *work)
 {
-       int i;
+       unsigned long i;
        struct delayed_work *dwork = to_delayed_work(work);
        struct kvm_arch *ka = container_of(dwork, struct kvm_arch,
                                           kvmclock_update_work);
@@ -5692,7 +5692,7 @@ void kvm_arch_sync_dirty_log(struct kvm *kvm, struct kvm_memory_slot *memslot)
         * VM-Exit.
         */
        struct kvm_vcpu *vcpu;
-       int i;
+       unsigned long i;
 
        kvm_for_each_vcpu(i, vcpu, kvm)
                kvm_vcpu_kick(vcpu);
@@ -5961,7 +5961,8 @@ static int kvm_vm_ioctl_set_msr_filter(struct kvm *kvm, void __user *argp)
 static int kvm_arch_suspend_notifier(struct kvm *kvm)
 {
        struct kvm_vcpu *vcpu;
-       int i, ret = 0;
+       unsigned long i;
+       int ret = 0;
 
        mutex_lock(&kvm->lock);
        kvm_for_each_vcpu(i, vcpu, kvm) {
@@ -8388,7 +8389,8 @@ static void __kvmclock_cpufreq_notifier(struct cpufreq_freqs *freq, int cpu)
 {
        struct kvm *kvm;
        struct kvm_vcpu *vcpu;
-       int i, send_ipi = 0;
+       int send_ipi = 0;
+       unsigned long i;
 
        /*
         * We allow guests to temporarily run on slowing clocks,
@@ -8561,9 +8563,8 @@ static struct perf_guest_info_callbacks kvm_guest_cbs = {
 static void pvclock_gtod_update_fn(struct work_struct *work)
 {
        struct kvm *kvm;
-
        struct kvm_vcpu *vcpu;
-       int i;
+       unsigned long i;
 
        mutex_lock(&kvm_lock);
        list_for_each_entry(kvm, &vm_list, vm_list)
@@ -10672,7 +10673,7 @@ static void kvm_arch_vcpu_guestdbg_update_apicv_inhibit(struct kvm *kvm)
 {
        bool inhibit = false;
        struct kvm_vcpu *vcpu;
-       int i;
+       unsigned long i;
 
        down_write(&kvm->arch.apicv_update_lock);
 
@@ -11160,7 +11161,7 @@ int kvm_arch_hardware_enable(void)
 {
        struct kvm *kvm;
        struct kvm_vcpu *vcpu;
-       int i;
+       unsigned long i;
        int ret;
        u64 local_tsc;
        u64 max_tsc = 0;
@@ -11413,7 +11414,7 @@ static void kvm_unload_vcpu_mmu(struct kvm_vcpu *vcpu)
 
 static void kvm_free_vcpus(struct kvm *kvm)
 {
-       unsigned int i;
+       unsigned long i;
        struct kvm_vcpu *vcpu;
 
        /*
@@ -11659,7 +11660,7 @@ out_free:
 void kvm_arch_memslots_updated(struct kvm *kvm, u64 gen)
 {
        struct kvm_vcpu *vcpu;
-       int i;
+       unsigned long i;
 
        /*
         * memslots->generation has been incremented.
index 2201dc07126a318f643cea57c07c6d264eee63c7..7da6086262c6753eb35096ad61d71dcd84c592da 100644 (file)
@@ -714,7 +714,7 @@ static inline struct kvm_vcpu *kvm_get_vcpu(struct kvm *kvm, int i)
 static inline struct kvm_vcpu *kvm_get_vcpu_by_id(struct kvm *kvm, int id)
 {
        struct kvm_vcpu *vcpu = NULL;
-       int i;
+       unsigned long i;
 
        if (id < 0)
                return NULL;
index 594f90307b20e1edd6e69c242383d8d8b918887d..1c68384a7c4b8eec5dc9b18e1c4efff84c438bac 100644 (file)
@@ -305,8 +305,9 @@ bool kvm_make_all_cpus_request_except(struct kvm *kvm, unsigned int req,
 {
        struct kvm_vcpu *vcpu;
        struct cpumask *cpus;
+       unsigned long i;
        bool called;
-       int i, me;
+       int me;
 
        me = get_cpu();
 
@@ -453,7 +454,7 @@ static void kvm_vcpu_destroy(struct kvm_vcpu *vcpu)
 
 void kvm_destroy_vcpus(struct kvm *kvm)
 {
-       unsigned int i;
+       unsigned long i;
        struct kvm_vcpu *vcpu;
 
        kvm_for_each_vcpu(i, vcpu, kvm) {
@@ -3389,10 +3390,10 @@ void kvm_vcpu_on_spin(struct kvm_vcpu *me, bool yield_to_kernel_mode)
        struct kvm *kvm = me->kvm;
        struct kvm_vcpu *vcpu;
        int last_boosted_vcpu = me->kvm->last_boosted_vcpu;
+       unsigned long i;
        int yielded = 0;
        int try = 3;
        int pass;
-       int i;
 
        kvm_vcpu_set_in_spin_loop(me, true);
        /*
@@ -4201,7 +4202,7 @@ static int kvm_vm_ioctl_enable_dirty_log_ring(struct kvm *kvm, u32 size)
 
 static int kvm_vm_ioctl_reset_dirty_pages(struct kvm *kvm)
 {
-       int i;
+       unsigned long i;
        struct kvm_vcpu *vcpu;
        int cleared = 0;
 
@@ -5120,7 +5121,7 @@ static int kvm_clear_stat_per_vm(struct kvm *kvm, size_t offset)
 
 static int kvm_get_stat_per_vcpu(struct kvm *kvm, size_t offset, u64 *val)
 {
-       int i;
+       unsigned long i;
        struct kvm_vcpu *vcpu;
 
        *val = 0;
@@ -5133,7 +5134,7 @@ static int kvm_get_stat_per_vcpu(struct kvm *kvm, size_t offset, u64 *val)
 
 static int kvm_clear_stat_per_vcpu(struct kvm *kvm, size_t offset)
 {
-       int i;
+       unsigned long i;
        struct kvm_vcpu *vcpu;
 
        kvm_for_each_vcpu(i, vcpu, kvm)