Skip to content

Commit fea9816

Browse files
Oleksandr Tyshchenkojgross1
authored andcommitted
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>
1 parent 625ab90 commit fea9816

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

include/xen/arm/xen-ops.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,14 @@
33
#define _ASM_ARM_XEN_OPS_H
44

55
#include <xen/swiotlb-xen.h>
6+
#include <xen/xen-ops.h>
67

78
static inline void xen_setup_dma_ops(struct device *dev)
89
{
910
#ifdef CONFIG_XEN
10-
if (xen_swiotlb_detect())
11+
if (xen_is_grant_dma_device(dev))
12+
xen_grant_setup_dma_ops(dev);
13+
else if (xen_swiotlb_detect())
1114
dev->dma_ops = &xen_swiotlb_dma_ops;
1215
#endif
1316
}

0 commit comments

Comments
 (0)