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

From: Stephen Rothwell <[email-masked]>
Date: Thu, 8 Dec 2022 10:45:03 +1100

Hi all,

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

  include/linux/iommu.h

between commit:

  493c9b68d1d8 ("iommu/tegra: Add tegra_dev_iommu_get_stream_id() helper")

from the mmc tree and commit:

  be51b1d6bbff ("iommu/sva: Refactoring iommu_sva_bind/unbind_device()")

from the iommu 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 6f53ad74fa0d,68d7d304cdb7..000000000000
--- a/include/linux/iommu.h
+++ b/include/linux/iommu.h
@@@ -1103,25 -1143,26 +1147,47 @@@ static inline void iommu_dma_compose_ms
  
  #endif	/* CONFIG_IOMMU_DMA */
  
 +/*
 + * Newer generations of Tegra SoCs require devices' stream IDs to be directly programmed into
 + * some registers. These are always paired with a Tegra SMMU or ARM SMMU, for which the contents
 + * of the struct iommu_fwspec are known. Use this helper to formalize access to these internals.
 + */
 +#define TEGRA_STREAM_ID_BYPASS 0x7f
 +
 +static inline bool tegra_dev_iommu_get_stream_id(struct device *dev, u32 *stream_id)
 +{
 +#ifdef CONFIG_IOMMU_API
 +	struct iommu_fwspec *fwspec = dev_iommu_fwspec_get(dev);
 +
 +	if (fwspec && fwspec->num_ids == 1) {
 +		*stream_id = fwspec->ids[0] & 0xffff;
 +		return true;
 +	}
 +#endif
 +
 +	return false;
 +}
 +
+ #ifdef CONFIG_IOMMU_SVA
+ struct iommu_sva *iommu_sva_bind_device(struct device *dev,
+ 					struct mm_struct *mm);
+ void iommu_sva_unbind_device(struct iommu_sva *handle);
+ u32 iommu_sva_get_pasid(struct iommu_sva *handle);
+ #else
+ static inline struct iommu_sva *
+ iommu_sva_bind_device(struct device *dev, struct mm_struct *mm)
+ {
+ 	return NULL;
+ }
+ 
+ static inline void iommu_sva_unbind_device(struct iommu_sva *handle)
+ {
+ }
+ 
+ static inline u32 iommu_sva_get_pasid(struct iommu_sva *handle)
+ {
+ 	return IOMMU_PASID_INVALID;
+ }
+ #endif /* CONFIG_IOMMU_SVA */
+ 
  #endif /* __LINUX_IOMMU_H */