Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1604218

Re: [PATCH V1] mmc: core: fix still flush cache when eMMC cache off

From Shawn Lin <shawn.lin@rock-chips.com>
Newsgroups linux.kernel
Subject Re: [PATCH V1] mmc: core: fix still flush cache when eMMC cache off
Date 2017-03-20 08:40 +0100
Message-ID <tn054-1qT-25@gated-at.bofh.it> (permalink)
References <tmxZ8-6EK-7@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Hi

On 2017/3/19 8:45, Bean Huo (beanhuo) wrote:
> This patch fixes the issue that mmc_blk_issue_rq still
> flushes cache when eMMC cache has already been off
> through user space tool, such as mmc-utils.

I did a quick test and see the case you refer to, so

Tested-by: Shawn Lin <shawn.lin@rock-chips.com>
Reviewed-by: Shawn Lin <shawn.lin@rock-chips.com>

> The reason is that card->ext_csd.cache_ctrl isn't reset.
>
> Signed-off-by: beanhuo <beanhuo@micron.com>
> ---
>  drivers/mmc/core/block.c | 9 +++++++++
>  1 file changed, 9 insertions(+)
>
> diff --git a/drivers/mmc/core/block.c b/drivers/mmc/core/block.c
> index 1621fa0..fb3635ac 100644
> --- a/drivers/mmc/core/block.c
> +++ b/drivers/mmc/core/block.c
> @@ -64,6 +64,7 @@ MODULE_ALIAS("mmc:block");
>  #define MMC_BLK_TIMEOUT_MS  (10 * 60 * 1000)        /* 10 minute timeout */
>  #define MMC_SANITIZE_REQ_TIMEOUT 240000
>  #define MMC_EXTRACT_INDEX_FROM_ARG(x) ((x & 0x00FF0000) >> 16)
> +#define MMC_EXTRACT_VALUE_FROM_ARG(x) ((x & 0x0000FF00) >> 8)
>
>  #define mmc_req_rel_wr(req)	((req->cmd_flags & REQ_FUA) && \
>  				  (rq_data_dir(req) == WRITE))
> @@ -535,6 +536,14 @@ static int __mmc_blk_ioctl_cmd(struct mmc_card *card, struct mmc_blk_data *md,
>  		return data.error;
>  	}
>
> +	if ((MMC_EXTRACT_INDEX_FROM_ARG(cmd.arg) == EXT_CSD_CACHE_CTRL) &&
> +	    (cmd.opcode == MMC_SWITCH) && (card->ext_csd.cache_size > 0)) {
> +		if (MMC_EXTRACT_VALUE_FROM_ARG(cmd.arg) & 1)
> +			card->ext_csd.cache_ctrl = 1;
> +		else
> +			card->ext_csd.cache_ctrl = 0;
> +	}
> +
>  	/*
>  	 * According to the SD specs, some commands require a delay after
>  	 * issuing the command.
>

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH V1] mmc: core: fix still flush cache when eMMC cache off "Bean Huo (beanhuo)" <beanhuo@micron.com> - 2017-03-19 02:40 +0100
  Re: [PATCH V1] mmc: core: fix still flush cache when eMMC cache off Shawn Lin <shawn.lin@rock-chips.com> - 2017-03-20 08:40 +0100
  Re: [PATCH V1] mmc: core: fix still flush cache when eMMC cache off Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> - 2017-03-20 12:40 +0100
    RE: [PATCH V1] mmc: core: fix still flush cache when eMMC cache off "Bean Huo (beanhuo)" <beanhuo@micron.com> - 2017-03-22 18:40 +0100
  Re: [PATCH V1] mmc: core: fix still flush cache when eMMC cache off Ulf Hansson <ulf.hansson@linaro.org> - 2017-03-23 11:10 +0100
    RE: [PATCH V1] mmc: core: fix still flush cache when eMMC cache off "Bean Huo (beanhuo)" <beanhuo@micron.com> - 2017-03-23 11:50 +0100
      Re: [PATCH V1] mmc: core: fix still flush cache when eMMC cache off Ulf Hansson <ulf.hansson@linaro.org> - 2017-03-23 14:20 +0100
        RE: [PATCH V1] mmc: core: fix still flush cache when eMMC cache off "Bean Huo (beanhuo)" <beanhuo@micron.com> - 2017-03-24 12:20 +0100

csiph-web