This is a note to let you know that I've just added the patch titled mmc: block: Update ext_csd.cache_ctrl if it was written to the 5.12-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: mmc-block-update-ext_csd.cache_ctrl-if-it-was-written.patch and it can be found in the queue-5.12 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From aea0440ad023ab0662299326f941214b0d7480bd Mon Sep 17 00:00:00 2001 From: Avri Altman <avri.altman@xxxxxxx> Date: Tue, 20 Apr 2021 16:46:41 +0300 Subject: mmc: block: Update ext_csd.cache_ctrl if it was written From: Avri Altman <avri.altman@xxxxxxx> commit aea0440ad023ab0662299326f941214b0d7480bd upstream. The cache function can be turned ON and OFF by writing to the CACHE_CTRL byte (EXT_CSD byte [33]). However, card->ext_csd.cache_ctrl is only set on init if cache size > 0. Fix that by explicitly setting ext_csd.cache_ctrl on ext-csd write. Signed-off-by: Avri Altman <avri.altman@xxxxxxx> Acked-by: Adrian Hunter <adrian.hunter@xxxxxxxxx> Cc: stable@xxxxxxxxxxxxxxx Link: https://lore.kernel.org/r/20210420134641.57343-3-avri.altman@xxxxxxx Signed-off-by: Ulf Hansson <ulf.hansson@xxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- drivers/mmc/core/block.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) --- a/drivers/mmc/core/block.c +++ b/drivers/mmc/core/block.c @@ -573,6 +573,18 @@ static int __mmc_blk_ioctl_cmd(struct mm } /* + * Make sure to update CACHE_CTRL in case it was changed. The cache + * will get turned back on if the card is re-initialized, e.g. + * suspend/resume or hw reset in recovery. + */ + if ((MMC_EXTRACT_INDEX_FROM_ARG(cmd.arg) == EXT_CSD_CACHE_CTRL) && + (cmd.opcode == MMC_SWITCH)) { + u8 value = MMC_EXTRACT_VALUE_FROM_ARG(cmd.arg) & 1; + + card->ext_csd.cache_ctrl = value; + } + + /* * According to the SD specs, some commands require a delay after * issuing the command. */ Patches currently in stable-queue which might be from avri.altman@xxxxxxx are queue-5.12/mmc-block-issue-a-cache-flush-only-when-it-s-enabled.patch queue-5.12/mmc-block-update-ext_csd.cache_ctrl-if-it-was-written.patch