linux/include/xen
Christoph Hellwig 566fb90e05 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>
2022-05-11 19:48:32 +02:00
..
arm swiotlb-xen: fix DMA_ATTR_NO_KERNEL_MAPPING on arm 2022-05-11 19:48:32 +02:00
interface xen: branch for v5.17-rc1 2022-01-12 16:42:00 -08:00
acpi.h xen: Remove support for PV ACPI cpu/memory hotplug 2021-04-23 09:31:50 +02:00
balloon.h xen/balloon: Bring alloc(free)_xenballooned_pages helpers back 2022-01-06 09:53:35 +01:00
events.h xen/console: harden hvc_xen against event channel storms 2021-12-16 08:24:08 +01:00
features.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
grant_table.h xen/grant-table: remove readonly parameter from functions 2022-03-15 20:34:40 -05:00
hvc-console.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
hvm.h xen: Move xen_setup_callback_vector() definition to include/xen/hvm.h 2020-06-11 15:15:19 +02:00
mem-reservation.h xen/balloon: add runtime control for scrubbing ballooned out pages 2018-09-14 08:51:10 -04:00
page.h swiotlb-xen: remove XEN_PFN_PHYS 2020-08-04 07:50:43 +02:00
pci.h xen-pciback: allow compiling on other archs than x86 2021-11-02 08:03:43 -05:00
platform_pci.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
swiotlb-xen.h swiotlb-xen: fix DMA_ATTR_NO_KERNEL_MAPPING on arm 2022-05-11 19:48:32 +02:00
xen-front-pgdir-shbuf.h xen: Introduce shared buffer helpers for page directory... 2018-12-18 12:15:55 -05:00
xen-ops.h swiotlb-xen: fix DMA_ATTR_NO_KERNEL_MAPPING on arm 2022-05-11 19:48:32 +02:00
xen.h xen/unpopulated-alloc: Add mechanism to use Xen resource 2022-01-06 09:53:38 +01:00
xenbus.h xen: add "not_essential" flag to struct xenbus_driver 2021-11-23 13:41:29 -06:00
xenbus_dev.h xen: xenbus_dev.h: delete incorrect file name 2022-02-03 08:16:32 +01:00