[PATCH][CFI] Wrong cache invalidation bug fix
massimo cirillo
maxcir at gmail.com
Wed Dec 5 10:58:35 EST 2007
OK, I've verified your suggestion and the tests are ok.
Following the overall patch for the cfi_cmdset_0001.c
Signed-off-by Massimo Cirillo <maxcir at gmail.com> and Giuseppe D'Eliseo
<giuseppedeliseo at gmail.com>
Acked-by: Nicolas Pitre <nico at cam.org> and Jörn Engel <joern at logfs.org>
------
diff -aur a/drivers/mtd/chips/cfi_cmdset_0001.c
b/drivers/mtd/chips/cfi_cmdset_0001.c
--- a/drivers/mtd/chips/cfi_cmdset_0001.c 2007-12-05
10:45:20.000000000 +0100
+++ b/drivers/mtd/chips/cfi_cmdset_0001.c 2007-11-16
19:14:27.000000000 +0100
@@ -1486,9 +1486,12 @@
int ret, wbufsize, word_gap, words;
const struct kvec *vec;
unsigned long vec_seek;
+ unsigned long initial_adr;
+ int initial_len=len;
wbufsize = cfi_interleave(cfi) << cfi->cfiq->MaxBufWriteSize;
adr += chip->start;
+ initial_adr = adr;
cmd_adr = adr & ~(wbufsize-1);
/* Let's determine this according to the interleave only once */
@@ -1501,7 +1504,7 @@
return ret;
}
- XIP_INVAL_CACHED_RANGE(map, adr, len);
+ XIP_INVAL_CACHED_RANGE(map, initial_adr, initial_len);
ENABLE_VPP(map);
xip_disable(map, chip, cmd_adr);
@@ -1592,7 +1595,7 @@
chip->state = FL_WRITING;
ret = INVAL_CACHE_AND_WAIT(map, chip, cmd_adr,
- adr, len,
+ initial_adr, initial_len,
chip->buffer_write_time);
if (ret) {
map_write(map, CMD(0x70), cmd_adr);
------
2007/12/3, Nicolas Pitre <nico at cam.org>:
> On Mon, 3 Dec 2007, massimo cirillo wrote:
>
> > Hi,
> >
> > We encountered the problem with cache invalidation in CFI driver. It
> > causes corruptions of data read from flash.
> >
> > The problem is investigated. The original code performs cache
> > invalidation from "adr" to "adr + len" in do_write_buffer(). Since len
> > and adr could be updated in the code before invalidation - it causes
> > improper setting of cache invalidation regions.
> > The following patch fixes this problem. This patch has been verified
> > on our OMAP based platform.
> > Could you please acknowledge and commit this patch?
> >
> > Thanks a lot.
> >
> > Signed-off-by Massimo Cirillo <maxcir at gmail.com> and Giuseppe D'Eliseo
> > <giuseppedeliseo at gmail.com>
>
> This patch is correct. However, to make it more obvious, please change
> the used variable in the XIP_INVAL_CACHED_RANGE() call used in the same
> function as well.
>
> With that change you can add "Acked-by: Nicolas Pitre <nico at cam.org>".
>
>
> Nicolas
>
More information about the linux-mtd
mailing list