]> xenbits.xensource.com Git - people/julieng/linux-arm.git/commitdiff
KVM: arm: implement kvm_set_msi by gsi direct mapping
authorEric Auger <eric.auger@linaro.org>
Thu, 18 Jun 2015 11:21:28 +0000 (13:21 +0200)
committerJulien Grall <julien.grall@citrix.com>
Mon, 28 Sep 2015 11:05:14 +0000 (12:05 +0100)
If the ITS modality is not available, let's simply support MSI
injection by transforming the MSI.data into an SPI ID.

This becomes possible to use KVM_SIGNAL_MSI ioctl for arm too.

Signed-off-by: Eric Auger <eric.auger@linaro.org>
arch/arm/kvm/Kconfig
virt/kvm/arm/vgic-v2-emul.c

index 151e710e91edc6491de283e9184a804c2d40d235..0f58bafeb20c28b432c87f0704cee9f1f6a1d242 100644 (file)
@@ -31,6 +31,7 @@ config KVM
        select KVM_VFIO
        select HAVE_KVM_EVENTFD
        select HAVE_KVM_IRQFD
+       select HAVE_KVM_MSI
        select HAVE_KVM_IRQCHIP
        select HAVE_KVM_IRQ_ROUTING
        depends on ARM_VIRT_EXT && ARM_LPAE && ARM_ARCH_TIMER
index 8faa28c93d825ac8cf8b0c14feb5fcc6bc3a46d4..be0fe493ca3259bee073329d1020c5717dec21c3 100644 (file)
@@ -477,6 +477,17 @@ static bool vgic_v2_queue_sgi(struct kvm_vcpu *vcpu, int irq)
        return false;
 }
 
+/**
+ * Emulates GICv2M MSI injection by injecting the SPI ID matching
+ * the msi data
+ * @kvm: pointer to the kvm struct
+ * @msi: the msi struct handle
+ */
+static int vgic_v2m_inject_msi(struct kvm *kvm, struct kvm_msi *msi)
+{
+       return kvm_vgic_inject_irq(kvm, 0, msi->data, 1);
+}
+
 /**
  * kvm_vgic_map_resources - Configure global VGIC state before running any VCPUs
  * @kvm: pointer to the kvm struct
@@ -566,6 +577,7 @@ void vgic_v2_init_emulation(struct kvm *kvm)
        dist->vm_ops.add_sgi_source = vgic_v2_add_sgi_source;
        dist->vm_ops.init_model = vgic_v2_init_model;
        dist->vm_ops.map_resources = vgic_v2_map_resources;
+       dist->vm_ops.inject_msi = vgic_v2m_inject_msi;
 
        dist->vgic_cpu_base = VGIC_ADDR_UNDEF;
        dist->vgic_dist_base = VGIC_ADDR_UNDEF;