Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2697031pxj; Mon, 10 May 2021 08:45:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxSSi3r3XFeXM1rwJaMYmLfP3+u2OveY9DiaqLKjJUBgf8UPPp0BFoXm1tcmFpAac35d4t2 X-Received: by 2002:a05:6e02:1384:: with SMTP id d4mr19749145ilo.25.1620661535288; Mon, 10 May 2021 08:45:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620661535; cv=none; d=google.com; s=arc-20160816; b=BnrIET8oYqOZLrxwyAicHn3p6dNAZZh5UAgwApMBhsSF+avOgKuL1IsL9fv1Qoz5AT ioJtojZ+R/hKDndG+mjRXDB5Q45ACRpZu4hcWZYgRzhcxtQQMrRciZNUfYkmnVhuduZ7 b9U/dc8uaNAtaLDre0nAO8agNF0fR47fWX/dvH5nxtD33qVB63Z4065Zzm8GFUGOYmQ4 RX3sR9+lfDJPj0nyCJGxrGj38viy6G+SolNfgN8GoQoEJYuCEvyKvPToVgKp8De3/PPk h6lhIkzbSvnCJ8uKVc71yUx5i/tA4bg4ke1v+m59Wvl8QLmoybxCcBW46owk0mzIMb2v s8dQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=7Gj+si2Akkyw7gOIafJ/mrYWugT2bnqlR53LGPtPkbI=; b=ehGwxVtTfS+8MHGol2Sh5v3FCk8OihC2A0/FJ/xxlVuoQSSwjYTZZGRbv+aysncTtx pZLwwQSqvIlLIjFEOqSfeIUIA63C9ZrUjCrYUsoeVlaPgu9xmN6ruuoy+fZgoI2ogl+P tUkLaien3b7gohorDdjdiNYqJ/FDh6y/OURbcWW/M07nUTFLqvyVhd0ht7aYqosGWuGI 35qHc2H343BKO3YpzH+8aivdybbmp8FD193Ae4KkdMU3HYhfZyPbnMx/xwqNwYuDuPHQ d4k4KM7dZ1swiNJsySZsWs+iFO2lm3MUnb6s/iVJtMPTMF8UixjRX7hiTExi8Loch5X5 bkrg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=BTi3J0II; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q8si18971162ilv.144.2021.05.10.08.45.22; Mon, 10 May 2021 08:45:35 -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; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=BTi3J0II; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232063AbhEJKxJ (ORCPT + 99 others); Mon, 10 May 2021 06:53:09 -0400 Received: from mail.kernel.org ([198.145.29.99]:48608 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232147AbhEJKmV (ORCPT ); Mon, 10 May 2021 06:42:21 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 094ED61927; Mon, 10 May 2021 10:32:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1620642744; bh=NP0EJ8kuHK4TxSdYpQDX7lgasfB84oNqD23GsylnWUE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BTi3J0IIGhutsRRZi9qEwEkFvrQI/ofdu6X64XeXcoE8CW8RJ4KC5+slEQfvNBYZ3 Wl4IzTxHyruU+mnO+OZhTE5ZTi8ZEtt1KDV33mkLSmaTe8bY9AwkrwNDodR+hK+LZl iLT7JlOo/JsHuKUGD9JOOy8bu1O40fp+0iQTRXmo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Avri Altman , Adrian Hunter , Ulf Hansson Subject: [PATCH 5.10 033/299] mmc: block: Update ext_csd.cache_ctrl if it was written Date: Mon, 10 May 2021 12:17:10 +0200 Message-Id: <20210510102005.943751361@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210510102004.821838356@linuxfoundation.org> References: <20210510102004.821838356@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Avri Altman commit aea0440ad023ab0662299326f941214b0d7480bd upstream. 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 Cc: stable@vger.kernel.org Link: https://lore.kernel.org/r/20210420134641.57343-3-avri.altman@wdc.com Signed-off-by: Ulf Hansson Signed-off-by: Greg Kroah-Hartman --- drivers/mmc/core/block.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) --- a/drivers/mmc/core/block.c +++ b/drivers/mmc/core/block.c @@ -572,6 +572,18 @@ static int __mmc_blk_ioctl_cmd(struct mm } /* + * 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. */