]> git.itanic.dy.fi Git - linux-stable/commit
mmc: cqhci: Fix task clearing in CQE error recovery
authorAdrian Hunter <adrian.hunter@intel.com>
Fri, 3 Nov 2023 08:47:20 +0000 (10:47 +0200)
committerUlf Hansson <ulf.hansson@linaro.org>
Tue, 14 Nov 2023 16:15:08 +0000 (17:15 +0100)
commit1de1b77982e1a1df9707cb11f9b1789e6b8919d4
treef602d36cbc85ecd67f655d6bf21c8f21db10f0f5
parent35597bdb04ec27ef3b1cea007dc69f8ff5df75a5
mmc: cqhci: Fix task clearing in CQE error recovery

If a task completion notification (TCN) is received when there is no
outstanding task, the cqhci driver issues a "spurious TCN" warning. This
was observed to happen right after CQE error recovery.

When an error interrupt is received the driver runs recovery logic.
It halts the controller, clears all pending tasks, and then re-enables
it. On some platforms, like Intel Jasper Lake, a stale task completion
event was observed, regardless of the CQHCI_CLEAR_ALL_TASKS bit being set.

This results in either:
a) Spurious TC completion event for an empty slot.
b) Corrupted data being passed up the stack, as a result of premature
   completion for a newly added task.

Rather than add a quirk for affected controllers, ensure tasks are cleared
by toggling CQHCI_ENABLE, which would happen anyway if
cqhci_clear_all_tasks() timed out. This is simpler and should be safe and
effective for all controllers.

Fixes: a4080225f51d ("mmc: cqhci: support for command queue enabled host")
Cc: stable@vger.kernel.org
Reported-by: Kornel Dulęba <korneld@chromium.org>
Tested-by: Kornel Dulęba <korneld@chromium.org>
Co-developed-by: Kornel Dulęba <korneld@chromium.org>
Signed-off-by: Kornel Dulęba <korneld@chromium.org>
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Reviewed-by: Avri Altman <avri.altman@wdc.com>
Link: https://lore.kernel.org/r/20231103084720.6886-7-adrian.hunter@intel.com
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
drivers/mmc/host/cqhci-core.c