From: Frank Li <Frank.li@oss.nxp.com>
To: Koichiro Den <den@valinux.co.jp>
Cc: "Manivannan Sadhasivam" <mani@kernel.org>,
"Frank Li" <Frank.Li@nxp.com>,
"Niklas Cassel" <cassel@kernel.org>,
"Krzysztof Wilczyński" <kwilczynski@kernel.org>,
"Kishon Vijay Abraham I" <kishon@kernel.org>,
"Bjorn Helgaas" <bhelgaas@google.com>,
"Jon Mason" <jdmason@kudzu.us>,
"Dave Jiang" <dave.jiang@intel.com>,
"Allen Hubbe" <allenbh@gmail.com>,
linux-pci@vger.kernel.org, ntb@lists.linux.dev,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/3] PCI: endpoint: pci-ep-msi: Make embedded doorbell IRQ exclusive
Date: Tue, 28 Jul 2026 15:23:06 -0400 [thread overview]
Message-ID: <amkBmicqi6mMTIQ6@lizhi-Precision-Tower-5810> (raw)
In-Reply-To: <20260728172306.2751813-3-den@valinux.co.jp>
On Wed, Jul 29, 2026 at 02:23:05AM +0900, Koichiro Den wrote:
> Embedded doorbells may use the same virq for several messages. This does
> not mean the IRQ itself should be shared. Consumers only need to request
> each distinct virq once, as vNTB and pci-epf-test already do.
>
> IRQF_SHARED would let different EPFs register handlers for the same IRQ.
> The embedded doorbell interface cannot tell which EPF a write targets,
> so every handler would handle it.
>
> Only the first EPF can allocate doorbells today, so this cannot happen
> yet. Drop IRQF_SHARED before extending the embedded backend to non-first
> EPFs. A second request for the same IRQ will then fail with -EBUSY
> instead of attaching another handler.
>
> Signed-off-by: Koichiro Den <den@valinux.co.jp>
> ---
Reviewed-by: Frank Li <Frank.Li@nxp.com>
> drivers/pci/endpoint/pci-ep-msi.c | 9 +++++----
> include/linux/pci-epf.h | 3 ++-
> 2 files changed, 7 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/pci/endpoint/pci-ep-msi.c b/drivers/pci/endpoint/pci-ep-msi.c
> index 0855c7930abb..a123a189b4e6 100644
> --- a/drivers/pci/endpoint/pci-ep-msi.c
> +++ b/drivers/pci/endpoint/pci-ep-msi.c
> @@ -10,7 +10,6 @@
> #include <linux/cleanup.h>
> #include <linux/device.h>
> #include <linux/export.h>
> -#include <linux/interrupt.h>
> #include <linux/irqdomain.h>
> #include <linux/module.h>
> #include <linux/msi.h>
> @@ -112,8 +111,11 @@ static int pci_epf_alloc_doorbell_embedded(struct pci_epf *epf, u16 num_db)
> *
> * Still, pci_epf_alloc_doorbell() allows requesting multiple doorbells.
> * For such backends we replicate the same address/data for each entry
> - * and mark the IRQ as shared (IRQF_SHARED). Consumers must treat them
> - * as equivalent "kick" doorbells.
> + * as equivalent "kick" doorbells. Consumers must request each distinct
> + * IRQ only once.
> + *
> + * Keep the IRQ exclusive because the source cannot identify which EPF
> + * rang the doorbell.
> */
> for (i = 0; i < num_db; i++)
> msg[i] = (struct pci_epf_doorbell_msg) {
> @@ -121,7 +123,6 @@ static int pci_epf_alloc_doorbell_embedded(struct pci_epf *epf, u16 num_db)
> .msg.address_hi = (u32)(addr >> 32),
> .msg.data = doorbell->u.db_mmio.data,
> .virq = doorbell->u.db_mmio.irq,
> - .irq_flags = IRQF_SHARED,
> .type = PCI_EPF_DOORBELL_EMBEDDED,
> .bar = doorbell->bar,
> .offset = (doorbell->bar == NO_BAR) ? 0 :
> diff --git a/include/linux/pci-epf.h b/include/linux/pci-epf.h
> index 8a6c64a35890..e5b9a79beb93 100644
> --- a/include/linux/pci-epf.h
> +++ b/include/linux/pci-epf.h
> @@ -163,7 +163,8 @@ enum pci_epf_doorbell_type {
> * For MSI-backed doorbells this is the MSI message, while for
> * "embedded" doorbells this represents an MMIO write that asserts
> * an interrupt on the EP side.
> - * @virq: IRQ number of this doorbell message
> + * @virq: IRQ number of this doorbell message. Multiple messages may use the
> + * same IRQ; consumers must request each distinct IRQ only once.
> * @irq_flags: Required flags for request_irq()/request_threaded_irq().
> * Callers may OR-in additional flags (e.g. IRQF_ONESHOT).
> * @type: Doorbell type.
> --
> 2.51.0
>
next prev parent reply other threads:[~2026-07-28 19:23 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-28 17:23 [PATCH 0/3] PCI: endpoint: Support vNTB as a non-first EPF Koichiro Den
2026-07-28 17:23 ` [PATCH 1/3] PCI: endpoint: pci-epf-vntb: Pass PF/VF number when BAR programming Koichiro Den
2026-07-28 19:18 ` Frank Li
2026-09-08 16:53 ` Bjorn Helgaas
2026-09-09 2:01 ` Koichiro Den
2026-09-09 2:23 ` Bjorn Helgaas
2026-09-09 4:53 ` Koichiro Den
2026-09-09 16:09 ` Bjorn Helgaas
2026-09-10 4:56 ` Koichiro Den
2026-09-10 6:08 ` Manivannan Sadhasivam
2026-09-10 8:26 ` Koichiro Den
2026-09-08 21:08 ` Bjorn Helgaas
2026-07-28 17:23 ` [PATCH 2/3] PCI: endpoint: pci-ep-msi: Make embedded doorbell IRQ exclusive Koichiro Den
2026-07-28 19:23 ` Frank Li [this message]
2026-07-28 17:23 ` [PATCH 3/3] PCI: endpoint: pci-ep-msi: Let non-first EPFs use embedded doorbells Koichiro Den
2026-07-28 19:26 ` Frank Li
2026-09-03 5:58 ` [PATCH 0/3] PCI: endpoint: Support vNTB as a non-first EPF Manivannan Sadhasivam
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=amkBmicqi6mMTIQ6@lizhi-Precision-Tower-5810 \
--to=frank.li@oss.nxp.com \
--cc=Frank.Li@nxp.com \
--cc=allenbh@gmail.com \
--cc=bhelgaas@google.com \
--cc=cassel@kernel.org \
--cc=dave.jiang@intel.com \
--cc=den@valinux.co.jp \
--cc=jdmason@kudzu.us \
--cc=kishon@kernel.org \
--cc=kwilczynski@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=mani@kernel.org \
--cc=ntb@lists.linux.dev \
/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®