PCI: hv: Fix multi-MSI to allow more than one MSI vector
[platform/kernel/linux-rpi.git] / drivers / pci / controller / pci-hyperv.c
index 5b156c5..44731a0 100644 (file)
@@ -1204,6 +1204,21 @@ static void hv_irq_mask(struct irq_data *data)
        pci_msi_mask_irq(data);
 }
 
+static int hv_msi_prepare(struct irq_domain *domain, struct device *dev,
+                         int nvec, msi_alloc_info_t *info)
+{
+       int ret = pci_msi_prepare(domain, dev, nvec, info);
+
+       /*
+        * By using the interrupt remapper in the hypervisor IOMMU, contiguous
+        * CPU vectors is not needed for multi-MSI
+        */
+       if (info->type == X86_IRQ_ALLOC_TYPE_PCI_MSI)
+               info->flags &= ~X86_IRQ_ALLOC_CONTIGUOUS_VECTORS;
+
+       return ret;
+}
+
 /**
  * hv_irq_unmask() - "Unmask" the IRQ by setting its current
  * affinity.
@@ -1601,7 +1616,7 @@ static struct irq_chip hv_msi_irq_chip = {
 };
 
 static struct msi_domain_ops hv_msi_ops = {
-       .msi_prepare    = pci_msi_prepare,
+       .msi_prepare    = hv_msi_prepare,
        .msi_free       = hv_msi_free,
 };