Received: by 2002:a05:7412:b10a:b0:f3:1519:9f41 with SMTP id az10csp896429rdb; Fri, 1 Dec 2023 01:10:48 -0800 (PST) X-Google-Smtp-Source: AGHT+IEIWWG5r0xfP8h57k5IIr2zddWqB3EvrStla6aNbbxGm6YX4mN59OHMRiLuhOTWkzB2oMRT X-Received: by 2002:a05:6871:4504:b0:1ea:746d:1703 with SMTP id nj4-20020a056871450400b001ea746d1703mr31650000oab.7.1701421848532; Fri, 01 Dec 2023 01:10:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701421848; cv=none; d=google.com; s=arc-20160816; b=B5vRBHn0naveXvDi3WpEyo6K943hqR181+MhqMgt2jkQRn0FKPVbQ0KRDS1pGTbQD1 zAR1EMFTrv4uk5rp3zV+O9gNo1SF5ZRM8bT3n2J11dNBRmY7Q1tzByNDS9qW8RKNo/J2 lvZhUtxBuGV2ZdNMAxxF+awGd7dkXj9oqNpgU3hAiCWdTtVABiRBWiGCA68c0Ya0greI aEiF1ejkzspny2ApBT+l17qk4dwrQSZk8qJ2j2KGLrSMQMdz4k4nhIQajhay5LjUeUiw CBW+lNv87a5EUKehD8Na3rhtUrIWt8XhgXLSXUptnhRU3W4i6J3WH0nrFXzLGdPHvop8 2PQw== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=BGkdE3ShZBtVYdzFjb0Caam+cQoN6A+OKXsRf0MTX64=; fh=WFkRbGD8qJE0TlgaYQSgUPHjPRcw2pbNC+2+yqhfygI=; b=ILfkvGYR6Gekflg5KV9/KhXCRbuK4Or0P3uyChFze3UTWIT4vrutuCC0+PDL+lmcHL C3MLokY4lk4j8fl5bMihljSZ9PgGEUOB7g73kP5VxLXWu2PUl64SqmUZ44jJEmaGS51D 3c+cOR0G1QFp53tjzbxiL6j+pamjDynFKVHn/f5azC0g8wNp0hk2uMPOMZ8nW/YBOM3r J4/2Z2kBxRlHtVNFycc4CWB7wOu0A2abIj6Fa1msBlS5NTwVNbOOl1pdQmakIQtgGCIB q6AYMfWOdId94YcBq7qiCPyjPInOhJsgx/30H316mewTfnPtJMWhpnnkFpQYJw6uAhmh X7UQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@foundries.io header.s=google header.b=k5cxZLcH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=foundries.io Return-Path: Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id l1-20020a654481000000b00573f885c4easi2952835pgq.753.2023.12.01.01.10.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Dec 2023 01:10:48 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@foundries.io header.s=google header.b=k5cxZLcH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=foundries.io Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id B3C8A80D31D5; Fri, 1 Dec 2023 01:10:46 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377899AbjLAJKf (ORCPT + 99 others); Fri, 1 Dec 2023 04:10:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58488 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235242AbjLAJKe (ORCPT ); Fri, 1 Dec 2023 04:10:34 -0500 Received: from mail-wr1-x42e.google.com (mail-wr1-x42e.google.com [IPv6:2a00:1450:4864:20::42e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1C6491718 for ; Fri, 1 Dec 2023 01:10:40 -0800 (PST) Received: by mail-wr1-x42e.google.com with SMTP id ffacd0b85a97d-3316d09c645so1686409f8f.0 for ; Fri, 01 Dec 2023 01:10:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foundries.io; s=google; t=1701421838; x=1702026638; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=BGkdE3ShZBtVYdzFjb0Caam+cQoN6A+OKXsRf0MTX64=; b=k5cxZLcHul+zqe1oTBXN5DTyVF3kRq1KKkdCjX11fF7O3r5O1HDOUQJrR5rzYNN1qW 4ThLIEdy139OmQXXE+RCmcpQ/zOwzcsftXHkExfMH1VcXVRMJ2wy20TEJ0xCgzphB2Ll jk0SJcImvYgYkP/fc7MkZur4qcVPUEXZB3P1GXI2ZqbD9rb7PIaKKaKjWIfpvOsjZZej KIzXGJ2B4zqbLYWlXwMOGZ+HzWjnLFr3LA0IfltS/PHZsSiIZ99EpJoiqK2j/xwgUI4v JD6ffM2j2Obh/YM7WBBvL8m3yciRnFYhG1kRaDmK2ixrhG2euO1ZiILNBqY6lGFg+1hG 6Srg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701421838; x=1702026638; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=BGkdE3ShZBtVYdzFjb0Caam+cQoN6A+OKXsRf0MTX64=; b=o1OCbwHYxzGz9w4p3JoTZLuaVcQskASFat0bH1t+O0k1r/kjpQfbtrkKNhd4mWsYcJ +bQzU9DimCtBAggu/5eZOJr8G167FskJvQGXaTKXImK3doykJ7fVrt0pZ4xqzmcbHXoy YBTf8pjRdHjPZZfdcpvUxpglnEqvaEDpbqsSLUoUaBUatTQiFQ9Uh23uuNBjMsPdty0v IuvzJjw3lKFU+FODMkAcIg8X7iUhQwcK+0H9KpGtPwH+ocVtuyj0KT0KgebfrNl/aS3a WxTvIpXrZlep/4O3RMJuDcug6dfAxfETKdc7jByHnwlVMgWPK6XIxRwUdoYh1xbg/yIB EKEw== X-Gm-Message-State: AOJu0YwFFWNvh5kE68mHTDaKHfsI3AwaqFM1VeA3DAeKH2jIS4YKoeDN EPyfLMZvUh+bdi+5CS6uYSWlCw== X-Received: by 2002:a05:6000:12c6:b0:333:3be:2d44 with SMTP id l6-20020a05600012c600b0033303be2d44mr534769wrx.45.1701421838421; Fri, 01 Dec 2023 01:10:38 -0800 (PST) Received: from trax.. (139.red-79-144-198.dynamicip.rima-tde.net. [79.144.198.139]) by smtp.gmail.com with ESMTPSA id q13-20020adffecd000000b0033334410d01sm157126wrs.36.2023.12.01.01.10.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Dec 2023 01:10:37 -0800 (PST) From: Jorge Ramirez-Ortiz To: jorge@foundries.io, ulf.hansson@linaro.org, CLoehle@hyperstone.com, adrian.hunter@intel.com, jinpu.wang@ionos.com, hare@suse.de, beanhuo@micron.com, asuk4.q@gmail.com, yangyingliang@huawei.com, yibin.ding@unisoc.com, victor.shih@genesyslogic.com.tw, linus.walleij@linaro.org Cc: linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] mmc: rpmb: fixes pause retune on all RPMB partitions. Date: Fri, 1 Dec 2023 10:10:34 +0100 Message-Id: <20231201091034.936441-1-jorge@foundries.io> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Fri, 01 Dec 2023 01:10:46 -0800 (PST) When RPMB was converted to a character device, it added support for multiple RPMB partitions (Commit 97548575bef3 ("mmc: block: Convert RPMB to a character device"). One of the changes in this commit was transforming the variable target_part defined in __mmc_blk_ioctl_cmd into a bitmask. This inadvertedly regressed the validation check done in mmc_blk_part_switch_pre() and mmc_blk_part_switch_post(). This commit fixes that regression. Fixes: 97548575bef3 ("mmc: block: Convert RPMB to a character device") Signed-off-by: Jorge Ramirez-Ortiz --- drivers/mmc/core/block.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/mmc/core/block.c b/drivers/mmc/core/block.c index 152dfe593c43..8d29687635c4 100644 --- a/drivers/mmc/core/block.c +++ b/drivers/mmc/core/block.c @@ -851,9 +851,10 @@ static const struct block_device_operations mmc_bdops = { static int mmc_blk_part_switch_pre(struct mmc_card *card, unsigned int part_type) { + const unsigned int mask = EXT_CSD_PART_CONFIG_ACC_RPMB; int ret = 0; - if (part_type == EXT_CSD_PART_CONFIG_ACC_RPMB) { + if (part_type & mask == mask) { if (card->ext_csd.cmdq_en) { ret = mmc_cmdq_disable(card); if (ret) @@ -868,9 +869,10 @@ static int mmc_blk_part_switch_pre(struct mmc_card *card, static int mmc_blk_part_switch_post(struct mmc_card *card, unsigned int part_type) { + const unsigned int mask = EXT_CSD_PART_CONFIG_ACC_RPMB; int ret = 0; - if (part_type == EXT_CSD_PART_CONFIG_ACC_RPMB) { + if (part_type & mask == mask) { mmc_retune_unpause(card->host); if (card->reenable_cmdq && !card->ext_csd.cmdq_en) ret = mmc_cmdq_enable(card); -- 2.34.1