[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v5 07/14] vpci/header: handle p2m range sets per BAR
- To: Roger Pau Monné <roger.pau@xxxxxxxxxx>
- From: Oleksandr Andrushchenko <Oleksandr_Andrushchenko@xxxxxxxx>
- Date: Wed, 2 Feb 2022 10:02:03 +0000
- Accept-language: en-US
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; 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=UVYeBeFZyGtHQvuHSu/itqdBMcmCDHzatlyWxpEYyEc=; b=FP+0vPK+GBundmvKNodvWBCjcgFvmz+NdJgODP9bIdyU68qcLMle2CpcKsOz8ZfmWkX5YUXVzLCWHF4PX7yql6WqdDz/QrQhBHADONQl67zD/kvYc6Kyka/ePL9YQFAQUPZj2ej6isWneXuQY6ph/1rCJxvFaQ4Wd8PCmMs5Wbp8PUBC5+h99/xcQtgaMa9+tHVl7bLNvlSyz3Sh/iMLw7CPLQfPvZAhkedLH0sulH45ohIvRvFIB+LZmBDjRJp7OiXk/RhGn1IktuP10YcBM5ps5M+fq+AIaemUb/3ZZ9LX6o3wFv53QFx1pmySLOVoXiOSjQaKBliMP3Can8tfAA==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=W04uuupOcY4ppkBvVBXJG/YHeZJ98M3cABnBdXXhxAbxaycEx0npBlvel4gC7LeBEJrEZwXvOBvD7+5CypWMITd3GohgtNVpy+KWnI3GnkcATQg5S0KKD/vrQ7SwrqOSjkvpbR9LGPEuWGWE6TTCQOsQF/b/kD1A7vaOxHDSbk0lX3pJQ0AJpYVIvhSem2NInNiMLSDf9xRQjGQDASOoiilMqazeyUyj0JsDIvOBQ6LLN3iUSQffBPFyVl4qdmqIyM/nJMC2QIjMT+ByILI6jHGc4Em6KIuvvS8N/JCnS6ND2j2+okzRmlZzinQsb6Chkt25PgQpJkroDmb3LHb/ig==
- Cc: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, "julien@xxxxxxx" <julien@xxxxxxx>, "sstabellini@xxxxxxxxxx" <sstabellini@xxxxxxxxxx>, Oleksandr Tyshchenko <Oleksandr_Tyshchenko@xxxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>, Artem Mygaiev <Artem_Mygaiev@xxxxxxxx>, "jbeulich@xxxxxxxx" <jbeulich@xxxxxxxx>, "andrew.cooper3@xxxxxxxxxx" <andrew.cooper3@xxxxxxxxxx>, "george.dunlap@xxxxxxxxxx" <george.dunlap@xxxxxxxxxx>, "paul@xxxxxxx" <paul@xxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, Rahul Singh <rahul.singh@xxxxxxx>, Oleksandr Andrushchenko <Oleksandr_Andrushchenko@xxxxxxxx>
- Delivery-date: Wed, 02 Feb 2022 10:02:28 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
- Thread-index: AQHX4ewHO5mM8SE93ki3ObXvstqjIqxfypkAgCByRICAADWlgIAAAX8A
- Thread-topic: [PATCH v5 07/14] vpci/header: handle p2m range sets per BAR
Hi, Roger!
On 02.02.22 11:56, Roger Pau Monné wrote:
> On Wed, Feb 02, 2022 at 06:44:41AM +0000, Oleksandr Andrushchenko wrote:
>> Hi, Roger!
>>
>> On 12.01.22 17:15, Roger Pau Monné wrote:
>>> On Thu, Nov 25, 2021 at 01:02:44PM +0200, Oleksandr Andrushchenko wrote:
>>>> @@ -108,11 +115,32 @@ int vpci_add_handlers(struct pci_dev *pdev)
>>>> pdev->vpci = vpci;
>>>> INIT_LIST_HEAD(&pdev->vpci->handlers);
>>>>
>>>> + header = &pdev->vpci->header;
>>>> + for ( i = 0; i < ARRAY_SIZE(header->bars); i++ )
>>>> + {
>>>> + struct vpci_bar *bar = &header->bars[i];
>>>> + char str[32];
>>>> +
>>>> + snprintf(str, sizeof(str), "%pp:BAR%d", &pdev->sbdf, i);
>>>> + bar->mem = rangeset_new(pdev->domain, str, RANGESETF_no_print);
>>>> + if ( !bar->mem )
>>>> + {
>>>> + rc = -ENOMEM;
>>>> + goto fail;
>>>> + }
>>>> + }
>>> You just need the ranges for the VPCI_BAR_MEM32, VPCI_BAR_MEM64_LO and
>>> VPCI_BAR_ROM BAR types (see the MAPPABLE_BAR macro). Would it be
>>> possible to only allocate the rangeset for those BAR types?
>> I guess so
>>> Also this should be done in init_bars rather than here, as you would
>>> know the BAR types.
>> So, if we allocate these in init_bars so where are they destroyed then?
>> I think this should be vpci_remove_device and from this POV it would
>> be good to keep alloc/free code close to each other, e.g.
>> vpci_add_handlers/vpci_remove_device in the same file
> The alloc/free is asymmetric already, as vpci->{msix,msi} gets
> allocated in init_msi{x} but freed at vpci_remove_device.
Makes sense, I will implement as you suggest
>
> Thanks, Roger.
Thank you,
Oleksandr
|