Commit a9047f24 authored by Bjorn Helgaas's avatar Bjorn Helgaas

vfio-pci: Use cached MSI/MSI-X capabilities

We now cache the MSI/MSI-X capability offsets in the struct pci_dev,
so no need to find the capabilities again.
Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
Acked-by: default avatarAlex Williamson <alex.williamson@redhat.com>
parent 508d1aa6
...@@ -70,7 +70,7 @@ static int vfio_pci_enable(struct vfio_pci_device *vdev) ...@@ -70,7 +70,7 @@ static int vfio_pci_enable(struct vfio_pci_device *vdev)
pci_write_config_word(pdev, PCI_COMMAND, cmd); pci_write_config_word(pdev, PCI_COMMAND, cmd);
} }
msix_pos = pci_find_capability(pdev, PCI_CAP_ID_MSIX); msix_pos = pdev->msix_cap;
if (msix_pos) { if (msix_pos) {
u16 flags; u16 flags;
u32 table; u32 table;
...@@ -183,7 +183,7 @@ static int vfio_pci_get_irq_count(struct vfio_pci_device *vdev, int irq_type) ...@@ -183,7 +183,7 @@ static int vfio_pci_get_irq_count(struct vfio_pci_device *vdev, int irq_type)
u8 pos; u8 pos;
u16 flags; u16 flags;
pos = pci_find_capability(vdev->pdev, PCI_CAP_ID_MSI); pos = vdev->pdev->msi_cap;
if (pos) { if (pos) {
pci_read_config_word(vdev->pdev, pci_read_config_word(vdev->pdev,
pos + PCI_MSI_FLAGS, &flags); pos + PCI_MSI_FLAGS, &flags);
...@@ -194,7 +194,7 @@ static int vfio_pci_get_irq_count(struct vfio_pci_device *vdev, int irq_type) ...@@ -194,7 +194,7 @@ static int vfio_pci_get_irq_count(struct vfio_pci_device *vdev, int irq_type)
u8 pos; u8 pos;
u16 flags; u16 flags;
pos = pci_find_capability(vdev->pdev, PCI_CAP_ID_MSIX); pos = vdev->pdev->msix_cap;
if (pos) { if (pos) {
pci_read_config_word(vdev->pdev, pci_read_config_word(vdev->pdev,
pos + PCI_MSIX_FLAGS, &flags); pos + PCI_MSIX_FLAGS, &flags);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment