[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v1 05/11] vfio: Introduce host_iommu_device_create callback
From: |
Eric Auger |
Subject: |
Re: [PATCH v1 05/11] vfio: Introduce host_iommu_device_create callback |
Date: |
Mon, 18 Mar 2024 15:23:39 +0100 |
User-agent: |
Mozilla Thunderbird |
On 3/18/24 14:52, Eric Auger wrote:
> Hi ZHenzhong,
>
> On 2/28/24 04:58, Zhenzhong Duan wrote:
>> Introduce host_iommu_device_create callback and a wrapper for it.
>>
>> This callback is used to allocate a host iommu device instance and
>> initialize it based on type.
>>
>> Signed-off-by: Zhenzhong Duan <zhenzhong.duan@intel.com>
>> ---
>> include/hw/vfio/vfio-common.h | 1 +
>> include/hw/vfio/vfio-container-base.h | 1 +
>> hw/vfio/common.c | 8 ++++++++
>> 3 files changed, 10 insertions(+)
>>
>> diff --git a/include/hw/vfio/vfio-common.h b/include/hw/vfio/vfio-common.h
>> index b6676c9f79..9fefea4b89 100644
>> --- a/include/hw/vfio/vfio-common.h
>> +++ b/include/hw/vfio/vfio-common.h
>> @@ -208,6 +208,7 @@ struct vfio_device_info *vfio_get_device_info(int fd);
>> int vfio_attach_device(char *name, VFIODevice *vbasedev,
>> AddressSpace *as, Error **errp);
>> void vfio_detach_device(VFIODevice *vbasedev);
>> +void host_iommu_device_create(VFIODevice *vbasedev);
>>
>> int vfio_kvm_device_add_fd(int fd, Error **errp);
>> int vfio_kvm_device_del_fd(int fd, Error **errp);
>> diff --git a/include/hw/vfio/vfio-container-base.h
>> b/include/hw/vfio/vfio-container-base.h
>> index b2813b0c11..dc003f6eb2 100644
>> --- a/include/hw/vfio/vfio-container-base.h
>> +++ b/include/hw/vfio/vfio-container-base.h
>> @@ -120,6 +120,7 @@ struct VFIOIOMMUClass {
>> int (*attach_device)(const char *name, VFIODevice *vbasedev,
>> AddressSpace *as, Error **errp);
>> void (*detach_device)(VFIODevice *vbasedev);
>> + void (*host_iommu_device_create)(VFIODevice *vbasedev);
>> /* migration feature */
>> int (*set_dirty_page_tracking)(const VFIOContainerBase *bcontainer,
>> bool start);
>> diff --git a/hw/vfio/common.c b/hw/vfio/common.c
>> index 059bfdc07a..41e9031c59 100644
>> --- a/hw/vfio/common.c
>> +++ b/hw/vfio/common.c
>> @@ -1521,3 +1521,11 @@ void vfio_detach_device(VFIODevice *vbasedev)
>> }
>> vbasedev->bcontainer->ops->detach_device(vbasedev);
>> }
>> +
>> +void host_iommu_device_create(VFIODevice *vbasedev)
>> +{
>> + const VFIOIOMMUClass *ops = vbasedev->bcontainer->ops;
>> +
>> + assert(ops->host_iommu_device_create);
> at this stage ops actual implementation do not exist yet so this will
> break the bisection
Sorry it is OK at the function only is called in
[PATCH v1 08/11] vfio/pci: Allocate and initialize HostIOMMUDevice after
attachment
Sorry for the noise
Eric
>
> Eric
>> + ops->host_iommu_device_create(vbasedev);
>> +}
>