aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorNicolin Chen <nicolinc@nvidia.com>2024-11-05 12:05:11 -0800
committerJason Gunthorpe <jgg@nvidia.com>2024-11-12 11:46:19 -0400
commit67db79dc1a411335f8a7e53a5e206d96b237d9a8 (patch)
tree14ebd2c8ff0aa13887cfcce514618e969f860881
parentiommufd/selftest: Add IOMMU_VDEVICE_ALLOC test coverage (diff)
downloadwireguard-linux-67db79dc1a411335f8a7e53a5e206d96b237d9a8.tar.xz
wireguard-linux-67db79dc1a411335f8a7e53a5e206d96b237d9a8.zip
iommu/viommu: Add cache_invalidate to iommufd_viommu_ops
This per-vIOMMU cache_invalidate op is like the cache_invalidate_user op in struct iommu_domain_ops, but wider, supporting device cache (e.g. PCI ATC invaldiations). Link: https://patch.msgid.link/r/90138505850fa6b165135e78a87b4cc7022869a4.1730836308.git.nicolinc@nvidia.com Reviewed-by: Jason Gunthorpe <jgg@nvidia.com> Reviewed-by: Kevin Tian <kevin.tian@intel.com> Signed-off-by: Nicolin Chen <nicolinc@nvidia.com> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
Diffstat (limited to '')
-rw-r--r--include/linux/iommufd.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/include/linux/iommufd.h b/include/linux/iommufd.h
index 71fa1e343023..2bc735ff9511 100644
--- a/include/linux/iommufd.h
+++ b/include/linux/iommufd.h
@@ -16,6 +16,7 @@ struct device;
struct file;
struct iommu_group;
struct iommu_user_data;
+struct iommu_user_data_array;
struct iommufd_access;
struct iommufd_ctx;
struct iommufd_device;
@@ -105,12 +106,21 @@ struct iommufd_viommu {
* must be defined in include/uapi/linux/iommufd.h.
* It must fully initialize the new iommu_domain before
* returning. Upon failure, ERR_PTR must be returned.
+ * @cache_invalidate: Flush hardware cache used by a vIOMMU. It can be used for
+ * any IOMMU hardware specific cache: TLB and device cache.
+ * The @array passes in the cache invalidation requests, in
+ * form of a driver data structure. A driver must update the
+ * array->entry_num to report the number of handled requests.
+ * The data structure of the array entry must be defined in
+ * include/uapi/linux/iommufd.h
*/
struct iommufd_viommu_ops {
void (*destroy)(struct iommufd_viommu *viommu);
struct iommu_domain *(*alloc_domain_nested)(
struct iommufd_viommu *viommu, u32 flags,
const struct iommu_user_data *user_data);
+ int (*cache_invalidate)(struct iommufd_viommu *viommu,
+ struct iommu_user_data_array *array);
};
#if IS_ENABLED(CONFIG_IOMMUFD)