From: Barry Song <21cnbao@gmail.com>
To: bhelgaas@google.com, maz@kernel.org, tglx@linutronix.de
Cc: Jonathan.Cameron@huawei.com, bilbao@vt.edu, corbet@lwn.net,
gregkh@linuxfoundation.org, leon@kernel.org,
linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org,
linuxarm@huawei.com, luzmaximilian@gmail.com,
mchehab+huawei@kernel.org, schnelle@linux.ibm.com,
jesse.brandeburg@intel.com, anthony.l.nguyen@intel.com,
intel-wired-lan@lists.osuosl.org,
Barry Song <song.bao.hua@hisilicon.com>
Subject: [PATCH v3 3/3] PCI/MSI: remove msi_attrib.default_irq in msi_desc
Date: Wed, 25 Aug 2021 18:26:36 +0800 [thread overview]
Message-ID: <20210825102636.52757-4-21cnbao@gmail.com> (raw)
In-Reply-To: <20210825102636.52757-1-21cnbao@gmail.com>
From: Marc Zyngier <maz@kernel.org>
default_irq is hideous as it should be per-device but not per-desc.
On the other hand, MSI-X case doesn't use it at all. Since sysfs
IRQ has moved to use the msi_entry instead of pci_dev.irq, now it
seems it is safe to remove msi_attrib.default_irq.
Cc: Jesse Brandeburg <jesse.brandeburg@intel.com>
Cc: Tony Nguyen <anthony.l.nguyen@intel.com>
Signed-off-by: Marc Zyngier <maz@kernel.org>
[Barry: Updated pci_irq_vector and __pci_restore_msi_state]
Signed-off-by: Barry Song <song.bao.hua@hisilicon.com>
---
drivers/pci/msi.c | 12 +++++-------
include/linux/msi.h | 2 --
2 files changed, 5 insertions(+), 9 deletions(-)
diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c
index e5e7533..9434afa 100644
--- a/drivers/pci/msi.c
+++ b/drivers/pci/msi.c
@@ -422,7 +422,7 @@ static void __pci_restore_msi_state(struct pci_dev *dev)
if (!dev->msi_enabled)
return;
- entry = irq_get_msi_desc(dev->irq);
+ entry = first_pci_msi_entry(dev);
pci_intx_for_msi(dev, 0);
pci_msi_set_enable(dev, 0);
@@ -591,7 +591,6 @@ static int populate_msi_sysfs(struct pci_dev *pdev)
entry->msi_attrib.is_virtual = 0;
entry->msi_attrib.entry_nr = 0;
entry->msi_attrib.maskbit = !!(control & PCI_MSI_FLAGS_MASKBIT);
- entry->msi_attrib.default_irq = dev->irq; /* Save IOAPIC IRQ */
entry->msi_attrib.multi_cap = (control & PCI_MSI_FLAGS_QMASK) >> 1;
entry->msi_attrib.multiple = ilog2(__roundup_pow_of_two(nvec));
@@ -682,7 +681,6 @@ static int msi_capability_init(struct pci_dev *dev, int nvec,
dev->msi_enabled = 1;
pcibios_free_irq(dev);
- dev->irq = entry->irq;
return 0;
}
@@ -742,7 +740,6 @@ static int msix_setup_entries(struct pci_dev *dev, void __iomem *base,
entry->msi_attrib.is_virtual =
entry->msi_attrib.entry_nr >= vec_count;
- entry->msi_attrib.default_irq = dev->irq;
entry->mask_base = base;
addr = pci_msix_desc_addr(entry);
@@ -964,8 +961,6 @@ static void pci_msi_shutdown(struct pci_dev *dev)
mask = msi_mask(desc->msi_attrib.multi_cap);
msi_mask_irq(desc, mask, 0);
- /* Restore dev->irq to its default pin-assertion IRQ */
- dev->irq = desc->msi_attrib.default_irq;
pcibios_alloc_irq(dev);
}
@@ -1301,12 +1296,15 @@ int pci_irq_vector(struct pci_dev *dev, unsigned int nr)
if (WARN_ON_ONCE(nr >= entry->nvec_used))
return -EINVAL;
+
+ return entry->irq + nr;
} else {
if (WARN_ON_ONCE(nr > 0))
return -EINVAL;
}
- return dev->irq + nr;
+ /* legacy INTx */
+ return dev->irq;
}
EXPORT_SYMBOL(pci_irq_vector);
diff --git a/include/linux/msi.h b/include/linux/msi.h
index e8bdcb8..a631664 100644
--- a/include/linux/msi.h
+++ b/include/linux/msi.h
@@ -114,7 +114,6 @@ struct ti_sci_inta_msi_desc {
* @maskbit: [PCI MSI/X] Mask-Pending bit supported?
* @is_64: [PCI MSI/X] Address size: 0=32bit 1=64bit
* @entry_nr: [PCI MSI/X] Entry which is described by this descriptor
- * @default_irq:[PCI MSI/X] The default pre-assigned non-MSI irq
* @mask_pos: [PCI MSI] Mask register position
* @mask_base: [PCI MSI-X] Mask register base address
* @platform: [platform] Platform device specific msi descriptor data
@@ -148,7 +147,6 @@ struct msi_desc {
u8 is_64 : 1;
u8 is_virtual : 1;
u16 entry_nr;
- unsigned default_irq;
} msi_attrib;
union {
u8 mask_pos;
--
1.8.3.1
next prev parent reply other threads:[~2021-08-25 10:28 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-25 10:26 [PATCH v3 0/3] PCI/MSI: Clarify the IRQ sysfs ABI for PCI devices Barry Song
2021-08-25 10:26 ` [PATCH v3 1/3] Documentation: ABI: sysfs-bus-pci: Add description for IRQ entry Barry Song
2021-08-25 10:26 ` [PATCH v3 2/3] PCI/sysfs: Don't depend on pci_dev.irq " Barry Song
2021-08-25 13:30 ` Marc Zyngier
2021-08-25 10:26 ` Barry Song [this message]
2021-08-25 13:38 ` [PATCH v3 3/3] PCI/MSI: remove msi_attrib.default_irq in msi_desc Marc Zyngier
2021-08-29 14:55 ` [PCI/MSI] a4fc4cf388: dmesg.genirq:Flags_mismatch_irq##(mei_me)vs.#(xhci_hcd) kernel test robot
2021-08-31 1:21 ` Barry Song
2021-08-31 1:36 ` Barry Song
2021-09-02 19:34 ` Winkler, Tomas
2021-10-03 8:32 ` Barry Song
2021-10-15 14:45 ` [LKP] " Carel Si
2021-10-16 0:08 ` Barry Song
2021-10-19 6:52 ` Carel Si
2021-08-31 8:08 ` Marc Zyngier
2021-08-31 21:36 ` Barry Song
2021-09-01 13:09 ` Marc Zyngier
2021-10-16 10:11 ` [PATCH v3 0/3] PCI/MSI: Clarify the IRQ sysfs ABI for PCI devices Barry Song
2021-10-18 21:50 ` Bjorn Helgaas
2021-10-19 7:39 ` Marc Zyngier
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210825102636.52757-4-21cnbao@gmail.com \
--to=21cnbao@gmail.com \
--cc=Jonathan.Cameron@huawei.com \
--cc=anthony.l.nguyen@intel.com \
--cc=bhelgaas@google.com \
--cc=bilbao@vt.edu \
--cc=corbet@lwn.net \
--cc=gregkh@linuxfoundation.org \
--cc=intel-wired-lan@lists.osuosl.org \
--cc=jesse.brandeburg@intel.com \
--cc=leon@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=linuxarm@huawei.com \
--cc=luzmaximilian@gmail.com \
--cc=maz@kernel.org \
--cc=mchehab+huawei@kernel.org \
--cc=schnelle@linux.ibm.com \
--cc=song.bao.hua@hisilicon.com \
--cc=tglx@linutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®