>-----Original Message----- >From: Eric Auger <eric.au...@redhat.com> >Sent: Thursday, November 16, 2023 4:33 PM >Subject: Re: [PATCH v6 01/21] backends/iommufd: Introduce the iommufd object > >Hi Zhenzhong, > >On 11/16/23 05:04, Duan, Zhenzhong wrote: >> Hi Eric, >> >>> -----Original Message----- >>> From: Eric Auger <eric.au...@redhat.com> >>> Sent: Wednesday, November 15, 2023 8:53 PM >>> Subject: Re: [PATCH v6 01/21] backends/iommufd: Introduce the iommufd >object >>> >>> Hi Zhenzhong, >>> >>> On 11/14/23 11:09, Zhenzhong Duan wrote: >>>> From: Eric Auger <eric.au...@redhat.com> >>>> >>>> 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. >>>> >>>> Suggested-by: Alex Williamson <alex.william...@redhat.com> >>>> Signed-off-by: Eric Auger <eric.au...@redhat.com> >>>> Signed-off-by: Yi Liu <yi.l....@intel.com> >>>> Signed-off-by: Zhenzhong Duan <zhenzhong.d...@intel.com> >>>> --- >>>> v6: remove redundant call, alloc_hwpt, get/put_ioas >>>> >>>> MAINTAINERS | 7 ++ >>>> qapi/qom.json | 19 ++++ >>>> include/sysemu/iommufd.h | 44 ++++++++ >>>> backends/iommufd.c | 228 >+++++++++++++++++++++++++++++++++++++++ >>>> backends/Kconfig | 4 + >>>> backends/meson.build | 1 + >>>> backends/trace-events | 10 ++ >>>> qemu-options.hx | 12 +++ >>>> 8 files changed, 325 insertions(+) >>>> create mode 100644 include/sysemu/iommufd.h >>>> create mode 100644 backends/iommufd.c >>>> >>>> diff --git a/MAINTAINERS b/MAINTAINERS >>>> index ff1238bb98..a4891f7bda 100644 >>>> --- a/MAINTAINERS >>>> +++ b/MAINTAINERS >>>> @@ -2166,6 +2166,13 @@ F: hw/vfio/ap.c >>>> F: docs/system/s390x/vfio-ap.rst >>>> L: qemu-s3...@nongnu.org >>>> >>>> +iommufd >>>> +M: Yi Liu <yi.l....@intel.com> >>>> +M: Eric Auger <eric.au...@redhat.com> >>> Zhenzhong, don't you want to be added here?
Sorry, missed this comment. My pleasure, I'll add myself in v7. >>>> +S: Supported >>>> +F: backends/iommufd.c >>>> +F: include/sysemu/iommufd.h >>>> + >>>> vhost >>>> M: Michael S. Tsirkin <m...@redhat.com> >>>> S: Supported >>>> diff --git a/qapi/qom.json b/qapi/qom.json >>>> index c53ef978ff..1fd8555a75 100644 >>>> --- a/qapi/qom.json >>>> +++ b/qapi/qom.json >>>> @@ -794,6 +794,23 @@ >>>> { 'struct': 'VfioUserServerProperties', >>>> 'data': { 'socket': 'SocketAddress', 'device': 'str' } } >>>> >>>> +## >>>> +# @IOMMUFDProperties: >>>> +# >>>> +# Properties for iommufd objects. >>>> +# >>>> +# @fd: file descriptor name previously passed via 'getfd' command, >>> "previously passed via 'getfd' command", I wonder if this applies here or >whether >>> it is copy/paste of >>> RemoteObjectProperties.fd doc? >> Maybe copied😊 I thinks this applies here because I use monitor_fd_param to >get fd. >> Or I miss anything? >This is a bit cryptic to me and I don't really understand what it means. >It does not mean it is not correct but I am curious about explanations >if anybody has some ;-) I have a weak understanding on this, may have errors😊 QMP support a command named 'getfd' to send a pre-opened fd with a name, This fd is then stored in a fd list. Then we can use that name to reference the fd In ths list. Thanks Zhenzhong