]> git.ipfire.org Git - thirdparty/linux.git/blobdiff - include/linux/iommu.h
Merge tag 'iommu-updates-v6.6' of git://git.kernel.org/pub/scm/linux/kernel/git/joro...
[thirdparty/linux.git] / include / linux / iommu.h
index bd6a1110b294504eb379f1f814b263e31c994a6e..c50a769d569a60f2922a40ad7b813de4b29513d0 100644 (file)
@@ -196,6 +196,8 @@ enum iommu_dev_features {
        IOMMU_DEV_FEAT_IOPF,
 };
 
+#define IOMMU_NO_PASID (0U) /* Reserved for DMA w/o PASID */
+#define IOMMU_FIRST_GLOBAL_PASID       (1U) /*starting range for allocation */
 #define IOMMU_PASID_INVALID    (-1U)
 typedef unsigned int ioasid_t;
 
@@ -414,6 +416,8 @@ struct iommu_fault_param {
  * @priv:       IOMMU Driver private data
  * @max_pasids:  number of PASIDs this device can consume
  * @attach_deferred: the dma domain attachment is deferred
+ * @pci_32bit_workaround: Limit DMA allocations to 32-bit IOVAs
+ * @require_direct: device requires IOMMU_RESV_DIRECT regions
  *
  * TODO: migrate other per device data pointers under iommu_dev_data, e.g.
  *     struct iommu_group      *iommu_group;
@@ -427,6 +431,8 @@ struct dev_iommu {
        void                            *priv;
        u32                             max_pasids;
        u32                             attach_deferred:1;
+       u32                             pci_32bit_workaround:1;
+       u32                             require_direct:1;
 };
 
 int iommu_device_register(struct iommu_device *iommu,
@@ -721,6 +727,8 @@ void iommu_detach_device_pasid(struct iommu_domain *domain,
 struct iommu_domain *
 iommu_get_domain_for_dev_pasid(struct device *dev, ioasid_t pasid,
                               unsigned int type);
+ioasid_t iommu_alloc_global_pasid(struct device *dev);
+void iommu_free_global_pasid(ioasid_t pasid);
 #else /* CONFIG_IOMMU_API */
 
 struct iommu_ops {};
@@ -1082,6 +1090,13 @@ iommu_get_domain_for_dev_pasid(struct device *dev, ioasid_t pasid,
 {
        return NULL;
 }
+
+static inline ioasid_t iommu_alloc_global_pasid(struct device *dev)
+{
+       return IOMMU_PASID_INVALID;
+}
+
+static inline void iommu_free_global_pasid(ioasid_t pasid) {}
 #endif /* CONFIG_IOMMU_API */
 
 /**