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

Re: [PATCH v3 01/11] vpci: Make vpci registers removal a dedicated function


  • To: Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • From: Oleksandr Andrushchenko <Oleksandr_Andrushchenko@xxxxxxxx>
  • Date: Wed, 27 Oct 2021 09:12:14 +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=9cTXzK1Sb5+ewj/DvvP9J6UW+QqHWp2DE6YuusLLBxk=; b=ocgQ18M1XaH3nJ09gIjEHUDRVcRMEHUUNbYhbm/Zl2dThV7aevADenxpmL5zQsJgI4vA9Zn1xn9ECdlmYjbwg6iAIV5r24ZuSD0ql8B6dpUemuL9EmXgRo+ltEJG9JDFJzsm2uLJex2/znk49do8LAidvEXomqy8iua3nRSTixr+ZY4NFE3sG2kmW0nbEdGDDLveKkrnII9SVqZQerbnVgaiVlUF6p9RkQ2K2JaVZylEuc5aOm5O/jp/etmh2szOBFETEA6BnH3s8z0zJURwkkOMijfIMYZfQ/wPta2yPgZIIL/ulyAc1phpB9S67F8akF3K5UCgpz+ODnhQCk+iMA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CPFEe62w1CQEbDkLPHbqtkunJ4Xz1x2fbBHa+e+2Y+ePj7PQaEE2Q3ThF2yiPAmErgOP66tCR2Rr8QtW3sF6lpF7F9gdmNOCEQdonlf3s0mnvYjIJ3T+IPoWsZGErJSQ1UeCDYuLN1NiL3u6kaU4+UrVJ9lb9NL2/IKZ9Ed2lJvS+YgoI0S7CVfUgQ/Ix93CLaJUcpStZb0nTgtJZdaU2iTko099c7v8TN4nm1G4KSq1oUVvn4Lsyn4lkaZ7/hO0vvZ4l021jqvijkTOqHbdM49oY9vRs3oF8M08p1VB6CniDsXgwG9DNbu0xl/4XA9IVZ0aIxgFmNoz7iVDVk5FsA==
  • 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>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, Rahul Singh <rahul.singh@xxxxxxx>, Oleksandr Andrushchenko <Oleksandr_Andrushchenko@xxxxxxxx>, Michal Orzel <michal.orzel@xxxxxxx>
  • Delivery-date: Wed, 27 Oct 2021 09:12:38 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHXtdAgeXiPCGUCJ0Oi6HCqPD8Y4KvQ2oUAgBXfUAA=
  • Thread-topic: [PATCH v3 01/11] vpci: Make vpci registers removal a dedicated function

Hi, Roger!

On 13.10.21 14:11, Roger Pau Monné wrote:
> On Thu, Sep 30, 2021 at 10:52:13AM +0300, Oleksandr Andrushchenko wrote:
>> From: Oleksandr Andrushchenko <oleksandr_andrushchenko@xxxxxxxx>
>>
>> This is in preparation for dynamic assignment of the vpci register
>> handlers depending on the domain: hwdom or guest.
>>
>> Signed-off-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@xxxxxxxx>
>> Reviewed-by: Michal Orzel <michal.orzel@xxxxxxx>
>> ---
>> Since v1:
>>   - constify struct pci_dev where possible
>> ---
>>   xen/drivers/vpci/vpci.c | 7 ++++++-
>>   xen/include/xen/vpci.h  | 2 ++
>>   2 files changed, 8 insertions(+), 1 deletion(-)
>>
>> diff --git a/xen/drivers/vpci/vpci.c b/xen/drivers/vpci/vpci.c
>> index cbd1bac7fc33..1666402d55b8 100644
>> --- a/xen/drivers/vpci/vpci.c
>> +++ b/xen/drivers/vpci/vpci.c
>> @@ -35,7 +35,7 @@ extern vpci_register_init_t *const __start_vpci_array[];
>>   extern vpci_register_init_t *const __end_vpci_array[];
>>   #define NUM_VPCI_INIT (__end_vpci_array - __start_vpci_array)
>>   
>> -void vpci_remove_device(struct pci_dev *pdev)
>> +void vpci_remove_device_registers(const struct pci_dev *pdev)
> Making this const is kind of misleading, as you end up modifying
> contents of the pdev, is just that vpci data is stored as a pointer
> inside the struct so you avoid the effects of the constification.
Ok, I will remove const
>
>>   {
>>       spin_lock(&pdev->vpci->lock);
>>       while ( !list_empty(&pdev->vpci->handlers) )
>> @@ -48,6 +48,11 @@ void vpci_remove_device(struct pci_dev *pdev)
>>           xfree(r);
>>       }
>>       spin_unlock(&pdev->vpci->lock);
>> +}
>> +
>> +void vpci_remove_device(struct pci_dev *pdev)
>> +{
>> +    vpci_remove_device_registers(pdev);
>>       xfree(pdev->vpci->msix);
>>       xfree(pdev->vpci->msi);
>>       xfree(pdev->vpci);
>> diff --git a/xen/include/xen/vpci.h b/xen/include/xen/vpci.h
>> index 9f5b5d52e159..2e910d0b1f90 100644
>> --- a/xen/include/xen/vpci.h
>> +++ b/xen/include/xen/vpci.h
>> @@ -28,6 +28,8 @@ int __must_check vpci_add_handlers(struct pci_dev *dev);
>>   
>>   /* Remove all handlers and free vpci related structures. */
>>   void vpci_remove_device(struct pci_dev *pdev);
>> +/* Remove all handlers for the device given. */
> I would drop the 'given' form the end of the sentence...
Sure
>
>> +void vpci_remove_device_registers(const struct pci_dev *pdev);
> ...and maybe name this vpci_remove_device_handlers as it's clearer
> IMO.
Ok, will rename
>
> Thanks, Roger.
Thank you,
Oleksandr

 


Rackspace

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