[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [linux-2.6.18-xen] pciback: check PF instead of VF for PCI_COMMAND_MEMORY


  • To: xen-changelog@xxxxxxxxxxxxxxxxxxx
  • From: Xen patchbot-linux-2.6.18-xen <patchbot@xxxxxxx>
  • Date: Mon, 22 Feb 2016 14:33:03 +0000
  • Delivery-date: Mon, 22 Feb 2016 14:33:08 +0000
  • List-id: "Change log for Mercurial \(receive only\)" <xen-changelog.lists.xen.org>

# HG changeset patch
# User Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>
# Date 1456150985 -3600
#      Mon Feb 22 15:23:05 2016 +0100
# Node ID c00c8be428cdccdd82de9a3adb8a5510d56c1270
# Parent  c13c5210b623867c1ac88b14183a051152b1febd
pciback: check PF instead of VF for PCI_COMMAND_MEMORY

c/s 408fb0e5aa7fda0059db282ff58c3b2a4278baa0
"xen/pciback: Don't allow MSI-X ops if PCI_COMMAND_MEMORY is not set."
would check the device for PCI_COMMAND_MEMORY which is great.
Except that VF devices are unique - for example they have no
legacy interrupts, and also any writes to PCI_COMMAND_MEMORY
are silently ignored (by the hardware).

Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>
Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
Committed-by: Jan Beulich <jbeulich@xxxxxxxx>
---


diff -r c13c5210b623 -r c00c8be428cd 
drivers/xen/pciback/conf_space_capability_msi.c
--- a/drivers/xen/pciback/conf_space_capability_msi.c   Mon Feb 22 15:17:24 
2016 +0100
+++ b/drivers/xen/pciback/conf_space_capability_msi.c   Mon Feb 22 15:23:05 
2016 +0100
@@ -48,6 +48,7 @@ int pciback_enable_msix(struct pciback_d
        int i, result;
        struct msix_entry *entries;
        u16 cmd;
+       struct pci_dev *phys_dev = dev;
 
        if (op->value > SH_INFO_MAX_VEC)
                return -EINVAL;
@@ -58,8 +59,12 @@ int pciback_enable_msix(struct pciback_d
        /*
         * PCI_COMMAND_MEMORY must be enabled, otherwise we may not be able
         * to access the BARs where the MSI-X entries reside.
+        * But VF devices are unique in which the PF needs to be checked.
         */
-       pci_read_config_word(dev, PCI_COMMAND, &cmd);
+#ifdef CONFIG_PCI_IOV
+       phys_dev = dev->is_physfn ? dev : dev->physfn;
+#endif
+       pci_read_config_word(phys_dev, PCI_COMMAND, &cmd);
        if (dev->msi_enabled || !(cmd & PCI_COMMAND_MEMORY))
                return -ENXIO;
 

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.