]> git.karo-electronics.de Git - karo-tx-linux.git/commit
mmc: dw_mmc: avoid race condition of cpu and IDMAC
authorShawn Lin <shawn.lin@rock-chips.com>
Fri, 2 Sep 2016 04:14:37 +0000 (12:14 +0800)
committerUlf Hansson <ulf.hansson@linaro.org>
Mon, 26 Sep 2016 19:31:35 +0000 (21:31 +0200)
commit3b2a067b98b45f7a7dafe21c34a3ae744c697f0f
treeabd8f7e1f3f103512bf454512abefaeb0ae4d38c
parentec0baaa6b33932a25432e17e0bca8d96083caffa
mmc: dw_mmc: avoid race condition of cpu and IDMAC

We could see an obvious race condition by test that
the former write operation by IDMAC aiming to clear
OWN bit reach right after the later configuration of
the same desc, which makes the IDMAC be in SUSPEND
state as the OWN bit was cleared by the asynchronous
write operation of IDMAC. The bug can be very easy
reproduced on RK3288 or similar when we reduce the
running rate of system buses and keep the CPU running
faster. So as two separate masters, IDMAC and cpu
write the same descriptor stored on the same address,
and this should be protected by adding check of OWN
bit before preparing new descriptors.

Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
drivers/mmc/host/dw_mmc.c