Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3670424pxf; Mon, 22 Mar 2021 12:01:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyVkv8aeyf1/FwPAUBhSn5NqunRQ0PNhAz/lpttxOC8KrK2Hk/pqUxZ8p1vQJyV/Nz2FZfa X-Received: by 2002:aa7:db01:: with SMTP id t1mr1076151eds.77.1616439697113; Mon, 22 Mar 2021 12:01:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616439697; cv=none; d=google.com; s=arc-20160816; b=BH93YSmhYmhfM5uEwBMCfGFYWgj5hJ0rjtf3ykUm4+x9CDsfqYXBO1zT+GPFfvOeI5 rpLUdRA4WlzOnuwEhbXF0D+vLxOi4flvmCofFCr9FTXTX5sDmLSISwPbVv1Qkq3+4nwn gr2Aq3vrCdUo5el6xRhvssdMC+rRzadM3GItFuQLl4xU8IxoS4mGzzJcMJmXzC0W6uhU qrwFdVas7DkvZXcbvfGPTtDg0Cpf0ZQdCZMxv6vl1G9iZJmcIX+b/KYpTKwkSNvZYIJ7 jtciRbVyUozUbBkarBusiSQQmNiGeiI5pnEusqLVup6g7CXbikakbi4xcAEb7y7iv/vs roXQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:organization :from:references:cc:to:subject:ironport-sdr:ironport-sdr; bh=r8SVg1/lsSuTsPArkI/563mNN30OoFLoKGRt9X8uDmQ=; b=q7wvBHMPEq/S/AbojMt0RFccuu5I5D+5Y3xNazVXyc2yMNBQlGwKWbEeWN3f5fGoYp /epTZjm3TYKLosdNQWrlUsFAHzEpT7B450hIl90sfsyrZSKOL8tRWFpNPWXUwLR5JIjT u7BNAbjZSWGGhRm4cniwuuJRLi/4QrZ1uYZAhFnZYExPq+d89XFMjz9YmSezeCBJlieC EuGMsXgc4lnkjz8G3ZqhzgwQL2EFXV2hlOgp6l1A06T4zxe3+eKXv3j/SAjQDah5HrB0 5XhAeY2ZAyUHd9tel4D3G0BvC+g7ryVvOWb5+6BkPG2o97B5VG/yH2LK2tEGl+htnOjk bukA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q8si12399760ejy.320.2021.03.22.12.01.14; Mon, 22 Mar 2021 12:01:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232265AbhCVS7c (ORCPT + 99 others); Mon, 22 Mar 2021 14:59:32 -0400 Received: from mga09.intel.com ([134.134.136.24]:63231 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232118AbhCVS6x (ORCPT ); Mon, 22 Mar 2021 14:58:53 -0400 IronPort-SDR: d5PpxvhGQ9h2zaLysXySFsWmDXnUQ6xoqHQ4xpiFobg56GZM6g+mt2FuxwB2oBLp41WUXmxQIA yim4QD9+u2Nw== X-IronPort-AV: E=McAfee;i="6000,8403,9931"; a="190425724" X-IronPort-AV: E=Sophos;i="5.81,269,1610438400"; d="scan'208";a="190425724" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Mar 2021 11:58:52 -0700 IronPort-SDR: JcmCca+q+mbHurgTFhqUnenc2gcc4b+YxsNFGmrlyrpEziFMkAqlllhuG1PLGKKB0EtObfNuWN WSBN5SsMqOtw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.81,269,1610438400"; d="scan'208";a="407948533" Received: from ahunter-desktop.fi.intel.com (HELO [10.237.72.174]) ([10.237.72.174]) by fmsmga008.fm.intel.com with ESMTP; 22 Mar 2021 11:58:50 -0700 Subject: Re: [PATCH 2/2] mmc: block: Update ext_csd.cache_ctrl if it was written To: Avri Altman , Ulf Hansson , linux-mmc@vger.kernel.org Cc: linux-kernel@vger.kernel.org References: <20210322133645.4901-1-avri.altman@wdc.com> <20210322133645.4901-3-avri.altman@wdc.com> From: Adrian Hunter Organization: Intel Finland Oy, Registered Address: PL 281, 00181 Helsinki, Business Identity Code: 0357606 - 4, Domiciled in Helsinki Message-ID: <017e203c-e53f-b07e-fcea-e357d8947d43@intel.com> Date: Mon, 22 Mar 2021 20:59:04 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1 MIME-Version: 1.0 In-Reply-To: <20210322133645.4901-3-avri.altman@wdc.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 22/03/21 3:36 pm, Avri Altman wrote: > The cache function can be turned ON and OFF by writing to the CACHE_CTRL > byte (EXT_CSD byte [33]). However, card->ext_csd.cache_ctrl is only > set on init if cache size > 0. > > Fix that by explicitly setting ext_csd.cache_ctrl on ext-csd write. > > Signed-off-by: Avri Altman > --- > drivers/mmc/core/block.c | 8 ++++++++ > 1 file changed, 8 insertions(+) > > diff --git a/drivers/mmc/core/block.c b/drivers/mmc/core/block.c > index a93c66aa91db..4c816d001ac1 100644 > --- a/drivers/mmc/core/block.c > +++ b/drivers/mmc/core/block.c > @@ -571,6 +571,14 @@ static int __mmc_blk_ioctl_cmd(struct mmc_card *card, struct mmc_blk_data *md, > main_md->part_curr = value & EXT_CSD_PART_CONFIG_ACC_MASK; > } > > + /* Make sure to update CACHE_CTRL in case it was changed */ It might be worth noting that the cache will get turned back on if the card is re-initialized, for example suspend/resume or hw reset in recovery. > + if ((MMC_EXTRACT_INDEX_FROM_ARG(cmd.arg) == EXT_CSD_CACHE_CTRL) && > + (cmd.opcode == MMC_SWITCH)) { > + u8 value = MMC_EXTRACT_VALUE_FROM_ARG(cmd.arg) & 1; > + > + card->ext_csd.cache_ctrl = value; > + } > + > /* > * According to the SD specs, some commands require a delay after > * issuing the command. >