[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: Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • From: Bertrand Marquis <Bertrand.Marquis@xxxxxxx>
  • Date: Wed, 13 Apr 2022 14:13:41 +0000
  • Accept-language: en-GB, en-US
  • 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=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=vE/lAdxhqN300wP/pN5KO/QFNf2oijdeHaLrHNbMz8c=; b=TgBdCHF8n4cDkEZ39o0qwrc+sTkQc+5Cp7c2GIzuWf/xbgJPIzqvwe/pN1ybdPoNmJ+7O1mrIOebMME8igfG3BlTTvmzAAnyWJharKndLacekEfiGvmV/GZ1nNh5aZsv8xNdWaRsZte7h7ys24/Lq10TdG/C0wY4dew4OanUB+KUfxb5SNcNVOMqyK+wjrLIACoDrThg+Pvny5cQ9rR7hgRr4EpUquXBLz1aQGQ/sabcpsFVSkgIBo6zJkgHCn99gboGRwM0U6Pm0F46r4d85xq6FDxsjp+6bA6i6oUcVJmN8mTGUmFxgPsttpMKOSDw80ZCoT7+WqkGZiAXBH6ujQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ikzCp8LL3H5Yf1KCJnSOH+fHzD6miUFdGT60x4UI/Gnr+RceA/KJh7jlh6CTmz9Quqj62d9o7r4QfCvBw1PJqOvt0USY987iZyqalrSEJVR61khyetVpU72wfOMHY0qkheRjRx2VKLWvxH7ojmE3zzivKzk7bVFOpa0sRLi/QjJ9y/wmKyHxcJP2aUHMi9JK8DuXasvEk++rjwUiO7yB+bfeJ8YIVSr3j/VH5TuMUttRSaWK2FWx0e9lQmizBpnAtyTEioOlsAodFHjmTcovSBjKmhatier0dim30sLhDPZ0zb6CMZmoute/KDWOUJXtiVlIdIDMpUcZHq4SfAVcig==
  • Authentication-results-original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.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 14:14:06 +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: AQHYTYhA4nLWVzOAC0uoUDkBvluxmqzt3yyAgAACy4CAAARSgA==
  • Thread-topic: [PATCH 7/8] PCI: replace stray uses of PCI_{DEVFN,BDF}2()

Hi,

> 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:
>> 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.

There is not df field in the sbdf structure so it should be devfn instead.

Cheers
Bertrand

> 
> Thanks, Roger.


 


Rackspace

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