Re: [PATCH] mmc: block: enable cache-flushing when mmc cache is on

From: Adrian Hunter
Date: Mon Mar 14 2022 - 06:32:55 EST


On 14/03/2022 09:26, Avri Altman wrote:
> Hi,
>> The mmc core enable cache on default. But it only enables cache-flushing
>> when host supports cmd23 and eMMC supports reliable write.
>> For hosts which do not support cmd23 or eMMCs which do not support
>> reliable write, the cache can not be flushed by `sync` command.
>> This may leads to cache data lost.
>> This patch enables cache-flushing as long as cache is enabled, no matter host
>> supports cmd23 and/or eMMC supports reliable write or not.
> I looked in the spec and indeed couldn't find why enabling cache is dependent of cmd23/reliable write.
> Nor I was able to find the original commit log.

Reliable write was added first, so it might have been an oversight:

commit 881d1c25f765938a95def5afe39486ce39f9fc96
Author: Seungwon Jeon <tgih.jun@xxxxxxxxxxx>
Date: Fri Oct 14 14:03:21 2011 +0900

mmc: core: Add cache control for eMMC4.5 device

This patch adds cache feature of eMMC4.5 Spec.
If device supports cache capability, host can utilize some specific
operations.

Signed-off-by: Seungwon Jeon <tgih.jun@xxxxxxxxxxx>
Signed-off-by: Jaehoon Chung <jh80.chung@xxxxxxxxxxx>
Signed-off-by: Chris Ball <cjb@xxxxxxxxxx>



>
> Please allow few days to ask internally.
>
> Thanks,
> Avri