mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-12-05 18:14:07 +08:00
fea981610c
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>
19 lines
406 B
C
19 lines
406 B
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
#ifndef _ASM_ARM_XEN_OPS_H
|
|
#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_is_grant_dma_device(dev))
|
|
xen_grant_setup_dma_ops(dev);
|
|
else if (xen_swiotlb_detect())
|
|
dev->dma_ops = &xen_swiotlb_dma_ops;
|
|
#endif
|
|
}
|
|
|
|
#endif /* _ASM_ARM_XEN_OPS_H */
|