alistair23-linux/drivers/mmc/host
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
..
android-goldfish.c Replace <asm/uaccess.h> with <linux/uaccess.h> globally 2016-12-24 11:46:01 -08:00
atmel-mci.c mmc: atmel-mci: Remove redundant runtime PM calls 2016-05-02 10:33:20 +02:00
au1xmmc.c mmc: host: drop owner assignment from platform_drivers 2014-10-20 16:20:56 +02:00
bfin_sdh.c mmc: bfin_sdh: remove the MMC_DATA_STREAM flag 2016-02-29 11:02:59 +01:00
cb710-mmc.c mmc: cb710: Move away from using deprecated APIs 2013-10-30 20:26:37 -04:00
cb710-mmc.h mmc: cb710: use to_platform_device() 2016-01-05 18:04:57 +01:00
davinci_mmc.c mmc: host: Include interrupt.h in mmc host drivers that depends on it 2017-02-13 13:20:01 +01:00
dw_mmc-exynos.c mmc: dw_mmc: Remove the public dw_mmc header file 2017-02-13 13:19:59 +01:00
dw_mmc-exynos.h mmc: dw_mmc: exynos: Support eMMC's HS400 mode 2015-03-23 14:13:28 +01:00
dw_mmc-k3.c mmc: dw_mmc: Remove the public dw_mmc header file 2017-02-13 13:19:59 +01:00
dw_mmc-pci.c mmc: dw_mmc: Remove the public dw_mmc header file 2017-02-13 13:19:59 +01:00
dw_mmc-pltfm.c mmc: dw_mmc: Remove the public dw_mmc header file 2017-02-13 13:19:59 +01:00
dw_mmc-pltfm.h
dw_mmc-rockchip.c mmc: dw_mmc: Remove the public dw_mmc header file 2017-02-13 13:19:59 +01:00
dw_mmc-zx.c mmc: dw_mmc: zx: Initial support for ZX mmc controller 2017-02-13 13:20:03 +01:00
dw_mmc-zx.h mmc: dw_mmc: zx: Initial support for ZX mmc controller 2017-02-13 13:20:03 +01:00
dw_mmc.c mmc: dw_mmc: Add fifo watermark alignment property 2017-02-13 13:20:02 +01:00
dw_mmc.h mmc: dw_mmc: Add fifo watermark alignment property 2017-02-13 13:20:02 +01:00
jz4740_mmc.c mmc: delete is_first_req parameter from pre-request callback 2016-11-29 09:05:27 +01:00
Kconfig mmc: dw_mmc: zx: Initial support for ZX mmc controller 2017-02-13 13:20:03 +01:00
Makefile mmc: dw_mmc: zx: Initial support for ZX mmc controller 2017-02-13 13:20:03 +01:00
meson-gx-mmc.c mmc: meson: cleanup stray debug messages 2017-02-13 13:20:40 +01:00
mmc_spi.c mmc: mmc_spi: Add Card Detect comments and fix CD GPIO case 2016-03-16 12:36:09 +01:00
mmci.c mmc: core/mmci: restore pre/post_req behaviour 2017-02-13 13:20:52 +01:00
mmci.h mmc: core/mmci: restore pre/post_req behaviour 2017-02-13 13:20:52 +01:00
mmci_qcom_dml.c mmc: mmci: Add qcom dml support to the driver. 2014-09-09 13:58:46 +02:00
mmci_qcom_dml.h mmc: mmci: Add qcom dml support to the driver. 2014-09-09 13:58:46 +02:00
moxart-mmc.c mmc: moxart: fix wait_for_completion_interruptible_timeout return variable type 2016-09-26 21:31:07 +02:00
mtk-sd.c mmc: mediatek: correct the implementation of msdc_card_busy 2017-02-13 13:20:05 +01:00
mvsdio.c mmc: mvsdio: delete platform data code path 2015-12-22 11:32:12 +01:00
mvsdio.h
mxcmmc.c mmc: host: use the defined function to check whether card is removable 2016-07-25 10:34:21 +02:00
mxs-mmc.c mmc: mxs-mmc: Implement CMD23 support 2017-02-13 13:20:27 +01:00
of_mmc_spi.c mmc: of_mmc_spi: fix unused warning 2016-03-17 14:54:40 +01:00
omap.c mmc: omap: Don't use mmc_card_present() when validating for inserted card 2017-02-13 13:20:23 +01:00
omap_hsmmc.c mmc: delete is_first_req parameter from pre-request callback 2016-11-29 09:05:27 +01:00
pxamci.c mmc: pxamci: fix potential oops 2016-07-18 11:50:40 +02:00
pxamci.h
rtsx_pci_sdmmc.c mmc: use empty initializer list to zero-clear structures 2017-02-13 13:19:54 +01:00
rtsx_usb_sdmmc.c mmc: use empty initializer list to zero-clear structures 2017-02-13 13:19:54 +01:00
s3cmci.c mmc: s3cmci: include linux/interrupt.h for tasklet_struct 2017-02-13 13:20:19 +01:00
s3cmci.h mmc: s3cmci: Register cpufreq notifier only on S3C24xx 2016-07-25 10:34:46 +02:00
sdhci-acpi.c mmc: sdhci-acpi: support deferred probe 2017-02-13 13:20:26 +01:00
sdhci-bcm-kona.c mmc: sdhci-bcm-kona: fix error return code in sdhci_bcm_kona_probe() 2016-09-26 21:31:08 +02:00
sdhci-brcmstb.c mmc: sdhci-brcmstb: Fix incorrect capability 2016-09-26 21:31:28 +02:00
sdhci-cadence.c mmc: sdhci-cadence: Include mmc.h 2017-02-13 13:19:59 +01:00
sdhci-cns3xxx.c mmc: sdhci-pltfm: Drop define for SDHCI_PLTFM_PMOPS 2016-07-29 11:29:04 +02:00
sdhci-dove.c mmc: sdhci-pltfm: Drop define for SDHCI_PLTFM_PMOPS 2016-07-29 11:29:04 +02:00
sdhci-esdhc-imx.c mmc: sdhci-esdhc-imx: Correct two register accesses 2016-10-13 08:58:03 +02:00
sdhci-esdhc.h mmc: sdhci-of-esdhc: avoid clock glitch when frequency is changing 2017-02-13 13:20:15 +01:00
sdhci-iproc.c mmc: sdhci-iproc: Increase max_blk_size for bcm2835 2017-02-13 13:19:55 +01:00
sdhci-msm.c mmc: sdhci-msm: Remove unnecessary comments of CDC init sequence 2017-02-13 13:20:46 +01:00
sdhci-of-arasan.c mmc: sdhci-of-arasan: add sdhci_arasan_voltage_switch for arasan, 5.1 2016-10-10 14:01:33 +02:00
sdhci-of-at91.c mmc: sdhci-of-at91: Fix module autoload 2016-11-29 09:00:29 +01:00
sdhci-of-esdhc.c mmc: sdhci-of-esdhc: avoid clock glitch when frequency is changing 2017-02-13 13:20:15 +01:00
sdhci-of-hlwd.c mmc: sdhci-pltfm: Drop define for SDHCI_PLTFM_PMOPS 2016-07-29 11:29:04 +02:00
sdhci-pci-core.c mmc: sdhci-pci: Add support for HS200 tuning mode on AMD, eMMC-4.5.1 2017-02-13 13:20:14 +01:00
sdhci-pci-data.c mmc: sdhci-pci: Add support for drive strength selection for SPT 2015-06-01 09:07:14 +02:00
sdhci-pci-o2micro.c mmc: sdhci-pci: Make sdhci_pci_o2_fujin2_pci_init() static 2015-10-26 16:00:05 +01:00
sdhci-pci-o2micro.h mmc: sdhci-pci: Make sdhci_pci_o2_fujin2_pci_init() static 2015-10-26 16:00:05 +01:00
sdhci-pci.h mmc: sdhci-pci: Remove unused member cd_con_id 2017-02-13 13:20:06 +01:00
sdhci-pic32.c mmc: sdhci-pic32: remove owner assignment 2016-05-02 10:33:25 +02:00
sdhci-pltfm.c mmc: sdhci: Remove ->platform_init() callback as it's no longer used 2016-09-26 21:31:16 +02:00
sdhci-pltfm.h mmc: sdhci: remove unneeded (void *) casts in sdhci_(pltfm_)priv() 2016-11-29 09:01:00 +01:00
sdhci-pxav2.c mmc: sdhci-pltfm: Drop define for SDHCI_PLTFM_PMOPS 2016-07-29 11:29:04 +02:00
sdhci-pxav3.c mmc: sdhci: Rename sdhci_set_power() to sdhci_set_power_noreg() 2016-10-10 14:20:41 +02:00
sdhci-s3c.c mmc: sdhci-s3c: use the bitops API for bit operation 2017-02-13 13:20:36 +01:00
sdhci-sirf.c mmc: sdhci-sirf: Remove non needed #ifdef CONFIG_PM* for dev_pm_ops 2016-07-27 11:25:23 +02:00
sdhci-spear.c Update Viresh Kumar's email address 2015-07-17 16:39:53 -07:00
sdhci-st.c mmc: sdhci-st: Handle interconnect clock 2016-09-12 10:31:43 +02:00
sdhci-tegra.c mmc: tegra: Mark 64-bit DMA broken on Tegra124 2016-09-26 21:31:23 +02:00
sdhci.c mmc: sdhci: Clear SDHCI_HS400_TUNING flag after platform_execute_tuning 2017-02-13 13:20:30 +01:00
sdhci.h mmc: host: Include interrupt.h in mmc host drivers that depends on it 2017-02-13 13:20:01 +01:00
sdhci_f_sdh30.c mmc: sdhci-pltfm: Drop define for SDHCI_PLTFM_PMOPS 2016-07-29 11:29:04 +02:00
sdricoh_cs.c mmc: sdricoh_cs: Less checks in sdricoh_init_mmc() after, error detection 2016-02-29 11:02:45 +01:00
sh_mmcif.c mmc: sh_mmcif: Remove unused clk_ctrl2_present from the platform data 2017-02-13 13:19:58 +01:00
sh_mobile_sdhi.c mmc: sh_mobile_sdhi: add support for 2 clocks 2017-02-13 13:20:41 +01:00
sunxi-mmc.c mmc: sunxi: Add more debug informations 2017-02-13 13:20:52 +01:00
tifm_sd.c mmc: Convert pr_warning to pr_warn 2014-09-24 10:13:09 +02:00
tmio_mmc.c mmc: TMIO: Use devm_request_irq() 2015-06-01 09:06:48 +02:00
tmio_mmc.h mmc: tmio: discard obsolete SDIO irqs before enabling irqs 2017-02-13 13:20:35 +01:00
tmio_mmc_dma.c mmc: tmio: merge distributed include files 2016-05-02 10:33:40 +02:00
tmio_mmc_pio.c mmc: tmio: discard obsolete SDIO irqs before enabling irqs 2017-02-13 13:20:35 +01:00
toshsd.c PM / Runtime: Move ignore_children flag under CONFIG_PM 2016-04-22 01:32:37 +02:00
toshsd.h mmc: add Toshiba PCI SD controller driver 2014-11-26 14:30:58 +01:00
usdhi6rol0.c mmc: usdhi6rol0: add pinctrl to set pin drive strength 2016-05-02 10:36:06 +02:00
ushc.c mmc: ushc: Fix incorrect parameter in sizeof 2014-02-25 15:42:20 -05:00
via-sdmmc.c mmc: host: Include interrupt.h in mmc host drivers that depends on it 2017-02-13 13:20:01 +01:00
vub300.c mmc: vub300: Don't use mmc_card_present() when validating for inserted card 2017-02-13 13:20:23 +01:00
wbsd.c mmc: wbsd: safer check if dma_addr is valid DMA address 2017-02-13 13:20:26 +01:00
wbsd.h
wmt-sdmmc.c mmc: host: Include interrupt.h in mmc host drivers that depends on it 2017-02-13 13:20:01 +01:00