On 2023/10/11 01:21, Jason Gunthorpe wrote:
On Thu, Sep 21, 2023 at 12:51:23AM -0700, Yi Liu wrote:
From: Lu Baolu <baolu.lu@xxxxxxxxxxxxxxx>
Introduce a new domain type for a user I/O page table, which is nested on
top of another user space address represented by a UNMANAGED
domain. The
Lets start using the world PAGING whenever you want to type
UNMANAGED. I'm trying to get rid of UNMANAGED.
sure.
@@ -241,6 +245,21 @@ struct iommu_user_data {
size_t len;
};
+/**
+ * struct iommu_user_data_array - iommu driver specific user space data array
+ * @uptr: Pointer to the user buffer array for copy_from_user()
+ * @entry_len: The fixed-width length of a entry in the array, in bytes
+ * @entry_num: The number of total entries in the array
+ *
+ * A array having a @entry_num number of @entry_len sized entries, each entry is
+ * user space data, i.e. an uAPI that is defined in include/uapi/linux/iommufd.h
+ */
+struct iommu_user_data_array {
+ void __user *uptr;
+ size_t entry_len;
+ int entry_num;
+};
Ditto about iommu-driver.h for most of this stuff
ack.
+
/**
* iommu_copy_user_data - Copy iommu driver specific user space data
* @dst_data: Pointer to an iommu driver specific user data that is defined in
@@ -263,6 +282,34 @@ static inline int iommu_copy_user_data(void *dst_data,
src_data->uptr, src_data->len);
}
+/**
+ * iommu_copy_user_data_from_array - Copy iommu driver specific user space data
+ * from an iommu_user_data_array input
+ * @dst_data: Pointer to an iommu driver specific user data that is defined in
+ * include/uapi/linux/iommufd.h
+ * @src_data: Pointer to a struct iommu_user_data_array for user space data array
+ * @index: Index to offset the location in the array to copy user data from
+ * @data_len: Length of current user data structure, i.e. sizeof(struct _dst)
+ * @min_len: Initial length of user data structure for backward compatibility.
+ * This should be offsetofend using the last member in the user data
+ * struct that was initially added to include/uapi/linux/iommufd.h
+ */
+static inline int
+iommu_copy_user_data_from_array(void *dst_data,
+ const struct iommu_user_data_array *src_array,
+ int index, size_t data_len, size_t min_len)
Index should be 'unsigned int'
yes.
--
Regards,
Yi Liu