All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Tian, Kevin" <kevin.tian@intel.com>
To: "Beulich, Jan" <JBeulich@suse.com>,
	"xen-devel@lists.xenproject.org" <xen-devel@lists.xenproject.org>
Cc: "Paul Durrant" <paul@xen.org>, "Julien Grall" <julien@xen.org>,
	"Stefano Stabellini" <sstabellini@kernel.org>,
	"Volodymyr Babchuk" <volodymyr_babchuk@epam.com>,
	"Bertrand Marquis" <bertrand.marquis@arm.com>,
	"Cooper, Andrew" <andrew.cooper3@citrix.com>,
	"Wei Liu" <wl@xen.org>, "Pau Monné, Roger" <roger.pau@citrix.com>
Subject: RE: [PATCH 7/8] PCI: replace stray uses of PCI_{DEVFN,BDF}2()
Date: Wed, 20 Apr 2022 06:29:47 +0000	[thread overview]
Message-ID: <BN9PR11MB52763455AF804EDA3300CE368CF59@BN9PR11MB5276.namprd11.prod.outlook.com> (raw)
In-Reply-To: <452b42cb-56a5-3f28-989f-c02e53334447@suse.com>

> From: Jan Beulich <jbeulich@suse.com>
> Sent: Monday, April 11, 2022 5:40 PM
> 
> 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@suse.com>

Reviewed-by: Kevin Tian <kevin.tian@intel.com>

> ---
> 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;
>  }
> 
>  bool __init pci_ecam_need_p2m_hwdom_mapping(struct domain *d,
> --- a/xen/arch/x86/msi.c
> +++ b/xen/arch/x86/msi.c
> @@ -839,7 +839,7 @@ static int msix_capability_init(struct p
>              pbus = dev->info.physfn.bus;
>              pslot = PCI_SLOT(dev->info.physfn.devfn);
>              pfunc = PCI_FUNC(dev->info.physfn.devfn);
> -            vf = PCI_BDF2(dev->bus, dev->devfn);
> +            vf = dev->sbdf.bdf;
>          }
> 
>          table_paddr = read_pci_mem_bar(seg, pbus, pslot, pfunc, bir, vf);
> --- a/xen/drivers/passthrough/vtd/qinval.c
> +++ b/xen/drivers/passthrough/vtd/qinval.c
> @@ -267,7 +267,7 @@ int qinval_device_iotlb_sync(struct vtd_
>      qinval_entry->q.dev_iotlb_inv_dsc.lo.res_1 = 0;
>      qinval_entry->q.dev_iotlb_inv_dsc.lo.max_invs_pend = pdev-
> >ats.queue_depth;
>      qinval_entry->q.dev_iotlb_inv_dsc.lo.res_2 = 0;
> -    qinval_entry->q.dev_iotlb_inv_dsc.lo.sid = PCI_BDF2(pdev->bus, pdev-
> >devfn);
> +    qinval_entry->q.dev_iotlb_inv_dsc.lo.sid = pdev->sbdf.bdf;
>      qinval_entry->q.dev_iotlb_inv_dsc.lo.res_3 = 0;
> 
>      qinval_entry->q.dev_iotlb_inv_dsc.hi.size = size;


  parent reply	other threads:[~2022-04-20  6:30 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-11  9:34 [PATCH 0/8] IOMMU: assorted follow-on to XSA-400 Jan Beulich
2022-04-11  9:35 ` [PATCH 1/8] IOMMU/x86: drop locking from quarantine_init() hooks Jan Beulich
2022-04-11 10:01   ` Andrew Cooper
2022-04-11 10:18     ` Jan Beulich
2022-04-12 13:14     ` Jan Beulich
2022-04-12 11:05   ` Roger Pau Monné
2022-04-12 12:17     ` Jan Beulich
2022-04-12 12:54       ` Roger Pau Monné
2022-04-12 13:12         ` Jan Beulich
2022-04-20  6:22   ` Tian, Kevin
2022-04-11  9:36 ` [PATCH 2/8] VT-d: drop ROOT_ENTRY_NR Jan Beulich
2022-04-12  8:20   ` Roger Pau Monné
2022-04-20  6:22   ` Tian, Kevin
2022-04-11  9:36 ` [PATCH 3/8] VT-d: plug memory leaks in iommu_alloc() Jan Beulich
2022-04-12  8:29   ` Roger Pau Monné
2022-04-20  6:23   ` Tian, Kevin
2022-04-11  9:37 ` [PATCH 4/8] VT-d: refuse to use IOMMU with reserved CAP.ND value Jan Beulich
2022-04-12  9:22   ` Roger Pau Monné
2022-04-12 10:35     ` Jan Beulich
2022-04-20  6:23   ` Tian, Kevin
2022-04-11  9:37 ` [PATCH 5/8] AMD/IOMMU: replace a few PCI_BDF2() Jan Beulich
2022-04-12  9:37   ` Roger Pau Monné
2022-04-11  9:38 ` [PATCH 6/8] IOMMU: log appropriate SBDF Jan Beulich
2022-04-12 10:05   ` Roger Pau Monné
2022-04-12 10:39     ` Jan Beulich
2022-04-11  9:40 ` [PATCH 7/8] PCI: replace stray uses of PCI_{DEVFN,BDF}2() Jan Beulich
2022-04-12 10:07   ` Roger Pau Monné
2022-04-13 13:48   ` Bertrand Marquis
2022-04-13 13:55     ` Jan Beulich
2022-04-13 13:58     ` Roger Pau Monné
2022-04-13 14:13       ` Bertrand Marquis
2022-04-13 14:38         ` Jan Beulich
2022-04-20  6:29   ` Tian, Kevin [this message]
2022-04-11  9:42 ` [PATCH 8/8] PCI: replace "secondary" flavors of PCI_{DEVFN,BDF,SBDF}() Jan Beulich
2022-04-12 10:49   ` Roger Pau Monné
2022-04-20  6:37   ` Tian, Kevin

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=BN9PR11MB52763455AF804EDA3300CE368CF59@BN9PR11MB5276.namprd11.prod.outlook.com \
    --to=kevin.tian@intel.com \
    --cc=JBeulich@suse.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=bertrand.marquis@arm.com \
    --cc=julien@xen.org \
    --cc=paul@xen.org \
    --cc=roger.pau@citrix.com \
    --cc=sstabellini@kernel.org \
    --cc=volodymyr_babchuk@epam.com \
    --cc=wl@xen.org \
    --cc=xen-devel@lists.xenproject.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.