]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/commit
mmc: block: Issue a cache flush only when it's enabled
authorAvri Altman <avri.altman@wdc.com>
Sun, 25 Apr 2021 06:02:06 +0000 (09:02 +0300)
committerStefan Bader <stefan.bader@canonical.com>
Wed, 19 May 2021 08:59:33 +0000 (10:59 +0200)
commitb74ea5e3cc137a05084f4bff9b83dbe70ea1e0b2
tree1b10d5fec2980553a14dde5b64a197d905c06f33
parenta8117e9d7e60eb089595885b49c148cd1f434c75
mmc: block: Issue a cache flush only when it's enabled

BugLink: https://bugs.launchpad.net/bugs/1928825
commit 97fce126e279690105ee15be652b465fd96f9997 upstream.

In command queueing mode, the cache isn't flushed via the mmc_flush_cache()
function, but instead by issuing a CMDQ_TASK_MGMT (CMD48) with a
FLUSH_CACHE opcode. In this path, we need to check if cache has been
enabled, before deciding to flush the cache, along the lines of what's
being done in mmc_flush_cache().

To fix this problem, let's add a new bus ops callback ->cache_enabled() and
implement it for the mmc bus type. In this way, the mmc block device driver
can call it to know whether cache flushing should be done.

Fixes: 1e8e55b67030 (mmc: block: Add CQE support)
Cc: stable@vger.kernel.org
Reported-by: Brendan Peter <bpeter@lytx.com>
Signed-off-by: Avri Altman <avri.altman@wdc.com>
Tested-by: Brendan Peter <bpeter@lytx.com>
Acked-by: Adrian Hunter <adrian.hunter@intel.com>
Link: https://lore.kernel.org/r/20210425060207.2591-2-avri.altman@wdc.com
Link: https://lore.kernel.org/r/20210425060207.2591-3-avri.altman@wdc.com
[Ulf: Squashed the two patches and made some minor updates]
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
drivers/mmc/core/block.c
drivers/mmc/core/core.h
drivers/mmc/core/mmc.c
drivers/mmc/core/mmc_ops.c