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


Groups > linux.kernel > #1173898

[PATCH 5/7] KVM: arm/arm64: build a default routing table

From Eric Auger <eric.auger@linaro.org>
Newsgroups linux.kernel
Subject [PATCH 5/7] KVM: arm/arm64: build a default routing table
Date 2015-06-29 17:40 +0200
Message-ID <pGJk9-77K-77@gated-at.bofh.it> (permalink)
References <pGJk6-77K-33@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Implement a default routing table made of flat irqchip routing
entries (gsi = irqchip.pin) covering the VGIC SPI indexes.
This routing table is overwritten by the first user-space call
to KVM_SET_GSI_ROUTING ioctl.

Signed-off-by: Eric Auger <eric.auger@linaro.org>

---

PATCH: creation
---
 virt/kvm/arm/vgic.c | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/virt/kvm/arm/vgic.c b/virt/kvm/arm/vgic.c
index 212a5ff..410fee1 100644
--- a/virt/kvm/arm/vgic.c
+++ b/virt/kvm/arm/vgic.c
@@ -1783,6 +1783,8 @@ int vgic_init(struct kvm *kvm)
 	ret |= vgic_init_bitmap(&dist->irq_cfg, nr_cpus, nr_irqs);
 	ret |= vgic_init_bytemap(&dist->irq_priority, nr_cpus, nr_irqs);
 
+	ret |= kvm_setup_default_irq_routing(kvm);
+
 	if (ret)
 		goto out;
 
@@ -2264,6 +2266,25 @@ out:
 	return r;
 }
 
+int kvm_setup_default_irq_routing(struct kvm *kvm)
+{
+	struct kvm_irq_routing_entry *entries;
+	u32 nr = kvm->arch.vgic.nr_irqs - VGIC_NR_PRIVATE_IRQS;
+	int i, ret;
+
+	entries = kcalloc(nr, sizeof(struct kvm_kernel_irq_routing_entry),
+			  GFP_KERNEL);
+	for (i = 0; i < nr; i++) {
+		entries[i].gsi = i;
+		entries[i].type = KVM_IRQ_ROUTING_IRQCHIP;
+		entries[i].u.irqchip.irqchip = 0;
+		entries[i].u.irqchip.pin = i;
+	}
+	ret = kvm_set_irq_routing(kvm, entries, nr, 0);
+	kfree(entries);
+	return ret;
+}
+
 int kvm_set_msi(struct kvm_kernel_irq_routing_entry *e,
 		struct kvm *kvm, int irq_source_id,
 		int level, bool line_status)
-- 
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 0/7] KVM: arm/arm64: gsi routing support Eric Auger <eric.auger@linaro.org> - 2015-06-29 17:40 +0200
  [PATCH 7/7] KVM: arm: implement kvm_set_msi by gsi direct mapping Eric Auger <eric.auger@linaro.org> - 2015-06-29 17:40 +0200
  [PATCH 2/7] KVM: kvm_host: add kvm_extended_msi Eric Auger <eric.auger@linaro.org> - 2015-06-29 17:40 +0200
  [PATCH 5/7] KVM: arm/arm64: build a default routing table Eric Auger <eric.auger@linaro.org> - 2015-06-29 17:40 +0200
  [PATCH 1/7] KVM: api: add kvm_irq_routing_extended_msi Eric Auger <eric.auger@linaro.org> - 2015-06-29 17:40 +0200
    RE: [PATCH 1/7] KVM: api: add kvm_irq_routing_extended_msi Pavel Fedin <p.fedin@samsung.com> - 2015-07-02 10:50 +0200
    RE: [PATCH 1/7] KVM: api: add kvm_irq_routing_extended_msi Pavel Fedin <p.fedin@samsung.com> - 2015-07-03 17:30 +0200
      Re: [PATCH 1/7] KVM: api: add kvm_irq_routing_extended_msi Eric Auger <eric.auger@linaro.org> - 2015-07-03 17:50 +0200
    Re: [PATCH 1/7] KVM: api: add kvm_irq_routing_extended_msi Andre Przywara <andre.przywara@arm.com> - 2015-07-03 18:00 +0200
    Re: [PATCH 1/7] KVM: api: add kvm_irq_routing_extended_msi Andre Przywara <andre.przywara@arm.com> - 2015-07-07 12:10 +0200
      RE: [PATCH 1/7] KVM: api: add kvm_irq_routing_extended_msi Pavel Fedin <p.fedin@samsung.com> - 2015-07-07 13:00 +0200
  [PATCH 6/7] KVM: arm/arm64: enable MSI routing Eric Auger <eric.auger@linaro.org> - 2015-06-29 17:40 +0200
  [PATCH 3/7] KVM: irqchip: convey devid to kvm_set_msi Eric Auger <eric.auger@linaro.org> - 2015-06-29 17:50 +0200

csiph-web