• Home
  • Raw
  • Download

Lines Matching full:irq

9 #include <linux/irq.h>
53 struct vgic_irq *irq = vgic_get_irq(vcpu->kvm, vcpu, intid + i); in vgic_mmio_read_group() local
55 if (irq->group) in vgic_mmio_read_group()
58 vgic_put_irq(vcpu->kvm, irq); in vgic_mmio_read_group()
64 static void vgic_update_vsgi(struct vgic_irq *irq) in vgic_update_vsgi() argument
66 WARN_ON(its_prop_update_vsgi(irq->host_irq, irq->priority, irq->group)); in vgic_update_vsgi()
77 struct vgic_irq *irq = vgic_get_irq(vcpu->kvm, vcpu, intid + i); in vgic_mmio_write_group() local
79 raw_spin_lock_irqsave(&irq->irq_lock, flags); in vgic_mmio_write_group()
80 irq->group = !!(val & BIT(i)); in vgic_mmio_write_group()
81 if (irq->hw && vgic_irq_is_sgi(irq->intid)) { in vgic_mmio_write_group()
82 vgic_update_vsgi(irq); in vgic_mmio_write_group()
83 raw_spin_unlock_irqrestore(&irq->irq_lock, flags); in vgic_mmio_write_group()
85 vgic_queue_irq_unlock(vcpu->kvm, irq, flags); in vgic_mmio_write_group()
88 vgic_put_irq(vcpu->kvm, irq); in vgic_mmio_write_group()
105 struct vgic_irq *irq = vgic_get_irq(vcpu->kvm, vcpu, intid + i); in vgic_mmio_read_enable() local
107 if (irq->enabled) in vgic_mmio_read_enable()
110 vgic_put_irq(vcpu->kvm, irq); in vgic_mmio_read_enable()
125 struct vgic_irq *irq = vgic_get_irq(vcpu->kvm, vcpu, intid + i); in vgic_mmio_write_senable() local
127 raw_spin_lock_irqsave(&irq->irq_lock, flags); in vgic_mmio_write_senable()
128 if (irq->hw && vgic_irq_is_sgi(irq->intid)) { in vgic_mmio_write_senable()
129 if (!irq->enabled) { in vgic_mmio_write_senable()
132 irq->enabled = true; in vgic_mmio_write_senable()
133 data = &irq_to_desc(irq->host_irq)->irq_data; in vgic_mmio_write_senable()
135 enable_irq(irq->host_irq); in vgic_mmio_write_senable()
138 raw_spin_unlock_irqrestore(&irq->irq_lock, flags); in vgic_mmio_write_senable()
139 vgic_put_irq(vcpu->kvm, irq); in vgic_mmio_write_senable()
142 } else if (vgic_irq_is_mapped_level(irq)) { in vgic_mmio_write_senable()
143 bool was_high = irq->line_level; in vgic_mmio_write_senable()
150 irq->line_level = vgic_get_phys_line_level(irq); in vgic_mmio_write_senable()
155 if (!irq->active && was_high && !irq->line_level) in vgic_mmio_write_senable()
156 vgic_irq_set_phys_active(irq, false); in vgic_mmio_write_senable()
158 irq->enabled = true; in vgic_mmio_write_senable()
159 vgic_queue_irq_unlock(vcpu->kvm, irq, flags); in vgic_mmio_write_senable()
161 vgic_put_irq(vcpu->kvm, irq); in vgic_mmio_write_senable()
174 struct vgic_irq *irq = vgic_get_irq(vcpu->kvm, vcpu, intid + i); in vgic_mmio_write_cenable() local
176 raw_spin_lock_irqsave(&irq->irq_lock, flags); in vgic_mmio_write_cenable()
177 if (irq->hw && vgic_irq_is_sgi(irq->intid) && irq->enabled) in vgic_mmio_write_cenable()
178 disable_irq_nosync(irq->host_irq); in vgic_mmio_write_cenable()
180 irq->enabled = false; in vgic_mmio_write_cenable()
182 raw_spin_unlock_irqrestore(&irq->irq_lock, flags); in vgic_mmio_write_cenable()
183 vgic_put_irq(vcpu->kvm, irq); in vgic_mmio_write_cenable()
196 struct vgic_irq *irq = vgic_get_irq(vcpu->kvm, vcpu, intid + i); in vgic_uaccess_write_senable() local
198 raw_spin_lock_irqsave(&irq->irq_lock, flags); in vgic_uaccess_write_senable()
199 irq->enabled = true; in vgic_uaccess_write_senable()
200 vgic_queue_irq_unlock(vcpu->kvm, irq, flags); in vgic_uaccess_write_senable()
202 vgic_put_irq(vcpu->kvm, irq); in vgic_uaccess_write_senable()
217 struct vgic_irq *irq = vgic_get_irq(vcpu->kvm, vcpu, intid + i); in vgic_uaccess_write_cenable() local
219 raw_spin_lock_irqsave(&irq->irq_lock, flags); in vgic_uaccess_write_cenable()
220 irq->enabled = false; in vgic_uaccess_write_cenable()
221 raw_spin_unlock_irqrestore(&irq->irq_lock, flags); in vgic_uaccess_write_cenable()
223 vgic_put_irq(vcpu->kvm, irq); in vgic_uaccess_write_cenable()
238 struct vgic_irq *irq = vgic_get_irq(vcpu->kvm, vcpu, intid + i); in vgic_mmio_read_pending() local
242 raw_spin_lock_irqsave(&irq->irq_lock, flags); in vgic_mmio_read_pending()
243 if (irq->hw && vgic_irq_is_sgi(irq->intid)) { in vgic_mmio_read_pending()
247 err = irq_get_irqchip_state(irq->host_irq, in vgic_mmio_read_pending()
250 WARN_RATELIMIT(err, "IRQ %d", irq->host_irq); in vgic_mmio_read_pending()
252 val = irq_is_pending(irq); in vgic_mmio_read_pending()
256 raw_spin_unlock_irqrestore(&irq->irq_lock, flags); in vgic_mmio_read_pending()
258 vgic_put_irq(vcpu->kvm, irq); in vgic_mmio_read_pending()
264 static bool is_vgic_v2_sgi(struct kvm_vcpu *vcpu, struct vgic_irq *irq) in is_vgic_v2_sgi() argument
266 return (vgic_irq_is_sgi(irq->intid) && in is_vgic_v2_sgi()
279 struct vgic_irq *irq = vgic_get_irq(vcpu->kvm, vcpu, intid + i); in vgic_mmio_write_spending() local
282 if (is_vgic_v2_sgi(vcpu, irq)) { in vgic_mmio_write_spending()
283 vgic_put_irq(vcpu->kvm, irq); in vgic_mmio_write_spending()
287 raw_spin_lock_irqsave(&irq->irq_lock, flags); in vgic_mmio_write_spending()
289 if (irq->hw && vgic_irq_is_sgi(irq->intid)) { in vgic_mmio_write_spending()
292 err = irq_set_irqchip_state(irq->host_irq, in vgic_mmio_write_spending()
295 WARN_RATELIMIT(err, "IRQ %d", irq->host_irq); in vgic_mmio_write_spending()
297 raw_spin_unlock_irqrestore(&irq->irq_lock, flags); in vgic_mmio_write_spending()
298 vgic_put_irq(vcpu->kvm, irq); in vgic_mmio_write_spending()
303 irq->pending_latch = true; in vgic_mmio_write_spending()
304 if (irq->hw) in vgic_mmio_write_spending()
305 vgic_irq_set_phys_active(irq, true); in vgic_mmio_write_spending()
307 vgic_queue_irq_unlock(vcpu->kvm, irq, flags); in vgic_mmio_write_spending()
308 vgic_put_irq(vcpu->kvm, irq); in vgic_mmio_write_spending()
321 struct vgic_irq *irq = vgic_get_irq(vcpu->kvm, vcpu, intid + i); in vgic_uaccess_write_spending() local
323 raw_spin_lock_irqsave(&irq->irq_lock, flags); in vgic_uaccess_write_spending()
324 irq->pending_latch = true; in vgic_uaccess_write_spending()
331 if (is_vgic_v2_sgi(vcpu, irq)) in vgic_uaccess_write_spending()
332 irq->source |= BIT(vcpu->vcpu_id); in vgic_uaccess_write_spending()
334 vgic_queue_irq_unlock(vcpu->kvm, irq, flags); in vgic_uaccess_write_spending()
336 vgic_put_irq(vcpu->kvm, irq); in vgic_uaccess_write_spending()
342 /* Must be called with irq->irq_lock held */
343 static void vgic_hw_irq_cpending(struct kvm_vcpu *vcpu, struct vgic_irq *irq) in vgic_hw_irq_cpending() argument
345 irq->pending_latch = false; in vgic_hw_irq_cpending()
358 vgic_irq_set_phys_pending(irq, false); in vgic_hw_irq_cpending()
359 if (!irq->active) in vgic_hw_irq_cpending()
360 vgic_irq_set_phys_active(irq, false); in vgic_hw_irq_cpending()
372 struct vgic_irq *irq = vgic_get_irq(vcpu->kvm, vcpu, intid + i); in vgic_mmio_write_cpending() local
375 if (is_vgic_v2_sgi(vcpu, irq)) { in vgic_mmio_write_cpending()
376 vgic_put_irq(vcpu->kvm, irq); in vgic_mmio_write_cpending()
380 raw_spin_lock_irqsave(&irq->irq_lock, flags); in vgic_mmio_write_cpending()
382 if (irq->hw && vgic_irq_is_sgi(irq->intid)) { in vgic_mmio_write_cpending()
385 err = irq_set_irqchip_state(irq->host_irq, in vgic_mmio_write_cpending()
388 WARN_RATELIMIT(err, "IRQ %d", irq->host_irq); in vgic_mmio_write_cpending()
390 raw_spin_unlock_irqrestore(&irq->irq_lock, flags); in vgic_mmio_write_cpending()
391 vgic_put_irq(vcpu->kvm, irq); in vgic_mmio_write_cpending()
396 if (irq->hw) in vgic_mmio_write_cpending()
397 vgic_hw_irq_cpending(vcpu, irq); in vgic_mmio_write_cpending()
399 irq->pending_latch = false; in vgic_mmio_write_cpending()
401 raw_spin_unlock_irqrestore(&irq->irq_lock, flags); in vgic_mmio_write_cpending()
402 vgic_put_irq(vcpu->kvm, irq); in vgic_mmio_write_cpending()
415 struct vgic_irq *irq = vgic_get_irq(vcpu->kvm, vcpu, intid + i); in vgic_uaccess_write_cpending() local
417 raw_spin_lock_irqsave(&irq->irq_lock, flags); in vgic_uaccess_write_cpending()
423 if (is_vgic_v2_sgi(vcpu, irq)) in vgic_uaccess_write_cpending()
424 irq->source = 0; in vgic_uaccess_write_cpending()
426 irq->pending_latch = false; in vgic_uaccess_write_cpending()
428 raw_spin_unlock_irqrestore(&irq->irq_lock, flags); in vgic_uaccess_write_cpending()
430 vgic_put_irq(vcpu->kvm, irq); in vgic_uaccess_write_cpending()
437 * If we are fiddling with an IRQ's active state, we have to make sure the IRQ
444 * the IRQ locks and we don't want to be chasing moving targets.
475 struct vgic_irq *irq = vgic_get_irq(vcpu->kvm, vcpu, intid + i); in __vgic_mmio_read_active() local
481 if (irq->active) in __vgic_mmio_read_active()
484 vgic_put_irq(vcpu->kvm, irq); in __vgic_mmio_read_active()
513 /* Must be called with irq->irq_lock held */
514 static void vgic_hw_irq_change_active(struct kvm_vcpu *vcpu, struct vgic_irq *irq, in vgic_hw_irq_change_active() argument
520 irq->active = active; in vgic_hw_irq_change_active()
521 vgic_irq_set_phys_active(irq, active); in vgic_hw_irq_change_active()
524 static void vgic_mmio_change_active(struct kvm_vcpu *vcpu, struct vgic_irq *irq, in vgic_mmio_change_active() argument
530 raw_spin_lock_irqsave(&irq->irq_lock, flags); in vgic_mmio_change_active()
532 if (irq->hw && !vgic_irq_is_sgi(irq->intid)) { in vgic_mmio_change_active()
533 vgic_hw_irq_change_active(vcpu, irq, active, !requester_vcpu); in vgic_mmio_change_active()
534 } else if (irq->hw && vgic_irq_is_sgi(irq->intid)) { in vgic_mmio_change_active()
540 irq->active = false; in vgic_mmio_change_active()
545 irq->active = active; in vgic_mmio_change_active()
561 active && vgic_irq_is_sgi(irq->intid)) in vgic_mmio_change_active()
562 irq->active_source = active_source; in vgic_mmio_change_active()
565 if (irq->active) in vgic_mmio_change_active()
566 vgic_queue_irq_unlock(vcpu->kvm, irq, flags); in vgic_mmio_change_active()
568 raw_spin_unlock_irqrestore(&irq->irq_lock, flags); in vgic_mmio_change_active()
579 struct vgic_irq *irq = vgic_get_irq(vcpu->kvm, vcpu, intid + i); in __vgic_mmio_write_cactive() local
580 vgic_mmio_change_active(vcpu, irq, false); in __vgic_mmio_write_cactive()
581 vgic_put_irq(vcpu->kvm, irq); in __vgic_mmio_write_cactive()
616 struct vgic_irq *irq = vgic_get_irq(vcpu->kvm, vcpu, intid + i); in __vgic_mmio_write_sactive() local
617 vgic_mmio_change_active(vcpu, irq, true); in __vgic_mmio_write_sactive()
618 vgic_put_irq(vcpu->kvm, irq); in __vgic_mmio_write_sactive()
653 struct vgic_irq *irq = vgic_get_irq(vcpu->kvm, vcpu, intid + i); in vgic_mmio_read_priority() local
655 val |= (u64)irq->priority << (i * 8); in vgic_mmio_read_priority()
657 vgic_put_irq(vcpu->kvm, irq); in vgic_mmio_read_priority()
679 struct vgic_irq *irq = vgic_get_irq(vcpu->kvm, vcpu, intid + i); in vgic_mmio_write_priority() local
681 raw_spin_lock_irqsave(&irq->irq_lock, flags); in vgic_mmio_write_priority()
683 irq->priority = (val >> (i * 8)) & GENMASK(7, 8 - VGIC_PRI_BITS); in vgic_mmio_write_priority()
684 if (irq->hw && vgic_irq_is_sgi(irq->intid)) in vgic_mmio_write_priority()
685 vgic_update_vsgi(irq); in vgic_mmio_write_priority()
686 raw_spin_unlock_irqrestore(&irq->irq_lock, flags); in vgic_mmio_write_priority()
688 vgic_put_irq(vcpu->kvm, irq); in vgic_mmio_write_priority()
700 struct vgic_irq *irq = vgic_get_irq(vcpu->kvm, vcpu, intid + i); in vgic_mmio_read_config() local
702 if (irq->config == VGIC_CONFIG_EDGE) in vgic_mmio_read_config()
705 vgic_put_irq(vcpu->kvm, irq); in vgic_mmio_read_config()
720 struct vgic_irq *irq; in vgic_mmio_write_config() local
731 irq = vgic_get_irq(vcpu->kvm, vcpu, intid + i); in vgic_mmio_write_config()
732 raw_spin_lock_irqsave(&irq->irq_lock, flags); in vgic_mmio_write_config()
735 irq->config = VGIC_CONFIG_EDGE; in vgic_mmio_write_config()
737 irq->config = VGIC_CONFIG_LEVEL; in vgic_mmio_write_config()
739 raw_spin_unlock_irqrestore(&irq->irq_lock, flags); in vgic_mmio_write_config()
740 vgic_put_irq(vcpu->kvm, irq); in vgic_mmio_write_config()
751 struct vgic_irq *irq; in vgic_read_irq_line_level_info() local
756 irq = vgic_get_irq(vcpu->kvm, vcpu, intid + i); in vgic_read_irq_line_level_info()
757 if (irq->config == VGIC_CONFIG_LEVEL && irq->line_level) in vgic_read_irq_line_level_info()
760 vgic_put_irq(vcpu->kvm, irq); in vgic_read_irq_line_level_info()
774 struct vgic_irq *irq; in vgic_write_irq_line_level_info() local
780 irq = vgic_get_irq(vcpu->kvm, vcpu, intid + i); in vgic_write_irq_line_level_info()
783 * Line level is set irrespective of irq type in vgic_write_irq_line_level_info()
785 * restore irq config before line level. in vgic_write_irq_line_level_info()
788 raw_spin_lock_irqsave(&irq->irq_lock, flags); in vgic_write_irq_line_level_info()
789 irq->line_level = new_level; in vgic_write_irq_line_level_info()
791 vgic_queue_irq_unlock(vcpu->kvm, irq, flags); in vgic_write_irq_line_level_info()
793 raw_spin_unlock_irqrestore(&irq->irq_lock, flags); in vgic_write_irq_line_level_info()
795 vgic_put_irq(vcpu->kvm, irq); in vgic_write_irq_line_level_info()
920 /* Do we access a non-allocated IRQ? */ in check_region()