[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 1/5] pci: Introduce parse_pci_sbdf{_seg}()
- To: Teddy Astie <teddy.astie@xxxxxxxxxx>
- From: dmukhin@xxxxxxxx
- Date: Wed, 20 May 2026 18:32:21 -0700
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 148.163.138.245) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=ford.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=ford.com; dkim=pass (signature was verified) header.d=saarlouis.ford.com; dkim=pass (signature was verified) header.d=ford.com; arc=none (0)
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=VM02yeOMyT3DINqHV98cZq4VmXxuKOIjewDO7nNRGPc=; b=Lj7zrTcInv7Gz3rO8CdF3VMmSSROUgJ3hVRe7pMpQyzyfNWOnN4DtCOM2du1vi4Qdh/tG5xD4UKxbx9VP7DFgSOZko3vmT5aEenHi5bHLyWtsmEAaoWyGXdm06rM2a+jLdA95bRhx/91+DoMwh9efIpn3C8CnGQtF+4vpB8+tli1s/dKzENRL/WgrfWC9lwHeVAnzpJIXlroRXDfFpxyv3BdSO7g4xV9PnQ4Ow3DYQHqfQady1/i14Oeo1BQUj6lvu4IEG2gM0A+X1zHnVJEWOi5UvfY2sNV+eRcW935+Oks5ls8/MS0cIi5opaeOjYtspJOxU0llmY7JGV8TJJDLw==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=h7kfaMiB9pTIHsw+UawH1gj0fs3ZJwHCm62gTc+be55dHxH923++cjO7Cy2LrZdyLNbevfkEIIBBwDT+qjG9TOYTinWFtZvf5ilL+foo470NWGQnm5eEdebEMo8NFucCJ4yfUACSyP0LUw1WRS0VKh+eoeMpiRwC1aeQh9Oe7CgnZ5nnBv+2PceKTx+M9JKhPYyN+TIyqz9hWpNE9X5TwuDdx4vDxCoQVS1yDJClDRg+UyEOtAJxihAQWNHbryB/CtNRsIG4UVJ/+4wlR+x6ZtqB4eCX0Pp2TsfcwABF88OVKJvuzTPvQemLH4AFWykLiPAuI6ury91B1fHak2xJ0Q==
- Authentication-results: eu.smtp.expurgate.cloud; dkim=pass header.s=ppford header.d=ford.com header.i="@ford.com" header.h="Cc:Content-Transfer-Encoding:Content-Type:Date:From:In-Reply-To:Message-ID:MIME-Version:References:Subject:To"; dkim=fail header.s=selector2-azureford-onmicrosoft-com header.d=azureford.onmicrosoft.com header.i="@azureford.onmicrosoft.com"; dkim=pass header.s=ppserprodsaar header.d=saarlouis.ford.com header.i="@saarlouis.ford.com" header.h="Cc:Content-Transfer-Encoding:Content-Type:Date:From:In-Reply-To:Message-ID:MIME-Version:References:Subject:To"; dkim=pass header.s=ppfserpocford header.d=ford.com header.i="@ford.com" header.h="Cc:Content-Transfer-Encoding:Content-Type:Date:From:In-Reply-To:Message-ID:MIME-Version:References:Subject:To"
- Cc: dmukhin@xxxxxxxx, xen-devel@xxxxxxxxxxxxxxxxxxxx, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Anthony PERARD <anthony.perard@xxxxxxxxxx>, Michal Orzel <michal.orzel@xxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, Julien Grall <julien@xxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>
- Delivery-date: Thu, 21 May 2026 01:32:53 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
- Pser-m365-app: SER-APP
On Wed, May 20, 2026 at 12:00:07PM +0200, Teddy Astie wrote:
> Le 20/05/2026 à 04:43, dmukhin@xxxxxxxx a écrit :
> > On Mon, May 18, 2026 at 05:21:25PM +0200, Teddy Astie wrote:
> > > In many places, we're parsing a PCI string into individual parts
> > > (seg, bus, dev, fn) and then transform it into a pci_sbdf_t using PCI_SBDF
> > > macro. Rather than converting from parts to pci_sbdf_t and vice versa,
> > > introduce a new function that parses a PCI string into a pci_sbdf_t
> > > structure
> > > directly.
> > >
> > > Signed-off-by: Teddy Astie <teddy.astie@xxxxxxxxxx>
> > > ---
> > > xen/drivers/pci/pci.c | 18 ++++++++++++++++++
> > > xen/include/xen/pci.h | 3 +++
> > > 2 files changed, 21 insertions(+)
> > >
> > > diff --git a/xen/drivers/pci/pci.c b/xen/drivers/pci/pci.c
> > > index 084be3880c..1d06cb035b 100644
> > > --- a/xen/drivers/pci/pci.c
> > > +++ b/xen/drivers/pci/pci.c
> > > @@ -202,3 +202,21 @@ const char *__init parse_pci_seg(const char *s,
> > > unsigned int *seg_p,
> > > return s;
> > > }
> > > +
> > > +const char *parse_pci_sbdf(const char *s, pci_sbdf_t *sbdf)
> > > +{
> > > + unsigned int seg, bus, dev, func;
> > > + const char *out = parse_pci(s, &seg, &bus, &dev, &func);
> >
> > IMO, both parse_pci() and parse_pci_seg() should be merged into
> > parse_pci_sbdf() and parse_pci_sbdf_seg() at the end of the series,
> > since there will be no remaining consumers of the old APIs.
> >
> > What do you think?
> >
>
> That was my plan, but parse_phantom_dev() (in xen/drivers/passthrough/pci.c)
> wants to parse the PCI string without the function part (i.e XXXX:YY:ZZ)
> which can't be expressed with a full SBDF parse function.
I see.
Perhaps adding "SBD" parsing in-place in parse_phantom_dev() is OK?
Like duplicate a small amount of code but drop old APIs.
>
> It currently works by passing NULL to `func_p`, which has special handling
> in parse_pci.
>
> We could eventually allow omitting PCI function and make default it to zero,
> so that we will be able migrate parse_phantom_dev to this new function (so
> it now allows parsing full SBDF, but ignore the function part of it).
>
|