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

Re: [PATCH v9 04/16] vpci: add hooks for PCI device assign/de-assign


  • To: Jan Beulich <jbeulich@xxxxxxxx>
  • From: Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>
  • Date: Tue, 12 Sep 2023 23:41:41 +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=ByCiywusZZZLVTSAT8Os38Och+OnuvlsrVYSwBJUIE8=; b=l7vI+wgfJozDMLQcpJsW9XTcVFZRdnjrc1QpRQL9QxN4y1Zmbwk/zc7ooIAz0+QChVfCuCS84aZaGhkzu6sj5G+e2tycxaBmN4cJnXbLhYQunF8eHERM8Jp04tLWdIETITAZ0LVjsDVbpJF6ULqQ7UyRVnk45WroA5opwTR0BLxn/Y3FKPqyBR6vNaM/ZilvtabM4aIJ9WqymNQ208GKRFJ9W3ijURWLOT5Tr0KtHA4dIG4KmwV6Bn3BDaHdtk0BfWggC+110k0PlKFWj/zV99w9w0jfXbnK7/oMs88qUB6dKUJqu9siemHJ+fd8/3puU4ZQ86m4MHW76BHByomDBQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QrViNF5Flpu3LMtwBY5n9XmOBow3sow9e+4+0lR/jwiIncNXwvHR6omtmXjzzhW68Wh2SAfG6ZZB32RteSOya7Wbl0tnJaMdOKnaSCn95K97YotLTZf1wSKlQ9qZFW16gNwYaVCFTUJRWMHaMiP60IgkCUtFJASHtHiy0WlwmbH6BxIRAg2RkUttn513Fg8RdJdwNAxfm9W9x6fZXZvw7hhJ4wm4EjLpkGFYwlHIscqlTkgNesqL7KiN4p2tXP6wStXpnSMARTixSyyUmrtMQo3i27R56UnPy7VxcltZMOA2BQy9gozWGed6seapbGryds+pn1JfTkcRU5MrwlpFgA==
  • Cc: Stewart Hildebrand <stewart.hildebrand@xxxxxxx>, Oleksandr Andrushchenko <Oleksandr_Andrushchenko@xxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Paul Durrant <paul@xxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Tue, 12 Sep 2023 23:42:09 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHZ2s9Kc9kNunOnfUurMYypVVbdQ7AXA+KAgADqFoA=
  • Thread-topic: [PATCH v9 04/16] vpci: add hooks for PCI device assign/de-assign

Hi Jan,

Jan Beulich <jbeulich@xxxxxxxx> writes:

> On 30.08.2023 01:19, Volodymyr Babchuk wrote:
>> @@ -1481,6 +1488,13 @@ static int assign_device(struct domain *d, u16 seg, 
>> u8 bus, u8 devfn, u32 flag)
>>      if ( pdev->broken && d != hardware_domain && d != dom_io )
>>          goto done;
>>  
>> +    if ( IS_ENABLED(CONFIG_HAS_VPCI_GUEST_SUPPORT) )
>> +    {
>> +        write_lock(&pdev->domain->pci_lock);
>> +        vpci_deassign_device(pdev);
>> +        write_unlock(&pdev->domain->pci_lock);
>> +    }
>
> Why is the DomIO special case ...

vpci_deassign_device() does nothing if vPCI was initialized for a
domain. So it not wrong to call this function even if pdev belongs to dom_io.

>> @@ -1506,6 +1520,15 @@ static int assign_device(struct domain *d, u16 seg, 
>> u8 bus, u8 devfn, u32 flag)
>>          rc = iommu_call(hd->platform_ops, assign_device, d, devfn,
>>                          pci_to_dev(pdev), flag);
>>      }
>> +    if ( rc )
>> +        goto done;
>> +
>> +    if ( IS_ENABLED(CONFIG_HAS_VPCI_GUEST_SUPPORT) && d != dom_io)
>> +    {
>> +        write_lock(&d->pci_lock);
>> +        rc = vpci_assign_device(pdev);
>> +        write_unlock(&d->pci_lock);
>> +    }
>
> ... relevant only here?
>

There is no sense to initialize vPCI for dom_io.


-- 
WBR, Volodymyr


 


Rackspace

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