[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: [PATCH v3 18/37] vfio/container: Implement attach/detach_device
|
From: |
Duan, Zhenzhong |
|
Subject: |
RE: [PATCH v3 18/37] vfio/container: Implement attach/detach_device |
|
Date: |
Mon, 30 Oct 2023 03:20:41 +0000 |
>-----Original Message-----
>From: Cédric Le Goater <clg@redhat.com>
>Sent: Saturday, October 28, 2023 12:07 AM
>Subject: Re: [PATCH v3 18/37] vfio/container: Implement attach/detach_device
>
>Sorry, previous email was empty. Friday effect !
>
>On 10/26/23 12:30, Zhenzhong Duan wrote:
>> From: Eric Auger <eric.auger@redhat.com>
>>
>> No fucntional change intended.
>>
>> Signed-off-by: Eric Auger <eric.auger@redhat.com>
>> Signed-off-by: Yi Liu <yi.l.liu@intel.com>
>> Signed-off-by: Yi Sun <yi.y.sun@linux.intel.com>
>> Signed-off-by: Zhenzhong Duan <zhenzhong.duan@intel.com>
>> Signed-off-by: Cédric Le Goater <clg@redhat.com>
>> ---
>> hw/vfio/common.c | 16 ++++++++++++++++
>> hw/vfio/container.c | 12 +++++-------
>> 2 files changed, 21 insertions(+), 7 deletions(-)
>>
>> diff --git a/hw/vfio/common.c b/hw/vfio/common.c
>> index d62c815d7f..64565b4ae9 100644
>> --- a/hw/vfio/common.c
>> +++ b/hw/vfio/common.c
>> @@ -1500,3 +1500,19 @@ retry:
>>
>> return info;
>> }
>> +
>> +int vfio_attach_device(char *name, VFIODevice *vbasedev,
>> + AddressSpace *as, Error **errp)
>> +{
>> + const VFIOIOMMUOps *ops = &vfio_legacy_ops;
>
>hmm, this looks wrong. please explain.
The final shape will be:
int vfio_attach_device(char *name, VFIODevice *vbasedev,
AddressSpace *as, Error **errp)
{
const VFIOIOMMUOps *ops;
#ifdef CONFIG_IOMMUFD
if (vbasedev->iommufd) {
ops = &vfio_iommufd_ops;
} else
#endif
{
ops = &vfio_legacy_ops;
}
return ops->attach_device(name, vbasedev, as, errp);
}
Depending on if iommufd is selected, different ops will be chosen.
Then corresponding attach_device callback is called to attach to
iommufd or legacy container.
Thanks
Zhenzhong
- [PATCH v3 15/37] vfio/container: Move listener to base container, (continued)
- [PATCH v3 15/37] vfio/container: Move listener to base container, Zhenzhong Duan, 2023/10/26
- [PATCH v3 19/37] vfio/spapr: Introduce spapr backend and target interface, Zhenzhong Duan, 2023/10/26
- [PATCH v3 25/37] util/char_dev: Add open_cdev(), Zhenzhong Duan, 2023/10/26
- [PATCH v3 18/37] vfio/container: Implement attach/detach_device, Zhenzhong Duan, 2023/10/26
- [PATCH v3 24/37] backends/iommufd: Introduce the iommufd object, Zhenzhong Duan, 2023/10/26
[PATCH v3 20/37] vfio/spapr: switch to spapr IOMMU BE add/del_section_window, Zhenzhong Duan, 2023/10/26
[PATCH v3 22/37] vfio/spapr: Move hostwin_list into spapr container, Zhenzhong Duan, 2023/10/26
[PATCH v3 21/37] vfio/spapr: Move prereg_listener into spapr container, Zhenzhong Duan, 2023/10/26
[PATCH v3 23/37] Add iommufd configure option, Zhenzhong Duan, 2023/10/26