Re: [PATCH] vfio: mlx5, pds: add IOMMU_SUPPORT dependency

From: Joao Martins
Date: Mon Oct 23 2023 - 08:38:01 EST


On 23/10/2023 13:04, Jason Gunthorpe wrote:
> On Mon, Oct 23, 2023 at 01:55:03PM +0200, Arnd Bergmann wrote:
>> From: Arnd Bergmann <arnd@xxxxxxxx>
>>
>> Selecting IOMMUFD_DRIVER is not allowed if IOMMUs themselves are not supported:
>>
>> WARNING: unmet direct dependencies detected for IOMMUFD_DRIVER
>> Depends on [n]: IOMMU_SUPPORT [=n]
>> Selected by [m]:
>> - MLX5_VFIO_PCI [=m] && VFIO [=y] && PCI [=y] && MMU [=y] && MLX5_CORE [=y]
>>
>> There is no actual build failure, only the warning.
>>
>> Make the 'select' conditional using the same logic that we have for
>> INTEL_IOMMU and AMD_IOMMU.
>>
>> Fixes: 33f6339534287 ("vfio: Move iova_bitmap into iommufd")
>> Signed-off-by: Arnd Bergmann <arnd@xxxxxxxx>
>> ---
>> drivers/vfio/pci/mlx5/Kconfig | 2 +-
>> drivers/vfio/pci/pds/Kconfig | 2 +-
>> 2 files changed, 2 insertions(+), 2 deletions(-)
>
> But this isn't the logic this wants, it wants to turn on
> IOMMUFD_DRIVER if MLX5_VFIO_PCI is turned on.
>

Right -- IOMMU drivers need really IOMMUFD (as its usage is driven by IOMMUFD),
whereby vfio pci drivers don't quite need the iommufd support, only the helper
code support, as the vfio UAPI drives VF own dirty tracking.

> I think it means IOMMUFD_DRIVER should be lifted out of the
> IOMMU_SUPPORT block somehow. I guess just move it into the top of
> drivers/iommu/Kconfig?

iommufd Kconfig is only included in the IOMMU_SUPPORT kconfig if clause; so
moving it out from the iommufd kconfig out into iommu kconfig should fix it.
Didn't realize that one can select IOMMU_API yet have IOMMU_SUPPORT unset/unmet.
I'll make the move in v6

Joao