[RFC,v1,1/3] iommu: Add set/unset_rid_user ops

Message ID 1944e8b2226585e309081a541e51addc137e6684.1680762112.git.nicolinc@nvidia.com
State New
Headers
Series Add set_rid_user and unset_rid_user support |

Commit Message

Nicolin Chen April 6, 2023, 6:25 a.m. UTC
  Add a pair of new ops to allow user space to set virtual RID of a device.
This can be converted to Stream ID for SMMUv3, so as to create the link
between a physical Stream ID and a virtual Stream ID.

Signed-off-by: Nicolin Chen <nicolinc@nvidia.com>
---
 include/linux/iommu.h | 4 ++++
 1 file changed, 4 insertions(+)
  

Patch

diff --git a/include/linux/iommu.h b/include/linux/iommu.h
index 080278c8154d..f85ce6f01408 100644
--- a/include/linux/iommu.h
+++ b/include/linux/iommu.h
@@ -248,6 +248,7 @@  struct iommu_iotlb_gather {
  *                      driver init to device driver init (default no)
  * @dev_enable/disable_feat: per device entries to enable/disable
  *                               iommu specific features.
+ * @set/unset_rid_user: per device entries to set/unset user space Request ID
  * @page_response: handle page request response
  * @def_domain_type: device default domain type, return value:
  *		- IOMMU_DOMAIN_IDENTITY: must use an identity domain
@@ -291,6 +292,9 @@  struct iommu_ops {
 	int (*dev_enable_feat)(struct device *dev, enum iommu_dev_features f);
 	int (*dev_disable_feat)(struct device *dev, enum iommu_dev_features f);
 
+	int (*set_rid_user)(struct device *dev, u32 rid, u32 rid_base);
+	int (*unset_rid_user)(struct device *dev);
+
 	int (*page_response)(struct device *dev,
 			     struct iommu_fault_event *evt,
 			     struct iommu_page_response *msg);