[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: [PATCH v4 32/41] vfio/pci: Introduce a vfio pci hot reset interface
|
From: |
Duan, Zhenzhong |
|
Subject: |
RE: [PATCH v4 32/41] vfio/pci: Introduce a vfio pci hot reset interface |
|
Date: |
Wed, 8 Nov 2023 05:46:27 +0000 |
>-----Original Message-----
>From: Cédric Le Goater <clg@redhat.com>
>Sent: Tuesday, November 7, 2023 9:53 PM
>Subject: Re: [PATCH v4 32/41] vfio/pci: Introduce a vfio pci hot reset
>interface
>
>On 11/2/23 08:12, Zhenzhong Duan wrote:
>> Legacy vfio pci and iommufd cdev have different process to hot reset
>> vfio device, expand current code to abstract out pci_hot_reset callback
>> for legacy vfio, this same interface will also be used by iommufd
>> cdev vfio device.
>>
>> Suggested-by: Cédric Le Goater <clg@redhat.com>
>> Signed-off-by: Zhenzhong Duan <zhenzhong.duan@intel.com>
>> ---
>> hw/vfio/pci.h | 1 +
>> include/hw/vfio/vfio-container-base.h | 3 +++
>> hw/vfio/container.c | 2 ++
>> hw/vfio/pci.c | 11 ++++++++++-
>> 4 files changed, 16 insertions(+), 1 deletion(-)
>>
>> diff --git a/hw/vfio/pci.h b/hw/vfio/pci.h
>> index 1006061afb..12cc765821 100644
>> --- a/hw/vfio/pci.h
>> +++ b/hw/vfio/pci.h
>> @@ -220,6 +220,7 @@ extern const PropertyInfo
>qdev_prop_nv_gpudirect_clique;
>>
>> int vfio_pci_get_pci_hot_reset_info(VFIOPCIDevice *vdev,
>> struct vfio_pci_hot_reset_info
>> **info_p);
>> +int vfio_legacy_pci_hot_reset(VFIODevice *vbasedev, bool single);
>>
>> int vfio_populate_vga(VFIOPCIDevice *vdev, Error **errp);
>>
>> diff --git a/include/hw/vfio/vfio-container-base.h b/include/hw/vfio/vfio-
>container-base.h
>> index 4b6f017c6f..45bb19c767 100644
>> --- a/include/hw/vfio/vfio-container-base.h
>> +++ b/include/hw/vfio/vfio-container-base.h
>> @@ -106,6 +106,9 @@ struct VFIOIOMMUOps {
>> int (*set_dirty_page_tracking)(VFIOContainerBase *bcontainer, bool
>> start);
>> int (*query_dirty_bitmap)(VFIOContainerBase *bcontainer, VFIOBitmap
>*vbmap,
>> hwaddr iova, hwaddr size);
>> + /* PCI specific */
>> + int (*pci_hot_reset)(VFIODevice *vbasedev, bool single);
>> +
>> /* SPAPR specific */
>> int (*add_window)(VFIOContainerBase *bcontainer,
>> MemoryRegionSection *section,
>> diff --git a/hw/vfio/container.c b/hw/vfio/container.c
>> index ed2d721b2b..f27cc15d09 100644
>> --- a/hw/vfio/container.c
>> +++ b/hw/vfio/container.c
>> @@ -33,6 +33,7 @@
>> #include "trace.h"
>> #include "qapi/error.h"
>> #include "migration/migration.h"
>> +#include "pci.h"
>>
>> VFIOGroupList vfio_group_list =
>> QLIST_HEAD_INITIALIZER(vfio_group_list);
>> @@ -929,4 +930,5 @@ const VFIOIOMMUOps vfio_legacy_ops = {
>> .detach_device = vfio_legacy_detach_device,
>> .set_dirty_page_tracking = vfio_legacy_set_dirty_page_tracking,
>> .query_dirty_bitmap = vfio_legacy_query_dirty_bitmap,
>> + .pci_hot_reset = vfio_legacy_pci_hot_reset,
>> };
>> diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c
>> index eb55e8ae88..a6194b7bfe 100644
>> --- a/hw/vfio/pci.c
>> +++ b/hw/vfio/pci.c
>> @@ -2483,8 +2483,9 @@ int vfio_pci_get_pci_hot_reset_info(VFIOPCIDevice
>*vdev,
>> return 0;
>> }
>>
>> -static int vfio_pci_hot_reset(VFIOPCIDevice *vdev, bool single)
>> +int vfio_legacy_pci_hot_reset(VFIODevice *vbasedev, bool single)
>
>Could we move this routine to container .c ?
Good idea, will do.
Thanks
Zhenzhong
- Re: [PATCH v4 27/41] util/char_dev: Add open_cdev(), (continued)
- [PATCH v4 28/41] vfio/iommufd: Implement the iommufd backend, Zhenzhong Duan, 2023/11/02
- [PATCH v4 31/41] vfio/pci: Extract out a helper vfio_pci_get_pci_hot_reset_info, Zhenzhong Duan, 2023/11/02
- [PATCH v4 32/41] vfio/pci: Introduce a vfio pci hot reset interface, Zhenzhong Duan, 2023/11/02
- [PATCH v4 30/41] vfio/iommufd: Add support for iova_ranges, Zhenzhong Duan, 2023/11/02
- [PATCH v4 29/41] vfio/iommufd: Relax assert check for iommufd backend, Zhenzhong Duan, 2023/11/02
- [PATCH v4 33/41] vfio/iommufd: Enable pci hot reset through iommufd cdev interface, Zhenzhong Duan, 2023/11/02
- [PATCH v4 34/41] vfio/pci: Allow the selection of a given iommu backend, Zhenzhong Duan, 2023/11/02
- [PATCH v4 35/41] vfio/pci: Make vfio cdev pre-openable by passing a file handle, Zhenzhong Duan, 2023/11/02
- [PATCH v4 37/41] vfio/platform: Make vfio cdev pre-openable by passing a file handle, Zhenzhong Duan, 2023/11/02
- [PATCH v4 36/41] vfio: Allow the selection of a given iommu backend for platform ap and ccw, Zhenzhong Duan, 2023/11/02