2 * VGICv3 MMIO handling functions
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.
14 #include <linux/irqchip/arm-gic-v3.h>
15 #include <linux/kvm.h>
16 #include <linux/kvm_host.h>
17 #include <kvm/iodev.h>
18 #include <kvm/arm_vgic.h>
20 #include <asm/kvm_emulate.h>
23 #include "vgic-mmio.h"
25 /* extract @num bytes at @offset bytes offset in data */
26 unsigned long extract_bytes(unsigned long data, unsigned int offset,
29 return (data >> (offset * 8)) & GENMASK_ULL(num * 8 - 1, 0);
32 /* allows updates of any half of a 64-bit register (or the whole thing) */
33 u64 update_64bit_reg(u64 reg, unsigned int offset, unsigned int len,
36 int lower = (offset & 4) * 8;
37 int upper = lower + 8 * len - 1;
39 reg &= ~GENMASK_ULL(upper, lower);
40 val &= GENMASK_ULL(len * 8 - 1, 0);
42 return reg | ((u64)val << lower);
45 bool vgic_has_its(struct kvm *kvm)
47 struct vgic_dist *dist = &kvm->arch.vgic;
49 if (dist->vgic_model != KVM_DEV_TYPE_ARM_VGIC_V3)
55 static unsigned long vgic_mmio_read_v3_misc(struct kvm_vcpu *vcpu,
56 gpa_t addr, unsigned int len)
60 switch (addr & 0x0c) {
62 if (vcpu->kvm->arch.vgic.enabled)
63 value |= GICD_CTLR_ENABLE_SS_G1;
64 value |= GICD_CTLR_ARE_NS | GICD_CTLR_DS;
67 value = vcpu->kvm->arch.vgic.nr_spis + VGIC_NR_PRIVATE_IRQS;
68 value = (value >> 5) - 1;
69 if (vgic_has_its(vcpu->kvm)) {
70 value |= (INTERRUPT_ID_BITS_ITS - 1) << 19;
71 value |= GICD_TYPER_LPIS;
73 value |= (INTERRUPT_ID_BITS_SPIS - 1) << 19;
77 value = (PRODUCT_ID_KVM << 24) | (IMPLEMENTER_ARM << 0);
86 static void vgic_mmio_write_v3_misc(struct kvm_vcpu *vcpu,
87 gpa_t addr, unsigned int len,
90 struct vgic_dist *dist = &vcpu->kvm->arch.vgic;
91 bool was_enabled = dist->enabled;
93 switch (addr & 0x0c) {
95 dist->enabled = val & GICD_CTLR_ENABLE_SS_G1;
97 if (!was_enabled && dist->enabled)
98 vgic_kick_vcpus(vcpu->kvm);
106 static unsigned long vgic_mmio_read_irouter(struct kvm_vcpu *vcpu,
107 gpa_t addr, unsigned int len)
109 int intid = VGIC_ADDR_TO_INTID(addr, 64);
110 struct vgic_irq *irq = vgic_get_irq(vcpu->kvm, NULL, intid);
111 unsigned long ret = 0;
116 /* The upper word is RAZ for us. */
118 ret = extract_bytes(READ_ONCE(irq->mpidr), addr & 7, len);
120 vgic_put_irq(vcpu->kvm, irq);
124 static void vgic_mmio_write_irouter(struct kvm_vcpu *vcpu,
125 gpa_t addr, unsigned int len,
128 int intid = VGIC_ADDR_TO_INTID(addr, 64);
129 struct vgic_irq *irq;
131 /* The upper word is WI for us since we don't implement Aff3. */
135 irq = vgic_get_irq(vcpu->kvm, NULL, intid);
140 spin_lock(&irq->irq_lock);
142 /* We only care about and preserve Aff0, Aff1 and Aff2. */
143 irq->mpidr = val & GENMASK(23, 0);
144 irq->target_vcpu = kvm_mpidr_to_vcpu(vcpu->kvm, irq->mpidr);
146 spin_unlock(&irq->irq_lock);
147 vgic_put_irq(vcpu->kvm, irq);
150 static unsigned long vgic_mmio_read_v3r_ctlr(struct kvm_vcpu *vcpu,
151 gpa_t addr, unsigned int len)
153 struct vgic_cpu *vgic_cpu = &vcpu->arch.vgic_cpu;
155 return vgic_cpu->lpis_enabled ? GICR_CTLR_ENABLE_LPIS : 0;
159 static void vgic_mmio_write_v3r_ctlr(struct kvm_vcpu *vcpu,
160 gpa_t addr, unsigned int len,
163 struct vgic_cpu *vgic_cpu = &vcpu->arch.vgic_cpu;
164 bool was_enabled = vgic_cpu->lpis_enabled;
166 if (!vgic_has_its(vcpu->kvm))
169 vgic_cpu->lpis_enabled = val & GICR_CTLR_ENABLE_LPIS;
171 if (!was_enabled && vgic_cpu->lpis_enabled)
172 vgic_enable_lpis(vcpu);
175 static unsigned long vgic_mmio_read_v3r_typer(struct kvm_vcpu *vcpu,
176 gpa_t addr, unsigned int len)
178 unsigned long mpidr = kvm_vcpu_get_mpidr_aff(vcpu);
179 int target_vcpu_id = vcpu->vcpu_id;
182 value = (mpidr & GENMASK(23, 0)) << 32;
183 value |= ((target_vcpu_id & 0xffff) << 8);
184 if (target_vcpu_id == atomic_read(&vcpu->kvm->online_vcpus) - 1)
185 value |= GICR_TYPER_LAST;
186 if (vgic_has_its(vcpu->kvm))
187 value |= GICR_TYPER_PLPIS;
189 return extract_bytes(value, addr & 7, len);
192 static unsigned long vgic_mmio_read_v3r_iidr(struct kvm_vcpu *vcpu,
193 gpa_t addr, unsigned int len)
195 return (PRODUCT_ID_KVM << 24) | (IMPLEMENTER_ARM << 0);
198 static unsigned long vgic_mmio_read_v3_idregs(struct kvm_vcpu *vcpu,
199 gpa_t addr, unsigned int len)
201 switch (addr & 0xffff) {
203 /* report a GICv3 compliant implementation */
210 /* We want to avoid outer shareable. */
211 u64 vgic_sanitise_shareability(u64 field)
214 case GIC_BASER_OuterShareable:
215 return GIC_BASER_InnerShareable;
221 /* Avoid any inner non-cacheable mapping. */
222 u64 vgic_sanitise_inner_cacheability(u64 field)
225 case GIC_BASER_CACHE_nCnB:
226 case GIC_BASER_CACHE_nC:
227 return GIC_BASER_CACHE_RaWb;
233 /* Non-cacheable or same-as-inner are OK. */
234 u64 vgic_sanitise_outer_cacheability(u64 field)
237 case GIC_BASER_CACHE_SameAsInner:
238 case GIC_BASER_CACHE_nC:
241 return GIC_BASER_CACHE_nC;
245 u64 vgic_sanitise_field(u64 reg, u64 field_mask, int field_shift,
246 u64 (*sanitise_fn)(u64))
248 u64 field = (reg & field_mask) >> field_shift;
250 field = sanitise_fn(field) << field_shift;
251 return (reg & ~field_mask) | field;
254 #define PROPBASER_RES0_MASK \
255 (GENMASK_ULL(63, 59) | GENMASK_ULL(55, 52) | GENMASK_ULL(6, 5))
256 #define PENDBASER_RES0_MASK \
257 (BIT_ULL(63) | GENMASK_ULL(61, 59) | GENMASK_ULL(55, 52) | \
258 GENMASK_ULL(15, 12) | GENMASK_ULL(6, 0))
260 static u64 vgic_sanitise_pendbaser(u64 reg)
262 reg = vgic_sanitise_field(reg, GICR_PENDBASER_SHAREABILITY_MASK,
263 GICR_PENDBASER_SHAREABILITY_SHIFT,
264 vgic_sanitise_shareability);
265 reg = vgic_sanitise_field(reg, GICR_PENDBASER_INNER_CACHEABILITY_MASK,
266 GICR_PENDBASER_INNER_CACHEABILITY_SHIFT,
267 vgic_sanitise_inner_cacheability);
268 reg = vgic_sanitise_field(reg, GICR_PENDBASER_OUTER_CACHEABILITY_MASK,
269 GICR_PENDBASER_OUTER_CACHEABILITY_SHIFT,
270 vgic_sanitise_outer_cacheability);
272 reg &= ~PENDBASER_RES0_MASK;
273 reg &= ~GENMASK_ULL(51, 48);
278 static u64 vgic_sanitise_propbaser(u64 reg)
280 reg = vgic_sanitise_field(reg, GICR_PROPBASER_SHAREABILITY_MASK,
281 GICR_PROPBASER_SHAREABILITY_SHIFT,
282 vgic_sanitise_shareability);
283 reg = vgic_sanitise_field(reg, GICR_PROPBASER_INNER_CACHEABILITY_MASK,
284 GICR_PROPBASER_INNER_CACHEABILITY_SHIFT,
285 vgic_sanitise_inner_cacheability);
286 reg = vgic_sanitise_field(reg, GICR_PROPBASER_OUTER_CACHEABILITY_MASK,
287 GICR_PROPBASER_OUTER_CACHEABILITY_SHIFT,
288 vgic_sanitise_outer_cacheability);
290 reg &= ~PROPBASER_RES0_MASK;
291 reg &= ~GENMASK_ULL(51, 48);
295 static unsigned long vgic_mmio_read_propbase(struct kvm_vcpu *vcpu,
296 gpa_t addr, unsigned int len)
298 struct vgic_dist *dist = &vcpu->kvm->arch.vgic;
300 return extract_bytes(dist->propbaser, addr & 7, len);
303 static void vgic_mmio_write_propbase(struct kvm_vcpu *vcpu,
304 gpa_t addr, unsigned int len,
307 struct vgic_dist *dist = &vcpu->kvm->arch.vgic;
308 struct vgic_cpu *vgic_cpu = &vcpu->arch.vgic_cpu;
309 u64 propbaser = dist->propbaser;
311 /* Storing a value with LPIs already enabled is undefined */
312 if (vgic_cpu->lpis_enabled)
315 propbaser = update_64bit_reg(propbaser, addr & 4, len, val);
316 propbaser = vgic_sanitise_propbaser(propbaser);
318 dist->propbaser = propbaser;
321 static unsigned long vgic_mmio_read_pendbase(struct kvm_vcpu *vcpu,
322 gpa_t addr, unsigned int len)
324 struct vgic_cpu *vgic_cpu = &vcpu->arch.vgic_cpu;
326 return extract_bytes(vgic_cpu->pendbaser, addr & 7, len);
329 static void vgic_mmio_write_pendbase(struct kvm_vcpu *vcpu,
330 gpa_t addr, unsigned int len,
333 struct vgic_cpu *vgic_cpu = &vcpu->arch.vgic_cpu;
334 u64 pendbaser = vgic_cpu->pendbaser;
336 /* Storing a value with LPIs already enabled is undefined */
337 if (vgic_cpu->lpis_enabled)
340 pendbaser = update_64bit_reg(pendbaser, addr & 4, len, val);
341 pendbaser = vgic_sanitise_pendbaser(pendbaser);
343 vgic_cpu->pendbaser = pendbaser;
347 * The GICv3 per-IRQ registers are split to control PPIs and SGIs in the
348 * redistributors, while SPIs are covered by registers in the distributor
349 * block. Trying to set private IRQs in this block gets ignored.
350 * We take some special care here to fix the calculation of the register
353 #define REGISTER_DESC_WITH_BITS_PER_IRQ_SHARED(off, rd, wr, bpi, acc) \
356 .bits_per_irq = bpi, \
357 .len = (bpi * VGIC_NR_PRIVATE_IRQS) / 8, \
358 .access_flags = acc, \
359 .read = vgic_mmio_read_raz, \
360 .write = vgic_mmio_write_wi, \
362 .reg_offset = off + (bpi * VGIC_NR_PRIVATE_IRQS) / 8, \
363 .bits_per_irq = bpi, \
364 .len = (bpi * (1024 - VGIC_NR_PRIVATE_IRQS)) / 8, \
365 .access_flags = acc, \
370 static const struct vgic_register_region vgic_v3_dist_registers[] = {
371 REGISTER_DESC_WITH_LENGTH(GICD_CTLR,
372 vgic_mmio_read_v3_misc, vgic_mmio_write_v3_misc, 16,
374 REGISTER_DESC_WITH_BITS_PER_IRQ_SHARED(GICD_IGROUPR,
375 vgic_mmio_read_rao, vgic_mmio_write_wi, 1,
377 REGISTER_DESC_WITH_BITS_PER_IRQ_SHARED(GICD_ISENABLER,
378 vgic_mmio_read_enable, vgic_mmio_write_senable, 1,
380 REGISTER_DESC_WITH_BITS_PER_IRQ_SHARED(GICD_ICENABLER,
381 vgic_mmio_read_enable, vgic_mmio_write_cenable, 1,
383 REGISTER_DESC_WITH_BITS_PER_IRQ_SHARED(GICD_ISPENDR,
384 vgic_mmio_read_pending, vgic_mmio_write_spending, 1,
386 REGISTER_DESC_WITH_BITS_PER_IRQ_SHARED(GICD_ICPENDR,
387 vgic_mmio_read_pending, vgic_mmio_write_cpending, 1,
389 REGISTER_DESC_WITH_BITS_PER_IRQ_SHARED(GICD_ISACTIVER,
390 vgic_mmio_read_active, vgic_mmio_write_sactive, 1,
392 REGISTER_DESC_WITH_BITS_PER_IRQ_SHARED(GICD_ICACTIVER,
393 vgic_mmio_read_active, vgic_mmio_write_cactive, 1,
395 REGISTER_DESC_WITH_BITS_PER_IRQ_SHARED(GICD_IPRIORITYR,
396 vgic_mmio_read_priority, vgic_mmio_write_priority, 8,
397 VGIC_ACCESS_32bit | VGIC_ACCESS_8bit),
398 REGISTER_DESC_WITH_BITS_PER_IRQ_SHARED(GICD_ITARGETSR,
399 vgic_mmio_read_raz, vgic_mmio_write_wi, 8,
400 VGIC_ACCESS_32bit | VGIC_ACCESS_8bit),
401 REGISTER_DESC_WITH_BITS_PER_IRQ_SHARED(GICD_ICFGR,
402 vgic_mmio_read_config, vgic_mmio_write_config, 2,
404 REGISTER_DESC_WITH_BITS_PER_IRQ_SHARED(GICD_IGRPMODR,
405 vgic_mmio_read_raz, vgic_mmio_write_wi, 1,
407 REGISTER_DESC_WITH_BITS_PER_IRQ_SHARED(GICD_IROUTER,
408 vgic_mmio_read_irouter, vgic_mmio_write_irouter, 64,
409 VGIC_ACCESS_64bit | VGIC_ACCESS_32bit),
410 REGISTER_DESC_WITH_LENGTH(GICD_IDREGS,
411 vgic_mmio_read_v3_idregs, vgic_mmio_write_wi, 48,
415 static const struct vgic_register_region vgic_v3_rdbase_registers[] = {
416 REGISTER_DESC_WITH_LENGTH(GICR_CTLR,
417 vgic_mmio_read_v3r_ctlr, vgic_mmio_write_v3r_ctlr, 4,
419 REGISTER_DESC_WITH_LENGTH(GICR_IIDR,
420 vgic_mmio_read_v3r_iidr, vgic_mmio_write_wi, 4,
422 REGISTER_DESC_WITH_LENGTH(GICR_TYPER,
423 vgic_mmio_read_v3r_typer, vgic_mmio_write_wi, 8,
424 VGIC_ACCESS_64bit | VGIC_ACCESS_32bit),
425 REGISTER_DESC_WITH_LENGTH(GICR_PROPBASER,
426 vgic_mmio_read_propbase, vgic_mmio_write_propbase, 8,
427 VGIC_ACCESS_64bit | VGIC_ACCESS_32bit),
428 REGISTER_DESC_WITH_LENGTH(GICR_PENDBASER,
429 vgic_mmio_read_pendbase, vgic_mmio_write_pendbase, 8,
430 VGIC_ACCESS_64bit | VGIC_ACCESS_32bit),
431 REGISTER_DESC_WITH_LENGTH(GICR_IDREGS,
432 vgic_mmio_read_v3_idregs, vgic_mmio_write_wi, 48,
436 static const struct vgic_register_region vgic_v3_sgibase_registers[] = {
437 REGISTER_DESC_WITH_LENGTH(GICR_IGROUPR0,
438 vgic_mmio_read_rao, vgic_mmio_write_wi, 4,
440 REGISTER_DESC_WITH_LENGTH(GICR_ISENABLER0,
441 vgic_mmio_read_enable, vgic_mmio_write_senable, 4,
443 REGISTER_DESC_WITH_LENGTH(GICR_ICENABLER0,
444 vgic_mmio_read_enable, vgic_mmio_write_cenable, 4,
446 REGISTER_DESC_WITH_LENGTH(GICR_ISPENDR0,
447 vgic_mmio_read_pending, vgic_mmio_write_spending, 4,
449 REGISTER_DESC_WITH_LENGTH(GICR_ICPENDR0,
450 vgic_mmio_read_pending, vgic_mmio_write_cpending, 4,
452 REGISTER_DESC_WITH_LENGTH(GICR_ISACTIVER0,
453 vgic_mmio_read_active, vgic_mmio_write_sactive, 4,
455 REGISTER_DESC_WITH_LENGTH(GICR_ICACTIVER0,
456 vgic_mmio_read_active, vgic_mmio_write_cactive, 4,
458 REGISTER_DESC_WITH_LENGTH(GICR_IPRIORITYR0,
459 vgic_mmio_read_priority, vgic_mmio_write_priority, 32,
460 VGIC_ACCESS_32bit | VGIC_ACCESS_8bit),
461 REGISTER_DESC_WITH_LENGTH(GICR_ICFGR0,
462 vgic_mmio_read_config, vgic_mmio_write_config, 8,
464 REGISTER_DESC_WITH_LENGTH(GICR_IGRPMODR0,
465 vgic_mmio_read_raz, vgic_mmio_write_wi, 4,
467 REGISTER_DESC_WITH_LENGTH(GICR_NSACR,
468 vgic_mmio_read_raz, vgic_mmio_write_wi, 4,
472 unsigned int vgic_v3_init_dist_iodev(struct vgic_io_device *dev)
474 dev->regions = vgic_v3_dist_registers;
475 dev->nr_regions = ARRAY_SIZE(vgic_v3_dist_registers);
477 kvm_iodevice_init(&dev->dev, &kvm_io_gic_ops);
482 int vgic_register_redist_iodevs(struct kvm *kvm, gpa_t redist_base_address)
484 struct kvm_vcpu *vcpu;
487 kvm_for_each_vcpu(c, vcpu, kvm) {
488 gpa_t rd_base = redist_base_address + c * SZ_64K * 2;
489 gpa_t sgi_base = rd_base + SZ_64K;
490 struct vgic_io_device *rd_dev = &vcpu->arch.vgic_cpu.rd_iodev;
491 struct vgic_io_device *sgi_dev = &vcpu->arch.vgic_cpu.sgi_iodev;
493 kvm_iodevice_init(&rd_dev->dev, &kvm_io_gic_ops);
494 rd_dev->base_addr = rd_base;
495 rd_dev->iodev_type = IODEV_REDIST;
496 rd_dev->regions = vgic_v3_rdbase_registers;
497 rd_dev->nr_regions = ARRAY_SIZE(vgic_v3_rdbase_registers);
498 rd_dev->redist_vcpu = vcpu;
500 mutex_lock(&kvm->slots_lock);
501 ret = kvm_io_bus_register_dev(kvm, KVM_MMIO_BUS, rd_base,
502 SZ_64K, &rd_dev->dev);
503 mutex_unlock(&kvm->slots_lock);
508 kvm_iodevice_init(&sgi_dev->dev, &kvm_io_gic_ops);
509 sgi_dev->base_addr = sgi_base;
510 sgi_dev->iodev_type = IODEV_REDIST;
511 sgi_dev->regions = vgic_v3_sgibase_registers;
512 sgi_dev->nr_regions = ARRAY_SIZE(vgic_v3_sgibase_registers);
513 sgi_dev->redist_vcpu = vcpu;
515 mutex_lock(&kvm->slots_lock);
516 ret = kvm_io_bus_register_dev(kvm, KVM_MMIO_BUS, sgi_base,
517 SZ_64K, &sgi_dev->dev);
518 mutex_unlock(&kvm->slots_lock);
520 kvm_io_bus_unregister_dev(kvm, KVM_MMIO_BUS,
527 /* The current c failed, so we start with the previous one. */
528 for (c--; c >= 0; c--) {
529 struct vgic_cpu *vgic_cpu;
531 vcpu = kvm_get_vcpu(kvm, c);
532 vgic_cpu = &vcpu->arch.vgic_cpu;
533 kvm_io_bus_unregister_dev(kvm, KVM_MMIO_BUS,
534 &vgic_cpu->rd_iodev.dev);
535 kvm_io_bus_unregister_dev(kvm, KVM_MMIO_BUS,
536 &vgic_cpu->sgi_iodev.dev);
544 * Compare a given affinity (level 1-3 and a level 0 mask, from the SGI
545 * generation register ICC_SGI1R_EL1) with a given VCPU.
546 * If the VCPU's MPIDR matches, return the level0 affinity, otherwise
549 static int match_mpidr(u64 sgi_aff, u16 sgi_cpu_mask, struct kvm_vcpu *vcpu)
551 unsigned long affinity;
555 * Split the current VCPU's MPIDR into affinity level 0 and the
556 * rest as this is what we have to compare against.
558 affinity = kvm_vcpu_get_mpidr_aff(vcpu);
559 level0 = MPIDR_AFFINITY_LEVEL(affinity, 0);
560 affinity &= ~MPIDR_LEVEL_MASK;
562 /* bail out if the upper three levels don't match */
563 if (sgi_aff != affinity)
566 /* Is this VCPU's bit set in the mask ? */
567 if (!(sgi_cpu_mask & BIT(level0)))
574 * The ICC_SGI* registers encode the affinity differently from the MPIDR,
575 * so provide a wrapper to use the existing defines to isolate a certain
578 #define SGI_AFFINITY_LEVEL(reg, level) \
579 ((((reg) & ICC_SGI1R_AFFINITY_## level ##_MASK) \
580 >> ICC_SGI1R_AFFINITY_## level ##_SHIFT) << MPIDR_LEVEL_SHIFT(level))
583 * vgic_v3_dispatch_sgi - handle SGI requests from VCPUs
584 * @vcpu: The VCPU requesting a SGI
585 * @reg: The value written into the ICC_SGI1R_EL1 register by that VCPU
587 * With GICv3 (and ARE=1) CPUs trigger SGIs by writing to a system register.
588 * This will trap in sys_regs.c and call this function.
589 * This ICC_SGI1R_EL1 register contains the upper three affinity levels of the
590 * target processors as well as a bitmask of 16 Aff0 CPUs.
591 * If the interrupt routing mode bit is not set, we iterate over all VCPUs to
592 * check for matching ones. If this bit is set, we signal all, but not the
595 void vgic_v3_dispatch_sgi(struct kvm_vcpu *vcpu, u64 reg)
597 struct kvm *kvm = vcpu->kvm;
598 struct kvm_vcpu *c_vcpu;
602 int vcpu_id = vcpu->vcpu_id;
605 sgi = (reg & ICC_SGI1R_SGI_ID_MASK) >> ICC_SGI1R_SGI_ID_SHIFT;
606 broadcast = reg & BIT(ICC_SGI1R_IRQ_ROUTING_MODE_BIT);
607 target_cpus = (reg & ICC_SGI1R_TARGET_LIST_MASK) >> ICC_SGI1R_TARGET_LIST_SHIFT;
608 mpidr = SGI_AFFINITY_LEVEL(reg, 3);
609 mpidr |= SGI_AFFINITY_LEVEL(reg, 2);
610 mpidr |= SGI_AFFINITY_LEVEL(reg, 1);
613 * We iterate over all VCPUs to find the MPIDRs matching the request.
614 * If we have handled one CPU, we clear its bit to detect early
615 * if we are already finished. This avoids iterating through all
616 * VCPUs when most of the times we just signal a single VCPU.
618 kvm_for_each_vcpu(c, c_vcpu, kvm) {
619 struct vgic_irq *irq;
621 /* Exit early if we have dealt with all requested CPUs */
622 if (!broadcast && target_cpus == 0)
625 /* Don't signal the calling VCPU */
626 if (broadcast && c == vcpu_id)
632 level0 = match_mpidr(mpidr, target_cpus, c_vcpu);
636 /* remove this matching VCPU from the mask */
637 target_cpus &= ~BIT(level0);
640 irq = vgic_get_irq(vcpu->kvm, c_vcpu, sgi);
642 spin_lock(&irq->irq_lock);
645 vgic_queue_irq_unlock(vcpu->kvm, irq);
646 vgic_put_irq(vcpu->kvm, irq);