|
@@ -212,6 +212,7 @@ int xen_pcibk_enable_msix(struct xen_pcibk_device *pdev,
|
|
|
struct xen_pcibk_dev_data *dev_data;
|
|
|
int i, result;
|
|
|
struct msix_entry *entries;
|
|
|
+ u16 cmd;
|
|
|
|
|
|
if (unlikely(verbose_request))
|
|
|
printk(KERN_DEBUG DRV_NAME ": %s: enable MSI-X\n",
|
|
@@ -223,7 +224,12 @@ int xen_pcibk_enable_msix(struct xen_pcibk_device *pdev,
|
|
|
if (dev->msix_enabled)
|
|
|
return -EALREADY;
|
|
|
|
|
|
- if (dev->msi_enabled)
|
|
|
+ /*
|
|
|
+ * PCI_COMMAND_MEMORY must be enabled, otherwise we may not be able
|
|
|
+ * to access the BARs where the MSI-X entries reside.
|
|
|
+ */
|
|
|
+ pci_read_config_word(dev, PCI_COMMAND, &cmd);
|
|
|
+ if (dev->msi_enabled || !(cmd & PCI_COMMAND_MEMORY))
|
|
|
return -ENXIO;
|
|
|
|
|
|
entries = kmalloc(op->value * sizeof(*entries), GFP_KERNEL);
|