Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp3256917pxb; Tue, 20 Apr 2021 04:23:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzxtaJlhq5HUHG/w01DU2Vjjiu552T6g8HaNkf5UqmDA3robX33g/qbt9DoA9FJOGan4pfA X-Received: by 2002:a05:6402:1109:: with SMTP id u9mr32113769edv.174.1618917832889; Tue, 20 Apr 2021 04:23:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618917832; cv=none; d=google.com; s=arc-20160816; b=QX+5iV+GWX4Sy4qx62IkJJl/oIjY275yA+vlzTEgEZQJ6883IN5btgM0vwdw4Bumq/ P55W0I431wSH0kKKYNTaKv0cM5X3jzw+pL2dDa3ODf6oovCV7sQpDFnMNkp77F7AGKsu Gur37YdOHUTR/jDIn9y17PSZE6HOWA+wS5a9L4tABgJukOuqy/VcObTbVMhTEode/qep PXSCGB5w3ULsPO4hpN7/YmO3S5QvkCDapt5rZpxH9HzrakLTf5JLdN9gMe5Geeg/6bNL 3k0t8FTe4adVt7XBRw8eQ1ealArQcRoQPPUf8gFCMtJlq6faNeNPacptn1SM2XI/0Z7/ Yi1g== 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=/0rDQ/ao+/2wFHTSIqcCodNOYYvE7Gdc46wNBjCiQI4=; b=D/mCaI+pdcEU8A5V7xCqqNzJdUznJFPSMpC3ag+xmPnx5EPwdw1MJHugxkmElZ6QY7 KjmEiJB4LztfeLrGw4JUHMrlHbMJf8diegw96mlgkAaQD0jOAQnhlSf/FDm2QcVT87o0 DeANfKQT2Myq6bAcEWfs+BGFs1EJUYA+YoYRwe+4ruCCGHyZXtX/snHPnMbcA9OxX0SE givXE5H9iLGry0+paQ4z4r6T9yYW1X8LqcsH+gzQv4cCsjRGQTr/KRCh0jv16MNzHpqe 1cmTrEUKYMhMJ69TF4PyTP6k1khO9Ct8MgUJExj5V5ow7T41fgLnYESeR7l4lP77GUh7 RoNg== 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 t16si16239916edi.299.2021.04.20.04.23.29; Tue, 20 Apr 2021 04:23:52 -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 S232034AbhDTLW2 (ORCPT + 99 others); Tue, 20 Apr 2021 07:22:28 -0400 Received: from mga18.intel.com ([134.134.136.126]:40728 "EHLO mga18.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232000AbhDTLWZ (ORCPT ); Tue, 20 Apr 2021 07:22:25 -0400 IronPort-SDR: stH7R77hV4DwLsNxmd9/vu/UFlE6hQQFxN4OglmJ4YsYFqPKGs5FmHgqEIYR9qEScqZxx+c2/+ D8U0oACPfkZA== X-IronPort-AV: E=McAfee;i="6200,9189,9959"; a="182981076" X-IronPort-AV: E=Sophos;i="5.82,236,1613462400"; d="scan'208";a="182981076" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Apr 2021 04:21:52 -0700 IronPort-SDR: vl9U8bhnqc/0zKk91IktvaYMeMqYtqWUgYPaZ9mmG5KNuzUjLVds+NqDeAyOR4hM4Fnq3A/+E9 Ppbky0DBSdxw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.82,236,1613462400"; d="scan'208";a="445480363" Received: from ahunter-desktop.fi.intel.com (HELO [10.237.72.174]) ([10.237.72.174]) by fmsmga004.fm.intel.com with ESMTP; 20 Apr 2021 04:21:50 -0700 Subject: Re: [PATCH v3 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: <20210420055306.4858-1-avri.altman@wdc.com> <20210420055306.4858-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: Date: Tue, 20 Apr 2021 14:22:05 +0300 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: <20210420055306.4858-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 20/04/21 8:53 am, 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 Acked-by: Adrian Hunter > --- > drivers/mmc/core/block.c | 12 ++++++++++++ > 1 file changed, 12 insertions(+) > > diff --git a/drivers/mmc/core/block.c b/drivers/mmc/core/block.c > index 5b6501fc9fb7..8b07ed5e08de 100644 > --- a/drivers/mmc/core/block.c > +++ b/drivers/mmc/core/block.c > @@ -572,6 +572,18 @@ 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. The cache > + * will get turned back on if the card is re-initialized, e.g. > + * 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. >