Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1273206

[PATCH v4 11/13] KVM: arm/arm64: vgic: implement clear active for non shared mapped IRQ

From Eric Auger <eric.auger@linaro.org>
Newsgroups linux.kernel
Subject [PATCH v4 11/13] KVM: arm/arm64: vgic: implement clear active for non shared mapped IRQ
Date 2015-11-19 16:00 +0100
Message-ID <qwyQP-2dv-55@gated-at.bofh.it> (permalink)
References <qwyQN-2dv-7@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


When disabling a non shared mapped IRQs, we must manually deactivate
the corresponding physical IRQ on top of removing the active state
from the distributor.

Signed-off-by: Eric Auger <eric.auger@linaro.org>
---
 virt/kvm/arm/vgic.c | 22 +++++++++++++++++++++-
 1 file changed, 21 insertions(+), 1 deletion(-)

diff --git a/virt/kvm/arm/vgic.c b/virt/kvm/arm/vgic.c
index bd500b4..98ae15f 100644
--- a/virt/kvm/arm/vgic.c
+++ b/virt/kvm/arm/vgic.c
@@ -604,14 +604,34 @@ bool vgic_handle_clear_active_reg(struct kvm *kvm,
 				  struct kvm_exit_mmio *mmio,
 				  phys_addr_t offset, int vcpu_id)
 {
-	u32 *reg;
+	u32 *reg, orig, cleared;
 	struct vgic_dist *dist = &kvm->arch.vgic;
+	struct kvm_vcpu *vcpu = kvm_get_vcpu(kvm, vcpu_id);
+	unsigned int i;
 
 	reg = vgic_bitmap_get_reg(&dist->irq_active, vcpu_id, offset);
+	orig = *reg;
 	vgic_reg_access(mmio, reg, offset,
 			ACCESS_READ_VALUE | ACCESS_WRITE_CLEARBIT);
 
 	if (mmio->is_write) {
+		cleared = orig ^ *reg;
+
+		for (i = 0; i < 32; i++) {
+			struct irq_phys_map *map;
+			unsigned int irq_num;
+
+			if (!(cleared && (1 << i)))
+				continue;
+			irq_num = (offset * 8) + i;
+			map = vgic_irq_map_search(vcpu, irq_num);
+			if (!map || (map && map->shared))
+				continue;
+			irq_set_irqchip_state(map->irq,
+					      IRQCHIP_STATE_ACTIVE,
+					      false);
+		}
+
 		vgic_update_state(kvm);
 		return true;
 	}
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v4 00/13] ARM IRQ forward control based on IRQ bypass manager Eric Auger <eric.auger@linaro.org> - 2015-11-19 16:00 +0100
  [PATCH v4 13/13] KVM: arm/arm64: implement IRQ bypass consumer functions Eric Auger <eric.auger@linaro.org> - 2015-11-19 16:00 +0100
  [PATCH v4 03/13] VFIO: platform: test forwarded state when selecting the IRQ handler Eric Auger <eric.auger@linaro.org> - 2015-11-19 16:00 +0100
  [PATCH v4 05/13] VFIO: platform: add vfio_platform_set_forwarded Eric Auger <eric.auger@linaro.org> - 2015-11-19 16:00 +0100
  [PATCH v4 06/13] VFIO: platform: add vfio_platform_irq_is_active Eric Auger <eric.auger@linaro.org> - 2015-11-19 16:00 +0100
  [PATCH v4 11/13] KVM: arm/arm64: vgic: implement clear active for non shared mapped IRQ Eric Auger <eric.auger@linaro.org> - 2015-11-19 16:00 +0100
  [PATCH v4 01/13] KVM: arm/arm64: select IRQ_BYPASS_MANAGER Eric Auger <eric.auger@linaro.org> - 2015-11-19 16:10 +0100

csiph-web