summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2024-11-27 14:24:34 -0800
committerLinus Torvalds <torvalds@linux-foundation.org>2024-11-27 14:24:34 -0800
commit64e6fc27d60f8b186bd4d071a6266f8c4d5aa2f7 (patch)
treef824a2e560d306c217ab56b7eaa7cbd7fd6c0149 /include
parent9ad55a67a788c0806b0fe23be36fae6dbfbc3fc5 (diff)
parentd53764723ecd639a0cc0c5ad24146847fc09f78d (diff)
downloadlinux-64e6fc27d60f8b186bd4d071a6266f8c4d5aa2f7.tar.gz
linux-64e6fc27d60f8b186bd4d071a6266f8c4d5aa2f7.tar.bz2
linux-64e6fc27d60f8b186bd4d071a6266f8c4d5aa2f7.zip
Merge tag 'for-linus-iommufd' of git://git.kernel.org/pub/scm/linux/kernel/git/jgg/iommufd
Pull more iommufd updates from Jason Gunthorpe: "Change the driver callback op domain_alloc_user() into two ops: domain_alloc_paging_flags() and domain_alloc_nesting() that better describe what the ops are expected to do. There will be per-driver cleanup based on this going into the next cycle via the driver trees" * tag 'for-linus-iommufd' of git://git.kernel.org/pub/scm/linux/kernel/git/jgg/iommufd: iommu: Rename ops->domain_alloc_user() to domain_alloc_paging_flags() iommu: Add ops->domain_alloc_nested()
Diffstat (limited to 'include')
-rw-r--r--include/linux/iommu.h27
1 files changed, 16 insertions, 11 deletions
diff --git a/include/linux/iommu.h b/include/linux/iommu.h
index 301e97d745c1..318d27841130 100644
--- a/include/linux/iommu.h
+++ b/include/linux/iommu.h
@@ -557,17 +557,19 @@ iommu_copy_struct_from_full_user_array(void *kdst, size_t kdst_entry_size,
* @domain_alloc: allocate and return an iommu domain if success. Otherwise
* NULL is returned. The domain is not fully initialized until
* the caller iommu_domain_alloc() returns.
- * @domain_alloc_user: Allocate an iommu domain corresponding to the input
- * parameters as defined in include/uapi/linux/iommufd.h.
- * Upon success, if the @user_data is valid and the @parent
- * points to a kernel-managed domain, the new domain must be
- * IOMMU_DOMAIN_NESTED type; otherwise, the @parent must be
- * NULL while the @user_data can be optionally provided, the
- * new domain must support __IOMMU_DOMAIN_PAGING.
- * Upon failure, ERR_PTR must be returned.
+ * @domain_alloc_paging_flags: Allocate an iommu domain corresponding to the
+ * input parameters as defined in
+ * include/uapi/linux/iommufd.h. The @user_data can be
+ * optionally provided, the new domain must support
+ * __IOMMU_DOMAIN_PAGING. Upon failure, ERR_PTR must be
+ * returned.
* @domain_alloc_paging: Allocate an iommu_domain that can be used for
- * UNMANAGED, DMA, and DMA_FQ domain types.
+ * UNMANAGED, DMA, and DMA_FQ domain types. This is the
+ * same as invoking domain_alloc_paging_flags() with
+ * @flags=0, @user_data=NULL. A driver should implement
+ * only one of the two ops.
* @domain_alloc_sva: Allocate an iommu_domain for Shared Virtual Addressing.
+ * @domain_alloc_nested: Allocate an iommu_domain for nested translation.
* @probe_device: Add device to iommu driver handling
* @release_device: Remove device from iommu driver handling
* @probe_finalize: Do final setup work after the device is added to an IOMMU
@@ -616,12 +618,15 @@ struct iommu_ops {
/* Domain allocation and freeing by the iommu driver */
struct iommu_domain *(*domain_alloc)(unsigned iommu_domain_type);
- struct iommu_domain *(*domain_alloc_user)(
- struct device *dev, u32 flags, struct iommu_domain *parent,
+ struct iommu_domain *(*domain_alloc_paging_flags)(
+ struct device *dev, u32 flags,
const struct iommu_user_data *user_data);
struct iommu_domain *(*domain_alloc_paging)(struct device *dev);
struct iommu_domain *(*domain_alloc_sva)(struct device *dev,
struct mm_struct *mm);
+ struct iommu_domain *(*domain_alloc_nested)(
+ struct device *dev, struct iommu_domain *parent, u32 flags,
+ const struct iommu_user_data *user_data);
struct iommu_device *(*probe_device)(struct device *dev);
void (*release_device)(struct device *dev);