[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: [PATCH v3 11/19] backends/iommufd: Implement HostIOMMUDeviceClass::c
From: |
Duan, Zhenzhong |
Subject: |
RE: [PATCH v3 11/19] backends/iommufd: Implement HostIOMMUDeviceClass::check_cap() handler |
Date: |
Tue, 30 Apr 2024 10:06:10 +0000 |
>-----Original Message-----
>From: Cédric Le Goater <clg@redhat.com>
>Subject: Re: [PATCH v3 11/19] backends/iommufd: Implement
>HostIOMMUDeviceClass::check_cap() handler
>
>On 4/29/24 08:50, Zhenzhong Duan wrote:
>> Suggested-by: Cédric Le Goater <clg@redhat.com>
>> Signed-off-by: Zhenzhong Duan <zhenzhong.duan@intel.com>
>> ---
>> backends/iommufd.c | 18 ++++++++++++++++++
>> 1 file changed, 18 insertions(+)
>>
>> diff --git a/backends/iommufd.c b/backends/iommufd.c
>> index d61209788a..28faec528e 100644
>> --- a/backends/iommufd.c
>> +++ b/backends/iommufd.c
>> @@ -233,6 +233,23 @@ int
>iommufd_backend_get_device_info(IOMMUFDBackend *be, uint32_t devid,
>> return ret;
>> }
>>
>> +static int hiod_iommufd_check_cap(HostIOMMUDevice *hiod, int cap,
>Error **errp)
>> +{
>> + switch (cap) {
>> + case HOST_IOMMU_DEVICE_CAP_IOMMUFD:
>> + return 1;
>
>I don't understand this value.
1 means this host iommu device is attached to IOMMUFD backend,
or else 0 if attached to legacy backend.
Strictly speaking, HOST_IOMMU_DEVICE_CAP_IOMMUFD is not a
hardware capability, I'm trying to put all(sw/hw) in CAPs checking
framework just like KVM<->qemu CAPs does.
Thanks
Zhenzhong
>
>
>Thanks,
>
>C.
>
>
>> + default:
>> + return host_iommu_device_check_cap_common(hiod, cap, errp);
>> + }
>> +}
>> +
>> +static void hiod_iommufd_class_init(ObjectClass *oc, void *data)
>> +{
>> + HostIOMMUDeviceClass *hioc = HOST_IOMMU_DEVICE_CLASS(oc);
>> +
>> + hioc->check_cap = hiod_iommufd_check_cap;
>> +};
>> +
>> static const TypeInfo types[] = {
>> {
>> .name = TYPE_IOMMUFD_BACKEND,
>> @@ -251,6 +268,7 @@ static const TypeInfo types[] = {
>> .parent = TYPE_HOST_IOMMU_DEVICE,
>> .instance_size = sizeof(HostIOMMUDeviceIOMMUFD),
>> .class_size = sizeof(HostIOMMUDeviceIOMMUFDClass),
>> + .class_init = hiod_iommufd_class_init,
>> .abstract = true,
>> }
>> };
- [PATCH v3 07/19] vfio/container: Implement HostIOMMUDeviceClass::realize() handler, (continued)
- [PATCH v3 07/19] vfio/container: Implement HostIOMMUDeviceClass::realize() handler, Zhenzhong Duan, 2024/04/29
- [PATCH v3 08/19] backends/iommufd: Introduce helper function iommufd_backend_get_device_info(), Zhenzhong Duan, 2024/04/29
- [PATCH v3 09/19] vfio/iommufd: Implement HostIOMMUDeviceClass::realize() handler, Zhenzhong Duan, 2024/04/29
- [PATCH v3 12/19] vfio: Introduce VFIOIOMMUClass::hiod_typename attribute, Zhenzhong Duan, 2024/04/29
- [PATCH v3 11/19] backends/iommufd: Implement HostIOMMUDeviceClass::check_cap() handler, Zhenzhong Duan, 2024/04/29
- [PATCH v3 10/19] vfio/container: Implement HostIOMMUDeviceClass::check_cap() handler, Zhenzhong Duan, 2024/04/29
- [PATCH v3 13/19] vfio: Create host IOMMU device instance, Zhenzhong Duan, 2024/04/29
[PATCH v3 15/19] hw/pci: Introduce pci_device_[set|unset]_iommu_device(), Zhenzhong Duan, 2024/04/29
[PATCH v3 14/19] hw/pci: Introduce helper function pci_device_get_iommu_bus_devfn(), Zhenzhong Duan, 2024/04/29
[PATCH v3 17/19] intel_iommu: Extract out vtd_cap_init() to initialize cap/ecap, Zhenzhong Duan, 2024/04/29
[PATCH v3 16/19] vfio/pci: Pass HostIOMMUDevice to vIOMMU, Zhenzhong Duan, 2024/04/29