linux_dsm_epyc7002/drivers/mmc/core
Linus Walleij e13934bdf4 mmc: core/mmci: restore pre/post_req behaviour
commit 64b12a68a9
"mmc: core: fix prepared requests while doing bkops"
is fixing a bug in the wrong way. A bug in the MMCI
device driver is fixed by amending the MMC core.

Thinking about it: what the pre- and post-callbacks
are doing is to essentially map and unmap SG lists
for DMA transfers. Why would we not be able to do that
just because a BKOPS command is sent inbetween?
Having to unprepare/prepare the next asynchronous
request for DMA seems wrong.

Looking the backtrace in that commit we can see what
the real problem actually is:

mmci_data_irq() is calling mmci_dma_unmap() twice
which is goung to call arm_dma_unmap_sg() twice
and v7_dma_inv_range() twice for the same sglist
and that will crash.

This happens because a request is prepared, then
a BKOPS is sent. The IRQ completing the BKOPS command
goes through mmci_data_irq() and thinks that a DMA
operation has just been completed because
dma_inprogress() reports true. It then proceeds to
unmap the sglist.

But that was wrong! dma_inprogress() should NOT be
true because no DMA was actually in progress! We had
just prepared the sglist, and the DMA channel
dma_current has been configured, but NOT started!

Because of this, the sglist is already unmapped when
we get our actual data completion IRQ, and we are
unmapping the sglist once more, and we get this crash.

Therefore, we need to revert this solution pushing
the problem to the core and causing problems, and
instead augment the implementation such that
dma_inprogress() only reports true if some DMA has
actually been started.

After this we can keep the request prepared during the
BKOPS and we need not unprepare/reprepare it.

Fixes: 64b12a68a9 ("mmc: core: fix prepared requests while doing bkops")
Cc: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Tested-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2017-02-13 13:20:52 +01:00
..
block.c mmc: block: stop passing around pointless return values 2017-02-13 13:20:40 +01:00
block.h mmc: block: stop passing around pointless return values 2017-02-13 13:20:40 +01:00
bus.c mmc: core: Move public functions from host.h to private headers 2017-02-13 13:20:25 +01:00
bus.h mmc: core: Move public functions from card.h to private headers 2017-02-13 13:20:24 +01:00
card.h mmc: core: Move public functions from card.h to private headers 2017-02-13 13:20:24 +01:00
core.c mmc: core/mmci: restore pre/post_req behaviour 2017-02-13 13:20:52 +01:00
core.h mmc: core: Rename __mmc_set_signal_voltage() to mmc_set_signal_voltage() 2017-02-13 13:20:43 +01:00
debugfs.c mmc: core: Move public functions from host.h to private headers 2017-02-13 13:20:25 +01:00
host.c mmc: core: fix error path in mmc_host_alloc 2017-02-13 13:20:48 +01:00
host.h mmc: core: Move public functions from host.h to private headers 2017-02-13 13:20:25 +01:00
Kconfig mmc: pwrseq: add support for Marvell SD8787 chip 2017-02-13 13:20:33 +01:00
Makefile mmc: pwrseq: add support for Marvell SD8787 chip 2017-02-13 13:20:33 +01:00
mmc_ops.c mmc: use empty initializer list to zero-clear structures 2017-02-13 13:19:54 +01:00
mmc_ops.h mmc: core: Move public functions from core.h to private headers 2017-02-13 13:20:21 +01:00
mmc_test.c mmc: core: Move public functions from host.h to private headers 2017-02-13 13:20:25 +01:00
mmc.c mmc: core: Invent MMC_CAP_3_3V_DDR 2017-02-13 13:20:44 +01:00
pwrseq_emmc.c mmc: pwrseq: convert to proper platform device 2016-05-02 10:33:30 +02:00
pwrseq_sd8787.c mmc: pwrseq: add support for Marvell SD8787 chip 2017-02-13 13:20:33 +01:00
pwrseq_simple.c mmc: pwrseq-simple: Add an optional post-power-on-delay 2016-09-26 21:31:07 +02:00
pwrseq.c mmc: pwrseq: convert to proper platform device 2016-05-02 10:33:30 +02:00
pwrseq.h mmc: core: First step in cleaning up private mmc header files 2017-02-13 13:20:20 +01:00
queue.c mmc: core: Move public functions from card.h to private headers 2017-02-13 13:20:24 +01:00
queue.h mmc: core: First step in cleaning up private mmc header files 2017-02-13 13:20:20 +01:00
quirks.c mmc: core: Move public functions from card.h to private headers 2017-02-13 13:20:24 +01:00
sd_ops.c mmc: use empty initializer list to zero-clear structures 2017-02-13 13:19:54 +01:00
sd_ops.h mmc: core: Move public functions from core.h to private headers 2017-02-13 13:20:21 +01:00
sd.c mmc: core: Clarify usage of mmc_set_signal_voltage() 2017-02-13 13:20:43 +01:00
sd.h mmc: core: First step in cleaning up private mmc header files 2017-02-13 13:20:20 +01:00
sdio_bus.c mmc: core: Move public functions from card.h to private headers 2017-02-13 13:20:24 +01:00
sdio_bus.h mmc: core: First step in cleaning up private mmc header files 2017-02-13 13:20:20 +01:00
sdio_cis.c mmc: core: remove BUG_ONs from sdio 2016-12-05 10:31:08 +01:00
sdio_cis.h mmc: core: First step in cleaning up private mmc header files 2017-02-13 13:20:20 +01:00
sdio_io.c mmc: core: Move public functions from card.h to private headers 2017-02-13 13:20:24 +01:00
sdio_irq.c mmc: core: Move public functions from card.h to private headers 2017-02-13 13:20:24 +01:00
sdio_ops.c mmc: use empty initializer list to zero-clear structures 2017-02-13 13:19:54 +01:00
sdio_ops.h mmc: core: Move public functions from core.h to private headers 2017-02-13 13:20:21 +01:00
sdio_uart.c mmc: block: Move files to core 2016-12-12 16:30:05 +01:00
sdio.c mmc: core: Clarify usage of mmc_set_signal_voltage() 2017-02-13 13:20:43 +01:00
slot-gpio.c mmc: slot-gpio: Don't override con_id when request descriptor 2017-02-13 13:20:06 +01:00
slot-gpio.h mmc: core: First step in cleaning up private mmc header files 2017-02-13 13:20:20 +01:00