summaryrefslogtreecommitdiff
path: root/drivers/pci/msi
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2021-12-10 23:19:18 +0100
committerThomas Gleixner <tglx@linutronix.de>2021-12-16 22:16:40 +0100
commit173ffad79d177d9a91fbf3be6bf67ca81e0f765a (patch)
treeff852acdd9a5996067b67a4c44b6fe997cd45a1f /drivers/pci/msi
parent0f18095871fc59c89a281caf6f18538cf9e50fbf (diff)
PCI/MSI: Use msi_desc::msi_index
The usage of msi_desc::pci::entry_nr is confusing at best. It's the index into the MSI[X] descriptor table. Use msi_desc::msi_index which is shared between all MSI incarnations instead of having a PCI specific storage for no value. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Tested-by: Michael Kelley <mikelley@microsoft.com> Tested-by: Nishanth Menon <nm@ti.com> Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Reviewed-by: Jason Gunthorpe <jgg@nvidia.com> Acked-by: Bjorn Helgaas <bhelgaas@google.com> Link: https://lore.kernel.org/r/20211210221814.602911509@linutronix.de
Diffstat (limited to 'drivers/pci/msi')
-rw-r--r--drivers/pci/msi/irqdomain.c2
-rw-r--r--drivers/pci/msi/msi.c20
2 files changed, 9 insertions, 13 deletions
diff --git a/drivers/pci/msi/irqdomain.c b/drivers/pci/msi/irqdomain.c
index 26b23a1c4f60..422420276d6f 100644
--- a/drivers/pci/msi/irqdomain.c
+++ b/drivers/pci/msi/irqdomain.c
@@ -57,7 +57,7 @@ static irq_hw_number_t pci_msi_domain_calc_hwirq(struct msi_desc *desc)
{
struct pci_dev *dev = msi_desc_to_pci_dev(desc);
- return (irq_hw_number_t)desc->pci.msi_attrib.entry_nr |
+ return (irq_hw_number_t)desc->msi_index |
pci_dev_id(dev) << 11 |
(pci_domain_nr(dev->bus) & 0xFFFFFFFF) << 27;
}
diff --git a/drivers/pci/msi/msi.c b/drivers/pci/msi/msi.c
index 76c15be8e1cc..8fb4dd2a18b9 100644
--- a/drivers/pci/msi/msi.c
+++ b/drivers/pci/msi/msi.c
@@ -44,7 +44,7 @@ static inline void pci_msi_unmask(struct msi_desc *desc, u32 mask)
static inline void __iomem *pci_msix_desc_addr(struct msi_desc *desc)
{
- return desc->pci.mask_base + desc->pci.msi_attrib.entry_nr * PCI_MSIX_ENTRY_SIZE;
+ return desc->pci.mask_base + desc->msi_index * PCI_MSIX_ENTRY_SIZE;
}
/*
@@ -394,13 +394,10 @@ msi_setup_entry(struct pci_dev *dev, int nvec, struct irq_affinity *affd)
if (dev->dev_flags & PCI_DEV_FLAGS_HAS_MSI_MASKING)
control |= PCI_MSI_FLAGS_MASKBIT;
- entry->pci.msi_attrib.is_msix = 0;
- entry->pci.msi_attrib.is_64 = !!(control & PCI_MSI_FLAGS_64BIT);
- entry->pci.msi_attrib.is_virtual = 0;
- entry->pci.msi_attrib.entry_nr = 0;
+ entry->pci.msi_attrib.is_64 = !!(control & PCI_MSI_FLAGS_64BIT);
entry->pci.msi_attrib.can_mask = !pci_msi_ignore_mask &&
!!(control & PCI_MSI_FLAGS_MASKBIT);
- entry->pci.msi_attrib.default_irq = dev->irq; /* Save IOAPIC IRQ */
+ entry->pci.msi_attrib.default_irq = dev->irq;
entry->pci.msi_attrib.multi_cap = (control & PCI_MSI_FLAGS_QMASK) >> 1;
entry->pci.msi_attrib.multiple = ilog2(__roundup_pow_of_two(nvec));
@@ -542,12 +539,11 @@ static int msix_setup_entries(struct pci_dev *dev, void __iomem *base,
entry->pci.msi_attrib.is_64 = 1;
if (entries)
- entry->pci.msi_attrib.entry_nr = entries[i].entry;
+ entry->msi_index = entries[i].entry;
else
- entry->pci.msi_attrib.entry_nr = i;
+ entry->msi_index = i;
- entry->pci.msi_attrib.is_virtual =
- entry->pci.msi_attrib.entry_nr >= vec_count;
+ entry->pci.msi_attrib.is_virtual = entry->msi_index >= vec_count;
entry->pci.msi_attrib.can_mask = !pci_msi_ignore_mask &&
!entry->pci.msi_attrib.is_virtual;
@@ -1088,7 +1084,7 @@ int pci_irq_vector(struct pci_dev *dev, unsigned int nr)
struct msi_desc *entry;
for_each_pci_msi_entry(entry, dev) {
- if (entry->pci.msi_attrib.entry_nr == nr)
+ if (entry->msi_index == nr)
return entry->irq;
}
WARN_ON_ONCE(1);
@@ -1127,7 +1123,7 @@ const struct cpumask *pci_irq_get_affinity(struct pci_dev *dev, int nr)
struct msi_desc *entry;
for_each_pci_msi_entry(entry, dev) {
- if (entry->pci.msi_attrib.entry_nr == nr)
+ if (entry->msi_index == nr)
return &entry->affinity->mask;
}
WARN_ON_ONCE(1);