Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp405211pxj; Thu, 20 May 2021 12:03:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwoFdt8CJZC5Eug6WEpV5uEDTd8uBS/rByMbw4WmlEM1LU0m02UcUecRyt8VDmW4s60cV4E X-Received: by 2002:a6b:f311:: with SMTP id m17mr6703440ioh.162.1621537403475; Thu, 20 May 2021 12:03:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621537403; cv=none; d=google.com; s=arc-20160816; b=zCi26nuvYkxqrS7pdXPPK7NH5KellMTLATIIR3s+0GcgA+ZJGO1+5ni79UQawjlA1I pr6CVnYvWwWlqlLVQoyLAiiW+jI2blOHT2XNyaOfEQM6EsJKi6ty6XB1hxzRSOsUvKbu Q0HiwQr6cB4LbljqD6KAEOJkvhZHxXGwNBarchemCYZT+T8xZ+Gfw8e9WVIMV/yC3JfW Re6hGa9wwVixpJmLRsWTu6wdYrWOgb2WfwtfIEgcRieZ+apGdB8eu6ZRlJmPI0XEJZdZ N/wDkKGZLrAgYS2aipEKje0WZUorsBzZC5TnwXZyz+LcWKZvi+XZ2ohAIPgkupx0LLUe AXOw== 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=X/gFaNu1tCC6H2oc8ldwOkCQUILO4uEk02r46qCc6DU=; b=mgise1h8OAabm6PzmGdGVcytgHSeHX6hZFCnA4LNqY06MpsF5sV5ko+YTkw09PiMRp vDWaF25OgAvf5ddwxkuba7R+3iHvYF8b9Upmkvrohyja8ODDy+4mBb3IIsJbnTGSTKDR umtfVSUVJJzxhkByblsjpjwHti6LKMdHVrObskLcI3PPChVIsEhzLKYzBji1C3UUuWk4 isUAc6hCOaNrIvWApg3DJwRXkXTx7YRFfe2s2HLW/lu1NT7hqIS4zTQZ1130zXTs23MP Js2R+YcVje0MAX9vf0o6G0RL3GpJu/3wGeNMrsOcw7NsYPSxwUf3aHMTcsFK5sVfuKgO pllg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=aQyd7w78; 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 y22si3004833jai.12.2021.05.20.12.03.09; Thu, 20 May 2021 12:03:23 -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=aQyd7w78; 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 S236753AbhETKb1 (ORCPT + 99 others); Thu, 20 May 2021 06:31:27 -0400 Received: from mail.kernel.org ([198.145.29.99]:51944 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235392AbhETKTN (ORCPT ); Thu, 20 May 2021 06:19:13 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 231066101D; Thu, 20 May 2021 09:46:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621504018; bh=+4tdMe23bQuqQUP4daVUklvY+rrCybMlF0Fn5hePeO8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aQyd7w78QMTO15N9OHZhmbM21ga4pSPxiACWZf1D6Is0M1ZARTSzPaX2tNr3qAhr4 3znqs6Z3Nv9+KBL14Rk/JxB3pbkLaOJp0PYbRNBNmzmPErCv5Og+//So5pSpVkt1mB Uvd81BBeHpBz0E4tuZkJE6wYXBoV+BN0mdg26B3c= 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 4.14 023/323] mmc: block: Update ext_csd.cache_ctrl if it was written Date: Thu, 20 May 2021 11:18:35 +0200 Message-Id: <20210520092120.909313339@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210520092120.115153432@linuxfoundation.org> References: <20210520092120.115153432@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 @@ -599,6 +599,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. */