Thread (15 messages) 15 messages, 2 authors, 2020-10-22

Re: [PATCH 3/4] vdpa: get_iova_range() is mandatory for device specific DMA translation

From: "Michael S. Tsirkin" <mst@redhat.com>
Date: 2020-08-05 17:21:53
Also in: lkml

On Wed, Jun 17, 2020 at 11:29:46AM +0800, Jason Wang wrote:
In order to let userspace work correctly, get_iova_range() is a must
for the device that has its own DMA translation logic.
I guess you mean for a device.

However in absence of ths op, I don't see what is wrong with just
assuming device can access any address.
quoted hunk ↗ jump to hunk
Signed-off-by: Jason Wang <jasowang@redhat.com>
---
 drivers/vdpa/vdpa.c | 4 ++++
 1 file changed, 4 insertions(+)
diff --git a/drivers/vdpa/vdpa.c b/drivers/vdpa/vdpa.c
index de211ef3738c..ab7af978ef70 100644
--- a/drivers/vdpa/vdpa.c
+++ b/drivers/vdpa/vdpa.c
@@ -82,6 +82,10 @@ struct vdpa_device *__vdpa_alloc_device(struct device *parent,
 	if (!!config->dma_map != !!config->dma_unmap)
 		goto err;
 
+	if ((config->dma_map || config->set_map) &&
+	    !config->get_iova_range)
+		goto err;
+
 	err = -ENOMEM;
 	vdev = kzalloc(size, GFP_KERNEL);
 	if (!vdev)
What about devices using an IOMMU for translation?
IOMMUs generally have a limited IOVA range too, right?


-- 
2.20.1
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help