android_kernel_xiaomi_sm8350/drivers/mmc/host
David Brownell e385ea63f4 mmc: at91_mci: don't use coherent dma buffers
At91_mci is abusing dma_free_coherent(), which may not be called with IRQs
disabled.  I saw "mkfs.ext3" on an MMC card objecting voluminously as each
write completed:

 WARNING: at arch/arm/mm/consistent.c:368 dma_free_coherent+0x2c/0x224()
 [<c002726c>] (dump_stack+0x0/0x14) from [<c00387d4>] (warn_on_slowpath+0x4c/0x68)
 [<c0038788>] (warn_on_slowpath+0x0/0x68) from [<c0028768>] (dma_free_coherent+0x2c/0x224)
  r6:00008008 r5:ffc06000 r4:00000000
 [<c002873c>] (dma_free_coherent+0x0/0x224) from [<c01918ac>] (at91_mci_irq+0x374/0x420)
 [<c0191538>] (at91_mci_irq+0x0/0x420) from [<c0065d9c>] (handle_IRQ_event+0x2c/0x6c)
 ...

This bug has been around for a LONG time.  The MM warning is from late
2005, but the driver merged a year later ...  so I'm puzzled why nobody
noticed this before now.

The fix involves noting that this buffer shouldn't be DMA-coherent; it's
just used for normal DMA writes.  So replace it with standard kmalloc()
buffering and DMA mapping calls.

This is the quickie fix.  A better one would not rely on allocating large
bounce buffers.  (Note that dma_alloc_coherent could have failed too, but
that case was ignored...  kmalloc is a bit more likely to fail though.)

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Acked-by: Pierre Ossman <drzeus-mmc@drzeus.cx>
Cc: Andrew Victor <linux@maxim.org.za>
Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Cc: Russell King <rmk@arm.linux.org.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-09-02 19:21:38 -07:00
..
at91_mci.c mmc: at91_mci: don't use coherent dma buffers 2008-09-02 19:21:38 -07:00
atmel-mci-regs.h atmel-mci: debugfs support 2008-07-27 01:26:17 +02:00
atmel-mci.c avr32: Use <mach/foo.h> instead of <asm/arch/foo.h> 2008-08-05 14:36:57 +02:00
au1xmmc.c au1xmmc: raise segment size limit. 2008-08-01 19:04:26 +02:00
imxmmc.c [ARM] Move include/asm-arm/arch-* to arch/arm/*/include/mach 2008-08-07 09:55:48 +01:00
imxmmc.h
Kconfig mfd: have TMIO drivers and subdevices depend on ARM 2008-08-10 23:30:34 +02:00
Makefile mfd: TMIO MMC driver 2008-08-10 23:30:16 +02:00
mmc_spi.c mmc_spi: put signals to low power off fix 2008-07-24 01:27:07 +02:00
mmci.c mmc: remove multiwrite capability 2008-07-15 14:14:49 +02:00
mmci.h
omap.c [ARM] Move include/asm-arm/arch-* to arch/arm/*/include/mach 2008-08-07 09:55:48 +01:00
pxamci.c [ARM] Move include/asm-arm/arch-* to arch/arm/*/include/mach 2008-08-07 09:55:48 +01:00
pxamci.h
ricoh_mmc.c mmc: extend ricoh_mmc to support Ricoh RL5c476 2008-02-08 09:02:47 +01:00
s3cmci.c s3cmci: attach get_cd host ops 2008-08-17 20:00:22 +02:00
s3cmci.h MMC: S3C24XX: Add platform data for MMC/SD driver 2008-07-15 14:14:47 +02:00
sdhci-pci.c sdhci: handle bug in JMB38x for sizes < 4 bytes 2008-08-01 19:03:35 +02:00
sdhci.c sdhci: check correct return value 2008-08-01 19:03:36 +02:00
sdhci.h sdhci: handle bug in JMB38x for sizes < 4 bytes 2008-08-01 19:03:35 +02:00
sdricoh_cs.c sdricoh_cs: removed unused #include <version.h> 2008-08-17 20:01:35 +02:00
tifm_sd.c mmc: remove multiwrite capability 2008-07-15 14:14:49 +02:00
tmio_mmc.c mfd: TMIO MMC driver 2008-08-10 23:30:16 +02:00
tmio_mmc.h mfd: TMIO MMC driver 2008-08-10 23:30:16 +02:00
wbsd.c mmc: remove multiwrite capability 2008-07-15 14:14:49 +02:00
wbsd.h