Upgrade to 4.4.50-rt62
[kvmfornfv.git] / kernel / kernel / irq / msi.c
index 6b0c0b7..cd60090 100644 (file)
@@ -268,7 +268,7 @@ int msi_domain_alloc_irqs(struct irq_domain *domain, struct device *dev,
        struct msi_domain_ops *ops = info->ops;
        msi_alloc_info_t arg;
        struct msi_desc *desc;
-       int i, ret, virq = -1;
+       int i, ret, virq;
 
        ret = ops->msi_check(domain, info, dev);
        if (ret == 0)
@@ -278,12 +278,8 @@ int msi_domain_alloc_irqs(struct irq_domain *domain, struct device *dev,
 
        for_each_msi_entry(desc, dev) {
                ops->set_desc(&arg, desc);
-               if (info->flags & MSI_FLAG_IDENTITY_MAP)
-                       virq = (int)ops->get_hwirq(info, &arg);
-               else
-                       virq = -1;
 
-               virq = __irq_domain_alloc_irqs(domain, virq, desc->nvec_used,
+               virq = __irq_domain_alloc_irqs(domain, -1, desc->nvec_used,
                                               dev_to_node(dev), &arg, false);
                if (virq < 0) {
                        ret = -ENOSPC;
@@ -302,11 +298,23 @@ int msi_domain_alloc_irqs(struct irq_domain *domain, struct device *dev,
                ops->msi_finish(&arg, 0);
 
        for_each_msi_entry(desc, dev) {
+               virq = desc->irq;
                if (desc->nvec_used == 1)
                        dev_dbg(dev, "irq %d for MSI\n", virq);
                else
                        dev_dbg(dev, "irq [%d-%d] for MSI\n",
                                virq, virq + desc->nvec_used - 1);
+               /*
+                * This flag is set by the PCI layer as we need to activate
+                * the MSI entries before the PCI layer enables MSI in the
+                * card. Otherwise the card latches a random msi message.
+                */
+               if (info->flags & MSI_FLAG_ACTIVATE_EARLY) {
+                       struct irq_data *irq_data;
+
+                       irq_data = irq_domain_get_irq_data(domain, desc->irq);
+                       irq_domain_activate_irq(irq_data);
+               }
        }
 
        return 0;