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


Groups > linux.kernel > #1173903

[PATCH 6/7] KVM: arm/arm64: enable MSI routing

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

Show all headers | View raw


Up to now, only irqchip routing entries could be set. This patch
adds the capability to insert MSI routing entries, extended or
standard ones. Although standard MSI entries can be set, their
injection still is not supported. For ARM64, let's also increase
KVM_MAX_IRQ_ROUTES to 4096: include SPI irqchip flat routes plus
MSI routes. In the future this might be extended.

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

---

RFC -> PATCH:
- move api MSI routing updates into that patch file
- use new devid field of user api struct
---
 Documentation/virtual/kvm/api.txt |  9 +++++++++
 include/linux/kvm_host.h          |  2 ++
 virt/kvm/arm/vgic.c               | 13 +++++++++++++
 3 files changed, 24 insertions(+)

diff --git a/Documentation/virtual/kvm/api.txt b/Documentation/virtual/kvm/api.txt
index 1e0d5f5..b411232 100644
--- a/Documentation/virtual/kvm/api.txt
+++ b/Documentation/virtual/kvm/api.txt
@@ -1405,6 +1405,10 @@ Sets the GSI routing table entries, overwriting any previously set entries.
 On arm/arm64, GSI routing has the following limitation:
 - GSI routing does not apply to KVM_IRQ_LINE but only to KVM_IRQFD.
 
+On arm/arm64, MSI routing through in-kernel GICv3 ITS must use
+KVM_IRQ_ROUTING_EXTENDED_MSI routing type to specify additionnal device ID.
+Otherwise, KVM_IRQ_ROUTING_MSI must be used.
+
 struct kvm_irq_routing {
 	__u32 nr;
 	__u32 flags;
@@ -2315,6 +2319,11 @@ On arm/arm64, gsi routing being supported, the following can happen:
 - in case no routing entry is associated to this gsi, injection fails
 - in case the gsi is associated to an irqchip routing entry,
   irqchip.pin + 32 corresponds to the injected SPI ID.
+- in case the gsi is associated to an MSI routing entry,
+  * without GICv3 ITS in-kernel emulation, MSI data patches the SPI ID
+    of the injected SPI
+  * with GICv3 ITS in-kernel emulation, the MSI message and device ID
+    are translated into an LPI.
 
 4.76 KVM_PPC_ALLOCATE_HTAB
 
diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
index e1c1c0d..4ca8f8e 100644
--- a/include/linux/kvm_host.h
+++ b/include/linux/kvm_host.h
@@ -927,6 +927,8 @@ static inline int mmu_notifier_retry(struct kvm *kvm, unsigned long mmu_seq)
 
 #ifdef CONFIG_S390
 #define KVM_MAX_IRQ_ROUTES 4096 //FIXME: we can have more than that...
+#elif defined(CONFIG_ARM64)
+#define KVM_MAX_IRQ_ROUTES 4096
 #else
 #define KVM_MAX_IRQ_ROUTES 1024
 #endif
diff --git a/virt/kvm/arm/vgic.c b/virt/kvm/arm/vgic.c
index 410fee1..0b4c48c 100644
--- a/virt/kvm/arm/vgic.c
+++ b/virt/kvm/arm/vgic.c
@@ -2258,6 +2258,19 @@ int kvm_set_routing_entry(struct kvm_kernel_irq_routing_entry *e,
 		    (e->irqchip.irqchip >= KVM_NR_IRQCHIPS))
 			goto out;
 		break;
+	case KVM_IRQ_ROUTING_MSI:
+		e->set = kvm_set_msi;
+		e->msi.address_lo = ue->u.msi.address_lo;
+		e->msi.address_hi = ue->u.msi.address_hi;
+		e->msi.data = ue->u.msi.data;
+		break;
+	case KVM_IRQ_ROUTING_EXTENDED_MSI:
+		e->set = kvm_set_msi;
+		e->ext_msi.address_lo = ue->u.msi.address_lo;
+		e->ext_msi.address_hi = ue->u.msi.address_hi;
+		e->ext_msi.data = ue->u.msi.data;
+		e->ext_msi.devid = ue->devid;
+		break;
 	default:
 		goto out;
 	}
-- 
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