Re: [MTD/NAND] Blackfin NFC driver DMA bug ?

Bryan Wu
2008-02-25T11:15:22Z

On Fri, Feb 22, 2008 at 4:54 PM, Ivan Djelic <ivan.djelic@parrot.com> wrote:
> On Fri, Feb 22, 2008 at 09:45:33AM +0100, Ivan Djelic wrote:
> > > Oh, I am not fully understand your concern. The code is invalidating
> > > or flushing buf before DMA operation.
> > > And invalidate and flush operation is OK for buf which is not
> > > cache-aligned on Blackfin arch. it also should be
> > > OK for other arch.
> >
> > Well, consider the following scenario, in which 'buf' is not cache-aligned:
> >
> > 1) function bf5xx_nand_dma_rw() is called for reading data.
> >
> > 2) dcache is partially invalidated on a range containing 'buf': this range is
> > cache-aligned, of course.
> >
>
> > 3) some variable residing nearby 'buf' (in the same cache line interval) is
> > read (not modified), resulting in a cache line being fetched. Cache line is not
> > dirty.
>
> Also, the variable contents in 3) may also be corrupted because of the
> invalidation in 2).
>

Thanks a lot for the clarification.

If can be fixed in drivers or in MTD API, maybe MTD API is good place
to fix it completely as David mentioned.
I will found some way to fix it in my driver firstly.

Regards,
-Bryan Wu