Message ID | 20231102071302.1818071-26-zhenzhong.duan@intel.com |
---|---|
State | New |
Headers | show |
Series | vfio: Adopt iommufd | expand |
On 11/2/23 08:12, Zhenzhong Duan wrote: > This adds "--enable-iommufd/--disable-iommufd" to enable or disable > iommufd support, enabled by default. I don't think a configure option is the right approach. I will comment other patches to propose another solution relying on Kconfig and activating IOMMUFD for aarch64, s390x, x86_64 only. Please drop this patch. Thanks, C. > > Signed-off-by: Zhenzhong Duan <zhenzhong.duan@intel.com> > --- > meson.build | 6 ++++++ > meson_options.txt | 2 ++ > scripts/meson-buildoptions.sh | 3 +++ > 3 files changed, 11 insertions(+) > > diff --git a/meson.build b/meson.build > index dcef8b1e79..72a57288a0 100644 > --- a/meson.build > +++ b/meson.build > @@ -560,6 +560,10 @@ have_tpm = get_option('tpm') \ > .require(targetos != 'windows', error_message: 'TPM emulation only available on POSIX systems') \ > .allowed() > > +have_iommufd = get_option('iommufd') \ > + .require(targetos == 'linux', error_message: 'iommufd is supported only on Linux') \ > + .allowed() > + > # vhost > have_vhost_user = get_option('vhost_user') \ > .disable_auto_if(targetos != 'linux') \ > @@ -2133,6 +2137,7 @@ if get_option('tcg').allowed() > endif > config_host_data.set('CONFIG_TPM', have_tpm) > config_host_data.set('CONFIG_TSAN', get_option('tsan')) > +config_host_data.set('CONFIG_IOMMUFD', have_iommufd) > config_host_data.set('CONFIG_USB_LIBUSB', libusb.found()) > config_host_data.set('CONFIG_VDE', vde.found()) > config_host_data.set('CONFIG_VHOST', have_vhost) > @@ -4075,6 +4080,7 @@ summary_info += {'vhost-user-crypto support': have_vhost_user_crypto} > summary_info += {'vhost-user-blk server support': have_vhost_user_blk_server} > summary_info += {'vhost-vdpa support': have_vhost_vdpa} > summary_info += {'build guest agent': have_ga} > +summary_info += {'iommufd support': have_iommufd} > summary(summary_info, bool_yn: true, section: 'Configurable features') > > # Compilation information > diff --git a/meson_options.txt b/meson_options.txt > index 3c7398f3c6..91bb958cae 100644 > --- a/meson_options.txt > +++ b/meson_options.txt > @@ -109,6 +109,8 @@ option('dbus_display', type: 'feature', value: 'auto', > description: '-display dbus support') > option('tpm', type : 'feature', value : 'auto', > description: 'TPM support') > +option('iommufd', type : 'feature', value : 'auto', > + description: 'iommufd support') > > # Do not enable it by default even for Mingw32, because it doesn't > # work on Wine. > diff --git a/scripts/meson-buildoptions.sh b/scripts/meson-buildoptions.sh > index 7ca4b77eae..1effc46f7d 100644 > --- a/scripts/meson-buildoptions.sh > +++ b/scripts/meson-buildoptions.sh > @@ -125,6 +125,7 @@ meson_options_help() { > printf "%s\n" ' guest-agent-msi Build MSI package for the QEMU Guest Agent' > printf "%s\n" ' hvf HVF acceleration support' > printf "%s\n" ' iconv Font glyph conversion support' > + printf "%s\n" ' iommufd iommufd support' > printf "%s\n" ' jack JACK sound support' > printf "%s\n" ' keyring Linux keyring support' > printf "%s\n" ' kvm KVM acceleration support' > @@ -342,6 +343,8 @@ _meson_option_parse() { > --enable-install-blobs) printf "%s" -Dinstall_blobs=true ;; > --disable-install-blobs) printf "%s" -Dinstall_blobs=false ;; > --interp-prefix=*) quote_sh "-Dinterp_prefix=$2" ;; > + --enable-iommufd) printf "%s" -Diommufd=enabled ;; > + --disable-iommufd) printf "%s" -Diommufd=disabled ;; > --enable-jack) printf "%s" -Djack=enabled ;; > --disable-jack) printf "%s" -Djack=disabled ;; > --enable-keyring) printf "%s" -Dkeyring=enabled ;;
On 11/7/23 14:14, Cédric Le Goater wrote: > On 11/2/23 08:12, Zhenzhong Duan wrote: >> This adds "--enable-iommufd/--disable-iommufd" to enable or disable >> iommufd support, enabled by default. > > I don't think a configure option is the right approach. I will > comment other patches to propose another solution relying on > Kconfig and activating IOMMUFD for aarch64, s390x, x86_64 only. Here is an example on your series : https://github.com/legoater/qemu/commits/vfio-8.2 The backend is always compiled (since it is common) but the VFIO frontend and the 'iommufd' object are only available on x86_64, arm, s390x. Looks like a good compromise. Please tell me what you think about it. Thanks, C. > > Please drop this patch. > > Thanks, > > C. > > > >> >> Signed-off-by: Zhenzhong Duan <zhenzhong.duan@intel.com> >> --- >> meson.build | 6 ++++++ >> meson_options.txt | 2 ++ >> scripts/meson-buildoptions.sh | 3 +++ >> 3 files changed, 11 insertions(+) >> >> diff --git a/meson.build b/meson.build >> index dcef8b1e79..72a57288a0 100644 >> --- a/meson.build >> +++ b/meson.build >> @@ -560,6 +560,10 @@ have_tpm = get_option('tpm') \ >> .require(targetos != 'windows', error_message: 'TPM emulation only available on POSIX systems') \ >> .allowed() >> +have_iommufd = get_option('iommufd') \ >> + .require(targetos == 'linux', error_message: 'iommufd is supported only on Linux') \ >> + .allowed() >> + >> # vhost >> have_vhost_user = get_option('vhost_user') \ >> .disable_auto_if(targetos != 'linux') \ >> @@ -2133,6 +2137,7 @@ if get_option('tcg').allowed() >> endif >> config_host_data.set('CONFIG_TPM', have_tpm) >> config_host_data.set('CONFIG_TSAN', get_option('tsan')) >> +config_host_data.set('CONFIG_IOMMUFD', have_iommufd) >> config_host_data.set('CONFIG_USB_LIBUSB', libusb.found()) >> config_host_data.set('CONFIG_VDE', vde.found()) >> config_host_data.set('CONFIG_VHOST', have_vhost) >> @@ -4075,6 +4080,7 @@ summary_info += {'vhost-user-crypto support': have_vhost_user_crypto} >> summary_info += {'vhost-user-blk server support': have_vhost_user_blk_server} >> summary_info += {'vhost-vdpa support': have_vhost_vdpa} >> summary_info += {'build guest agent': have_ga} >> +summary_info += {'iommufd support': have_iommufd} >> summary(summary_info, bool_yn: true, section: 'Configurable features') >> # Compilation information >> diff --git a/meson_options.txt b/meson_options.txt >> index 3c7398f3c6..91bb958cae 100644 >> --- a/meson_options.txt >> +++ b/meson_options.txt >> @@ -109,6 +109,8 @@ option('dbus_display', type: 'feature', value: 'auto', >> description: '-display dbus support') >> option('tpm', type : 'feature', value : 'auto', >> description: 'TPM support') >> +option('iommufd', type : 'feature', value : 'auto', >> + description: 'iommufd support') >> # Do not enable it by default even for Mingw32, because it doesn't >> # work on Wine. >> diff --git a/scripts/meson-buildoptions.sh b/scripts/meson-buildoptions.sh >> index 7ca4b77eae..1effc46f7d 100644 >> --- a/scripts/meson-buildoptions.sh >> +++ b/scripts/meson-buildoptions.sh >> @@ -125,6 +125,7 @@ meson_options_help() { >> printf "%s\n" ' guest-agent-msi Build MSI package for the QEMU Guest Agent' >> printf "%s\n" ' hvf HVF acceleration support' >> printf "%s\n" ' iconv Font glyph conversion support' >> + printf "%s\n" ' iommufd iommufd support' >> printf "%s\n" ' jack JACK sound support' >> printf "%s\n" ' keyring Linux keyring support' >> printf "%s\n" ' kvm KVM acceleration support' >> @@ -342,6 +343,8 @@ _meson_option_parse() { >> --enable-install-blobs) printf "%s" -Dinstall_blobs=true ;; >> --disable-install-blobs) printf "%s" -Dinstall_blobs=false ;; >> --interp-prefix=*) quote_sh "-Dinterp_prefix=$2" ;; >> + --enable-iommufd) printf "%s" -Diommufd=enabled ;; >> + --disable-iommufd) printf "%s" -Diommufd=disabled ;; >> --enable-jack) printf "%s" -Djack=enabled ;; >> --disable-jack) printf "%s" -Djack=disabled ;; >> --enable-keyring) printf "%s" -Dkeyring=enabled ;; >
>-----Original Message----- >From: Cédric Le Goater <clg@redhat.com> >Sent: Tuesday, November 7, 2023 10:37 PM >Subject: Re: [PATCH v4 25/41] Add iommufd configure option > >On 11/7/23 14:14, Cédric Le Goater wrote: >> On 11/2/23 08:12, Zhenzhong Duan wrote: >>> This adds "--enable-iommufd/--disable-iommufd" to enable or disable >>> iommufd support, enabled by default. >> >> I don't think a configure option is the right approach. I will >> comment other patches to propose another solution relying on >> Kconfig and activating IOMMUFD for aarch64, s390x, x86_64 only. > >Here is an example on your series : > > https://github.com/legoater/qemu/commits/vfio-8.2 > >The backend is always compiled (since it is common) but the VFIO frontend >and the 'iommufd' object are only available on x86_64, arm, s390x. It looks like iommufd backend is compiled only for x86_64, arm or s390x, this makes sense for me, as I think on other platform which doesn't support iommufd, no need to compile useless iommufd backend in. > >Looks like a good compromise. Please tell me what you think about it. Yes, this looks better for me, I'll include your change in v5. Thanks Zhenzhong
diff --git a/meson.build b/meson.build index dcef8b1e79..72a57288a0 100644 --- a/meson.build +++ b/meson.build @@ -560,6 +560,10 @@ have_tpm = get_option('tpm') \ .require(targetos != 'windows', error_message: 'TPM emulation only available on POSIX systems') \ .allowed() +have_iommufd = get_option('iommufd') \ + .require(targetos == 'linux', error_message: 'iommufd is supported only on Linux') \ + .allowed() + # vhost have_vhost_user = get_option('vhost_user') \ .disable_auto_if(targetos != 'linux') \ @@ -2133,6 +2137,7 @@ if get_option('tcg').allowed() endif config_host_data.set('CONFIG_TPM', have_tpm) config_host_data.set('CONFIG_TSAN', get_option('tsan')) +config_host_data.set('CONFIG_IOMMUFD', have_iommufd) config_host_data.set('CONFIG_USB_LIBUSB', libusb.found()) config_host_data.set('CONFIG_VDE', vde.found()) config_host_data.set('CONFIG_VHOST', have_vhost) @@ -4075,6 +4080,7 @@ summary_info += {'vhost-user-crypto support': have_vhost_user_crypto} summary_info += {'vhost-user-blk server support': have_vhost_user_blk_server} summary_info += {'vhost-vdpa support': have_vhost_vdpa} summary_info += {'build guest agent': have_ga} +summary_info += {'iommufd support': have_iommufd} summary(summary_info, bool_yn: true, section: 'Configurable features') # Compilation information diff --git a/meson_options.txt b/meson_options.txt index 3c7398f3c6..91bb958cae 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -109,6 +109,8 @@ option('dbus_display', type: 'feature', value: 'auto', description: '-display dbus support') option('tpm', type : 'feature', value : 'auto', description: 'TPM support') +option('iommufd', type : 'feature', value : 'auto', + description: 'iommufd support') # Do not enable it by default even for Mingw32, because it doesn't # work on Wine. diff --git a/scripts/meson-buildoptions.sh b/scripts/meson-buildoptions.sh index 7ca4b77eae..1effc46f7d 100644 --- a/scripts/meson-buildoptions.sh +++ b/scripts/meson-buildoptions.sh @@ -125,6 +125,7 @@ meson_options_help() { printf "%s\n" ' guest-agent-msi Build MSI package for the QEMU Guest Agent' printf "%s\n" ' hvf HVF acceleration support' printf "%s\n" ' iconv Font glyph conversion support' + printf "%s\n" ' iommufd iommufd support' printf "%s\n" ' jack JACK sound support' printf "%s\n" ' keyring Linux keyring support' printf "%s\n" ' kvm KVM acceleration support' @@ -342,6 +343,8 @@ _meson_option_parse() { --enable-install-blobs) printf "%s" -Dinstall_blobs=true ;; --disable-install-blobs) printf "%s" -Dinstall_blobs=false ;; --interp-prefix=*) quote_sh "-Dinterp_prefix=$2" ;; + --enable-iommufd) printf "%s" -Diommufd=enabled ;; + --disable-iommufd) printf "%s" -Diommufd=disabled ;; --enable-jack) printf "%s" -Djack=enabled ;; --disable-jack) printf "%s" -Djack=disabled ;; --enable-keyring) printf "%s" -Dkeyring=enabled ;;
This adds "--enable-iommufd/--disable-iommufd" to enable or disable iommufd support, enabled by default. Signed-off-by: Zhenzhong Duan <zhenzhong.duan@intel.com> --- meson.build | 6 ++++++ meson_options.txt | 2 ++ scripts/meson-buildoptions.sh | 3 +++ 3 files changed, 11 insertions(+)