From: Keith Busch <kbusch@meta.com>
To: <tglx@kernel.org>, <bhelgaas@google.com>
Cc: <maz@kernel.org>, <lrizzo@google.com>, <hch@lst.de>,
<changfengnan@bytedance.com>, <namjain@linux.microsoft.com>,
<linux-kernel@vger.kernel.org>, <linux-pci@vger.kernel.org>,
<linux-nvme@lists.infradead.org>, Keith Busch <kbusch@kernel.org>
Subject: [PATCHv4 2/3] PCI/MSI: Add pci_msix_write_vector_ctrl_and_flush()
Date: Wed, 2 Dec 2026 13:16:10 -0800 [thread overview]
Message-ID: <20261202211611.1523977-3-kbusch@meta.com> (raw)
In-Reply-To: <20261202211611.1523977-1-kbusch@meta.com>
From: Keith Busch <kbusch@kernel.org>
pci_msix_mask() open codes an offline check and a flushing read around
pci_msix_write_vector_ctrl(). Move both into a helper so the mask path
reads as a single flushed write. No functional change.
Suggested-by: Thomas Gleixner <tglx@kernel.org>
Signed-off-by: Keith Busch <kbusch@kernel.org>
---
drivers/pci/msi/msi.h | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)
diff --git a/drivers/pci/msi/msi.h b/drivers/pci/msi/msi.h
index f987cf897264e..9fbb96906a6ba 100644
--- a/drivers/pci/msi/msi.h
+++ b/drivers/pci/msi/msi.h
@@ -44,18 +44,22 @@ static inline void pci_msix_write_vector_ctrl(struct msi_desc *desc, u32 ctrl)
writel(ctrl, desc_addr + PCI_MSIX_ENTRY_VECTOR_CTRL);
}
-static inline void pci_msix_mask(struct msi_desc *desc)
+static inline void pci_msix_write_vector_ctrl_and_flush(struct msi_desc *desc,
+ u32 ctrl)
{
- desc->pci.msix_ctrl |= PCI_MSIX_ENTRY_CTRL_MASKBIT;
-
if (pci_channel_offline(msi_desc_to_pci_dev(desc)))
return;
- pci_msix_write_vector_ctrl(desc, desc->pci.msix_ctrl);
- /* Flush write to device */
+ pci_msix_write_vector_ctrl(desc, ctrl);
readl(desc->pci.mask_base);
}
+static inline void pci_msix_mask(struct msi_desc *desc)
+{
+ desc->pci.msix_ctrl |= PCI_MSIX_ENTRY_CTRL_MASKBIT;
+ pci_msix_write_vector_ctrl_and_flush(desc, desc->pci.msix_ctrl);
+}
+
static inline void pci_msix_unmask(struct msi_desc *desc)
{
desc->pci.msix_ctrl &= ~PCI_MSIX_ENTRY_CTRL_MASKBIT;
--
2.52.1
next prev parent reply other threads:[~2026-12-02 21:19 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-02 21:16 [PATCHv4 0/3] genirq, PCI/MSI: mask without flushing Keith Busch
2026-12-02 21:16 ` [PATCHv4 1/3] genirq: Add disable_irq_noflush() Keith Busch
2026-12-02 21:16 ` Keith Busch [this message]
2026-12-02 21:16 ` [PATCHv4 3/3] PCI/MSI: Implement irq_mask_noflush() for MSI-X Keith Busch
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=20261202211611.1523977-3-kbusch@meta.com \
--to=kbusch@meta.com \
--cc=bhelgaas@google.com \
--cc=changfengnan@bytedance.com \
--cc=hch@lst.de \
--cc=kbusch@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-nvme@lists.infradead.org \
--cc=linux-pci@vger.kernel.org \
--cc=lrizzo@google.com \
--cc=maz@kernel.org \
--cc=namjain@linux.microsoft.com \
--cc=tglx@kernel.org \
/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®