[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <a15812f3a4beb7ae4b9a04538298128bcc42e4f2.1729555967.git.nicolinc@nvidia.com>
Date: Mon, 21 Oct 2024 17:20:13 -0700
From: Nicolin Chen <nicolinc@...dia.com>
To: <jgg@...dia.com>, <kevin.tian@...el.com>, <will@...nel.org>
CC: <joro@...tes.org>, <suravee.suthikulpanit@....com>,
<robin.murphy@....com>, <dwmw2@...radead.org>, <baolu.lu@...ux.intel.com>,
<shuah@...nel.org>, <linux-kernel@...r.kernel.org>, <iommu@...ts.linux.dev>,
<linux-arm-kernel@...ts.infradead.org>, <linux-kselftest@...r.kernel.org>,
<eric.auger@...hat.com>, <jean-philippe@...aro.org>, <mdf@...nel.org>,
<mshavit@...gle.com>, <shameerali.kolothum.thodi@...wei.com>,
<smostafa@...gle.com>, <yi.l.liu@...el.com>, <aik@....com>,
<zhangfei.gao@...aro.org>, <patches@...ts.linux.dev>
Subject: [PATCH v4 04/14] 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).
Reviewed-by: Jason Gunthorpe <jgg@...dia.com>
Signed-off-by: Nicolin Chen <nicolinc@...dia.com>
---
include/linux/iommufd.h | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/include/linux/iommufd.h b/include/linux/iommufd.h
index 821816e3b1fd..559f274a26ea 100644
--- a/include/linux/iommufd.h
+++ b/include/linux/iommufd.h
@@ -15,6 +15,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;
@@ -121,6 +122,13 @@ struct iommufd_vdevice {
* @vdevice_free: Free a driver-managed iommufd_vdevice to de-init its structure
* or HW procedure. The memory of the vdevice will be free-ed by
* iommufd core.
+ * @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 (*free)(struct iommufd_viommu *viommu);
@@ -130,6 +138,8 @@ struct iommufd_viommu_ops {
struct iommufd_vdevice *(*vdevice_alloc)(struct iommufd_viommu *viommu,
struct device *dev, u64 id);
void (*vdevice_free)(struct iommufd_vdevice *vdev);
+ int (*cache_invalidate)(struct iommufd_viommu *viommu,
+ struct iommu_user_data_array *array);
};
#if IS_ENABLED(CONFIG_IOMMUFD)
--
2.43.0
Powered by blists - more mailing lists