[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: "Beulich, Jan" <JBeulich@xxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: "Tian, Kevin" <kevin.tian@xxxxxxxxx>
  • Date: Wed, 20 Apr 2022 06:29:47 +0000
  • Accept-language: en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.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=x/eKREl69vllJ+U+bZtwaa2nBis5/VWJXqQ0wKa6d/Q=; b=UntJneeaKgwyoaUf3O5eBN13Bsz3VgCQFeIimwMfISG3Xe8hSvWrLonzdBE5omkGDL60UhQ5DuWGYdvFE/+5uX6WFbioG4nMsj3Xqc2/ss2k/7OiBV+4pi7/+sHysQABEVCzdbkxJE+fttTS7mHN/BSNDR2rKI0IaWOn0Lh6xyX5y05VgnJLGn0dA1xHOhXAkHGRxiHw5TCx0gXWVx1Gb9v+YykPaWLyvvCd9qbGssbPM13GROnIxE87o6gIxm0dcQkUL0OKeqCMDVvsNVTXb57SJg8RmYnP1MO+wIF6eSCQTmplsktEypMnXl4vPhm8nEf+TUmBtLNSpP9XSvhX9w==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hHa0LJOJzQ9FRiX9/Q3taPLNAsKGnFOP/7+m7z3a7MtK+RggbrzU9/lQT6M2dGjw/EBk6cSnRDIywY/+aVO7wIWsX05hrrXyVSGpZbEVhEYrHo5fMe1amxGBCdHYA+G0ZT34rPm7TMifZ8DILiY647uya7OLGc88TcHPOz/izlyVA4LgjB78HzE5/Fdewt/FTkCR+1YccJm3VYfUzMDr0rsrImhGtA2zApmFV+sPY/5LeN+6PgKi3YLFDY7PWk+hayVxn0Er/0dTmXeibti/EH+Rg7sC7B8r/QLpenimpV3DTRVM3LzLFRXPHaWZzvN7SimWon2TTfP7+MrwNGQGXA==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com;
  • Cc: Paul Durrant <paul@xxxxxxx>, Julien Grall <julien@xxxxxxx>, "Stefano Stabellini" <sstabellini@xxxxxxxxxx>, Volodymyr Babchuk <volodymyr_babchuk@xxxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, "Cooper, Andrew" <andrew.cooper3@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Pau Monné, Roger <roger.pau@xxxxxxxxxx>
  • Delivery-date: Wed, 20 Apr 2022 06:30:03 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHYTYg2fJ9LlsxQzUiWYjlpaUlfRqz4ZOWA
  • Thread-topic: [PATCH 7/8] PCI: replace stray uses of PCI_{DEVFN,BDF}2()

> From: Jan Beulich <jbeulich@xxxxxxxx>
> 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@xxxxxxxx>

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

> ---
> 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;


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.