diff options
Diffstat (limited to 'include/linux/iommu.h')
| -rw-r--r-- | include/linux/iommu.h | 31 | 
1 files changed, 20 insertions, 11 deletions
diff --git a/include/linux/iommu.h b/include/linux/iommu.h index d31642596675..c50a769d569a 100644 --- a/include/linux/iommu.h +++ b/include/linux/iommu.h @@ -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; @@ -228,6 +230,10 @@ struct iommu_iotlb_gather {  /**   * struct iommu_ops - iommu ops and capabilities   * @capable: check capability + * @hw_info: report iommu hardware information. The data buffer returned by this + *           op is allocated in the iommu driver and freed by the caller after + *           use. The information type is one of enum iommu_hw_info_type defined + *           in include/uapi/linux/iommufd.h.   * @domain_alloc: allocate iommu domain   * @probe_device: Add device to iommu driver handling   * @release_device: Remove device from iommu driver handling @@ -257,6 +263,7 @@ struct iommu_iotlb_gather {   */  struct iommu_ops {  	bool (*capable)(struct device *dev, enum iommu_cap); +	void *(*hw_info)(struct device *dev, u32 *length, u32 *type);  	/* Domain allocation and freeing by the iommu driver */  	struct iommu_domain *(*domain_alloc)(unsigned iommu_domain_type); @@ -409,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; @@ -422,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, @@ -450,17 +461,6 @@ static inline void iommu_iotlb_gather_init(struct iommu_iotlb_gather *gather)  	};  } -static inline const struct iommu_ops *dev_iommu_ops(struct device *dev) -{ -	/* -	 * Assume that valid ops must be installed if iommu_probe_device() -	 * has succeeded. The device ops are essentially for internal use -	 * within the IOMMU subsystem itself, so we should be able to trust -	 * ourselves not to misuse the helper. -	 */ -	return dev->iommu->iommu_dev->ops; -} -  extern int bus_iommu_probe(const struct bus_type *bus);  extern bool iommu_present(const struct bus_type *bus);  extern bool device_iommu_capable(struct device *dev, enum iommu_cap cap); @@ -727,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 {}; @@ -1088,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 */  /**  |