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: [PATCH v3 2/2] PCI/MSI: Implement irq_mask_noflush() for MSI-X
Date: Fri, 6 Nov 2026 09:34:48 -0800 [thread overview]
Message-ID: <20261106173448.34794-3-kbusch@meta.com> (raw)
In-Reply-To: <20261106173448.34794-1-kbusch@meta.com>
From: Keith Busch <kbusch@kernel.org>
Skip the read-back that flushes the MSI-X mask write. Parent domains
that mask on behalf of PCI/MSI keep using their own irq_mask().
Suggested-by: Thomas Gleixner <tglx@kernel.org>
Signed-off-by: Keith Busch <kbusch@kernel.org>
---
drivers/irqchip/irq-msi-lib.c | 1 +
drivers/pci/msi/irqdomain.c | 6 ++++++
drivers/pci/msi/msi.h | 10 ++++++++--
3 files changed, 15 insertions(+), 2 deletions(-)
diff --git a/drivers/irqchip/irq-msi-lib.c b/drivers/irqchip/irq-msi-lib.c
index 45e0ed3134ce1..97bc95d592122 100644
--- a/drivers/irqchip/irq-msi-lib.c
+++ b/drivers/irqchip/irq-msi-lib.c
@@ -126,6 +126,7 @@ bool msi_lib_init_dev_msi_info(struct device *dev, struct irq_domain *domain,
*/
if (info->flags & MSI_FLAG_PCI_MSI_MASK_PARENT) {
chip->irq_mask = irq_chip_mask_parent;
+ chip->irq_mask_noflush = NULL;
chip->irq_unmask = irq_chip_unmask_parent;
}
diff --git a/drivers/pci/msi/irqdomain.c b/drivers/pci/msi/irqdomain.c
index 6e65f0f44112e..2b9a5a0c305fb 100644
--- a/drivers/pci/msi/irqdomain.c
+++ b/drivers/pci/msi/irqdomain.c
@@ -162,6 +162,11 @@ static void pci_irq_mask_msix(struct irq_data *data)
pci_msix_mask(irq_data_get_msi_desc(data));
}
+static void pci_irq_mask_noflush_msix(struct irq_data *data)
+{
+ pci_msix_mask_noflush(irq_data_get_msi_desc(data));
+}
+
static void pci_irq_unmask_msix(struct irq_data *data)
{
pci_msix_unmask(irq_data_get_msi_desc(data));
@@ -182,6 +187,7 @@ static const struct msi_domain_template pci_msix_template = {
.irq_startup = pci_irq_startup_msix,
.irq_shutdown = pci_irq_shutdown_msix,
.irq_mask = pci_irq_mask_msix,
+ .irq_mask_noflush = pci_irq_mask_noflush_msix,
.irq_unmask = pci_irq_unmask_msix,
.irq_write_msi_msg = pci_msi_domain_write_msg,
.flags = IRQCHIP_ONESHOT_SAFE,
diff --git a/drivers/pci/msi/msi.h b/drivers/pci/msi/msi.h
index f987cf897264e..c40d24e5ca901 100644
--- a/drivers/pci/msi/msi.h
+++ b/drivers/pci/msi/msi.h
@@ -44,14 +44,20 @@ 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)
+/* Posted write only: the device may still send an interrupt after return */
+static inline void pci_msix_mask_noflush(struct msi_desc *desc)
{
desc->pci.msix_ctrl |= PCI_MSIX_ENTRY_CTRL_MASKBIT;
+ pci_msix_write_vector_ctrl(desc, desc->pci.msix_ctrl);
+}
+
+static inline void pci_msix_mask(struct msi_desc *desc)
+{
+ pci_msix_mask_noflush(desc);
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 */
readl(desc->pci.mask_base);
}
--
2.52.0
next prev parent reply other threads:[~2026-11-06 17:38 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-06 17:34 [PATCH v3 0/2] genirq, PCI/MSI: mask without flushing Keith Busch
2026-11-06 17:34 ` [PATCH v3 1/2] genirq: Add disable_irq_noflush() Keith Busch
2026-11-06 17:48 ` sashiko-bot
2026-11-06 17:34 ` Keith Busch [this message]
2026-11-06 17:47 ` [PATCH v3 2/2] PCI/MSI: Implement irq_mask_noflush() for MSI-X sashiko-bot
2026-11-06 20:53 ` Thomas Gleixner
2026-11-07 20:00 ` Keith Busch
2026-11-07 21:53 ` Thomas Gleixner
2026-11-09 16:14 ` Keith Busch
2026-11-10 23:41 ` Thomas Gleixner
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=20261106173448.34794-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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.