xen/pciback: Print out the MSI/MSI-X (PIRQ) values
authorKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Thu, 17 Feb 2011 16:18:00 +0000 (11:18 -0500)
committerKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Wed, 20 Jul 2011 00:58:34 +0000 (20:58 -0400)
If the verbose_request is set (and loglevel high enough), print out
the MSI/MSI-X values that are sent to the guest. This should aid in
debugging issues.

Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
drivers/xen/xen-pciback/conf_space_capability_msi.c

index d0d2255..6e876b6 100644 (file)
@@ -16,6 +16,9 @@ int pciback_enable_msi(struct pciback_device *pdev,
        int otherend = pdev->xdev->otherend_id;
        int status;
 
+       if (unlikely(verbose_request))
+               printk(KERN_DEBUG "pciback: %s: enable MSI\n", pci_name(dev));
+
        status = pci_enable_msi(dev);
 
        if (status) {
@@ -29,9 +32,14 @@ int pciback_enable_msi(struct pciback_device *pdev,
         * the local domain's IRQ number. */
 
        op->value = dev->irq ? xen_pirq_from_irq(dev->irq) : 0;
+       if (unlikely(verbose_request))
+               printk(KERN_DEBUG "pciback: %s: MSI: %d\n", pci_name(dev),
+                       op->value);
+
        dev_data = pci_get_drvdata(dev);
        if (dev_data)
                dev_data->ack_intr = 0;
+
        return 0;
 }
 
@@ -39,9 +47,16 @@ int pciback_disable_msi(struct pciback_device *pdev,
                struct pci_dev *dev, struct xen_pci_op *op)
 {
        struct pciback_dev_data *dev_data;
+
+       if (unlikely(verbose_request))
+               printk(KERN_DEBUG "pciback: %s: disable MSI\n", pci_name(dev));
+
        pci_disable_msi(dev);
 
        op->value = dev->irq ? xen_pirq_from_irq(dev->irq) : 0;
+       if (unlikely(verbose_request))
+               printk(KERN_DEBUG "pciback: %s: MSI: %d\n", pci_name(dev),
+                       op->value);
        dev_data = pci_get_drvdata(dev);
        if (dev_data)
                dev_data->ack_intr = 1;
@@ -55,6 +70,10 @@ int pciback_enable_msix(struct pciback_device *pdev,
        int i, result;
        struct msix_entry *entries;
 
+       if (unlikely(verbose_request))
+               printk(KERN_DEBUG "pciback: %s: enable MSI-X\n",
+                      pci_name(dev));
+
        if (op->value > SH_INFO_MAX_VEC)
                return -EINVAL;
 
@@ -75,6 +94,11 @@ int pciback_enable_msix(struct pciback_device *pdev,
                        if (entries[i].vector)
                                op->msix_entries[i].vector =
                                        xen_pirq_from_irq(entries[i].vector);
+                               if (unlikely(verbose_request))
+                                       printk(KERN_DEBUG "pciback: %s: " \
+                                               "MSI-X[%d]: %d\n",
+                                               pci_name(dev), i,
+                                               op->msix_entries[i].vector);
                }
        } else {
                printk(KERN_WARNING "pciback: %s: failed to enable MSI-X: err %d!\n",
@@ -95,6 +119,10 @@ int pciback_disable_msix(struct pciback_device *pdev,
 {
        struct pciback_dev_data *dev_data;
 
+       if (unlikely(verbose_request))
+               printk(KERN_DEBUG "pciback: %s: disable MSI-X\n",
+                      pci_name(dev));
+
        pci_disable_msix(dev);
 
        /*
@@ -102,6 +130,9 @@ int pciback_disable_msix(struct pciback_device *pdev,
         * an undefined IRQ value of zero.
         */
        op->value = dev->irq ? xen_pirq_from_irq(dev->irq) : 0;
+       if (unlikely(verbose_request))
+               printk(KERN_DEBUG "pciback: %s: MSI-X: %d\n", pci_name(dev),
+                       op->value);
        dev_data = pci_get_drvdata(dev);
        if (dev_data)
                dev_data->ack_intr = 1;