Message ID | 20231102071302.1818071-42-zhenzhong.duan@intel.com |
---|---|
State | New |
Headers | show |
Series | vfio: Adopt iommufd | expand |
On 11/2/23 08:13, Zhenzhong Duan wrote: > Since PPC doesn't support IOMMUFD, make iommufd related code > compiled out. > > Suggested-by: Cédric Le Goater <clg@redhat.com> > Signed-off-by: Zhenzhong Duan <zhenzhong.duan@intel.com> Please drop this patch. Instead, add imply IOMMUFD in hw/{i386,s390x,arm}/Kconfig for platforms supporting IOMMUFD. Thanks, C. > --- > hw/vfio/common.c | 2 +- > hw/vfio/pci.c | 2 +- > hw/vfio/platform.c | 2 +- > backends/meson.build | 4 ++-- > hw/vfio/meson.build | 2 +- > 5 files changed, 6 insertions(+), 6 deletions(-) > > diff --git a/hw/vfio/common.c b/hw/vfio/common.c > index 1c9203183d..000717cef3 100644 > --- a/hw/vfio/common.c > +++ b/hw/vfio/common.c > @@ -1504,7 +1504,7 @@ int vfio_attach_device(char *name, VFIODevice *vbasedev, > { > const VFIOIOMMUOps *ops; > > -#ifdef CONFIG_IOMMUFD > +#if defined(CONFIG_IOMMUFD) && !defined(TARGET_PPC) > if (vbasedev->iommufd) { > ops = &vfio_iommufd_ops; > } else > diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c > index d8f658ea47..2287e45119 100644 > --- a/hw/vfio/pci.c > +++ b/hw/vfio/pci.c > @@ -3550,7 +3550,7 @@ static Property vfio_pci_dev_properties[] = { > qdev_prop_nv_gpudirect_clique, uint8_t), > DEFINE_PROP_OFF_AUTO_PCIBAR("x-msix-relocation", VFIOPCIDevice, msix_relo, > OFF_AUTOPCIBAR_OFF), > -#ifdef CONFIG_IOMMUFD > +#if defined(CONFIG_IOMMUFD) && !defined(TARGET_PPC) > DEFINE_PROP_LINK("iommufd", VFIOPCIDevice, vbasedev.iommufd, > TYPE_IOMMUFD_BACKEND, IOMMUFDBackend *), > #endif > diff --git a/hw/vfio/platform.c b/hw/vfio/platform.c > index aa0b2b9583..c8f4ae5a06 100644 > --- a/hw/vfio/platform.c > +++ b/hw/vfio/platform.c > @@ -648,7 +648,7 @@ static Property vfio_platform_dev_properties[] = { > DEFINE_PROP_UINT32("mmap-timeout-ms", VFIOPlatformDevice, > mmap_timeout, 1100), > DEFINE_PROP_BOOL("x-irqfd", VFIOPlatformDevice, irqfd_allowed, true), > -#ifdef CONFIG_IOMMUFD > +#if defined(CONFIG_IOMMUFD) && !defined(TARGET_PPC) > DEFINE_PROP_LINK("iommufd", VFIOPlatformDevice, vbasedev.iommufd, > TYPE_IOMMUFD_BACKEND, IOMMUFDBackend *), > #endif > diff --git a/backends/meson.build b/backends/meson.build > index 05ac57ff15..9dbdfa87f7 100644 > --- a/backends/meson.build > +++ b/backends/meson.build > @@ -21,9 +21,9 @@ if have_vhost_user > endif > system_ss.add(when: 'CONFIG_VIRTIO_CRYPTO', if_true: files('cryptodev-vhost.c')) > if have_iommufd > - system_ss.add(files('iommufd.c')) > + system_ss.add(when: 'TARGET_PPC', if_false: files('iommufd.c')) > else > - system_ss.add(files('iommufd-stub.c')) > + system_ss.add(when: 'TARGET_PPC', if_false: files('iommufd-stub.c')) > endif > if have_vhost_user_crypto > system_ss.add(when: 'CONFIG_VIRTIO_CRYPTO', if_true: files('cryptodev-vhost-user.c')) > diff --git a/hw/vfio/meson.build b/hw/vfio/meson.build > index 9cae2c9e21..4423bb3cd4 100644 > --- a/hw/vfio/meson.build > +++ b/hw/vfio/meson.build > @@ -8,7 +8,7 @@ vfio_ss.add(files( > 'migration.c', > )) > if have_iommufd > - vfio_ss.add(files('iommufd.c')) > + vfio_ss.add(when: 'TARGET_PPC', if_false: files('iommufd.c')) > endif > vfio_ss.add(when: 'CONFIG_VFIO_PCI', if_true: files( > 'display.c',
>-----Original Message----- >From: Cédric Le Goater <clg@redhat.com> >Sent: Tuesday, November 7, 2023 9:44 PM >Subject: Re: [PATCH v4 41/41] vfio: Compile out iommufd for PPC target > >On 11/2/23 08:13, Zhenzhong Duan wrote: >> Since PPC doesn't support IOMMUFD, make iommufd related code >> compiled out. >> >> Suggested-by: Cédric Le Goater <clg@redhat.com> >> Signed-off-by: Zhenzhong Duan <zhenzhong.duan@intel.com> >Please drop this patch. > >Instead, add > > imply IOMMUFD > >in hw/{i386,s390x,arm}/Kconfig for platforms supporting IOMMUFD. Good suggestions, will do. Thanks Zhenzhong
diff --git a/hw/vfio/common.c b/hw/vfio/common.c index 1c9203183d..000717cef3 100644 --- a/hw/vfio/common.c +++ b/hw/vfio/common.c @@ -1504,7 +1504,7 @@ int vfio_attach_device(char *name, VFIODevice *vbasedev, { const VFIOIOMMUOps *ops; -#ifdef CONFIG_IOMMUFD +#if defined(CONFIG_IOMMUFD) && !defined(TARGET_PPC) if (vbasedev->iommufd) { ops = &vfio_iommufd_ops; } else diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c index d8f658ea47..2287e45119 100644 --- a/hw/vfio/pci.c +++ b/hw/vfio/pci.c @@ -3550,7 +3550,7 @@ static Property vfio_pci_dev_properties[] = { qdev_prop_nv_gpudirect_clique, uint8_t), DEFINE_PROP_OFF_AUTO_PCIBAR("x-msix-relocation", VFIOPCIDevice, msix_relo, OFF_AUTOPCIBAR_OFF), -#ifdef CONFIG_IOMMUFD +#if defined(CONFIG_IOMMUFD) && !defined(TARGET_PPC) DEFINE_PROP_LINK("iommufd", VFIOPCIDevice, vbasedev.iommufd, TYPE_IOMMUFD_BACKEND, IOMMUFDBackend *), #endif diff --git a/hw/vfio/platform.c b/hw/vfio/platform.c index aa0b2b9583..c8f4ae5a06 100644 --- a/hw/vfio/platform.c +++ b/hw/vfio/platform.c @@ -648,7 +648,7 @@ static Property vfio_platform_dev_properties[] = { DEFINE_PROP_UINT32("mmap-timeout-ms", VFIOPlatformDevice, mmap_timeout, 1100), DEFINE_PROP_BOOL("x-irqfd", VFIOPlatformDevice, irqfd_allowed, true), -#ifdef CONFIG_IOMMUFD +#if defined(CONFIG_IOMMUFD) && !defined(TARGET_PPC) DEFINE_PROP_LINK("iommufd", VFIOPlatformDevice, vbasedev.iommufd, TYPE_IOMMUFD_BACKEND, IOMMUFDBackend *), #endif diff --git a/backends/meson.build b/backends/meson.build index 05ac57ff15..9dbdfa87f7 100644 --- a/backends/meson.build +++ b/backends/meson.build @@ -21,9 +21,9 @@ if have_vhost_user endif system_ss.add(when: 'CONFIG_VIRTIO_CRYPTO', if_true: files('cryptodev-vhost.c')) if have_iommufd - system_ss.add(files('iommufd.c')) + system_ss.add(when: 'TARGET_PPC', if_false: files('iommufd.c')) else - system_ss.add(files('iommufd-stub.c')) + system_ss.add(when: 'TARGET_PPC', if_false: files('iommufd-stub.c')) endif if have_vhost_user_crypto system_ss.add(when: 'CONFIG_VIRTIO_CRYPTO', if_true: files('cryptodev-vhost-user.c')) diff --git a/hw/vfio/meson.build b/hw/vfio/meson.build index 9cae2c9e21..4423bb3cd4 100644 --- a/hw/vfio/meson.build +++ b/hw/vfio/meson.build @@ -8,7 +8,7 @@ vfio_ss.add(files( 'migration.c', )) if have_iommufd - vfio_ss.add(files('iommufd.c')) + vfio_ss.add(when: 'TARGET_PPC', if_false: files('iommufd.c')) endif vfio_ss.add(when: 'CONFIG_VFIO_PCI', if_true: files( 'display.c',
Since PPC doesn't support IOMMUFD, make iommufd related code compiled out. Suggested-by: Cédric Le Goater <clg@redhat.com> Signed-off-by: Zhenzhong Duan <zhenzhong.duan@intel.com> --- hw/vfio/common.c | 2 +- hw/vfio/pci.c | 2 +- hw/vfio/platform.c | 2 +- backends/meson.build | 4 ++-- hw/vfio/meson.build | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-)