Flush cache for memory allocated by kmalloc

Arun KS getarunks at gmail.com
Fri Feb 7 00:47:39 EST 2014


Hi Silverstri,


On Fri, Feb 7, 2014 at 12:54 AM, m silverstri <
michael.j.silverstri at gmail.com> wrote:

> Hi,
>
> I allocate memory in my driver and I passed this address to my HW
> register to write to.  My question is when the HW done writing (my
> driver get notified by an interrupt). How can I flush the cache so
> that my driver can see what has been written by the HW?
>
There are some basic problems in your design.

If you are using external agents like DMA( or any other HW capable of
writing to DDR), do  not cache Memory.
Because if you do, your processor will cache the memory and will not see
the updates done by external agents.
If you want to maintain coherency, allocate memory using
dma_allocate_coherent.

Thanks,
Arun


> Thank you.
>
> _______________________________________________
> Kernelnewbies mailing list
> Kernelnewbies at kernelnewbies.org
> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20140207/277174df/attachment.html 


More information about the Kernelnewbies mailing list