• Shawn Lin's avatar
    mmc: dw_mmc: avoid race condition of cpu and IDMAC · 3b2a067b
    Shawn Lin authored
    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: default avatarShawn Lin <shawn.lin@rock-chips.com>
    Signed-off-by: default avatarJaehoon Chung <jh80.chung@samsung.com>
    Signed-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
    3b2a067b
dw_mmc.c 83.7 KB