提交 d86d4370 编写于 作者: A Alexey Korolev 提交者: Linus Torvalds

[PATCH] cfi_cmdset_0001: fix range for cache invalidation

I found an issue in cfi_cmdset0001.c.  It is related to cache region
invalidation in the buffered write procedure.

The code performs cache invalidation from "cmd_addr" to "cmd_adr + len" in
do_write_buffer() while we modify region from "adr" to "adr+len".

This issue affects writes + reads of data by small chunks.
Signed-off-by: NNicolas Pitre <nico@cam.org>
Acked-by: NThomas Gleixner <tglx@linutronix.de>
Signed-off-by: NAndrew Morton <akpm@osdl.org>
Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
上级 7d4c8e56
...@@ -1019,8 +1019,8 @@ static void __xipram xip_udelay(struct map_info *map, struct flchip *chip, ...@@ -1019,8 +1019,8 @@ static void __xipram xip_udelay(struct map_info *map, struct flchip *chip,
#define XIP_INVAL_CACHED_RANGE(map, from, size) \ #define XIP_INVAL_CACHED_RANGE(map, from, size) \
INVALIDATE_CACHED_RANGE(map, from, size) INVALIDATE_CACHED_RANGE(map, from, size)
#define INVALIDATE_CACHE_UDELAY(map, chip, adr, len, usec) \ #define INVALIDATE_CACHE_UDELAY(map, chip, cmd_adr, adr, len, usec) \
UDELAY(map, chip, adr, usec) UDELAY(map, chip, cmd_adr, usec)
/* /*
* Extra notes: * Extra notes:
...@@ -1052,7 +1052,7 @@ do { \ ...@@ -1052,7 +1052,7 @@ do { \
spin_lock(chip->mutex); \ spin_lock(chip->mutex); \
} while (0) } while (0)
#define INVALIDATE_CACHE_UDELAY(map, chip, adr, len, usec) \ #define INVALIDATE_CACHE_UDELAY(map, chip, cmd_adr, adr, len, usec) \
do { \ do { \
spin_unlock(chip->mutex); \ spin_unlock(chip->mutex); \
INVALIDATE_CACHED_RANGE(map, adr, len); \ INVALIDATE_CACHED_RANGE(map, adr, len); \
...@@ -1284,7 +1284,7 @@ static int __xipram do_write_oneword(struct map_info *map, struct flchip *chip, ...@@ -1284,7 +1284,7 @@ static int __xipram do_write_oneword(struct map_info *map, struct flchip *chip,
map_write(map, datum, adr); map_write(map, datum, adr);
chip->state = mode; chip->state = mode;
INVALIDATE_CACHE_UDELAY(map, chip, INVALIDATE_CACHE_UDELAY(map, chip, adr,
adr, map_bankwidth(map), adr, map_bankwidth(map),
chip->word_write_time); chip->word_write_time);
...@@ -1572,8 +1572,8 @@ static int __xipram do_write_buffer(struct map_info *map, struct flchip *chip, ...@@ -1572,8 +1572,8 @@ static int __xipram do_write_buffer(struct map_info *map, struct flchip *chip,
map_write(map, CMD(0xd0), cmd_adr); map_write(map, CMD(0xd0), cmd_adr);
chip->state = FL_WRITING; chip->state = FL_WRITING;
INVALIDATE_CACHE_UDELAY(map, chip, INVALIDATE_CACHE_UDELAY(map, chip, cmd_adr,
cmd_adr, len, adr, len,
chip->buffer_write_time); chip->buffer_write_time);
timeo = jiffies + (HZ/2); timeo = jiffies + (HZ/2);
...@@ -1744,7 +1744,7 @@ static int __xipram do_erase_oneblock(struct map_info *map, struct flchip *chip, ...@@ -1744,7 +1744,7 @@ static int __xipram do_erase_oneblock(struct map_info *map, struct flchip *chip,
chip->state = FL_ERASING; chip->state = FL_ERASING;
chip->erase_suspended = 0; chip->erase_suspended = 0;
INVALIDATE_CACHE_UDELAY(map, chip, INVALIDATE_CACHE_UDELAY(map, chip, adr,
adr, len, adr, len,
chip->erase_time*1000/2); chip->erase_time*1000/2);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册