platform_kernel-5.15/arch/arm
Alexander Duyck 1077fa36f2 arch: Add lightweight memory barriers dma_rmb() and dma_wmb()
There are a number of situations where the mandatory barriers rmb() and
wmb() are used to order memory/memory operations in the device drivers
and those barriers are much heavier than they actually need to be.  For
example in the case of PowerPC wmb() calls the heavy-weight sync
instruction when for coherent memory operations all that is really needed
is an lsync or eieio instruction.

This commit adds a coherent only version of the mandatory memory barriers
rmb() and wmb().  In most cases this should result in the barrier being the
same as the SMP barriers for the SMP case, however in some cases we use a
barrier that is somewhere in between rmb() and smp_rmb().  For example on
ARM the rmb barriers break down as follows:

  Barrier   Call     Explanation
  --------- -------- ----------------------------------
  rmb()     dsb()    Data synchronization barrier - system
  dma_rmb() dmb(osh) data memory barrier - outer sharable
  smp_rmb() dmb(ish) data memory barrier - inner sharable

These new barriers are not as safe as the standard rmb() and wmb().
Specifically they do not guarantee ordering between coherent and incoherent
memories.  The primary use case for these would be to enforce ordering of
reads and writes when accessing coherent memory that is shared between the
CPU and a device.

It may also be noted that there is no dma_mb().  Most architectures don't
provide a good mechanism for performing a coherent only full barrier without
resorting to the same mechanism used in mb().  As such there isn't much to
be gained in trying to define such a function.

Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
Cc: Michael Ellerman <michael@ellerman.id.au>
Cc: Michael Neuling <mikey@neuling.org>
Cc: Russell King <linux@arm.linux.org.uk>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Tony Luck <tony.luck@intel.com>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: David Miller <davem@davemloft.net>
Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Acked-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Alexander Duyck <alexander.h.duyck@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2014-12-11 21:15:06 -05:00
..
boot media updates for v3.19-rc1 2014-12-11 11:49:23 -08:00
common ARM: SoC driver updates for 3.19 2014-12-09 14:48:22 -08:00
configs Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next 2014-12-11 14:27:06 -08:00
crypto
firmware
include arch: Add lightweight memory barriers dma_rmb() and dma_wmb() 2014-12-11 21:15:06 -05:00
kernel Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next 2014-12-11 14:27:06 -08:00
kvm arm/arm64: kvm: drop inappropriate use of kvm_is_mmio_pfn() 2014-11-26 14:40:45 +01:00
lib
mach-asm9260 ARM: add mach-asm9260 2014-11-28 15:06:38 +01:00
mach-at91 ARM: SoC cleanups for 3.19 2014-12-09 14:18:35 -08:00
mach-axxia
mach-bcm Merge branch 'irq-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2014-12-10 08:38:57 -08:00
mach-berlin ARM: berlin: do not select RESET_CONTROLLER 2014-11-18 20:27:53 +01:00
mach-clps711x
mach-cns3xxx
mach-davinci media updates for v3.19-rc1 2014-12-11 11:49:23 -08:00
mach-dove
mach-ebsa110
mach-efm32
mach-ep93xx arm: ep93xx: add dma_masks for the M2P and M2M DMA controllers 2014-11-28 12:34:08 +01:00
mach-exynos ARM: SoC platform changes for 3.19 2014-12-09 14:38:28 -08:00
mach-footbridge
mach-gemini
mach-highbank
mach-hisi
mach-imx ACPI and power management updates for 3.19-rc1 2014-12-10 21:17:00 -08:00
mach-integrator soc: move SoC driver for the ARM Integrator 2014-11-13 10:32:05 +01:00
mach-iop13xx PCI/MSI: Rename mask/unmask_msi_irq treewide 2014-11-23 13:01:45 +01:00
mach-iop32x
mach-iop33x
mach-ixp4xx
mach-keystone
mach-ks8695
mach-lpc32xx
mach-mediatek ARM: SoC DT updates for 3.19 2014-12-09 14:57:37 -08:00
mach-meson ARM: meson: enable L2 cache 2014-11-18 16:35:01 +01:00
mach-mmp
mach-moxart
mach-msm
mach-mv78xx0
mach-mvebu ARM: mvebu: use the cpufreq-dt platform_data for independent clocks 2014-12-04 17:31:32 +01:00
mach-mxs
mach-netx
mach-nomadik
mach-nspire
mach-omap1
mach-omap2 media updates for v3.19-rc1 2014-12-11 11:49:23 -08:00
mach-orion5x
mach-picoxcell
mach-prima2
mach-pxa sound updates for 3.19-rc1 2014-12-11 13:20:50 -08:00
mach-qcom
mach-realview
mach-rockchip
mach-rpc
mach-s3c24xx
mach-s3c64xx cpuidle: Invert CPUIDLE_FLAG_TIME_VALID logic 2014-11-12 21:17:27 +01:00
mach-s5pv210
mach-sa1100 asm-generic: asm/io.h rewrite 2014-12-09 17:25:00 -08:00
mach-shmobile media updates for v3.19-rc1 2014-12-11 11:49:23 -08:00
mach-socfpga socfpga: hotplug: put cpu1 in wfi 2014-11-20 17:00:32 +01:00
mach-spear
mach-sti
mach-sunxi ARM: sunxi: make sun6i SMP ops static 2014-11-16 11:02:33 +01:00
mach-tegra ACPI and power management updates for 3.19-rc1 2014-12-10 21:17:00 -08:00
mach-u300
mach-ux500
mach-versatile
mach-vexpress ARM: vexpress: Enable regulator framework when MMCI is in use 2014-11-28 21:57:07 +01:00
mach-vt8500
mach-w90x900
mach-zynq ARM: zynq: Remove secondary_startup() declaration from header 2014-12-01 09:32:22 +01:00
mm ARM: SoC platform changes for 3.19 2014-12-09 14:38:28 -08:00
net
nwfpe
oprofile
plat-iop
plat-omap
plat-orion ACPI and power management updates for 3.19-rc1 2014-12-10 21:17:00 -08:00
plat-pxa
plat-samsung ARM: SoC platform changes for 3.19 2014-12-09 14:38:28 -08:00
plat-versatile ARM: vexpress: Remove non-DT code 2014-11-28 16:08:16 +01:00
tools
vfp
xen
Kconfig ARM: SoC driver updates for 3.19 2014-12-09 14:48:22 -08:00
Kconfig-nommu
Kconfig.debug ARM: SoC platform changes for 3.19 2014-12-09 14:38:28 -08:00
Makefile