aboutsummaryrefslogtreecommitdiffstats
path: root/include/xen/arm
diff options
context:
space:
mode:
authorOleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>2022-06-02 22:23:53 +0300
committerJuergen Gross <jgross@suse.com>2022-06-06 16:07:30 +0200
commitfea981610c25173e6e5d63ccd4fce49739663ab0 (patch)
tree9a87d7ab61808cf1b5d71243c976faa893502450 /include/xen/arm
parentxen/grant-dma-ops: Retrieve the ID of backend's domain for DT devices (diff)
downloadlinux-dev-fea981610c25173e6e5d63ccd4fce49739663ab0.tar.xz
linux-dev-fea981610c25173e6e5d63ccd4fce49739663ab0.zip
arm/xen: Assign xen-grant DMA ops for xen-grant DMA devices
By assigning xen-grant DMA ops we will restrict memory access for passed device using Xen grant mappings. This is needed for using any virtualized device (e.g. virtio) in Xen guests in a safe manner. Please note, for the virtio devices the XEN_VIRTIO config should be enabled (it forces ARCH_HAS_RESTRICTED_VIRTIO_MEMORY_ACCESS). Signed-off-by: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com> Reviewed-by: Stefano Stabellini <sstabellini@kernel.org> Link: https://lore.kernel.org/r/1654197833-25362-9-git-send-email-olekstysh@gmail.com Signed-off-by: Juergen Gross <jgross@suse.com>
Diffstat (limited to 'include/xen/arm')
-rw-r--r--include/xen/arm/xen-ops.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/include/xen/arm/xen-ops.h b/include/xen/arm/xen-ops.h
index 288deb1c3ac9..b0766a660338 100644
--- a/include/xen/arm/xen-ops.h
+++ b/include/xen/arm/xen-ops.h
@@ -3,11 +3,14 @@
#define _ASM_ARM_XEN_OPS_H
#include <xen/swiotlb-xen.h>
+#include <xen/xen-ops.h>
static inline void xen_setup_dma_ops(struct device *dev)
{
#ifdef CONFIG_XEN
- if (xen_swiotlb_detect())
+ if (xen_is_grant_dma_device(dev))
+ xen_grant_setup_dma_ops(dev);
+ else if (xen_swiotlb_detect())
dev->dma_ops = &xen_swiotlb_dma_ops;
#endif
}