[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 2/2] vpci: use named rangeset for BARs


  • To: Jan Beulich <jbeulich@xxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • From: Oleksandr Andrushchenko <Oleksandr_Andrushchenko@xxxxxxxx>
  • Date: Mon, 22 Nov 2021 10:50:18 +0000
  • Accept-language: en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=epam.com; dmarc=pass action=none header.from=epam.com; dkim=pass header.d=epam.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=FHyszV21KgT8vUZvQXpGOKYFZONbos1H5oe672i0Q+w=; b=R9gfKitcASAfODiBVjHReAwcXFjj3HSDXSnbnCt3FXP8Z3KdlfFRxQW8516Pv4DF7ggO95zDbdRfE/ffESxqUMOJhlILztIPCixhhewpRaqB0rErDZhtsgbYsK0mYSIsF3E1uUjK1a1UqohWq/wfz90C9YKuat/DMOXb3udKJ5/Gu66hDwhB29c66Pr+qRmLKdYoI+j9x4FNY8ymcC086vqMDOEidXfNVX2lUWIY8TA4VDIFwcjwhWBv8TW+JrLqATYKTp4cuGUrbCtbcNrKbceLd+w7+mkVVnSH+yc5p9kET1RrShyowVeisAej4BIQ77BxQcfIs7keY7av5zSzhQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Z8E9bRiHkTPwEgfJuINXtGGKAweugQ1gmqhq7BrZBJcy+wLba+6eUVMBNP6QckbQRwmucnX/x5VeBce7HskgkylEzdj53CQcAYIv6e3bNc6nBD2jP/q7cpaofCbs1Zj56O15IBd3AZG1RNzB82YVbHcvju9eZG2On+ktv+P+kELhDo+A9U/nIA6xXyomzuqxtRStMgPccXsAQlrZChyhlYwQXDSAXxOFL0G8/43QdoFpowU5fsWF4fdU51kl/EXavABRGhtl+es16G7832zmRY3PbXm3RAEGFci9AhJTKVqWZOYUGyiv7rOXpM+qcJvW+i8kMoyssDwrKcH6AEiGbg==
  • Cc: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Oleksandr Andrushchenko <Oleksandr_Andrushchenko@xxxxxxxx>
  • Delivery-date: Mon, 22 Nov 2021 10:50:32 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHX34NSPeXhoB5iREudUJGr9f4eDKwPWBGAgAAEhQCAAAHcgA==
  • Thread-topic: [PATCH 2/2] vpci: use named rangeset for BARs


On 22.11.21 12:43, Jan Beulich wrote:
> On 22.11.2021 11:27, Roger Pau Monné wrote:
>> On Mon, Nov 22, 2021 at 11:28:25AM +0200, Oleksandr Andrushchenko wrote:
>>> --- a/xen/drivers/vpci/header.c
>>> +++ b/xen/drivers/vpci/header.c
>>> @@ -206,12 +206,16 @@ static void defer_map(struct domain *d, struct 
>>> pci_dev *pdev,
>>>   static int modify_bars(const struct pci_dev *pdev, uint16_t cmd, bool 
>>> rom_only)
>>>   {
>>>       struct vpci_header *header = &pdev->vpci->header;
>>> -    struct rangeset *mem = rangeset_new(NULL, NULL, 0);
>>> +    struct rangeset *mem;
>>> +    char str[32];
>>>       struct pci_dev *tmp, *dev = NULL;
>>>       const struct vpci_msix *msix = pdev->vpci->msix;
>>>       unsigned int i;
>>>       int rc;
>>>   
>>> +    snprintf(str, sizeof(str), "%pp", &pdev->sbdf);
>>> +    mem = rangeset_new(NULL, str, RANGESETF_no_print);
>> You are still not adding the rangeset to the domain list, as the first
>> parameter passed here in NULL instead of a domain struct.
>>
>> Given the current short living of the rangesets I'm not sure it makes
>> much sense to link them to the domain ATM, but I guess this is kind of
>> a preparatory change as other patches you have will have the
>> rangesets permanent as long as the device is assigned to a domain.
>>
>> Likely the above reasoning (or the appropriate one) should be added to
>> the commit message.
If I fold then there is no reason to add the comment, right?
> Or, as also suggested as an option, them getting accounted to the domain
> could be folded into the patch making them long-lived.
Ok, I can fold this patch and have:
@@ -95,10 +102,27 @@ int vpci_add_handlers(struct pci_dev *pdev)
      INIT_LIST_HEAD(&pdev->vpci->handlers);
      spin_lock_init(&pdev->vpci->lock);

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

>
> Jan
>
Thank you,
Oleksandr

 


Rackspace

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