Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge branch 'for-next/kcsan' into for-next/core

* for-next/kcsan:
arm64: kcsan: Support detecting more missing memory barriers
asm-generic: Add memory barrier dma_mb()

+20 -11
+6 -5
Documentation/memory-barriers.txt
··· 1894 1894 1895 1895 (*) dma_wmb(); 1896 1896 (*) dma_rmb(); 1897 + (*) dma_mb(); 1897 1898 1898 1899 These are for use with consistent memory to guarantee the ordering 1899 1900 of writes or reads of shared memory accessible to both the CPU and a ··· 1926 1925 The dma_rmb() allows us guarantee the device has released ownership 1927 1926 before we read the data from the descriptor, and the dma_wmb() allows 1928 1927 us to guarantee the data is written to the descriptor before the device 1929 - can see it now has ownership. Note that, when using writel(), a prior 1930 - wmb() is not needed to guarantee that the cache coherent memory writes 1931 - have completed before writing to the MMIO region. The cheaper 1932 - writel_relaxed() does not provide this guarantee and must not be used 1933 - here. 1928 + can see it now has ownership. The dma_mb() implies both a dma_rmb() and 1929 + a dma_wmb(). Note that, when using writel(), a prior wmb() is not needed 1930 + to guarantee that the cache coherent memory writes have completed before 1931 + writing to the MMIO region. The cheaper writel_relaxed() does not provide 1932 + this guarantee and must not be used here. 1934 1933 1935 1934 See the subsection "Kernel I/O barrier effects" for more information on 1936 1935 relaxed I/O accessors and the Documentation/core-api/dma-api.rst file for
+6 -6
arch/arm64/include/asm/barrier.h
··· 50 50 #define pmr_sync() do {} while (0) 51 51 #endif 52 52 53 - #define mb() dsb(sy) 54 - #define rmb() dsb(ld) 55 - #define wmb() dsb(st) 53 + #define __mb() dsb(sy) 54 + #define __rmb() dsb(ld) 55 + #define __wmb() dsb(st) 56 56 57 - #define dma_mb() dmb(osh) 58 - #define dma_rmb() dmb(oshld) 59 - #define dma_wmb() dmb(oshst) 57 + #define __dma_mb() dmb(osh) 58 + #define __dma_rmb() dmb(oshld) 59 + #define __dma_wmb() dmb(oshst) 60 60 61 61 #define io_stop_wc() dgh() 62 62
+8
include/asm-generic/barrier.h
··· 38 38 #define wmb() do { kcsan_wmb(); __wmb(); } while (0) 39 39 #endif 40 40 41 + #ifdef __dma_mb 42 + #define dma_mb() do { kcsan_mb(); __dma_mb(); } while (0) 43 + #endif 44 + 41 45 #ifdef __dma_rmb 42 46 #define dma_rmb() do { kcsan_rmb(); __dma_rmb(); } while (0) 43 47 #endif ··· 67 63 68 64 #ifndef wmb 69 65 #define wmb() mb() 66 + #endif 67 + 68 + #ifndef dma_mb 69 + #define dma_mb() mb() 70 70 #endif 71 71 72 72 #ifndef dma_rmb