Now that our VGIC emulation can properly deal with two separate interrupt groups and their enable bits, we can allow a guest to control the Group0 enable bit in the distributor. When evaluating the state of an interrupt, we now take its individual group enable bit into account, and drop the global "distributor disabled" notion when checking for VCPUs with a pending interrupt. This allows the guest to control both groups independently. Signed-off-by: Andre Przywara <andre.przywara@xxxxxxx> --- virt/kvm/arm/vgic/vgic.c | 24 +----------------------- 1 file changed, 1 insertion(+), 23 deletions(-) diff --git a/virt/kvm/arm/vgic/vgic.c b/virt/kvm/arm/vgic/vgic.c index 28d9ff282017..ed3a10b9ea93 100644 --- a/virt/kvm/arm/vgic/vgic.c +++ b/virt/kvm/arm/vgic/vgic.c @@ -203,8 +203,7 @@ void vgic_irq_set_phys_active(struct vgic_irq *irq, bool active) static bool vgic_irq_is_grp_enabled(struct kvm *kvm, struct vgic_irq *irq) { - /* Placeholder implementation until we properly support Group0. */ - return kvm->arch.vgic.groups_enable; + return vgic_dist_group_enabled(kvm, irq->group); } /** @@ -320,15 +319,6 @@ int vgic_dist_enable_group(struct kvm *kvm, int group, bool status) if (new_bit == was_enabled) return 0; - /* Group 0 on GICv3 and Group 1 on GICv2 are ignored for now. */ - if (kvm->arch.vgic.vgic_model == KVM_DEV_TYPE_ARM_VGIC_V3) { - if (group == GIC_GROUP0) - return 0; - } else { - if (group == GIC_GROUP1) - return 0; - } - dist->groups_enable &= ~group_mask; dist->groups_enable |= new_bit; if (new_bit > was_enabled) @@ -435,15 +425,6 @@ bool vgic_dist_group_enabled(struct kvm *kvm, int group) { struct vgic_dist *dist = &kvm->arch.vgic; - /* Group 0 on GICv3 and Group 1 on GICv2 are ignored for now. */ - if (kvm->arch.vgic.vgic_model == KVM_DEV_TYPE_ARM_VGIC_V3) { - if (group == GIC_GROUP0) - return false; - } else { - if (group == GIC_GROUP1) - return false; - } - return dist->groups_enable & (1U << group); } @@ -1093,9 +1074,6 @@ int kvm_vgic_vcpu_pending_irq(struct kvm_vcpu *vcpu) unsigned long flags; struct vgic_vmcr vmcr; - if (!vcpu->kvm->arch.vgic.groups_enable) - return false; - if (vcpu->arch.vgic_cpu.vgic_v3.its_vpe.pending_last) return true; -- 2.17.1 _______________________________________________ kvmarm mailing list kvmarm@xxxxxxxxxxxxxxxxxxxxx https://lists.cs.columbia.edu/mailman/listinfo/kvmarm