[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 7/8] PCI: replace stray uses of PCI_{DEVFN,BDF}2()
- To: Bertrand Marquis <Bertrand.Marquis@xxxxxxx>
- From: Roger Pau Monné <roger.pau@xxxxxxxxxx>
- Date: Wed, 13 Apr 2022 15:58:13 +0200
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.com; arc=none
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=yijyodCYhp0irwzOqbT7mgex0fM4CkDeesh7WA4yTkU=; b=NpxF7BKoqD+/sTKLDcTFlPyC4rdkQp9hlYkfCdrpuxLVocCqmfQ+xQMsxQwW5Q0loOtmn1gvPsV7DT/qcMap5S2nU6pxc89dmRWZd4tRO94DxQVOZKhjlDxtz25LG8/wdOcLXPkk452G5ODdUgE9pVcFXhrL/+dnGVUPVEU2bcu/byF8aMRx2iQY22qKmImzeUYwHT6vKS8lXVBBvKEKF+lonR8s1IRTPTjzRVMtdnNg80QPf1E/tznDnfpo4izI1SQJnCCs3TvsmJLg7Ce6HyJEA3FFobOMQY5Hr5olXYb+//diYlXmFIBuA6ZuWN09zapAlPwDqjwT2RhTA3ux8Q==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BGQn8F9qbQKAWQOXmwg8Mt1ZjFsVHkou1kXraSgQ0UF6VFgGhDvu8MnEcuBo1tzlqQK+w8uKA0NVfd/DQa9SI2kXOBMhPVC09tsyhtl4VHkhbJwqZxF5v2d0XAbHt3PbsRysUz4pLBAtSJSE0RNG1Qx4l3Oe3emYDokYCWo6fCUa04Wo/Xd8t+XAMDyAOPLqo0M7a/AZ46uMvOsEHTT3M8dgJZKoTE1MZ6YkUo3YmZcRZBuAAfpte0sYpT5w+BVZVlpMH3C+eeH6FXxbfqD26jjEeItvaVE9C8ODdbRmI2Pz+t8GsQEsFNdYCMMZyLr78kt4A6tE9zMBOWSKsb9WmA==
- Authentication-results: esa3.hc3370-68.iphmx.com; dkim=pass (signature verified) header.i=@citrix.onmicrosoft.com
- Cc: Jan Beulich <jbeulich@xxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Kevin Tian <kevin.tian@xxxxxxxxx>, Paul Durrant <paul@xxxxxxx>, Julien Grall <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Volodymyr Babchuk <volodymyr_babchuk@xxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>
- Delivery-date: Wed, 13 Apr 2022 13:58:43 +0000
- Ironport-data: A9a23:ErJ3aKisk0RzBldDEj363ANMX1618RAKZh0ujC45NGQN5FlHY01je htvWj/XPKqMajSjeNskOYWwpEkP657XmoI2TQE6pSw9Figb9cadCdqndUqhZCn6wu8v7a5EA 2fyTvGacajYm1eF/k/F3oDJ9CU6jefSLlbFILas1hpZHGeIcw98z0M78wIFqtQw24LhX1rW4 YiaT/D3YzdJ5RYlagr41IrbwP9flKyaVOQw5wFWiVhj5TcyplFNZH4tDfjZw0jQG+G4KtWSV efbpIxVy0uCl/sb5nFJpZ6gGqECaua60QFjERO6UYD66vRJjnRaPqrWqJPwwKqY4tmEt4kZ9 TlDiXC/YQN5NZPtsvgBajgGLApxJotGyZGYG1Hq5KR/z2WeG5ft6/BnDUVwNowE4OdnR2pJ8 JT0KhhUMErF3bjvhuvmFK883azPL+GyVG8bkmtnwjzDS+4vXLjIQrnQ5M8e1zA17ixLNaiON 5JCNWAxBPjGS0BmPwwrBJYFpcihwWPwSSNKqlDSpJNitgA/yyQuieOwYbI5YOeiXt5Jl0yVo mbH+WXRARwAMtGbjz2f/RqEhPLLnC79cJIfEvu/7PECqEKX7nweDlsRT1TTiee+jkmyStdOM Xse8yAlrbUx3EGzR9y7VBq9yFactwMYc8pdFas98g7l4qje7hudB2MEZiVcc9Fgv8gzLRQA2 0WVhdrvCXpKuaeMVHOG3r6OqHW5Pi19BWwPey4CCxcE6t/LoYcvgxaJRdFmeIalg9uwFTzuz jSiqCklm65VncMNz7+8/13Mn3SrvJehc+IuzlyJBCT/tFo/PdP7IdzzgbTG0RpeBILJRWegl mQYounA08sBFreNpQLSesxYSdlF+M25GDHbhFduGbwo+DKs52OvcOhs3d1uGKt6Gp1aIGG0O Sc/rSsUvcYOZyXyMcebdqrrU6wXIb7c+cMJvxw+Rv5HedBPeQCO50mCjmbAjjm2wCDAfUzSU Kp3kPpA715HUcyLLxLsHo/xNIPHIAhklAs/orihkXyaPUK2PiL9dFv8GALmghoFxK2Fuh7J1 N1UKtGHzR5SOMWnPHWGodRLdA5WdiNmbXwTlyCxXrTSSuaBMDt/Y8I9PJt7I9A190irvrqgE o6Btr9wlwOk2CyvxfSiYXF/crL/NauTXlpgVRHAyW2AgiB5Ca72tf93X8JuIdEPqbwypdYpH qJtU5jRXZxypsHvpm11gW/V99c5KnxGRGumYkKYXdTIV8c5GVeYq4O+I1OHGetnJnPfiPbSa oaIj2vzaZECWx5jHIDRbveuxEm2pn8ThKR5WE6gHzWZUBSEHFRCQ8ApssIKHg==
- Ironport-hdrordr: A9a23:BYsV2qNE5xOSMsBcTqKjsMiBIKoaSvp037BL7SBMoHluGfBw+P rCoB1273XJYVUqOU3I5+ruBEDoexq1yXcf2+Us1NmZMjXbhA==
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
On Wed, Apr 13, 2022 at 01:48:14PM +0000, Bertrand Marquis wrote:
> Hi Jan,
>
> > On 11 Apr 2022, at 10:40, Jan Beulich <jbeulich@xxxxxxxx> wrote:
> >
> > There's no good reason to use these when we already have a pci_sbdf_t
> > type object available. This extends to the use of PCI_BUS() in
> > pci_ecam_map_bus() as well.
> >
> > No change to generated code (with gcc11 at least, and I have to admit
> > that I didn't expect compilers to necessarily be able to spot the
> > optimization potential on the original code).
> >
> > Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
> > ---
> > Note that the Arm changes are "blind": I haven't been able to spot a way
> > to at least compile test the changes there; the code looks to be
> > entirely dead.
> >
> > --- a/xen/arch/arm/pci/ecam.c
> > +++ b/xen/arch/arm/pci/ecam.c
> > @@ -28,8 +28,7 @@ void __iomem *pci_ecam_map_bus(struct pc
> > container_of(bridge->ops, const struct pci_ecam_ops, pci_ops);
> > unsigned int devfn_shift = ops->bus_shift - 8;
> > void __iomem *base;
> > -
> > - unsigned int busn = PCI_BUS(sbdf.bdf);
> > + unsigned int busn = sbdf.bus;
> >
> > if ( busn < cfg->busn_start || busn > cfg->busn_end )
> > return NULL;
> > @@ -37,7 +36,7 @@ void __iomem *pci_ecam_map_bus(struct pc
> > busn -= cfg->busn_start;
> > base = cfg->win + (busn << ops->bus_shift);
> >
> > - return base + (PCI_DEVFN2(sbdf.bdf) << devfn_shift) + where;
> > + return base + (sbdf.df << devfn_shift) + where;
>
> I think this should be sbdf.bdf instead (typo you removed the b).
I don't think so, notice PCI_DEVFN2(sbdf.bdf) which is extracting the
devfn from sbdf.bdf. That's not needed, as you can just get the devfn
directly from sbdf.df.
Or else the original code is wrong, and the PCI_DEVFN2 shouldn't be
there.
Thanks, Roger.
|