Subject: linux-next: manual merge of the iommufd tree with the iommu tree

From: Stephen Rothwell <[email-masked]>
Date: Mon, 30 Jun 2025 16:00:59 +1000

Hi all,

Today's linux-next merge of the iommufd tree got a conflict in:

  include/linux/iommu.h

between commit:

  792ea7b6cafa ("iommu: Remove ops->pgsize_bitmap")

from the iommu tree and commits:

  187f146d5de6 ("iommu: Introduce get_viommu_size and viommu_init ops")
  f842ea208e43 ("iommu: Deprecate viommu_alloc op")

from the iommufd tree.

I fixed it up (see below) and can carry the fix as necessary. This
is now fixed as far as linux-next is concerned, but any non trivial
conflicts should be mentioned to your upstream maintainer when your tree
is submitted for merging.  You may also want to consider cooperating
with the maintainer of the conflicting tree to minimise any particularly
complex conflicts.

-- 
Cheers,
Stephen Rothwell

diff --cc include/linux/iommu.h
index 7073be1d8841,04548b18df28..000000000000
--- a/include/linux/iommu.h
+++ b/include/linux/iommu.h
@@@ -596,14 -597,17 +597,16 @@@ iommu_copy_struct_from_full_user_array(
   *		- IOMMU_DOMAIN_DMA: must use a dma domain
   *		- 0: use the default setting
   * @default_domain_ops: the default ops for domains
-  * @viommu_alloc: Allocate an iommufd_viommu on a physical IOMMU instance behind
-  *                the @dev, as the set of virtualization resources shared/passed
-  *                to user space IOMMU instance. And associate it with a nesting
-  *                @parent_domain. The @viommu_type must be defined in the header
-  *                include/uapi/linux/iommufd.h
-  *                It is required to call iommufd_viommu_alloc() helper for
-  *                a bundled allocation of the core and the driver structures,
-  *                using the given @ictx pointer.
+  * @get_viommu_size: Get the size of a driver-level vIOMMU structure for a given
+  *                   @dev corresponding to @viommu_type. Driver should return 0
+  *                   if vIOMMU isn't supported accordingly. It is required for
+  *                   driver to use the VIOMMU_STRUCT_SIZE macro to sanitize the
+  *                   driver-level vIOMMU structure related to the core one
+  * @viommu_init: Init the driver-level struct of an iommufd_viommu on a physical
+  *               IOMMU instance @viommu->iommu_dev, as the set of virtualization
+  *               resources shared/passed to user space IOMMU instance. Associate
+  *               it with a nesting @parent_domain. It is required for driver to
+  *               set @viommu->ops pointing to its own viommu_ops
 - * @pgsize_bitmap: bitmap of all possible supported page sizes
   * @owner: Driver module providing these ops
   * @identity_domain: An always available, always attachable identity
   *                   translation.
@@@ -653,11 -657,13 +656,12 @@@ struct iommu_ops 
  
  	int (*def_domain_type)(struct device *dev);
  
- 	struct iommufd_viommu *(*viommu_alloc)(
- 		struct device *dev, struct iommu_domain *parent_domain,
- 		struct iommufd_ctx *ictx, unsigned int viommu_type);
+ 	size_t (*get_viommu_size)(struct device *dev,
+ 				  enum iommu_viommu_type viommu_type);
+ 	int (*viommu_init)(struct iommufd_viommu *viommu,
+ 			   struct iommu_domain *parent_domain);
  
  	const struct iommu_domain_ops *default_domain_ops;
 -	unsigned long pgsize_bitmap;
  	struct module *owner;
  	struct iommu_domain *identity_domain;
  	struct iommu_domain *blocked_domain;