summaryrefslogtreecommitdiffstats
path: root/include/xen/xen-ops.h
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2022-04-22 06:37:57 +0200
committerChristoph Hellwig <hch@lst.de>2022-05-11 19:48:32 +0200
commit566fb90e050dfa2132340bbdab9533b727dda6f1 (patch)
tree04e47ee8436c65cf9a85cfa8a84e866a93ec2f12 /include/xen/xen-ops.h
parent3cb4503a330159dc5cf2f8382181ccbabbbaa5b2 (diff)
downloadlinux-566fb90e050dfa2132340bbdab9533b727dda6f1.tar.bz2
swiotlb-xen: fix DMA_ATTR_NO_KERNEL_MAPPING on arm
swiotlb-xen uses very different ways to allocate coherent memory on x86 vs arm. On the former it allocates memory from the page allocator, while on the later it reuses the dma-direct allocator the handles the complexities of non-coherent DMA on arm platforms. Unfortunately the complexities of trying to deal with the two cases in the swiotlb-xen.c code lead to a bug in the handling of DMA_ATTR_NO_KERNEL_MAPPING on arm. With the DMA_ATTR_NO_KERNEL_MAPPING flag the coherent memory allocator does not actually allocate coherent memory, but just a DMA handle for some memory that is DMA addressable by the device, but which does not have to have a kernel mapping. Thus dereferencing the return value will lead to kernel crashed and memory corruption. Fix this by using the dma-direct allocator directly for arm, which works perfectly fine because on arm swiotlb-xen is only used when the domain is 1:1 mapped, and then simplifying the remaining code to only cater for the x86 case with DMA coherent device. Reported-by: Rahul Singh <Rahul.Singh@arm.com> Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Rahul Singh <rahul.singh@arm.com> Reviewed-by: Stefano Stabellini <sstabellini@kernel.org> Tested-by: Rahul Singh <rahul.singh@arm.com>
Diffstat (limited to 'include/xen/xen-ops.h')
-rw-r--r--include/xen/xen-ops.h7
1 files changed, 0 insertions, 7 deletions
diff --git a/include/xen/xen-ops.h b/include/xen/xen-ops.h
index a3584a357f35..c7c1b46ff4cd 100644
--- a/include/xen/xen-ops.h
+++ b/include/xen/xen-ops.h
@@ -42,13 +42,6 @@ int xen_setup_shutdown_event(void);
extern unsigned long *xen_contiguous_bitmap;
-#if defined(CONFIG_XEN_PV) || defined(CONFIG_ARM) || defined(CONFIG_ARM64)
-int xen_create_contiguous_region(phys_addr_t pstart, unsigned int order,
- unsigned int address_bits,
- dma_addr_t *dma_handle);
-void xen_destroy_contiguous_region(phys_addr_t pstart, unsigned int order);
-#endif
-
#if defined(CONFIG_XEN_PV)
int xen_remap_pfn(struct vm_area_struct *vma, unsigned long addr,
xen_pfn_t *pfn, int nr, int *err_ptr, pgprot_t prot,