>-----Original Message-----
>From: Cédric Le Goater <[email protected]>
>Subject: Re: [PATCH v7 17/23] iommufd: Introduce a helper function to
>extract vendor capabilities
>
>On 10/24/25 10:43, Zhenzhong Duan wrote:
>> In VFIO core, we call iommufd_backend_get_device_info() to return vendor
>> specific hardware information data, but it's not good to extract this raw
>> data in VFIO core.
>>
>> Introduce host_iommu_extract_quirks() to help extracting the raw data and
>> return a bitmap in iommufd.c because it's the place defining
>> iommufd_backend_get_device_info().
>>
>> The other choice is to put vendor data extracting code in vendor vIOMMU
>> emulation file, but that will make those files mixed with vIOMMU
>> emulation and host IOMMU extracting code, also need a new callback in
>> PCIIOMMUOps. So we choose a simpler way as above.
>>
>> Suggested-by: Nicolin Chen <[email protected]>
>> Signed-off-by: Zhenzhong Duan <[email protected]>
>> Reviewed-by: Nicolin Chen <[email protected]>
>> ---
>>   include/hw/iommu.h                 |  5 +++++
>>   include/system/host_iommu_device.h | 15 +++++++++++++++
>>   backends/iommufd.c                 | 13 +++++++++++++
>>   3 files changed, 33 insertions(+)
>>
>> diff --git a/include/hw/iommu.h b/include/hw/iommu.h
>> index 9b8bb94fc2..6d61410703 100644
>> --- a/include/hw/iommu.h
>> +++ b/include/hw/iommu.h
>> @@ -22,4 +22,9 @@ enum viommu_flags {
>>       VIOMMU_FLAG_WANT_NESTING_PARENT = BIT_ULL(0),
>>   };
>>
>> +/* Host IOMMU quirks. Extracted from host IOMMU capabilities */
>> +enum host_iommu_quirks {
>> +    HOST_IOMMU_QUIRK_NESTING_PARENT_BYPASS_RO = BIT_ULL(0),
>> +};
>> +
>>   #endif /* HW_IOMMU_H */
>> diff --git a/include/system/host_iommu_device.h
>b/include/system/host_iommu_device.h
>> index ab849a4a82..9ae7f4cc6d 100644
>> --- a/include/system/host_iommu_device.h
>> +++ b/include/system/host_iommu_device.h
>> @@ -39,6 +39,21 @@ typedef struct HostIOMMUDeviceCaps {
>>       uint64_t hw_caps;
>>       VendorCaps vendor_caps;
>>   } HostIOMMUDeviceCaps;
>> +
>> +/**
>> + * host_iommu_extract_quirk: Extract host IOMMU quirks
>> + *
>> + * This function converts @type specific hardware information data
>> + * into a standard bitmap format.
>> + *
>> + * @type: IOMMU Hardware Info Types
>> + *
>> + * @VendorCaps: IOMMU @type specific hardware information data
>> + *
>> + * Returns: bitmap with each representing a host IOMMU quirk defined in
>> + * enum host_iommu_quirks
>> + */
>> +uint64_t host_iommu_extract_quirks(uint32_t type, VendorCaps *caps);
>
>..._get_quirks() sounds nicer. This is minor.

OK, will do.

Thanks
Zhenzhong

Reply via email to