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 3/3] PCI: endpoint: pci-ep-msi: Let non-first EPFs use embedded doorbells
Date: Tue, 28 Jul 2026 15:26:44 -0400 [thread overview]
Message-ID: <amkCdJKg2enzDC6D@lizhi-Precision-Tower-5810> (raw)
In-Reply-To: <20260728172306.2751813-4-den@valinux.co.jp>
On Wed, Jul 29, 2026 at 02:23:06AM +0900, Koichiro Den wrote:
> pci_epf_alloc_doorbell() rejects every EPF that is not the first one
> attached to the EPC because the MSI-backed path can populate doorbell
> messages only for that EPF. This also prevents non-first EPFs from using
> the embedded doorbell backend.
>
> Keep the MSI-backed path limited to the first attached EPF. Let
> non-first EPFs skip it and try the embedded doorbell directly. The
> embedded IRQ is exclusive, so a second embedded user fails to request
> the IRQ instead of receiving another EPF's notifications.
>
> Signed-off-by: Koichiro Den <den@valinux.co.jp>
> ---
Reviewed-by: Frank Li <Frank.Li@nxp.com>
> drivers/pci/endpoint/pci-ep-msi.c | 31 +++++++++++++++++--------------
> 1 file changed, 17 insertions(+), 14 deletions(-)
>
> diff --git a/drivers/pci/endpoint/pci-ep-msi.c b/drivers/pci/endpoint/pci-ep-msi.c
> index a123a189b4e6..5ea7eef9794f 100644
> --- a/drivers/pci/endpoint/pci-ep-msi.c
> +++ b/drivers/pci/endpoint/pci-ep-msi.c
> @@ -199,28 +199,31 @@ static int pci_epf_alloc_doorbell_msi(struct pci_epf *epf, u16 num_db)
> int pci_epf_alloc_doorbell(struct pci_epf *epf, u16 num_db)
> {
> struct pci_epc *epc = epf->epc;
> + struct pci_epf *first_epf;
> struct device *dev = &epf->dev;
> int ret;
>
> - /* TODO: Multi-EPF support */
> - if (list_first_entry_or_null(&epc->pci_epf, struct pci_epf, list) != epf) {
> - dev_err(dev, "Doorbell doesn't support multiple EPF\n");
> - return -EINVAL;
> - }
> -
> if (epf->db_msg)
> return -EBUSY;
>
> - ret = pci_epf_alloc_doorbell_msi(epf, num_db);
> - if (!ret)
> - return 0;
> -
> /*
> - * Fall back to embedded doorbell only when platform MSI is unavailable
> - * for this EPC.
> + * The MSI-backed doorbell path currently targets the first EPF attached
> + * to the EPC. Let non-first EPFs try the embedded doorbell instead.
> */
> - if (ret != -ENODEV)
> - return ret;
> + first_epf = list_first_entry_or_null(&epc->pci_epf, struct pci_epf,
> + list);
> + if (first_epf == epf) {
> + ret = pci_epf_alloc_doorbell_msi(epf, num_db);
> + if (!ret)
> + return 0;
> +
> + /*
> + * Fall back to embedded doorbell only when platform MSI is
> + * unavailable for this EPC.
> + */
> + if (ret != -ENODEV)
> + return ret;
> + }
>
> ret = pci_epf_alloc_doorbell_embedded(epf, num_db);
> if (ret) {
> --
> 2.51.0
>
next prev parent reply other threads:[~2026-07-28 19:26 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
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 [this message]
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=amkCdJKg2enzDC6D@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®