Lines Matching refs:iter

35 static void iter_next(struct kvm *kvm, struct vgic_state_iter *iter)  in iter_next()  argument
39 if (iter->dist_id == 0) { in iter_next()
40 iter->dist_id++; in iter_next()
48 if (iter->intid >= (iter->nr_spis + VGIC_NR_PRIVATE_IRQS - 1) && in iter_next()
49 iter->nr_lpis) { in iter_next()
50 if (iter->lpi_idx < iter->nr_lpis) in iter_next()
51 xa_find_after(&dist->lpi_xa, &iter->intid, in iter_next()
54 iter->lpi_idx++; in iter_next()
58 iter->intid++; in iter_next()
59 if (iter->intid == VGIC_NR_PRIVATE_IRQS && in iter_next()
60 ++iter->vcpu_id < iter->nr_cpus) in iter_next()
61 iter->intid = 0; in iter_next()
94 static void iter_init(struct kvm *kvm, struct vgic_state_iter *iter, in iter_init() argument
99 memset(iter, 0, sizeof(*iter)); in iter_init()
101 iter->nr_cpus = nr_cpus; in iter_init()
102 iter->nr_spis = kvm->arch.vgic.nr_spis; in iter_init()
104 iter->nr_lpis = iter_mark_lpis(kvm); in iter_init()
108 iter_next(kvm, iter); in iter_init()
111 static bool end_of_vgic(struct vgic_state_iter *iter) in end_of_vgic() argument
113 return iter->dist_id > 0 && in end_of_vgic()
114 iter->vcpu_id == iter->nr_cpus && in end_of_vgic()
115 iter->intid >= (iter->nr_spis + VGIC_NR_PRIVATE_IRQS) && in end_of_vgic()
116 (!iter->nr_lpis || iter->lpi_idx > iter->nr_lpis); in end_of_vgic()
122 struct vgic_state_iter *iter; in vgic_debug_start() local
125 iter = kvm->arch.vgic.iter; in vgic_debug_start()
126 if (iter) { in vgic_debug_start()
127 iter = ERR_PTR(-EBUSY); in vgic_debug_start()
131 iter = kmalloc(sizeof(*iter), GFP_KERNEL); in vgic_debug_start()
132 if (!iter) { in vgic_debug_start()
133 iter = ERR_PTR(-ENOMEM); in vgic_debug_start()
137 iter_init(kvm, iter, *pos); in vgic_debug_start()
138 kvm->arch.vgic.iter = iter; in vgic_debug_start()
140 if (end_of_vgic(iter)) in vgic_debug_start()
141 iter = NULL; in vgic_debug_start()
144 return iter; in vgic_debug_start()
150 struct vgic_state_iter *iter = kvm->arch.vgic.iter; in vgic_debug_next() local
153 iter_next(kvm, iter); in vgic_debug_next()
154 if (end_of_vgic(iter)) in vgic_debug_next()
155 iter = NULL; in vgic_debug_next()
156 return iter; in vgic_debug_next()
162 struct vgic_state_iter *iter; in vgic_debug_stop() local
172 iter = kvm->arch.vgic.iter; in vgic_debug_stop()
174 kfree(iter); in vgic_debug_stop()
175 kvm->arch.vgic.iter = NULL; in vgic_debug_stop()
180 struct vgic_state_iter *iter) in print_dist_state() argument
189 seq_printf(s, "nr_lpis:\t%d\n", iter->nr_lpis); in print_dist_state()
270 struct vgic_state_iter *iter = v; in vgic_debug_show() local
275 if (iter->dist_id == 0) { in vgic_debug_show()
276 print_dist_state(s, &kvm->arch.vgic, iter); in vgic_debug_show()
283 if (iter->vcpu_id < iter->nr_cpus) in vgic_debug_show()
284 vcpu = kvm_get_vcpu(kvm, iter->vcpu_id); in vgic_debug_show()
290 irq = vgic_get_irq(kvm, vcpu, iter->intid); in vgic_debug_show()