Thread (24 messages) 24 messages, 4 authors, 2023-11-02

Re: [RFC 4/7] vdpa: change the map/unmap process to support iommufd

From: Jason Gunthorpe <jgg@nvidia.com>
Date: 2023-09-25 13:45:17
Also in: lkml

On Sun, Sep 24, 2023 at 01:05:37AM +0800, Cindy Lu wrote:
quoted hunk ↗ jump to hunk
Add the check for iommufd_ictx,If vdpa don't have the iommufd_ictx
then will use the Legacy iommu domain pathway

Signed-off-by: Cindy Lu <redacted>
---
 drivers/vhost/vdpa.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
diff --git a/drivers/vhost/vdpa.c b/drivers/vhost/vdpa.c
index 91da012084e9..8d1ad89d4671 100644
--- a/drivers/vhost/vdpa.c
+++ b/drivers/vhost/vdpa.c
@@ -981,6 +981,10 @@ static int vhost_vdpa_map(struct vhost_vdpa *v, struct vhost_iotlb *iotlb,
 	} else if (ops->set_map) {
 		if (!v->in_batch)
 			r = ops->set_map(vdpa, asid, iotlb);
+	} else if (!vdpa->iommufd_ictx) {
+		/* Legacy iommu domain pathway without IOMMUFD */
+		r = iommu_map(v->domain, iova, pa, size,
+			      perm_to_iommu_flags(perm));
 	} else {
 		r = iommu_map(v->domain, iova, pa, size,
 			      perm_to_iommu_flags(perm));
Um, why is the 2nd else the same as the new one?

Jason
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help