[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: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Wed, 13 Apr 2022 16:38:33 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.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=oNqWMVK/EfeWBO9+j68KQ/QnC6HF84wcYB2Emgq32gI=; b=eEjFbbiGS24Op3Gw0L3Dihgp6TZrxusZEJWVa7IdvoOsFcFXJh2wNO8+Ur82SE7RMA0NCjWg7mCwGMdtSpNSgT3PBiJe51LYlYOAT9j5wdNDqg2uhVMcfFFqAL1S8E9IsbTB2a4wfp9Qqab8or32QBfFWF8i+YRQ54xGhNc0GE8q4V6ngq2EPUTeykGmji4n4deV5nqz3K4vUuCWmijq2MyMgXT4V0Gyg3FXZbuAeJVGqsIEffPOBtD6TgEhMJKRajc1N3vsGP/j+VPx+ctmiaxAd65jI+RLtdGuQtVEQbDy3bNMjn9TUjy2QGnWOVWp6UKy+HFOfFK9vNtoHvbxxw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TNaPrV99O7JNY+hqAKwXJ6d6MWL9mcqHakmcRh8LUVySHl70FcwTOcCq7VETixrOqz6nwCr8g73G8QchR/Lw775TopqCxQuzLWQRPP4XEi/YrO01n6IaaoxDN9n1z79OmMauGT1FbnQg6kSrcL2jFuEesVRZWy4TsQ/o+KTPmhhjuPn0MGwxDF6dStxVlsOwAZfMbOa4uP371VVTIbJ1Sst7n9YV6AyBUS2LC0WLR4erYqE5ewS+KA+C4Y3aEeOUU3u+WqGwK9Fe9YcW96a1+8BQaddHDf1G4s+R+yuNttaoG5vJJQ0XOCt6Q7G49ac8lKP6DfcyI9EOWDhClFkUcA==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: "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>, Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Delivery-date: Wed, 13 Apr 2022 14:38:49 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 13.04.2022 16:13, Bertrand Marquis wrote:
>> On 13 Apr 2022, at 14:58, Roger Pau Monné <roger.pau@xxxxxxxxxx> wrote:
>> On Wed, Apr 13, 2022 at 01:48:14PM +0000, Bertrand Marquis wrote:
>>>> 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.

Note this remark.

>>>> --- 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.
> 
> There is not df field in the sbdf structure so it should be devfn instead.

Yes indeed, thanks for noticing. But really (see the remark further up)
this is what happens if code in the tree can't even be built-tested.

Jan




 


Rackspace

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