[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v2 13/17] vfio/container: Introduce an instance_init() handle
From: |
Eric Auger |
Subject: |
Re: [PATCH v2 13/17] vfio/container: Introduce an instance_init() handler |
Date: |
Mon, 17 Jun 2024 17:27:12 +0200 |
User-agent: |
Mozilla Thunderbird |
On 6/17/24 08:34, Cédric Le Goater wrote:
> This allows us to move the initialization code from vfio_container_init(),
> which we will soon remove.
>
> Signed-off-by: Cédric Le Goater <clg@redhat.com>
> Reviewed-by: Zhenzhong Duan <zhenzhong.duan@intel.com>
Reviewed-by: Eric Auger <eric.auger@redhat.com>
Eric
> ---
> hw/vfio/container-base.c | 19 +++++++++++++------
> 1 file changed, 13 insertions(+), 6 deletions(-)
>
> diff --git a/hw/vfio/container-base.c b/hw/vfio/container-base.c
> index
> 98c15e174dd78df5146ee83c05c98f3ea9c1e52c..3858f5ab1d68e897f9013161d7c5c20c0553029d
> 100644
> --- a/hw/vfio/container-base.c
> +++ b/hw/vfio/container-base.c
> @@ -75,12 +75,6 @@ void vfio_container_init(VFIOContainerBase *bcontainer,
> const VFIOIOMMUClass *ops)
> {
> bcontainer->ops = ops;
> - bcontainer->error = NULL;
> - bcontainer->dirty_pages_supported = false;
> - bcontainer->dma_max_mappings = 0;
> - bcontainer->iova_ranges = NULL;
> - QLIST_INIT(&bcontainer->giommu_list);
> - QLIST_INIT(&bcontainer->vrdl_list);
> }
>
> void vfio_container_destroy(VFIOContainerBase *bcontainer)
> @@ -99,10 +93,23 @@ void vfio_container_destroy(VFIOContainerBase *bcontainer)
> g_list_free_full(bcontainer->iova_ranges, g_free);
> }
>
> +static void vfio_container_instance_init(Object *obj)
> +{
> + VFIOContainerBase *bcontainer = VFIO_IOMMU(obj);
> +
> + bcontainer->error = NULL;
> + bcontainer->dirty_pages_supported = false;
> + bcontainer->dma_max_mappings = 0;
> + bcontainer->iova_ranges = NULL;
> + QLIST_INIT(&bcontainer->giommu_list);
> + QLIST_INIT(&bcontainer->vrdl_list);
> +}
> +
> static const TypeInfo types[] = {
> {
> .name = TYPE_VFIO_IOMMU,
> .parent = TYPE_OBJECT,
> + .instance_init = vfio_container_instance_init,
> .instance_size = sizeof(VFIOContainerBase),
> .class_size = sizeof(VFIOIOMMUClass),
> .abstract = true,
- [PATCH v2 09/17] vfio/container: Introduce vfio_create_container(), (continued)
- [PATCH v2 09/17] vfio/container: Introduce vfio_create_container(), Cédric Le Goater, 2024/06/17
- [PATCH v2 10/17] vfio/container: Discover IOMMU type before creating the container, Cédric Le Goater, 2024/06/17
- [PATCH v2 15/17] vfio/container: Remove vfio_container_init(), Cédric Le Goater, 2024/06/17
- [PATCH v2 17/17] vfio/container: Move vfio_container_destroy() to an instance_finalize() handler, Cédric Le Goater, 2024/06/17
- [PATCH v2 13/17] vfio/container: Introduce an instance_init() handler, Cédric Le Goater, 2024/06/17
- Re: [PATCH v2 13/17] vfio/container: Introduce an instance_init() handler,
Eric Auger <=
- [PATCH v2 16/17] vfio/container: Introduce vfio_iommu_legacy_instance_init(), Cédric Le Goater, 2024/06/17
- Re: [PATCH v2 00/17] vfio: QOMify VFIOContainer, Eric Auger, 2024/06/17
- Re: [PATCH v2 00/17] vfio: QOMify VFIOContainer, Cédric Le Goater, 2024/06/24