Re: [PATCH v2 01/22] iommufd/viommu: Add driver-allocated vDEVICE support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 4/26/25 13:57, Nicolin Chen wrote:
@@ -120,6 +128,13 @@ struct iommufd_viommu {
   *                    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
+ * @vdevice_alloc: Allocate a vDEVICE object and init its driver-level structure
+ *                 or HW procedure. Note that the core-level structure is filled
+ *                 by the iommufd core after calling this op. @virt_id carries a
+ *                 per-vIOMMU virtual ID for the driver to initialize its HW.

I'm wondering whether the 'per-vIOMMU virtual ID' is intended to be
generic for other features that might require a vdevice. I'm also not
sure where this virtual ID originates when I read it here. Could it
potentially come from the KVM instance? If so, how about retrieving it
directly from a struct kvm pointer? My understanding is that vIOMMU in
IOMMUFD acts as a handle to KVM, so perhaps we should maintain a
reference to the kvm pointer within the iommufd_viommu structure?

+ * @vdevice_destroy: Clean up all driver-specific parts of an iommufd_vdevice.
+ *                   The memory of the vDEVICE will be free-ed by iommufd core
+ *                   after calling this op
   */
  struct iommufd_viommu_ops {
  	void (*destroy)(struct iommufd_viommu *viommu);
@@ -128,6 +143,10 @@ struct iommufd_viommu_ops {
  		const struct iommu_user_data *user_data);
  	int (*cache_invalidate)(struct iommufd_viommu *viommu,
  				struct iommu_user_data_array *array);
+	struct iommufd_vdevice *(*vdevice_alloc)(struct iommufd_viommu *viommu,
+						 struct device *dev,
+						 u64 virt_id);
+	void (*vdevice_destroy)(struct iommufd_vdevice *vdev);
  };

Thanks,
baolu




[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux