[RFC PATCH v6 06/11] iommu: Add a helper to query vIOMMU hardware parameters
From: Aneesh Kumar K.V (Arm)
Date: Thu Sep 17 2026 - 10:16:25 EST
Expose a type-specific kernel parameter query through the physical IOMMU
driver. This lets an external vIOMMU provider obtain hardware parameters
without depending on private driver structures.
Signed-off-by: Aneesh Kumar K.V (Arm) <aneesh.kumar@xxxxxxxxxx>
---
drivers/iommu/iommu.c | 11 +++++++++++
include/linux/iommu.h | 7 +++++++
2 files changed, 18 insertions(+)
diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c
index 04cd5a686e18..70ca10380742 100644
--- a/drivers/iommu/iommu.c
+++ b/drivers/iommu/iommu.c
@@ -58,6 +58,17 @@ int iommu_viommu_validate_parent(struct device *dev,
}
EXPORT_SYMBOL_GPL(iommu_viommu_validate_parent);
+int iommu_viommu_get_params(struct device *dev,
+ enum iommu_viommu_type type, void *params, size_t params_size)
+{
+ const struct iommu_ops *ops = dev_iommu_ops(dev);
+
+ if (!ops->viommu_get_params)
+ return -EOPNOTSUPP;
+ return ops->viommu_get_params(dev, type, params, params_size);
+}
+EXPORT_SYMBOL_GPL(iommu_viommu_get_params);
+
/* Tags used with xa_tag_pointer() in group->pasid_array */
enum { IOMMU_PASID_ARRAY_DOMAIN = 0, IOMMU_PASID_ARRAY_HANDLE = 1 };
diff --git a/include/linux/iommu.h b/include/linux/iommu.h
index ee016a7c7a41..c006478c4b04 100644
--- a/include/linux/iommu.h
+++ b/include/linux/iommu.h
@@ -437,6 +437,8 @@ struct iommu_user_data {
int iommu_viommu_validate_parent(struct device *dev,
enum iommu_viommu_type type, struct iommu_domain *parent_domain);
+int iommu_viommu_get_params(struct device *dev,
+ enum iommu_viommu_type type, void *params, size_t params_size);
/**
* struct iommu_user_data_array - iommu driver specific user space data array
@@ -684,6 +686,8 @@ __iommu_copy_struct_to_user(const struct iommu_user_data *dst_data,
* set @viommu->ops pointing to its own viommu_ops
* @viommu_validate_parent: Validate that @parent_domain is compatible with
* @dev for @viommu_type.
+ * @viommu_get_params: Fill a kernel buffer with parameters for @viommu_type.
+ * The buffer format is defined by that vIOMMU type.
* @owner: Driver module providing these ops
* @identity_domain: An always available, always attachable identity
* translation.
@@ -742,6 +746,9 @@ struct iommu_ops {
int (*viommu_validate_parent)(struct device *dev,
enum iommu_viommu_type viommu_type,
struct iommu_domain *parent_domain);
+ int (*viommu_get_params)(struct device *dev,
+ enum iommu_viommu_type viommu_type,
+ void *params, size_t params_size);
const struct iommu_domain_ops *default_domain_ops;
struct module *owner;
--
2.43.0