title: How to "invalidate" or "flush" a range of CPU cache in PowerPC architecture?
body: <p>I am working with an embedded device which communicates with my <code>PowerPC</code> CPU via PCIe. Due to the SDK constraints i have to use linux kernel version <code>4.1.8</code>. This version doesn't have functions related to <code>cache</code> operations in <code>$KERNEL_SOURCE/arch/powerpc/include/asm/</code>, such as:  </p>
  
  <ul>
  <li><code>"invalidate_dcache_range()"</code>  </li>
  <li><code>"flush_dcache_range()"</code>  </li>
  <li><code>"clean_dcache_range()"</code>  </li>
  </ul>
  
  <p>(in this directory <code>"cacheflush.h"</code> header just contains declaration of mentioned functions.)<br>
  Also, my embedded device's SDK needs to call these functions to prepare <code>DMA</code> access.<br>
  Note that Kernel versions higher than <code>4.5</code> provide declaration of these functions.</p>
  
  <p>Now i have some questions:  </p>
  
  <ol>
  <li>I can use and copy functions which are implemented in newer kernels, in my old kernel and rebuild it, but modifying the kernel source doesn't make sense, right?</li>
  <li>Can you suggest some workaround to resolve it?</li>
  <li>How can i test that cache invalidated or flushed correctly? is there any way to read cache blocks in userspace?</li>
  </ol>
  
  <p>Thanks,</p>