summaryrefslogtreecommitdiff
path: root/drivers/xen/grant-dma-ops.c
diff options
context:
space:
mode:
authorJuergen Gross <jgross@suse.com>2022-08-29 14:26:08 +0300
committerJuergen Gross <jgross@suse.com>2022-10-10 15:31:26 +0300
commit61367688f1fb07678b1d865a0ce9364f5267a896 (patch)
treec6c251cc4779b477a2153e5d12b6f73f9aaab102 /drivers/xen/grant-dma-ops.c
parent7228113d1fa0107a377aef71094d610eb8824aa2 (diff)
downloadlinux-61367688f1fb07678b1d865a0ce9364f5267a896.tar.xz
xen/virtio: enable grant based virtio on x86
Use an x86-specific virtio_check_mem_acc_cb() for Xen in order to setup the correct DMA ops. Signed-off-by: Juergen Gross <jgross@suse.com> Reviewed-by: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com> # common code Reviewed-by: Boris Ostrovsky <boris.ostrovsky@oracle.com> Signed-off-by: Juergen Gross <jgross@suse.com>
Diffstat (limited to 'drivers/xen/grant-dma-ops.c')
-rw-r--r--drivers/xen/grant-dma-ops.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/drivers/xen/grant-dma-ops.c b/drivers/xen/grant-dma-ops.c
index 3e4c590896d0..860f37c93af4 100644
--- a/drivers/xen/grant-dma-ops.c
+++ b/drivers/xen/grant-dma-ops.c
@@ -313,7 +313,7 @@ bool xen_is_grant_dma_device(struct device *dev)
bool xen_virtio_mem_acc(struct virtio_device *dev)
{
- if (IS_ENABLED(CONFIG_XEN_VIRTIO_FORCE_GRANT))
+ if (IS_ENABLED(CONFIG_XEN_VIRTIO_FORCE_GRANT) || xen_pv_domain())
return true;
return xen_is_grant_dma_device(dev->dev.parent);
@@ -387,6 +387,16 @@ err:
dev_err(dev, "Cannot set up Xen grant DMA ops, retain platform DMA ops\n");
}
+bool xen_virtio_restricted_mem_acc(struct virtio_device *dev)
+{
+ bool ret = xen_virtio_mem_acc(dev);
+
+ if (ret)
+ xen_grant_setup_dma_ops(dev->dev.parent);
+
+ return ret;
+}
+
MODULE_DESCRIPTION("Xen grant DMA-mapping layer");
MODULE_AUTHOR("Juergen Gross <jgross@suse.com>");
MODULE_LICENSE("GPL");