aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/memory-barriers.txt67
1 files changed, 40 insertions, 27 deletions
diff --git a/Documentation/memory-barriers.txt b/Documentation/memory-barriers.txt
index 1660dde75e14..f70ebcdfe592 100644
--- a/Documentation/memory-barriers.txt
+++ b/Documentation/memory-barriers.txt
@@ -2523,27 +2523,37 @@ guarantees:
2523 ioremap()), the ordering guarantees are as follows: 2523 ioremap()), the ordering guarantees are as follows:
2524 2524
2525 1. All readX() and writeX() accesses to the same peripheral are ordered 2525 1. All readX() and writeX() accesses to the same peripheral are ordered
2526 with respect to each other. This ensures that MMIO register writes by 2526 with respect to each other. This ensures that MMIO register accesses
2527 the CPU to a particular device will arrive in program order. 2527 by the same CPU thread to a particular device will arrive in program
2528 2528 order.
2529 2. A writeX() by the CPU to the peripheral will first wait for the 2529
2530 completion of all prior CPU writes to memory. This ensures that 2530 2. A writeX() issued by a CPU thread holding a spinlock is ordered
2531 writes by the CPU to an outbound DMA buffer allocated by 2531 before a writeX() to the same peripheral from another CPU thread
2532 dma_alloc_coherent() will be visible to a DMA engine when the CPU 2532 issued after a later acquisition of the same spinlock. This ensures
2533 writes to its MMIO control register to trigger the transfer. 2533 that MMIO register writes to a particular device issued while holding
2534 2534 a spinlock will arrive in an order consistent with acquisitions of
2535 3. A readX() by the CPU from the peripheral will complete before any 2535 the lock.
2536 subsequent CPU reads from memory can begin. This ensures that reads 2536
2537 by the CPU from an incoming DMA buffer allocated by 2537 3. A writeX() by a CPU thread to the peripheral will first wait for the
2538 dma_alloc_coherent() will not see stale data after reading from the 2538 completion of all prior writes to memory either issued by, or
2539 DMA engine's MMIO status register to establish that the DMA transfer 2539 propagated to, the same thread. This ensures that writes by the CPU
2540 has completed. 2540 to an outbound DMA buffer allocated by dma_alloc_coherent() will be
2541 2541 visible to a DMA engine when the CPU writes to its MMIO control
2542 4. A readX() by the CPU from the peripheral will complete before any 2542 register to trigger the transfer.
2543 subsequent delay() loop can begin execution. This ensures that two 2543
2544 MMIO register writes by the CPU to a peripheral will arrive at least 2544 4. A readX() by a CPU thread from the peripheral will complete before
2545 1us apart if the first write is immediately read back with readX() 2545 any subsequent reads from memory by the same thread can begin. This
2546 and udelay(1) is called prior to the second writeX(): 2546 ensures that reads by the CPU from an incoming DMA buffer allocated
2547 by dma_alloc_coherent() will not see stale data after reading from
2548 the DMA engine's MMIO status register to establish that the DMA
2549 transfer has completed.
2550
2551 5. A readX() by a CPU thread from the peripheral will complete before
2552 any subsequent delay() loop can begin execution on the same thread.
2553 This ensures that two MMIO register writes by the CPU to a peripheral
2554 will arrive at least 1us apart if the first write is immediately read
2555 back with readX() and udelay(1) is called prior to the second
2556 writeX():
2547 2557
2548 writel(42, DEVICE_REGISTER_0); // Arrives at the device... 2558 writel(42, DEVICE_REGISTER_0); // Arrives at the device...
2549 readl(DEVICE_REGISTER_0); 2559 readl(DEVICE_REGISTER_0);
@@ -2559,10 +2569,11 @@ guarantees:
2559 2569
2560 These are similar to readX() and writeX(), but provide weaker memory 2570 These are similar to readX() and writeX(), but provide weaker memory
2561 ordering guarantees. Specifically, they do not guarantee ordering with 2571 ordering guarantees. Specifically, they do not guarantee ordering with
2562 respect to normal memory accesses or delay() loops (i.e. bullets 2-4 2572 respect to locking, normal memory accesses or delay() loops (i.e.
2563 above) but they are still guaranteed to be ordered with respect to other 2573 bullets 2-5 above) but they are still guaranteed to be ordered with
2564 accesses to the same peripheral when operating on __iomem pointers 2574 respect to other accesses from the same CPU thread to the same
2565 mapped with the default I/O attributes. 2575 peripheral when operating on __iomem pointers mapped with the default
2576 I/O attributes.
2566 2577
2567 (*) readsX(), writesX(): 2578 (*) readsX(), writesX():
2568 2579
@@ -2600,8 +2611,10 @@ guarantees:
2600 These will perform appropriately for the type of access they're actually 2611 These will perform appropriately for the type of access they're actually
2601 doing, be it inX()/outX() or readX()/writeX(). 2612 doing, be it inX()/outX() or readX()/writeX().
2602 2613
2603All of these accessors assume that the underlying peripheral is little-endian, 2614With the exception of the string accessors (insX(), outsX(), readsX() and
2604and will therefore perform byte-swapping operations on big-endian architectures. 2615writesX()), all of the above assume that the underlying peripheral is
2616little-endian and will therefore perform byte-swapping operations on big-endian
2617architectures.
2605 2618
2606 2619
2607======================================== 2620========================================