linux-stable/drivers/mmc/core
Michael Wu 75cae557bc mmc: core: Fixup support for writeback-cache for eMMC and SD
commit 08ebf903af upstream.

During the card initialization process, the mmc core checks whether the
eMMC/SD card supports an internal writeback-cache and then enables it
inside the card.

Unfortunately, this isn't according to what the mmc core reports to the
upper block layer. Instead, the writeback-cache support with REQ_FLUSH and
REQ_FUA, are being enabled depending on whether the host supports the CMD23
(MMC_CAP_CMD23) and whether an eMMC supports the reliable-write command.

This is wrong and it may also sound awkward. In fact, it's a remnant
from when both eMMC/SD cards didn't have dedicated commands/support to
control the internal writeback-cache. In other words, it was the best we
could do at that point in time.

To fix the problem, but also without breaking backwards compatibility,
let's align the REQ_FLUSH support with whether the writeback-cache became
successfully enabled - for both eMMC and SD cards.

Cc: stable@kernel.org
Fixes: 881d1c25f7 ("mmc: core: Add cache control for eMMC4.5 device")
Fixes: 130206a615 ("mmc: core: Add support for cache ctrl for SD cards")
Depends-on: 97fce126e2 ("mmc: block: Issue a cache flush only when it's enabled")
Reviewed-by: Avri Altman <Avri.Altman@wdc.com>
Signed-off-by: Michael Wu <michael@allwinnertech.com>
Link: https://lore.kernel.org/r/20220331073223.106415-1-michael@allwinnertech.com
[Ulf: Re-wrote the commit message]
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-04-13 20:59:21 +02:00
..
block.c mmc: core: Fixup support for writeback-cache for eMMC and SD 2022-04-13 20:59:21 +02:00
block.h
bus.c bus: Make remove callback return void 2021-07-21 11:53:42 +02:00
bus.h
card.h
core.c mmc: core: Disable card detect during shutdown 2021-12-29 12:28:56 +01:00
core.h mmc: core: Disable card detect during shutdown 2021-12-29 12:28:56 +01:00
crypto.c mmc: core: Store pointer to bio_crypt_ctx in mmc_request 2021-08-24 10:15:32 +02:00
crypto.h mmc: core: Add basic support for inline encryption 2021-02-01 12:02:33 +01:00
debugfs.c mmc: debugfs: add description for module parameter 2021-06-14 13:57:43 +02:00
host.c mmc: host: Return an error when ->enable_sdio_irq() ops is missing 2022-04-08 14:24:02 +02:00
host.h mmc: host: factor out clearing the retune state 2021-08-24 10:15:28 +02:00
Kconfig mmc: pwrseq: add wilc1000_sdio dependency for pwrseq_sd8787 2021-08-24 16:59:38 +02:00
Makefile mmc: core: Add basic support for inline encryption 2021-02-01 12:02:33 +01:00
mmc.c mmc: block: Support alternative_gpt_sector() operation 2021-08-24 10:09:06 -06:00
mmc_ops.c mmc: core: Issue HPI in case the BKOPS timed out 2021-08-24 16:59:39 +02:00
mmc_ops.h mmc: core: Avoid hogging the CPU while polling for busy in the I/O err path 2021-08-24 10:15:31 +02:00
mmc_test.c mmc: mmc_test: use erase_arg for mmc_erase command 2021-02-12 12:07:03 +01:00
pwrseq.c
pwrseq.h
pwrseq_emmc.c
pwrseq_sd8787.c mmc: pwrseq: sd8787: fix compilation warning 2021-08-25 11:11:16 +02:00
pwrseq_simple.c
queue.c mmc: queue: Remove unused parameters(request_queue) 2021-08-25 11:14:42 +02:00
queue.h mmc: switch to blk_mq_alloc_disk 2021-06-30 15:34:04 -06:00
quirks.h
regulator.c
sd.c mmc: core: Wait for command setting 'Power Off Notification' bit to complete 2022-02-16 12:56:04 +01:00
sd.h mmc: core: remove unused host parameter of mmc_sd_get_csd() 2021-02-01 11:54:48 +01:00
sd_ops.c mmc: core: Drop open coding in mmc_sd_switch() 2021-06-14 13:57:36 +02:00
sd_ops.h
sdio.c mmc: core: Fixup storing of OCR for MMC_QUIRK_NONSTD_SDIO 2022-01-27 11:04:42 +01:00
sdio_bus.c bus: Make remove callback return void 2021-07-21 11:53:42 +02:00
sdio_bus.h
sdio_cis.c mmc: sdio: Print contents of unknown CIS tuples 2021-08-24 10:15:33 +02:00
sdio_cis.h
sdio_io.c
sdio_irq.c
sdio_ops.c
sdio_ops.h
sdio_uart.c tty: drop put_tty_driver 2021-07-27 12:17:21 +02:00
slot-gpio.c
slot-gpio.h