Lines Matching refs:iter
36 static void iter_next(struct vgic_state_iter *iter) in iter_next() argument
38 if (iter->dist_id == 0) { in iter_next()
39 iter->dist_id++; in iter_next()
43 iter->intid++; in iter_next()
44 if (iter->intid == VGIC_NR_PRIVATE_IRQS && in iter_next()
45 ++iter->vcpu_id < iter->nr_cpus) in iter_next()
46 iter->intid = 0; in iter_next()
48 if (iter->intid >= (iter->nr_spis + VGIC_NR_PRIVATE_IRQS)) { in iter_next()
49 if (iter->lpi_idx < iter->nr_lpis) in iter_next()
50 iter->intid = iter->lpi_array[iter->lpi_idx]; in iter_next()
51 iter->lpi_idx++; in iter_next()
55 static void iter_init(struct kvm *kvm, struct vgic_state_iter *iter, in iter_init() argument
60 memset(iter, 0, sizeof(*iter)); in iter_init()
62 iter->nr_cpus = nr_cpus; in iter_init()
63 iter->nr_spis = kvm->arch.vgic.nr_spis; in iter_init()
65 iter->nr_lpis = vgic_copy_lpi_list(kvm, NULL, &iter->lpi_array); in iter_init()
66 if (iter->nr_lpis < 0) in iter_init()
67 iter->nr_lpis = 0; in iter_init()
72 iter_next(iter); in iter_init()
75 static bool end_of_vgic(struct vgic_state_iter *iter) in end_of_vgic() argument
77 return iter->dist_id > 0 && in end_of_vgic()
78 iter->vcpu_id == iter->nr_cpus && in end_of_vgic()
79 iter->intid >= (iter->nr_spis + VGIC_NR_PRIVATE_IRQS) && in end_of_vgic()
80 iter->lpi_idx > iter->nr_lpis; in end_of_vgic()
86 struct vgic_state_iter *iter; in vgic_debug_start() local
89 iter = kvm->arch.vgic.iter; in vgic_debug_start()
90 if (iter) { in vgic_debug_start()
91 iter = ERR_PTR(-EBUSY); in vgic_debug_start()
95 iter = kmalloc(sizeof(*iter), GFP_KERNEL); in vgic_debug_start()
96 if (!iter) { in vgic_debug_start()
97 iter = ERR_PTR(-ENOMEM); in vgic_debug_start()
101 iter_init(kvm, iter, *pos); in vgic_debug_start()
102 kvm->arch.vgic.iter = iter; in vgic_debug_start()
104 if (end_of_vgic(iter)) in vgic_debug_start()
105 iter = NULL; in vgic_debug_start()
108 return iter; in vgic_debug_start()
114 struct vgic_state_iter *iter = kvm->arch.vgic.iter; in vgic_debug_next() local
117 iter_next(iter); in vgic_debug_next()
118 if (end_of_vgic(iter)) in vgic_debug_next()
119 iter = NULL; in vgic_debug_next()
120 return iter; in vgic_debug_next()
126 struct vgic_state_iter *iter; in vgic_debug_stop() local
136 iter = kvm->arch.vgic.iter; in vgic_debug_stop()
137 kfree(iter->lpi_array); in vgic_debug_stop()
138 kfree(iter); in vgic_debug_stop()
139 kvm->arch.vgic.iter = NULL; in vgic_debug_stop()
233 struct vgic_state_iter *iter = v; in vgic_debug_show() local
238 if (iter->dist_id == 0) { in vgic_debug_show()
246 if (iter->vcpu_id < iter->nr_cpus) in vgic_debug_show()
247 vcpu = kvm_get_vcpu(kvm, iter->vcpu_id); in vgic_debug_show()
249 irq = vgic_get_irq(kvm, vcpu, iter->intid); in vgic_debug_show()
251 seq_printf(s, " LPI %4d freed\n", iter->intid); in vgic_debug_show()