mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Frank Li <Frank.li@nxp.com>
To: Koichiro Den <den@valinux.co.jp>
Cc: "Jingoo Han" <jingoohan1@gmail.com>,
	"Manivannan Sadhasivam" <mani@kernel.org>,
	"Lorenzo Pieralisi" <lpieralisi@kernel.org>,
	"Krzysztof Wilczyński" <kwilczynski@kernel.org>,
	"Rob Herring" <robh@kernel.org>,
	"Bjorn Helgaas" <bhelgaas@google.com>,
	"Kishon Vijay Abraham I" <kishon@kernel.org>,
	"Jon Mason" <jdmason@kudzu.us>,
	"Dave Jiang" <dave.jiang@intel.com>,
	"Allen Hubbe" <allenbh@gmail.com>,
	"Niklas Cassel" <cassel@kernel.org>,
	"Bhanu Seshu Kumar Valluri" <bhanuseshukumar@gmail.com>,
	"Marco Crivellari" <marco.crivellari@suse.com>,
	"Shin'ichiro Kawasaki" <shinichiro.kawasaki@wdc.com>,
	"Manikanta Maddireddy" <mmaddireddy@nvidia.com>,
	linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org,
	ntb@lists.linux.dev
Subject: Re: [PATCH v12 1/7] PCI: endpoint: Add auxiliary resource query API
Date: Tue, 31 Mar 2026 10:09:28 -0400	[thread overview]
Message-ID: <acvVmM-nk73ntNj5@lizhi-Precision-Tower-5810> (raw)
In-Reply-To: <zzatuxxzrg6yuqprvhgntwspsrg3igk2wqqqamx7xh733ksgef@mvwzcseqvjrb>

On Tue, Mar 31, 2026 at 10:56:34PM +0900, Koichiro Den wrote:
> On Fri, Mar 27, 2026 at 12:31:09PM -0400, Frank Li wrote:
> > On Fri, Mar 27, 2026 at 12:54:16PM +0900, Koichiro Den wrote:
> > > Endpoint controller drivers may integrate auxiliary blocks (e.g. DMA
> > > engines) whose register windows and descriptor memories metadata need to
> > > be exposed to a remote peer. Endpoint function drivers need a generic
> > > way to discover such resources without hard-coding controller-specific
> > > helpers.
> > >
> > > Add pci_epc_count_aux_resources() / pci_epc_get_aux_resources() and the
> > > corresponding pci_epc_ops callbacks. The count helper returns the number
> > > of available resources via an output parameter, while the get helper
> > > fills a caller-provided array of resources described by type, physical
> > > address and size, plus type-specific metadata.
> > >
> > > Suggested-by: Manivannan Sadhasivam <mani@kernel.org>
> > > Signed-off-by: Koichiro Den <den@valinux.co.jp>
> > > ---
> > > Changes in v12:
> > >   - Add pci_epc_count_aux_resources() and pci_epc_ops.count_aux_resources
> > >   - Use pci_epc_function_is_valid() instead of open-coding
> > >
> > >  drivers/pci/endpoint/pci-epc-core.c | 83 +++++++++++++++++++++++++++++
> > >  include/linux/pci-epc.h             | 53 ++++++++++++++++++
> > >  2 files changed, 136 insertions(+)
> > >
> > > diff --git a/drivers/pci/endpoint/pci-epc-core.c b/drivers/pci/endpoint/pci-epc-core.c
> > > index 6c3c58185fc5..fded71a19d71 100644
> > > --- a/drivers/pci/endpoint/pci-epc-core.c
> > > +++ b/drivers/pci/endpoint/pci-epc-core.c
> > > @@ -156,6 +156,89 @@ const struct pci_epc_features *pci_epc_get_features(struct pci_epc *epc,
> > >  }
> > >  EXPORT_SYMBOL_GPL(pci_epc_get_features);
> > >
> > > +/**
> > > + * pci_epc_count_aux_resources() - count EPC-provided auxiliary resources
> > > + * @epc: EPC device
> > > + * @func_no: function number
> > > + * @vfunc_no: virtual function number
> > > + * @num_resources: returned number of auxiliary resources
> > > + *
> > > + * Some EPC backends integrate auxiliary blocks (e.g. DMA engines) whose control
> > > + * registers and/or descriptor memories can be exposed to the host by mapping
> > > + * them into BAR space. This helper queries how many such resources the backend
> > > + * provides.
> > > + *
> > > + * Return: 0 on success, -EOPNOTSUPP if the backend does not support auxiliary
> > > + * resource queries, or another -errno on failure.
> > > + */
> > > +int pci_epc_count_aux_resources(struct pci_epc *epc, u8 func_no, u8 vfunc_no,
> > > +				int *num_resources)
> >
> > Most like such kinds APIs return count directly,
> >   < 0,  means error.
> >  >= 0,  means how many resource.
>
> I chose to return 0 on success here based on Mani's earlier feedback on v11:
> https://lore.kernel.org/linux-pci/lfbv6sjevz4xtjr6zt2hl3wap3bfwkvigqb6fdztqmutxgcvld@3t4x5gstr4nj/

I am okay for both, But may request Mani think 2nd. Most existing kernel
API use return value for count of resource.

Frank
>
> I don't have a strong preference here, but since there seems to be no clear
> policy/convention across the kernel, I would prefer to follow what is most
> consistent and maintainable for the maintainers. Of course, I'm happy to switch
> and respin if preferred.
>
> Thanks for reviewing,
> Koichiro
>
> >
> > Frank

  reply	other threads:[~2026-03-31 14:09 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-27  3:54 [PATCH v12 0/7] PCI: endpoint: pci-ep-msi: Add embedded doorbell fallback Koichiro Den
2026-03-27  3:54 ` [PATCH v12 1/7] PCI: endpoint: Add auxiliary resource query API Koichiro Den
2026-03-27 16:31   ` Frank Li
2026-03-31 13:56     ` Koichiro Den
2026-03-31 14:09       ` Frank Li [this message]
2026-04-03 16:55         ` Manivannan Sadhasivam
2026-04-03 17:40           ` Koichiro Den
2026-03-27  3:54 ` [PATCH v12 2/7] PCI: dwc: Record integrated eDMA register window Koichiro Den
2026-03-27  3:54 ` [PATCH v12 3/7] PCI: dwc: ep: Expose integrated eDMA resources via EPC aux-resource API Koichiro Den
2026-03-27  3:54 ` [PATCH v12 4/7] PCI: endpoint: pci-ep-msi: Refactor doorbell allocation for new backends Koichiro Den
2026-03-27  3:54 ` [PATCH v12 5/7] PCI: endpoint: pci-epf-vntb: Reuse pre-exposed doorbells and IRQ flags Koichiro Den
2026-03-27  3:54 ` [PATCH v12 6/7] PCI: endpoint: pci-epf-test: Reuse pre-exposed doorbell targets Koichiro Den
2026-03-27  3:54 ` [PATCH v12 7/7] PCI: endpoint: pci-ep-msi: Add embedded doorbell fallback Koichiro Den

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=acvVmM-nk73ntNj5@lizhi-Precision-Tower-5810 \
    --to=frank.li@nxp.com \
    --cc=allenbh@gmail.com \
    --cc=bhanuseshukumar@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=jingoohan1@gmail.com \
    --cc=kishon@kernel.org \
    --cc=kwilczynski@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=lpieralisi@kernel.org \
    --cc=mani@kernel.org \
    --cc=marco.crivellari@suse.com \
    --cc=mmaddireddy@nvidia.com \
    --cc=ntb@lists.linux.dev \
    --cc=robh@kernel.org \
    --cc=shinichiro.kawasaki@wdc.com \
    /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®