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 and device ID must be set
+in msi struct. Otherwise, KVM_IRQ_ROUTING_MSI must be used without
+populating the msi devid field.
+
struct kvm_irq_routing {
__u32 nr;
__u32 flags;
- 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 matches 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
#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
(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->msi.address_lo = ue->u.msi.address_lo;
+ e->msi.address_hi = ue->u.msi.address_hi;
+ e->msi.data = ue->u.msi.data;
+ e->devid = ue->u.msi.devid;
+ break;
default:
goto out;
}
irq = irqfd->irq_entry;
} while (read_seqcount_retry(&irqfd->irq_entry_sc, seq));
/* An event has been signaled, inject an interrupt */
- if (irq.type == KVM_IRQ_ROUTING_MSI)
+ if (irq.type == KVM_IRQ_ROUTING_MSI ||
+ irq.type == KVM_IRQ_ROUTING_EXTENDED_MSI)
kvm_set_msi(&irq, kvm, KVM_USERSPACE_IRQ_SOURCE_ID, 1,
false);
else
e = entries;
for (i = 0; i < n_entries; ++i, ++e) {
/* Only fast-path MSI. */
- if (e->type == KVM_IRQ_ROUTING_MSI)
+ if (e->type == KVM_IRQ_ROUTING_MSI ||
+ e->type == KVM_IRQ_ROUTING_EXTENDED_MSI)
irqfd->irq_entry = *e;
}