Skip to content

Commit 67db79d

Browse files
nicolincjgunthorpe
authored andcommitted
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 <[email protected]> Reviewed-by: Kevin Tian <[email protected]> Signed-off-by: Nicolin Chen <[email protected]> Signed-off-by: Jason Gunthorpe <[email protected]>
1 parent 5778c75 commit 67db79d

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

include/linux/iommufd.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ struct device;
1616
struct file;
1717
struct iommu_group;
1818
struct iommu_user_data;
19+
struct iommu_user_data_array;
1920
struct iommufd_access;
2021
struct iommufd_ctx;
2122
struct iommufd_device;
@@ -105,12 +106,21 @@ struct iommufd_viommu {
105106
* must be defined in include/uapi/linux/iommufd.h.
106107
* It must fully initialize the new iommu_domain before
107108
* returning. Upon failure, ERR_PTR must be returned.
109+
* @cache_invalidate: Flush hardware cache used by a vIOMMU. It can be used for
110+
* any IOMMU hardware specific cache: TLB and device cache.
111+
* The @array passes in the cache invalidation requests, in
112+
* form of a driver data structure. A driver must update the
113+
* array->entry_num to report the number of handled requests.
114+
* The data structure of the array entry must be defined in
115+
* include/uapi/linux/iommufd.h
108116
*/
109117
struct iommufd_viommu_ops {
110118
void (*destroy)(struct iommufd_viommu *viommu);
111119
struct iommu_domain *(*alloc_domain_nested)(
112120
struct iommufd_viommu *viommu, u32 flags,
113121
const struct iommu_user_data *user_data);
122+
int (*cache_invalidate)(struct iommufd_viommu *viommu,
123+
struct iommu_user_data_array *array);
114124
};
115125

116126
#if IS_ENABLED(CONFIG_IOMMUFD)

0 commit comments

Comments
 (0)