Hi Markus,
>-----Original Message-----
>From: Markus Armbruster <[email protected]>
>Sent: Monday, October 16, 2023 6:01 PM
>Subject: Re: [PATCH v2 17/27] backends/iommufd: Introduce the iommufd object
>
>Zhenzhong Duan <[email protected]> writes:
>
>> From: Eric Auger <[email protected]>
>>
>> Introduce an iommufd object which allows the interaction
>> with the host /dev/iommu device.
>>
>> The /dev/iommu can have been already pre-opened outside of qemu,
>> in which case the fd can be passed directly along with the
>> iommufd object:
>>
>> This allows the iommufd object to be shared accross several
>> subsystems (VFIO, VDPA, ...). For example, libvirt would open
>> the /dev/iommu once.
>>
>> If no fd is passed along with the iommufd object, the /dev/iommu
>> is opened by the qemu code.
>>
>> The CONFIG_IOMMUFD option must be set to compile this new object.
>>
>> Suggested-by: Alex Williamson <[email protected]>
>> Signed-off-by: Eric Auger <[email protected]>
>> Signed-off-by: Yi Liu <[email protected]>
>> Signed-off-by: Zhenzhong Duan <[email protected]>
>> ---
>> MAINTAINERS | 7 +
>> qapi/qom.json | 18 ++-
>> include/sysemu/iommufd.h | 46 +++++++
>> backends/iommufd-stub.c | 59 +++++++++
>> backends/iommufd.c | 268 +++++++++++++++++++++++++++++++++++++++
>> backends/Kconfig | 4 +
>> backends/meson.build | 5 +
>> backends/trace-events | 12 ++
>> qemu-options.hx | 13 ++
>> 9 files changed, 431 insertions(+), 1 deletion(-)
>> create mode 100644 include/sysemu/iommufd.h
>> create mode 100644 backends/iommufd-stub.c
>> create mode 100644 backends/iommufd.c
>>
>> diff --git a/MAINTAINERS b/MAINTAINERS
>> index 9e7dec4a58..a7cdeb7825 100644
>> --- a/MAINTAINERS
>> +++ b/MAINTAINERS
>> @@ -2081,6 +2081,13 @@ F: hw/vfio/ap.c
>> F: docs/system/s390x/vfio-ap.rst
>> L: [email protected]
>>
>> +iommufd
>> +M: Yi Liu <[email protected]>
>> +M: Eric Auger <[email protected]>
>> +S: Supported
>> +F: backends/iommufd.c
>> +F: include/sysemu/iommufd.h
>> +
>> vhost
>> M: Michael S. Tsirkin <[email protected]>
>> S: Supported
>> diff --git a/qapi/qom.json b/qapi/qom.json
>> index c53ef978ff..3f964e57f5 100644
>> --- a/qapi/qom.json
>> +++ b/qapi/qom.json
>> @@ -794,6 +794,18 @@
>> { 'struct': 'VfioUserServerProperties',
>> 'data': { 'socket': 'SocketAddress', 'device': 'str' } }
>>
>> +##
>> +# @IOMMUFDProperties:
>> +#
>> +# Properties for IOMMUFDbackend objects.
>
>This is the only occurence of "IOMMUFDbackend". Do you mean iommufd?
Yes, will fix.
>
>> +#
>> +# fd: file descriptor name
>
>Awfully terse. Like many existing FOOProperties. Would it make sense
>to document what objects of type iommufd are good for, and how they use
>@fd? Or is it already documented elsewhere?
Will add more comments here, thanks for point out.
>
>> +#
>> +# Since: 7.2
>
>Since: 8.2.
Yes.
>
>> +##
>> +{ 'struct': 'IOMMUFDProperties',
>> + 'data': { '*fd': 'str' } }
>> +
>> ##
>> # @RngProperties:
>> #
>> @@ -948,6 +960,8 @@
>> 'qtest',
>> 'rng-builtin',
>> 'rng-egd',
>> + { 'name': 'iommufd',
>> + 'if': 'CONFIG_IOMMUFD' },
>> { 'name': 'rng-random',
>> 'if': 'CONFIG_POSIX' },
>> 'secret',
>
>Please keep the members sorted.
Will fix.
>
>> @@ -1029,7 +1043,9 @@
>> 'tls-creds-x509': 'TlsCredsX509Properties',
>> 'tls-cipher-suites': 'TlsCredsProperties',
>> 'x-remote-object': 'RemoteObjectProperties',
>> - 'x-vfio-user-server': 'VfioUserServerProperties'
>> + 'x-vfio-user-server': 'VfioUserServerProperties',
>> + 'iommufd': { 'type': 'IOMMUFDProperties',
>> + 'if': 'CONFIG_IOMMUFD' }
>
>Likewise.
Will fix.
Thanks
Zhenzhong
>
>> } }
>>
>> ##
>
>[...]