Re: [PATCH v2 02/40] iommu/sva: Bind process address spaces to devices

From
Jean-Philippe Brucker <hidden>
Date
2018-09-06 11:10:02
Also in
kvm, linux-acpi, linux-arm-kernel, linux-iommu, linux-mm, linux-pci
Reply to
Auger Eric, 2018-09-05
On 05/09/2018 12:29, Auger Eric wrote:
quoted
+/**
+ * iommu_sva_bind_device() - Bind a process address space to a device
+ * @dev: the device
+ * @mm: the mm to bind, caller must hold a reference to it
+ * @pasid: valid address where the PASID will be stored
+ * @flags: bond properties
+ * @drvdata: private data passed to the mm exit handler
+ *
+ * Create a bond between device and task, allowing the device to access the mm
+ * using the returned PASID. If unbind() isn't called first, a subsequent bind()
+ * for the same device and mm fails with -EEXIST.
+ *
+ * iommu_sva_device_init() must be called first, to initialize the required SVA
+ * features. @flags is a subset of these features.
@flags must be a subset of these features?
Ok
don't you want to check flags is a subset of
dev->iommu_param->sva_param->features?
Yes, that will be in next version
quoted
+/**
+ * iommu_sva_unbind_device() - Remove a bond created with iommu_sva_bind_device
+ * @dev: the device
+ * @pasid: the pasid returned by bind()
+ *
+ * Remove bond between device and address space identified by @pasid. Users
+ * should not call unbind() if the corresponding mm exited (as the PASID might
+ * have been reallocated for another process).
+ *
+ * The device must not be issuing any more transaction for this PASID. All
+ * outstanding page requests for this PASID must have been flushed to the IOMMU.
+ *
+ * Returns 0 on success, or an error value
+ */
+int iommu_sva_unbind_device(struct device *dev, int pasid)
returned value needed?
I'd rather keep this one, since it already pointed out some of my bugs
during regression testing.

Thanks,
Jean
Thread (121 messages) 121 messages, 13 authors, last reply 2018-09-13
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help