[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v2 1/2] PCI: replace stray uses of PCI_{DEVFN,BDF}2()
- To: Jan Beulich <jbeulich@xxxxxxxx>
- From: Bertrand Marquis <Bertrand.Marquis@xxxxxxx>
- Date: Thu, 28 Apr 2022 09:09:00 +0000
- Accept-language: en-GB, en-US
- Arc-authentication-results: i=2; mx.microsoft.com 1; spf=pass (sender ip is 63.35.35.123) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com; arc=pass (0 oda=1 ltdi=1 spf=[1,1,smtp.mailfrom=arm.com] dkim=[1,1,header.d=arm.com] dmarc=[1,1,header.from=arm.com])
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none
- Arc-message-signature: i=2; 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=7LxXuvm4zJHuHXb7mdtjidzZHZTaVj7hHHBohfoKEBg=; b=LFuBlIdpYlLNZ6MdZmtClZ3vvGGuhxzO8n/sL4BQZpT8NyfAqGHnamO03IE+hWaUXYOMckAy1llTisMxCkRs/nhxNQWQAee97lY/uWjOm2GDfurHoAiBkA+CyjLoQ+0Yla0hBLx1bqXHlNnATzL+luiLQKGrgWqicmxw67qnArpT2Ili4fS6HQ8tmdeh5llHYNIvO9ZyNPdeNrYdYzIuPuYoUZeXLlDXfL3avHibCmA0PLFIy/cMkH50Z2jRWEbznIdHjlxtfCry4Y9lR/FOOg3lLMJHual0d87fPt3fibApodw+KPR+nducCLQ8CzFRbL9p04NqjG4mO5qKJGR+nA==
- 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=7LxXuvm4zJHuHXb7mdtjidzZHZTaVj7hHHBohfoKEBg=; b=WnhbBUCgN+SGnbk/KE4S7shqWYAUPCap2diizUM+xqxDTpIYTPuSEM/fQTD48rSF4yu0yGOLomXSFyL1+4pfg0/Nmmj7aW8sFaCSsszrq3VVDUkDUX8LNq+Tygn2RBn01JbM6V6SCFp720TNLqNZ5B5aW+z/YRoknzrFWPHoWBRJVnMT3mO0dzBnCsh5/hL4kcvJGO9KfapeR3krMCBJJlqV8U12NISVFeUk5/HEM5IdSdAPKh/rQKKLJOmJG+MZUsIVID8IeKu306uGuQ2o4Yypt6jGMN+yKlco3XJQ1XtPig7MvR8kKMcnw8TxT7cRunmeWCgk2Sv0lVVOtcxotw==
- Arc-seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=hnXm77gFIcRR72cR1zBQzaj8L/yIX04bbSIb2IVpVHECdipG8s+jGIKVQvaBKWGxCIUd1m5x68/2NbIgYlu4SQViOlm0NU49uze7GkR6+OpWExs0gjb3CbaNITY3zuHdcHfBgVTqikGgDIgqsl2o7cY2augIEBRhDln2io/P0Wom0YhZ9eLrS/FWlWCioZ/79ewfdzd+TV/aNhCZWsbjB9Qq1/TRJcl52SkLy+6muXiZeIC3NMBul9RXXX9xosr/mMEGiY+SOmo3C96uBD2s+yZ+8LebAStWFW7UVvFsVpj03FS4Czt5HAiuMe479kjILoBukLuDZBEKinDTCoCZKg==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IfmnG4u3YynRiGgEjpaTDCwn05ou59hnYlXPXEaEFeH+tICl4XJT9bZQCIp9SVmZXSjoxHkeu+Njjw/b16qLKa+V5CC04za/l+SIngCYPsenbjySy2yV+LflVfUA+5K9LnhY2tqjMbBLdI3u82TAA1H0AsjVwoHAESIj68vpUXSgivvL0eHRVBNjW/hwxbxtU+a4+Jfkjjt9GvGsrMgPPbJKgFYGZJ9oj/1Hq4RkqKqQaTw8AcjhgM9A/NA6vLCjebX+dyk76/N59KVxSAl4O8HdMYKpctPzWgvJ8WIzW3Kl7l2BCGL5wFeQbCi9lBKG3SRQiO7fLBwA6xhH8elhfQ==
- Authentication-results-original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
- Cc: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Kevin Tian <kevin.tian@xxxxxxxxx>, Paul Durrant <paul@xxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Volodymyr Babchuk <volodymyr_babchuk@xxxxxxxx>
- Delivery-date: Thu, 28 Apr 2022 09:09:25 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
- Nodisclaimer: true
- Original-authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
- Thread-index: AQHYVYvat6E8kIbOXkmbFmJIRAA5Ka0FFBoA
- Thread-topic: [PATCH v2 1/2] PCI: replace stray uses of PCI_{DEVFN,BDF}2()
Hi Jan,
> On 21 Apr 2022, at 15:26, 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>
> Reviewed-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>
> Reviewed-by: Kevin Tian <kevin.tian@xxxxxxxxx>
Reviewed-by: Bertrand Marquis <bertrand.marquis@xxxxxxx>
Sorry I missed it.
Cheers
Bertrand
> ---
> 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.
> ---
> v2: Arm build fix (for those who actually have ways to build the Arm
> code being changed here).
>
> --- 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.devfn << 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;
>
|