2 * Copyright (C) 2015, 2016 ARM Ltd.
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 #include <linux/kvm.h>
18 #include <linux/kvm_host.h>
19 #include <linux/list_sort.h>
20 #include <linux/interrupt.h>
21 #include <linux/irq.h>
25 #define CREATE_TRACE_POINTS
28 #ifdef CONFIG_DEBUG_SPINLOCK
29 #define DEBUG_SPINLOCK_BUG_ON(p) BUG_ON(p)
31 #define DEBUG_SPINLOCK_BUG_ON(p)
34 struct vgic_global kvm_vgic_global_state __ro_after_init = {
35 .gicv3_cpuif = STATIC_KEY_FALSE_INIT,
39 * Locking order is always:
41 * its->cmd_lock (mutex)
42 * its->its_lock (mutex)
43 * vgic_cpu->ap_list_lock
47 * If you need to take multiple locks, always take the upper lock first,
48 * then the lower ones, e.g. first take the its_lock, then the irq_lock.
49 * If you are already holding a lock and need to take a higher one, you
50 * have to drop the lower ranking lock first and re-aquire it after having
51 * taken the upper one.
53 * When taking more than one ap_list_lock at the same time, always take the
54 * lowest numbered VCPU's ap_list_lock first, so:
55 * vcpuX->vcpu_id < vcpuY->vcpu_id:
56 * spin_lock(vcpuX->arch.vgic_cpu.ap_list_lock);
57 * spin_lock(vcpuY->arch.vgic_cpu.ap_list_lock);
59 * Since the VGIC must support injecting virtual interrupts from ISRs, we have
60 * to use the spin_lock_irqsave/spin_unlock_irqrestore versions of outer
61 * spinlocks for any lock that may be taken while injecting an interrupt.
65 * Iterate over the VM's list of mapped LPIs to find the one with a
66 * matching interrupt ID and return a reference to the IRQ structure.
68 static struct vgic_irq *vgic_get_lpi(struct kvm *kvm, u32 intid)
70 struct vgic_dist *dist = &kvm->arch.vgic;
71 struct vgic_irq *irq = NULL;
73 spin_lock(&dist->lpi_list_lock);
75 list_for_each_entry(irq, &dist->lpi_list_head, lpi_list) {
76 if (irq->intid != intid)
80 * This increases the refcount, the caller is expected to
81 * call vgic_put_irq() later once it's finished with the IRQ.
83 vgic_get_irq_kref(irq);
89 spin_unlock(&dist->lpi_list_lock);
95 * This looks up the virtual interrupt ID to get the corresponding
96 * struct vgic_irq. It also increases the refcount, so any caller is expected
97 * to call vgic_put_irq() once it's finished with this IRQ.
99 struct vgic_irq *vgic_get_irq(struct kvm *kvm, struct kvm_vcpu *vcpu,
103 if (intid <= VGIC_MAX_PRIVATE)
104 return &vcpu->arch.vgic_cpu.private_irqs[intid];
107 if (intid <= VGIC_MAX_SPI)
108 return &kvm->arch.vgic.spis[intid - VGIC_NR_PRIVATE_IRQS];
111 if (intid >= VGIC_MIN_LPI)
112 return vgic_get_lpi(kvm, intid);
114 WARN(1, "Looking up struct vgic_irq for reserved INTID");
119 * We can't do anything in here, because we lack the kvm pointer to
120 * lock and remove the item from the lpi_list. So we keep this function
121 * empty and use the return value of kref_put() to trigger the freeing.
123 static void vgic_irq_release(struct kref *ref)
127 void vgic_put_irq(struct kvm *kvm, struct vgic_irq *irq)
129 struct vgic_dist *dist = &kvm->arch.vgic;
131 if (irq->intid < VGIC_MIN_LPI)
134 spin_lock(&dist->lpi_list_lock);
135 if (!kref_put(&irq->refcount, vgic_irq_release)) {
136 spin_unlock(&dist->lpi_list_lock);
140 list_del(&irq->lpi_list);
141 dist->lpi_list_count--;
142 spin_unlock(&dist->lpi_list_lock);
148 * kvm_vgic_target_oracle - compute the target vcpu for an irq
150 * @irq: The irq to route. Must be already locked.
152 * Based on the current state of the interrupt (enabled, pending,
153 * active, vcpu and target_vcpu), compute the next vcpu this should be
154 * given to. Return NULL if this shouldn't be injected at all.
156 * Requires the IRQ lock to be held.
158 static struct kvm_vcpu *vgic_target_oracle(struct vgic_irq *irq)
160 DEBUG_SPINLOCK_BUG_ON(!spin_is_locked(&irq->irq_lock));
162 /* If the interrupt is active, it must stay on the current vcpu */
164 return irq->vcpu ? : irq->target_vcpu;
167 * If the IRQ is not active but enabled and pending, we should direct
168 * it to its configured target VCPU.
169 * If the distributor is disabled, pending interrupts shouldn't be
172 if (irq->enabled && irq_is_pending(irq)) {
173 if (unlikely(irq->target_vcpu &&
174 !irq->target_vcpu->kvm->arch.vgic.enabled))
177 return irq->target_vcpu;
180 /* If neither active nor pending and enabled, then this IRQ should not
181 * be queued to any VCPU.
187 * The order of items in the ap_lists defines how we'll pack things in LRs as
188 * well, the first items in the list being the first things populated in the
191 * A hard rule is that active interrupts can never be pushed out of the LRs
192 * (and therefore take priority) since we cannot reliably trap on deactivation
193 * of IRQs and therefore they have to be present in the LRs.
195 * Otherwise things should be sorted by the priority field and the GIC
196 * hardware support will take care of preemption of priority groups etc.
198 * Return negative if "a" sorts before "b", 0 to preserve order, and positive
199 * to sort "b" before "a".
201 static int vgic_irq_cmp(void *priv, struct list_head *a, struct list_head *b)
203 struct vgic_irq *irqa = container_of(a, struct vgic_irq, ap_list);
204 struct vgic_irq *irqb = container_of(b, struct vgic_irq, ap_list);
208 spin_lock(&irqa->irq_lock);
209 spin_lock_nested(&irqb->irq_lock, SINGLE_DEPTH_NESTING);
211 if (irqa->active || irqb->active) {
212 ret = (int)irqb->active - (int)irqa->active;
216 penda = irqa->enabled && irq_is_pending(irqa);
217 pendb = irqb->enabled && irq_is_pending(irqb);
219 if (!penda || !pendb) {
220 ret = (int)pendb - (int)penda;
224 /* Both pending and enabled, sort by priority */
225 ret = irqa->priority - irqb->priority;
227 spin_unlock(&irqb->irq_lock);
228 spin_unlock(&irqa->irq_lock);
232 /* Must be called with the ap_list_lock held */
233 static void vgic_sort_ap_list(struct kvm_vcpu *vcpu)
235 struct vgic_cpu *vgic_cpu = &vcpu->arch.vgic_cpu;
237 DEBUG_SPINLOCK_BUG_ON(!spin_is_locked(&vgic_cpu->ap_list_lock));
239 list_sort(NULL, &vgic_cpu->ap_list_head, vgic_irq_cmp);
243 * Only valid injection if changing level for level-triggered IRQs or for a
244 * rising edge, and in-kernel connected IRQ lines can only be controlled by
247 static bool vgic_validate_injection(struct vgic_irq *irq, bool level, void *owner)
249 if (irq->owner != owner)
252 switch (irq->config) {
253 case VGIC_CONFIG_LEVEL:
254 return irq->line_level != level;
255 case VGIC_CONFIG_EDGE:
263 * Check whether an IRQ needs to (and can) be queued to a VCPU's ap list.
264 * Do the queuing if necessary, taking the right locks in the right order.
265 * Returns true when the IRQ was queued, false otherwise.
267 * Needs to be entered with the IRQ lock already held, but will return
268 * with all locks dropped.
270 bool vgic_queue_irq_unlock(struct kvm *kvm, struct vgic_irq *irq,
273 struct kvm_vcpu *vcpu;
275 DEBUG_SPINLOCK_BUG_ON(!spin_is_locked(&irq->irq_lock));
278 vcpu = vgic_target_oracle(irq);
279 if (irq->vcpu || !vcpu) {
281 * If this IRQ is already on a VCPU's ap_list, then it
282 * cannot be moved or modified and there is no more work for
285 * Otherwise, if the irq is not pending and enabled, it does
286 * not need to be inserted into an ap_list and there is also
287 * no more work for us to do.
289 spin_unlock_irqrestore(&irq->irq_lock, flags);
292 * We have to kick the VCPU here, because we could be
293 * queueing an edge-triggered interrupt for which we
294 * get no EOI maintenance interrupt. In that case,
295 * while the IRQ is already on the VCPU's AP list, the
296 * VCPU could have EOI'ed the original interrupt and
297 * won't see this one until it exits for some other
301 kvm_make_request(KVM_REQ_IRQ_PENDING, vcpu);
308 * We must unlock the irq lock to take the ap_list_lock where
309 * we are going to insert this new pending interrupt.
311 spin_unlock_irqrestore(&irq->irq_lock, flags);
313 /* someone can do stuff here, which we re-check below */
315 spin_lock_irqsave(&vcpu->arch.vgic_cpu.ap_list_lock, flags);
316 spin_lock(&irq->irq_lock);
319 * Did something change behind our backs?
321 * There are two cases:
322 * 1) The irq lost its pending state or was disabled behind our
323 * backs and/or it was queued to another VCPU's ap_list.
324 * 2) Someone changed the affinity on this irq behind our
325 * backs and we are now holding the wrong ap_list_lock.
327 * In both cases, drop the locks and retry.
330 if (unlikely(irq->vcpu || vcpu != vgic_target_oracle(irq))) {
331 spin_unlock(&irq->irq_lock);
332 spin_unlock_irqrestore(&vcpu->arch.vgic_cpu.ap_list_lock, flags);
334 spin_lock_irqsave(&irq->irq_lock, flags);
339 * Grab a reference to the irq to reflect the fact that it is
340 * now in the ap_list.
342 vgic_get_irq_kref(irq);
343 list_add_tail(&irq->ap_list, &vcpu->arch.vgic_cpu.ap_list_head);
346 spin_unlock(&irq->irq_lock);
347 spin_unlock_irqrestore(&vcpu->arch.vgic_cpu.ap_list_lock, flags);
349 kvm_make_request(KVM_REQ_IRQ_PENDING, vcpu);
356 * kvm_vgic_inject_irq - Inject an IRQ from a device to the vgic
357 * @kvm: The VM structure pointer
358 * @cpuid: The CPU for PPIs
359 * @intid: The INTID to inject a new state to.
360 * @level: Edge-triggered: true: to trigger the interrupt
361 * false: to ignore the call
362 * Level-sensitive true: raise the input signal
363 * false: lower the input signal
364 * @owner: The opaque pointer to the owner of the IRQ being raised to verify
365 * that the caller is allowed to inject this IRQ. Userspace
366 * injections will have owner == NULL.
368 * The VGIC is not concerned with devices being active-LOW or active-HIGH for
369 * level-sensitive interrupts. You can think of the level parameter as 1
370 * being HIGH and 0 being LOW and all devices being active-HIGH.
372 int kvm_vgic_inject_irq(struct kvm *kvm, int cpuid, unsigned int intid,
373 bool level, void *owner)
375 struct kvm_vcpu *vcpu;
376 struct vgic_irq *irq;
380 trace_vgic_update_irq_pending(cpuid, intid, level);
382 ret = vgic_lazy_init(kvm);
386 vcpu = kvm_get_vcpu(kvm, cpuid);
387 if (!vcpu && intid < VGIC_NR_PRIVATE_IRQS)
390 irq = vgic_get_irq(kvm, vcpu, intid);
394 spin_lock_irqsave(&irq->irq_lock, flags);
396 if (!vgic_validate_injection(irq, level, owner)) {
397 /* Nothing to see here, move along... */
398 spin_unlock_irqrestore(&irq->irq_lock, flags);
399 vgic_put_irq(kvm, irq);
403 if (irq->config == VGIC_CONFIG_LEVEL)
404 irq->line_level = level;
406 irq->pending_latch = true;
408 vgic_queue_irq_unlock(kvm, irq, flags);
409 vgic_put_irq(kvm, irq);
414 /* @irq->irq_lock must be held */
415 static int kvm_vgic_map_irq(struct kvm_vcpu *vcpu, struct vgic_irq *irq,
416 unsigned int host_irq)
418 struct irq_desc *desc;
419 struct irq_data *data;
422 * Find the physical IRQ number corresponding to @host_irq
424 desc = irq_to_desc(host_irq);
426 kvm_err("%s: no interrupt descriptor\n", __func__);
429 data = irq_desc_get_irq_data(desc);
430 while (data->parent_data)
431 data = data->parent_data;
434 irq->host_irq = host_irq;
435 irq->hwintid = data->hwirq;
439 /* @irq->irq_lock must be held */
440 static inline void kvm_vgic_unmap_irq(struct vgic_irq *irq)
446 int kvm_vgic_map_phys_irq(struct kvm_vcpu *vcpu, unsigned int host_irq,
449 struct vgic_irq *irq = vgic_get_irq(vcpu->kvm, vcpu, vintid);
455 spin_lock_irqsave(&irq->irq_lock, flags);
456 ret = kvm_vgic_map_irq(vcpu, irq, host_irq);
457 spin_unlock_irqrestore(&irq->irq_lock, flags);
458 vgic_put_irq(vcpu->kvm, irq);
463 int kvm_vgic_unmap_phys_irq(struct kvm_vcpu *vcpu, unsigned int vintid)
465 struct vgic_irq *irq;
468 if (!vgic_initialized(vcpu->kvm))
471 irq = vgic_get_irq(vcpu->kvm, vcpu, vintid);
474 spin_lock_irqsave(&irq->irq_lock, flags);
475 kvm_vgic_unmap_irq(irq);
476 spin_unlock_irqrestore(&irq->irq_lock, flags);
477 vgic_put_irq(vcpu->kvm, irq);
483 * kvm_vgic_set_owner - Set the owner of an interrupt for a VM
485 * @vcpu: Pointer to the VCPU (used for PPIs)
486 * @intid: The virtual INTID identifying the interrupt (PPI or SPI)
487 * @owner: Opaque pointer to the owner
489 * Returns 0 if intid is not already used by another in-kernel device and the
490 * owner is set, otherwise returns an error code.
492 int kvm_vgic_set_owner(struct kvm_vcpu *vcpu, unsigned int intid, void *owner)
494 struct vgic_irq *irq;
497 if (!vgic_initialized(vcpu->kvm))
500 /* SGIs and LPIs cannot be wired up to any device */
501 if (!irq_is_ppi(intid) && !vgic_valid_spi(vcpu->kvm, intid))
504 irq = vgic_get_irq(vcpu->kvm, vcpu, intid);
505 spin_lock(&irq->irq_lock);
506 if (irq->owner && irq->owner != owner)
510 spin_unlock(&irq->irq_lock);
516 * vgic_prune_ap_list - Remove non-relevant interrupts from the list
518 * @vcpu: The VCPU pointer
520 * Go over the list of "interesting" interrupts, and prune those that we
521 * won't have to consider in the near future.
523 static void vgic_prune_ap_list(struct kvm_vcpu *vcpu)
525 struct vgic_cpu *vgic_cpu = &vcpu->arch.vgic_cpu;
526 struct vgic_irq *irq, *tmp;
530 spin_lock_irqsave(&vgic_cpu->ap_list_lock, flags);
532 list_for_each_entry_safe(irq, tmp, &vgic_cpu->ap_list_head, ap_list) {
533 struct kvm_vcpu *target_vcpu, *vcpuA, *vcpuB;
535 spin_lock(&irq->irq_lock);
537 BUG_ON(vcpu != irq->vcpu);
539 target_vcpu = vgic_target_oracle(irq);
543 * We don't need to process this interrupt any
544 * further, move it off the list.
546 list_del(&irq->ap_list);
548 spin_unlock(&irq->irq_lock);
551 * This vgic_put_irq call matches the
552 * vgic_get_irq_kref in vgic_queue_irq_unlock,
553 * where we added the LPI to the ap_list. As
554 * we remove the irq from the list, we drop
555 * also drop the refcount.
557 vgic_put_irq(vcpu->kvm, irq);
561 if (target_vcpu == vcpu) {
562 /* We're on the right CPU */
563 spin_unlock(&irq->irq_lock);
567 /* This interrupt looks like it has to be migrated. */
569 spin_unlock(&irq->irq_lock);
570 spin_unlock_irqrestore(&vgic_cpu->ap_list_lock, flags);
573 * Ensure locking order by always locking the smallest
576 if (vcpu->vcpu_id < target_vcpu->vcpu_id) {
584 spin_lock_irqsave(&vcpuA->arch.vgic_cpu.ap_list_lock, flags);
585 spin_lock_nested(&vcpuB->arch.vgic_cpu.ap_list_lock,
586 SINGLE_DEPTH_NESTING);
587 spin_lock(&irq->irq_lock);
590 * If the affinity has been preserved, move the
591 * interrupt around. Otherwise, it means things have
592 * changed while the interrupt was unlocked, and we
593 * need to replay this.
595 * In all cases, we cannot trust the list not to have
596 * changed, so we restart from the beginning.
598 if (target_vcpu == vgic_target_oracle(irq)) {
599 struct vgic_cpu *new_cpu = &target_vcpu->arch.vgic_cpu;
601 list_del(&irq->ap_list);
602 irq->vcpu = target_vcpu;
603 list_add_tail(&irq->ap_list, &new_cpu->ap_list_head);
606 spin_unlock(&irq->irq_lock);
607 spin_unlock(&vcpuB->arch.vgic_cpu.ap_list_lock);
608 spin_unlock_irqrestore(&vcpuA->arch.vgic_cpu.ap_list_lock, flags);
612 spin_unlock_irqrestore(&vgic_cpu->ap_list_lock, flags);
615 static inline void vgic_fold_lr_state(struct kvm_vcpu *vcpu)
617 if (kvm_vgic_global_state.type == VGIC_V2)
618 vgic_v2_fold_lr_state(vcpu);
620 vgic_v3_fold_lr_state(vcpu);
623 /* Requires the irq_lock to be held. */
624 static inline void vgic_populate_lr(struct kvm_vcpu *vcpu,
625 struct vgic_irq *irq, int lr)
627 DEBUG_SPINLOCK_BUG_ON(!spin_is_locked(&irq->irq_lock));
629 if (kvm_vgic_global_state.type == VGIC_V2)
630 vgic_v2_populate_lr(vcpu, irq, lr);
632 vgic_v3_populate_lr(vcpu, irq, lr);
635 static inline void vgic_clear_lr(struct kvm_vcpu *vcpu, int lr)
637 if (kvm_vgic_global_state.type == VGIC_V2)
638 vgic_v2_clear_lr(vcpu, lr);
640 vgic_v3_clear_lr(vcpu, lr);
643 static inline void vgic_set_underflow(struct kvm_vcpu *vcpu)
645 if (kvm_vgic_global_state.type == VGIC_V2)
646 vgic_v2_set_underflow(vcpu);
648 vgic_v3_set_underflow(vcpu);
651 /* Requires the ap_list_lock to be held. */
652 static int compute_ap_list_depth(struct kvm_vcpu *vcpu)
654 struct vgic_cpu *vgic_cpu = &vcpu->arch.vgic_cpu;
655 struct vgic_irq *irq;
658 DEBUG_SPINLOCK_BUG_ON(!spin_is_locked(&vgic_cpu->ap_list_lock));
660 list_for_each_entry(irq, &vgic_cpu->ap_list_head, ap_list) {
661 spin_lock(&irq->irq_lock);
662 /* GICv2 SGIs can count for more than one... */
663 if (vgic_irq_is_sgi(irq->intid) && irq->source)
664 count += hweight8(irq->source);
667 spin_unlock(&irq->irq_lock);
672 /* Requires the VCPU's ap_list_lock to be held. */
673 static void vgic_flush_lr_state(struct kvm_vcpu *vcpu)
675 struct vgic_cpu *vgic_cpu = &vcpu->arch.vgic_cpu;
676 struct vgic_irq *irq;
679 DEBUG_SPINLOCK_BUG_ON(!spin_is_locked(&vgic_cpu->ap_list_lock));
681 if (compute_ap_list_depth(vcpu) > kvm_vgic_global_state.nr_lr)
682 vgic_sort_ap_list(vcpu);
684 list_for_each_entry(irq, &vgic_cpu->ap_list_head, ap_list) {
685 spin_lock(&irq->irq_lock);
687 if (unlikely(vgic_target_oracle(irq) != vcpu))
691 * If we get an SGI with multiple sources, try to get
692 * them in all at once.
695 vgic_populate_lr(vcpu, irq, count++);
696 } while (irq->source && count < kvm_vgic_global_state.nr_lr);
699 spin_unlock(&irq->irq_lock);
701 if (count == kvm_vgic_global_state.nr_lr) {
702 if (!list_is_last(&irq->ap_list,
703 &vgic_cpu->ap_list_head))
704 vgic_set_underflow(vcpu);
709 vcpu->arch.vgic_cpu.used_lrs = count;
711 /* Nuke remaining LRs */
712 for ( ; count < kvm_vgic_global_state.nr_lr; count++)
713 vgic_clear_lr(vcpu, count);
716 /* Sync back the hardware VGIC state into our emulation after a guest's run. */
717 void kvm_vgic_sync_hwstate(struct kvm_vcpu *vcpu)
719 struct vgic_cpu *vgic_cpu = &vcpu->arch.vgic_cpu;
721 WARN_ON(vgic_v4_sync_hwstate(vcpu));
723 /* An empty ap_list_head implies used_lrs == 0 */
724 if (list_empty(&vcpu->arch.vgic_cpu.ap_list_head))
727 if (vgic_cpu->used_lrs)
728 vgic_fold_lr_state(vcpu);
729 vgic_prune_ap_list(vcpu);
732 /* Flush our emulation state into the GIC hardware before entering the guest. */
733 void kvm_vgic_flush_hwstate(struct kvm_vcpu *vcpu)
735 WARN_ON(vgic_v4_flush_hwstate(vcpu));
738 * If there are no virtual interrupts active or pending for this
739 * VCPU, then there is no work to do and we can bail out without
740 * taking any lock. There is a potential race with someone injecting
741 * interrupts to the VCPU, but it is a benign race as the VCPU will
742 * either observe the new interrupt before or after doing this check,
743 * and introducing additional synchronization mechanism doesn't change
746 if (list_empty(&vcpu->arch.vgic_cpu.ap_list_head))
749 DEBUG_SPINLOCK_BUG_ON(!irqs_disabled());
751 spin_lock(&vcpu->arch.vgic_cpu.ap_list_lock);
752 vgic_flush_lr_state(vcpu);
753 spin_unlock(&vcpu->arch.vgic_cpu.ap_list_lock);
756 void kvm_vgic_load(struct kvm_vcpu *vcpu)
758 if (unlikely(!vgic_initialized(vcpu->kvm)))
761 if (kvm_vgic_global_state.type == VGIC_V2)
767 void kvm_vgic_put(struct kvm_vcpu *vcpu)
769 if (unlikely(!vgic_initialized(vcpu->kvm)))
772 if (kvm_vgic_global_state.type == VGIC_V2)
778 int kvm_vgic_vcpu_pending_irq(struct kvm_vcpu *vcpu)
780 struct vgic_cpu *vgic_cpu = &vcpu->arch.vgic_cpu;
781 struct vgic_irq *irq;
782 bool pending = false;
785 if (!vcpu->kvm->arch.vgic.enabled)
788 if (vcpu->arch.vgic_cpu.vgic_v3.its_vpe.pending_last)
791 spin_lock_irqsave(&vgic_cpu->ap_list_lock, flags);
793 list_for_each_entry(irq, &vgic_cpu->ap_list_head, ap_list) {
794 spin_lock(&irq->irq_lock);
795 pending = irq_is_pending(irq) && irq->enabled;
796 spin_unlock(&irq->irq_lock);
802 spin_unlock_irqrestore(&vgic_cpu->ap_list_lock, flags);
807 void vgic_kick_vcpus(struct kvm *kvm)
809 struct kvm_vcpu *vcpu;
813 * We've injected an interrupt, time to find out who deserves
816 kvm_for_each_vcpu(c, vcpu, kvm) {
817 if (kvm_vgic_vcpu_pending_irq(vcpu)) {
818 kvm_make_request(KVM_REQ_IRQ_PENDING, vcpu);
824 bool kvm_vgic_map_is_active(struct kvm_vcpu *vcpu, unsigned int vintid)
826 struct vgic_irq *irq = vgic_get_irq(vcpu->kvm, vcpu, vintid);
830 if (!vgic_initialized(vcpu->kvm))
833 spin_lock_irqsave(&irq->irq_lock, flags);
834 map_is_active = irq->hw && irq->active;
835 spin_unlock_irqrestore(&irq->irq_lock, flags);
836 vgic_put_irq(vcpu->kvm, irq);
838 return map_is_active;