Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

KVM: arm64: vgic: Be tolerant to the lack of maintenance interrupt masking

As it turns out, not all the interrupt controllers are able to
expose a vGIC maintenance interrupt that can be independently
enabled/disabled.

And to be fair, it doesn't really matter as all we require is
for the interrupt to kick us out of guest mode out way or another.

To that effect, add gic_kvm_info.no_maint_irq_mask for an interrupt
controller to advertise the lack of masking.

Signed-off-by: Marc Zyngier <maz@kernel.org>

+9 -1
+7 -1
arch/arm64/kvm/vgic/vgic-init.c
··· 519 519 */ 520 520 int kvm_vgic_hyp_init(void) 521 521 { 522 + bool has_mask; 522 523 int ret; 523 524 524 525 if (!gic_kvm_info) 525 526 return -ENODEV; 526 527 527 - if (!gic_kvm_info->maint_irq) { 528 + has_mask = !gic_kvm_info->no_maint_irq_mask; 529 + 530 + if (has_mask && !gic_kvm_info->maint_irq) { 528 531 kvm_err("No vgic maintenance irq\n"); 529 532 return -ENXIO; 530 533 } ··· 554 551 555 552 if (ret) 556 553 return ret; 554 + 555 + if (!has_mask) 556 + return 0; 557 557 558 558 ret = request_percpu_irq(kvm_vgic_global_state.maint_irq, 559 559 vgic_maintenance_handler,
+2
include/linux/irqchip/arm-vgic-info.h
··· 24 24 struct resource vcpu; 25 25 /* Interrupt number */ 26 26 unsigned int maint_irq; 27 + /* No interrupt mask, no need to use the above field */ 28 + bool no_maint_irq_mask; 27 29 /* Virtual control interface */ 28 30 struct resource vctrl; 29 31 /* vlpi support */