Re: [PATCH v6 02/13] iommufd: Move _iommufd_object_alloc helper to a sharable file
From: Jason Gunthorpe
Date: Thu Oct 31 2024 - 09:12:24 EST
On Wed, Oct 30, 2024 at 02:34:28PM -0700, Nicolin Chen wrote:
> The following patch will add a new vIOMMU allocator that will require this
> _iommufd_object_alloc to be sharable with IOMMU drivers (and iommufd too).
>
> Add a new driver.c file that will be built with CONFIG_IOMMUFD_DRIVER_CORE
> selected by CONFIG_IOMMUFD, and put the CONFIG_DRIVER under that remaining
> to be selectable for drivers to build the existing iova_bitmap.c file.
>
> Suggested-by: Jason Gunthorpe <jgg@xxxxxxxxxx>
> Signed-off-by: Nicolin Chen <nicolinc@xxxxxxxxxx>
> ---
> drivers/iommu/iommufd/Kconfig | 5 ++++
> drivers/iommu/iommufd/Makefile | 5 +++-
> drivers/iommu/iommufd/iommufd_private.h | 4 ---
> include/linux/iommufd.h | 10 +++++++
> drivers/iommu/iommufd/driver.c | 40 +++++++++++++++++++++++++
> drivers/iommu/iommufd/main.c | 32 --------------------
> 6 files changed, 59 insertions(+), 37 deletions(-)
> create mode 100644 drivers/iommu/iommufd/driver.c
>
> diff --git a/drivers/iommu/iommufd/Kconfig b/drivers/iommu/iommufd/Kconfig
> index 76656fe0470d..83addbe2ff7b 100644
> --- a/drivers/iommu/iommufd/Kconfig
> +++ b/drivers/iommu/iommufd/Kconfig
> @@ -1,9 +1,14 @@
> # SPDX-License-Identifier: GPL-2.0-only
> +config IOMMUFD_DRIVER_CORE
> + tristate
> + default IOMMUFD_DRIVER || IOMMUFD
> +
> config IOMMUFD
> tristate "IOMMU Userspace API"
> select INTERVAL_TREE
> select INTERVAL_TREE_SPAN_ITER
> select IOMMU_API
> + select IOMMUFD_DRIVER_CORE
Should drop the select
Reviewed-by: Jason Gunthorpe <jgg@xxxxxxxxxx>
Jason