linux-stable/arch/arm
Laurent Pinchart a93a121a96 ARM: dma-mapping: Don't tear down third-party mappings
arch_setup_dma_ops() is used in device probe code paths to create an
IOMMU mapping and attach it to the device. The function assumes that the
device is attached to a device-specific IOMMU instance (or at least a
device-specific TLB in a shared IOMMU instance) and thus creates a
separate mapping for every device.

On several systems (Renesas R-Car Gen2 being one of them), that
assumption is not true, and IOMMU mappings must be shared between
multiple devices. In those cases the IOMMU driver knows better than the
generic ARM dma-mapping layer and attaches mapping to devices manually
with arm_iommu_attach_device(), which sets the DMA ops for the device.

The arch_setup_dma_ops() function takes this into account and bails out
immediately if the device already has DMA ops assigned. However, the
corresponding arch_teardown_dma_ops() function, called from driver
unbind code paths (including probe deferral), will tear the mapping down
regardless of who created it. When the device is reprobed
arch_setup_dma_ops() will be called again but won't perform any
operation as the DMA ops will still be set.

We need to reset the DMA ops in arch_teardown_dma_ops() to fix this.
However, we can't do so unconditionally, as then a new mapping would be
created by arch_setup_dma_ops() when the device is reprobed, regardless
of whether the device needs to share a mapping or not. We must thus keep
track of whether arch_setup_dma_ops() created the mapping, and only in
that case tear it down in arch_teardown_dma_ops().

Keep track of that information in the dev_archdata structure. As the
structure is embedded in all instances of struct device let's not grow
it, but turn the existing dma_coherent bool field into a bitfield that
can be used for other purposes.

Fixes: 09515ef5dd ("of/acpi: Configure dma operations at probe time for platform/amba/pci bus devices")
Reviewed-by: Robin Murphy <robin.murphy@arm.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Joerg Roedel <jroedel@suse.de>
2017-05-30 11:31:33 +02:00
..
boot Fixes for omaps for v4.12-rc cycle most consisting of few minor dts fixes 2017-05-19 00:02:16 -07:00
common ARM/clk: move the ICST library to drivers/clk 2017-04-07 11:58:12 +02:00
configs ARM: configs: add a gemini defconfig 2017-05-18 23:56:47 -07:00
crypto crypto: arm/aes-neonbs - resolve fallback cipher at runtime 2017-03-09 18:34:16 +08:00
firmware
include ARM: dma-mapping: Don't tear down third-party mappings 2017-05-30 11:31:33 +02:00
kernel arm64 2nd set of updates for 4.12: 2017-05-11 11:27:54 -07:00
kvm KVM: arm: rename pm_fake handler to trap_raz_wi 2017-05-15 14:29:27 +02:00
lib new helper: uaccess_kernel() 2017-03-28 16:43:25 -04:00
mach-alpine ARM: 8641/1: treewide: Replace uses of virt_to_phys with __pa_symbol 2017-02-28 11:06:10 +00:00
mach-artpec
mach-asm9260
mach-aspeed ARM: aspeed: Select pinctrl drivers 2017-01-10 22:36:06 +11:00
mach-at91 ARM: remove duplicate 'const' annotations' 2017-05-19 10:12:55 +02:00
mach-axxia ARM: 8641/1: treewide: Replace uses of virt_to_phys with __pa_symbol 2017-02-28 11:06:10 +00:00
mach-bcm ARM: remove duplicate 'const' annotations' 2017-05-19 10:12:55 +02:00
mach-berlin ARM: 8646/1: mmu: decouple VECTORS_BASE from Kconfig 2017-02-28 11:06:12 +00:00
mach-clps711x
mach-cns3xxx ARM: remove duplicate 'const' annotations' 2017-05-19 10:12:55 +02:00
mach-davinci ARM: SoC platform updates 2017-05-09 09:49:36 -07:00
mach-digicolor
mach-dove
mach-ebsa110
mach-efm32
mach-ep93xx ARM: ep93xx: Register ts73xx-fpga manager driver for TS-7300 2017-03-17 15:10:48 +09:00
mach-exynos Merge branch 'for-linus' of git://git.armlinux.org.uk/~rmk/linux-arm 2017-02-28 11:50:53 -08:00
mach-footbridge
mach-gemini ARM: gemini: don't select SERIAL_OF_PLATFORM 2017-03-24 22:12:42 +01:00
mach-highbank
mach-hisi ARM: hisi: fix error return code in hip04_smp_init() 2017-03-28 15:30:54 +01:00
mach-imx ARM: SoC driver updates 2017-05-09 10:01:15 -07:00
mach-integrator
mach-iop13xx
mach-iop32x
mach-iop33x
mach-ixp4xx scripts/spelling.txt: add regsiter -> register spelling mistake 2017-05-08 17:15:13 -07:00
mach-keystone ARM: keystone: Drop PM domain support for k2g 2017-04-04 08:59:28 -07:00
mach-ks8695
mach-lpc18xx
mach-lpc32xx
mach-mediatek ARM: 8641/1: treewide: Replace uses of virt_to_phys with __pa_symbol 2017-02-28 11:06:10 +00:00
mach-meson
mach-mmp ARM: mmp: let clk_disable() return immediately if clk is NULL 2017-03-30 17:38:34 +02:00
mach-moxart irqchip/faraday: Replace moxa with ftintc010 2017-04-07 10:36:30 +01:00
mach-mv78xx0 ARM: mv78xx0: fix possible PCI buffer overflow 2017-01-27 17:52:57 +01:00
mach-mvebu Merge branch 'for-linus' of git://git.armlinux.org.uk/~rmk/linux-arm 2017-02-28 11:50:53 -08:00
mach-mxs ARM: mxs: add support for I2SE Duckbill 2 boards 2017-04-10 21:25:50 +08:00
mach-netx
mach-nomadik
mach-nspire
mach-omap1 ARM: OMAP: PM: Drop useless checks for PM_SUSPEND_STANDBY 2017-03-06 10:38:19 -08:00
mach-omap2 ARM: remove duplicate 'const' annotations' 2017-05-19 10:12:55 +02:00
mach-orion5x ARM: orion5x: only call into phylib when available 2017-03-30 17:30:39 +02:00
mach-oxnas ARM: oxnas: remove redundant select CPU_V6K 2017-03-20 10:13:45 +01:00
mach-picoxcell
mach-prima2 ARM: 8641/1: treewide: Replace uses of virt_to_phys with __pa_symbol 2017-02-28 11:06:10 +00:00
mach-pxa ARM: pxa/raumfeld: fix compile error in rotary controller resources 2017-04-18 11:28:38 -07:00
mach-qcom
mach-realview ARM: 8641/1: treewide: Replace uses of virt_to_phys with __pa_symbol 2017-02-28 11:06:10 +00:00
mach-rockchip Merge branch 'for-linus' of git://git.armlinux.org.uk/~rmk/linux-arm 2017-02-28 11:50:53 -08:00
mach-rpc sched/headers: Prepare for new header dependencies before moving code to <linux/sched/mm.h> 2017-03-02 08:42:28 +01:00
mach-s3c24xx Merge branch 'for-linus' of git://git.armlinux.org.uk/~rmk/linux-arm 2017-02-28 11:50:53 -08:00
mach-s3c64xx regulator: arizona-ldo1: Move pdata into a separate structure 2017-04-25 16:36:32 +01:00
mach-s5pv210 Merge branch 'for-linus' of git://git.armlinux.org.uk/~rmk/linux-arm 2017-02-28 11:50:53 -08:00
mach-sa1100 ARM: 8641/1: treewide: Replace uses of virt_to_phys with __pa_symbol 2017-02-28 11:06:10 +00:00
mach-shmobile ARM: 8660/1: shmobile: r7s72100: Enable L2 cache 2017-03-17 10:01:27 +00:00
mach-socfpga ARM: 8641/1: treewide: Replace uses of virt_to_phys with __pa_symbol 2017-02-28 11:06:10 +00:00
mach-spear ARM: remove duplicate 'const' annotations' 2017-05-19 10:12:55 +02:00
mach-sti ARM: 8641/1: treewide: Replace uses of virt_to_phys with __pa_symbol 2017-02-28 11:06:10 +00:00
mach-stm32 ARM: stm32: Add a new SOC - STM32H743 2017-03-24 11:37:24 +01:00
mach-sunxi ARM: sunxi: Select PM_OPP 2017-03-06 07:37:41 +01:00
mach-tango ARM: 8641/1: treewide: Replace uses of virt_to_phys with __pa_symbol 2017-02-28 11:06:10 +00:00
mach-tegra soc/tegra: Move Tegra flowctrl driver 2017-04-04 15:48:04 +02:00
mach-u300
mach-uniphier
mach-ux500 ARM: SoC: late DT updates for v4.11 2017-03-03 16:15:48 -08:00
mach-versatile
mach-vexpress ARM: 8641/1: treewide: Replace uses of virt_to_phys with __pa_symbol 2017-02-28 11:06:10 +00:00
mach-vt8500
mach-w90x900 ARM: w90x900: let clk_disable() return immediately if clk is NULL 2017-03-30 17:37:19 +02:00
mach-zx ARM: 8641/1: treewide: Replace uses of virt_to_phys with __pa_symbol 2017-02-28 11:06:10 +00:00
mach-zynq ARM: 8641/1: treewide: Replace uses of virt_to_phys with __pa_symbol 2017-02-28 11:06:10 +00:00
mm ARM: dma-mapping: Don't tear down third-party mappings 2017-05-30 11:31:33 +02:00
net arm: use set_memory.h header 2017-05-08 17:15:13 -07:00
nwfpe sched/headers: Move task_struct::signal and task_struct::sighand types and accessors into <linux/sched/signal.h> 2017-03-03 01:43:37 +01:00
oprofile
plat-iop
plat-omap
plat-orion ARM: orion5x: only call into phylib when available 2017-03-30 17:30:39 +02:00
plat-pxa
plat-samsung dmaengine: pl330: remove pdata based initialization 2017-03-28 21:37:48 +05:30
plat-versatile ARM: plat-versatile: remove stale clock header 2017-04-07 11:57:57 +02:00
probes arm: kprobes: Align stack to 8-bytes in test code 2017-03-21 16:24:19 +00:00
tools ARM: wire up statx syscall 2017-03-10 10:15:15 +00:00
vdso
vfp sched/headers: Prepare for new header dependencies before moving code to <linux/sched/signal.h> 2017-03-02 08:42:29 +01:00
xen xen: Implement EFI reset_system callback 2017-05-02 12:06:50 +02:00
Kconfig ARM: SoC platform updates 2017-05-09 09:49:36 -07:00
Kconfig-nommu ARM: 8635/1: nommu: allow enabling REMAP_VECTORS_TO_RAM 2017-01-10 23:32:54 +00:00
Kconfig.debug arch: Move CONFIG_DEBUG_RODATA and CONFIG_SET_MODULE_RONX to be common 2017-02-07 12:32:52 -08:00
Makefile arm: Use full path in KBUILD_IMAGE definition 2017-03-20 22:42:20 +09:00