[PATCH] vfio/pci: rename vfio_put_device to vfio_pci_put_device

Zhenzhong Duan posted 1 patch 7 months, 1 week ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20230922025223.1091821-1-zhenzhong.duan@intel.com
Maintainers: Alex Williamson <alex.williamson@redhat.com>, "Cédric Le Goater" <clg@redhat.com>
hw/vfio/pci.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
[PATCH] vfio/pci: rename vfio_put_device to vfio_pci_put_device
Posted by Zhenzhong Duan 7 months, 1 week ago
vfio_put_device() is a VFIO PCI specific function, rename it with
'vfio_pci' prefix to avoid confusing.

No functional change.

Suggested-by: Cédric Le Goater <clg@redhat.com>
Signed-off-by: Zhenzhong Duan <zhenzhong.duan@intel.com>
---
 hw/vfio/pci.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c
index 3b2ca3c24ca2..b2d5010b9f0e 100644
--- a/hw/vfio/pci.c
+++ b/hw/vfio/pci.c
@@ -2826,7 +2826,7 @@ static void vfio_populate_device(VFIOPCIDevice *vdev, Error **errp)
     }
 }
 
-static void vfio_put_device(VFIOPCIDevice *vdev)
+static void vfio_pci_put_device(VFIOPCIDevice *vdev)
 {
     g_free(vdev->vbasedev.name);
     g_free(vdev->msix);
@@ -3317,7 +3317,7 @@ static void vfio_instance_finalize(Object *obj)
      *
      * g_free(vdev->igd_opregion);
      */
-    vfio_put_device(vdev);
+    vfio_pci_put_device(vdev);
     vfio_put_group(group);
 }
 
-- 
2.34.1


Re: [PATCH] vfio/pci: rename vfio_put_device to vfio_pci_put_device
Posted by Philippe Mathieu-Daudé 6 months, 3 weeks ago
Hi,

On 22/9/23 04:52, Zhenzhong Duan wrote:
> vfio_put_device() is a VFIO PCI specific function, rename it with
> 'vfio_pci' prefix to avoid confusing.

Why not, but what about the other functions?

$ git grep -F '(VFIOPCIDevice *' hw/vfio/pci.c | grep -vF ' vfio_pci_'
hw/vfio/pci.c:51:static void vfio_disable_interrupts(VFIOPCIDevice *vdev);
hw/vfio/pci.c:52:static void vfio_mmap_set_enabled(VFIOPCIDevice *vdev, 
bool enabled);
hw/vfio/pci.c:53:static void vfio_msi_disable_common(VFIOPCIDevice *vdev);
hw/vfio/pci.c:117:static void vfio_intx_enable_kvm(VFIOPCIDevice *vdev, 
Error **errp)
hw/vfio/pci.c:175:static void vfio_intx_disable_kvm(VFIOPCIDevice *vdev)
hw/vfio/pci.c:212:static void vfio_intx_update(VFIOPCIDevice *vdev, 
PCIINTxRoute *route)
hw/vfio/pci.c:260:static int vfio_intx_enable(VFIOPCIDevice *vdev, Error 
**errp)
hw/vfio/pci.c:314:static void vfio_intx_disable(VFIOPCIDevice *vdev)
hw/vfio/pci.c:372:static int vfio_enable_vectors(VFIOPCIDevice *vdev, 
bool msix)
hw/vfio/pci.c:416:static void vfio_add_kvm_msi_virq(VFIOPCIDevice *vdev, 
VFIOMSIVector *vector,
hw/vfio/pci.c:588:static void 
vfio_prepare_kvm_msi_virq_batch(VFIOPCIDevice *vdev)
hw/vfio/pci.c:595:static void 
vfio_commit_kvm_msi_virq_batch(VFIOPCIDevice *vdev)
hw/vfio/pci.c:609:static void vfio_msix_enable(VFIOPCIDevice *vdev)
hw/vfio/pci.c:660:static void vfio_msi_enable(VFIOPCIDevice *vdev)
hw/vfio/pci.c:732:static void vfio_msi_disable_common(VFIOPCIDevice *vdev)
hw/vfio/pci.c:754:static void vfio_msix_disable(VFIOPCIDevice *vdev)
hw/vfio/pci.c:788:static void vfio_msi_disable(VFIOPCIDevice *vdev)
hw/vfio/pci.c:802:static void vfio_update_msi(VFIOPCIDevice *vdev)
hw/vfio/pci.c:1263:static void vfio_disable_interrupts(VFIOPCIDevice *vdev)
hw/vfio/pci.c:1281:static int vfio_msi_setup(VFIOPCIDevice *vdev, int 
pos, Error **errp)
hw/vfio/pci.c:1491:static void vfio_msix_early_setup(VFIOPCIDevice 
*vdev, Error **errp)
hw/vfio/pci.c:1573:static int vfio_msix_setup(VFIOPCIDevice *vdev, int 
pos, Error **errp)
hw/vfio/pci.c:1630:static void vfio_teardown_msi(VFIOPCIDevice *vdev)
hw/vfio/pci.c:1645:static void vfio_mmap_set_enabled(VFIOPCIDevice 
*vdev, bool enabled)
hw/vfio/pci.c:1654:static void vfio_bar_prepare(VFIOPCIDevice *vdev, int nr)
hw/vfio/pci.c:1682:static void vfio_bars_prepare(VFIOPCIDevice *vdev)
hw/vfio/pci.c:1691:static void vfio_bar_register(VFIOPCIDevice *vdev, 
int nr)
hw/vfio/pci.c:1717:static void vfio_bars_register(VFIOPCIDevice *vdev)
hw/vfio/pci.c:1726:static void vfio_bars_exit(VFIOPCIDevice *vdev)
hw/vfio/pci.c:1746:static void vfio_bars_finalize(VFIOPCIDevice *vdev)
hw/vfio/pci.c:1810:static void vfio_add_emulated_word(VFIOPCIDevice 
*vdev, int pos,
hw/vfio/pci.c:1823:static void vfio_add_emulated_long(VFIOPCIDevice 
*vdev, int pos,
hw/vfio/pci.c:1906:static int vfio_setup_pcie_cap(VFIOPCIDevice *vdev, 
int pos, uint8_t size,
hw/vfio/pci.c:2036:static void vfio_check_pcie_flr(VFIOPCIDevice *vdev, 
uint8_t pos)
hw/vfio/pci.c:2046:static void vfio_check_pm_reset(VFIOPCIDevice *vdev, 
uint8_t pos)
hw/vfio/pci.c:2056:static void vfio_check_af_flr(VFIOPCIDevice *vdev, 
uint8_t pos)
hw/vfio/pci.c:2066:static int vfio_add_std_cap(VFIOPCIDevice *vdev, 
uint8_t pos, Error **errp)
hw/vfio/pci.c:2148:static int vfio_setup_rebar_ecap(VFIOPCIDevice *vdev, 
uint16_t pos)
hw/vfio/pci.c:2196:static void vfio_add_ext_cap(VFIOPCIDevice *vdev)
hw/vfio/pci.c:2291:static int vfio_add_capabilities(VFIOPCIDevice *vdev, 
Error **errp)
hw/vfio/pci.c:2678:int vfio_populate_vga(VFIOPCIDevice *vdev, Error **errp)
hw/vfio/pci.c:2746:static void vfio_populate_device(VFIOPCIDevice *vdev, 
Error **errp)
hw/vfio/pci.c:2829:static void vfio_put_device(VFIOPCIDevice *vdev)
hw/vfio/pci.c:2865:static void vfio_register_err_notifier(VFIOPCIDevice 
*vdev)
hw/vfio/pci.c:2892:static void 
vfio_unregister_err_notifier(VFIOPCIDevice *vdev)
hw/vfio/pci.c:2924:static void vfio_register_req_notifier(VFIOPCIDevice 
*vdev)
hw/vfio/pci.c:2958:static void 
vfio_unregister_req_notifier(VFIOPCIDevice *vdev)

> No functional change.
> 
> Suggested-by: Cédric Le Goater <clg@redhat.com>
> Signed-off-by: Zhenzhong Duan <zhenzhong.duan@intel.com>
> ---
>   hw/vfio/pci.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c
> index 3b2ca3c24ca2..b2d5010b9f0e 100644
> --- a/hw/vfio/pci.c
> +++ b/hw/vfio/pci.c
> @@ -2826,7 +2826,7 @@ static void vfio_populate_device(VFIOPCIDevice *vdev, Error **errp)
>       }
>   }
>   
> -static void vfio_put_device(VFIOPCIDevice *vdev)
> +static void vfio_pci_put_device(VFIOPCIDevice *vdev)


Re: [PATCH] vfio/pci: rename vfio_put_device to vfio_pci_put_device
Posted by Cédric Le Goater 6 months, 3 weeks ago
On 10/11/23 15:02, Philippe Mathieu-Daudé wrote:
> Hi,
> 
> On 22/9/23 04:52, Zhenzhong Duan wrote:
>> vfio_put_device() is a VFIO PCI specific function, rename it with
>> 'vfio_pci' prefix to avoid confusing.
> 
> Why not, but what about the other functions?

yes. Let's tackle that after the IOMMUFD earthquake :)

C.


> 
> $ git grep -F '(VFIOPCIDevice *' hw/vfio/pci.c | grep -vF ' vfio_pci_'
> hw/vfio/pci.c:51:static void vfio_disable_interrupts(VFIOPCIDevice *vdev);
> hw/vfio/pci.c:52:static void vfio_mmap_set_enabled(VFIOPCIDevice *vdev, bool enabled);
> hw/vfio/pci.c:53:static void vfio_msi_disable_common(VFIOPCIDevice *vdev);
> hw/vfio/pci.c:117:static void vfio_intx_enable_kvm(VFIOPCIDevice *vdev, Error **errp)
> hw/vfio/pci.c:175:static void vfio_intx_disable_kvm(VFIOPCIDevice *vdev)
> hw/vfio/pci.c:212:static void vfio_intx_update(VFIOPCIDevice *vdev, PCIINTxRoute *route)
> hw/vfio/pci.c:260:static int vfio_intx_enable(VFIOPCIDevice *vdev, Error **errp)
> hw/vfio/pci.c:314:static void vfio_intx_disable(VFIOPCIDevice *vdev)
> hw/vfio/pci.c:372:static int vfio_enable_vectors(VFIOPCIDevice *vdev, bool msix)
> hw/vfio/pci.c:416:static void vfio_add_kvm_msi_virq(VFIOPCIDevice *vdev, VFIOMSIVector *vector,
> hw/vfio/pci.c:588:static void vfio_prepare_kvm_msi_virq_batch(VFIOPCIDevice *vdev)
> hw/vfio/pci.c:595:static void vfio_commit_kvm_msi_virq_batch(VFIOPCIDevice *vdev)
> hw/vfio/pci.c:609:static void vfio_msix_enable(VFIOPCIDevice *vdev)
> hw/vfio/pci.c:660:static void vfio_msi_enable(VFIOPCIDevice *vdev)
> hw/vfio/pci.c:732:static void vfio_msi_disable_common(VFIOPCIDevice *vdev)
> hw/vfio/pci.c:754:static void vfio_msix_disable(VFIOPCIDevice *vdev)
> hw/vfio/pci.c:788:static void vfio_msi_disable(VFIOPCIDevice *vdev)
> hw/vfio/pci.c:802:static void vfio_update_msi(VFIOPCIDevice *vdev)
> hw/vfio/pci.c:1263:static void vfio_disable_interrupts(VFIOPCIDevice *vdev)
> hw/vfio/pci.c:1281:static int vfio_msi_setup(VFIOPCIDevice *vdev, int pos, Error **errp)
> hw/vfio/pci.c:1491:static void vfio_msix_early_setup(VFIOPCIDevice *vdev, Error **errp)
> hw/vfio/pci.c:1573:static int vfio_msix_setup(VFIOPCIDevice *vdev, int pos, Error **errp)
> hw/vfio/pci.c:1630:static void vfio_teardown_msi(VFIOPCIDevice *vdev)
> hw/vfio/pci.c:1645:static void vfio_mmap_set_enabled(VFIOPCIDevice *vdev, bool enabled)
> hw/vfio/pci.c:1654:static void vfio_bar_prepare(VFIOPCIDevice *vdev, int nr)
> hw/vfio/pci.c:1682:static void vfio_bars_prepare(VFIOPCIDevice *vdev)
> hw/vfio/pci.c:1691:static void vfio_bar_register(VFIOPCIDevice *vdev, int nr)
> hw/vfio/pci.c:1717:static void vfio_bars_register(VFIOPCIDevice *vdev)
> hw/vfio/pci.c:1726:static void vfio_bars_exit(VFIOPCIDevice *vdev)
> hw/vfio/pci.c:1746:static void vfio_bars_finalize(VFIOPCIDevice *vdev)
> hw/vfio/pci.c:1810:static void vfio_add_emulated_word(VFIOPCIDevice *vdev, int pos,
> hw/vfio/pci.c:1823:static void vfio_add_emulated_long(VFIOPCIDevice *vdev, int pos,
> hw/vfio/pci.c:1906:static int vfio_setup_pcie_cap(VFIOPCIDevice *vdev, int pos, uint8_t size,
> hw/vfio/pci.c:2036:static void vfio_check_pcie_flr(VFIOPCIDevice *vdev, uint8_t pos)
> hw/vfio/pci.c:2046:static void vfio_check_pm_reset(VFIOPCIDevice *vdev, uint8_t pos)
> hw/vfio/pci.c:2056:static void vfio_check_af_flr(VFIOPCIDevice *vdev, uint8_t pos)
> hw/vfio/pci.c:2066:static int vfio_add_std_cap(VFIOPCIDevice *vdev, uint8_t pos, Error **errp)
> hw/vfio/pci.c:2148:static int vfio_setup_rebar_ecap(VFIOPCIDevice *vdev, uint16_t pos)
> hw/vfio/pci.c:2196:static void vfio_add_ext_cap(VFIOPCIDevice *vdev)
> hw/vfio/pci.c:2291:static int vfio_add_capabilities(VFIOPCIDevice *vdev, Error **errp)
> hw/vfio/pci.c:2678:int vfio_populate_vga(VFIOPCIDevice *vdev, Error **errp)
> hw/vfio/pci.c:2746:static void vfio_populate_device(VFIOPCIDevice *vdev, Error **errp)
> hw/vfio/pci.c:2829:static void vfio_put_device(VFIOPCIDevice *vdev)
> hw/vfio/pci.c:2865:static void vfio_register_err_notifier(VFIOPCIDevice *vdev)
> hw/vfio/pci.c:2892:static void vfio_unregister_err_notifier(VFIOPCIDevice *vdev)
> hw/vfio/pci.c:2924:static void vfio_register_req_notifier(VFIOPCIDevice *vdev)
> hw/vfio/pci.c:2958:static void vfio_unregister_req_notifier(VFIOPCIDevice *vdev)
> 
>> No functional change.
>>
>> Suggested-by: Cédric Le Goater <clg@redhat.com>
>> Signed-off-by: Zhenzhong Duan <zhenzhong.duan@intel.com>
>> ---
>>   hw/vfio/pci.c | 4 ++--
>>   1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c
>> index 3b2ca3c24ca2..b2d5010b9f0e 100644
>> --- a/hw/vfio/pci.c
>> +++ b/hw/vfio/pci.c
>> @@ -2826,7 +2826,7 @@ static void vfio_populate_device(VFIOPCIDevice *vdev, Error **errp)
>>       }
>>   }
>> -static void vfio_put_device(VFIOPCIDevice *vdev)
>> +static void vfio_pci_put_device(VFIOPCIDevice *vdev)
> 


Re: [PATCH] vfio/pci: rename vfio_put_device to vfio_pci_put_device
Posted by Cédric Le Goater 7 months, 1 week ago
On 9/22/23 04:52, Zhenzhong Duan wrote:
> vfio_put_device() is a VFIO PCI specific function, rename it with
> 'vfio_pci' prefix to avoid confusing.
> 
> No functional change.

There is more to be done but it can wait after the big code reshuffle.

> Suggested-by: Cédric Le Goater <clg@redhat.com>
> Signed-off-by: Zhenzhong Duan <zhenzhong.duan@intel.com>

Applied to vfio-next.

Thanks,

C.

> ---
>   hw/vfio/pci.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c
> index 3b2ca3c24ca2..b2d5010b9f0e 100644
> --- a/hw/vfio/pci.c
> +++ b/hw/vfio/pci.c
> @@ -2826,7 +2826,7 @@ static void vfio_populate_device(VFIOPCIDevice *vdev, Error **errp)
>       }
>   }
>   
> -static void vfio_put_device(VFIOPCIDevice *vdev)
> +static void vfio_pci_put_device(VFIOPCIDevice *vdev)
>   {
>       g_free(vdev->vbasedev.name);
>       g_free(vdev->msix);
> @@ -3317,7 +3317,7 @@ static void vfio_instance_finalize(Object *obj)
>        *
>        * g_free(vdev->igd_opregion);
>        */
> -    vfio_put_device(vdev);
> +    vfio_pci_put_device(vdev);
>       vfio_put_group(group);
>   }
>