From patchwork Wed Aug 7 06:03:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Avri Altman X-Patchwork-Id: 13755668 Received: from esa4.hgst.iphmx.com (esa4.hgst.iphmx.com [216.71.154.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A2289198E86 for ; Wed, 7 Aug 2024 06:05:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=216.71.154.42 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723010708; cv=none; b=OTTcSLGZuZPG9Dy7pNGoaKPLDEizr15T6VRgCZXAA/S0tB8wg5o2IG/k40X3D54sVUIVfqTJi1Npe/1zg/9QLN2+AIB1L3qgck2G/DyyW9zrtKj564KD2p7mOQXvRTxvRLh7mmWSmnFYGWW9aTLYT5JHEpchT0ryHPGhPx3tF3o= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723010708; c=relaxed/simple; bh=Wcj/mjpTmCbjL+Xssf02Wc9rFe9DuiBgVw5VCokqUaM=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=RLGB24+yOOObBRyHwX3dxxo9U46gJmnD16HthdOuL1F/yTA5Bwmv7IWDWcUQEYTxOiaY2AIw7bGNJJ84CC1CiC3ggChWb8CZvYZobdV1vsO6AkRfr2WxhaquNxVPduu+H1XzZtR2YFvdaL9YZMvrG6aDY2GkTVxxcSY9IpDaJZI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=wdc.com; spf=pass smtp.mailfrom=wdc.com; dkim=pass (2048-bit key) header.d=wdc.com header.i=@wdc.com header.b=NOEAb1cm; arc=none smtp.client-ip=216.71.154.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=wdc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=wdc.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=wdc.com header.i=@wdc.com header.b="NOEAb1cm" DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1723010706; x=1754546706; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Wcj/mjpTmCbjL+Xssf02Wc9rFe9DuiBgVw5VCokqUaM=; b=NOEAb1cmE2Q84+sLWTKdJQoBFmlrF7/tU/p6f1sg4fe6K2fO43EiokoT KM8Xxa95GvJO2OM9kDJGsStFCwl2+C7RqqPpA7LexA7oIbc0sg1Xfhgxn ED2YsjTlMOmoaFDq+v6LVCdfTfikBtOtfQH1qn7PIXiuuhSeIwasZ9hgU z06FbJkI7Qx8CIsdAkuFnJN3U0UcA1Lxf1Iqy4fz8rKTE0ltkPNsYvg0N +0eRPr1Tu0c3mVSV+6K+6VMKa3NIc6/f7JU+40lw7PaOLPJXgnsp/wM7V AgT3+ArLCdQ0xVezz7O+8nlOdZ2N21gkfLunlyVfys6ZPzSLvC3uphCzQ Q==; X-CSE-ConnectionGUID: t1dMmJ3/SwWKMPwsxWm/sA== X-CSE-MsgGUID: MU7aajEhSM2zBUr3XR2JKg== X-IronPort-AV: E=Sophos;i="6.09,269,1716220800"; d="scan'208";a="23039327" Received: from uls-op-cesaip02.wdc.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 07 Aug 2024 14:05:06 +0800 IronPort-SDR: 66b30098_JnMCyhjUz2ySKUo1lKRg9mVE12O6QZYLQkvl9cPiVPuF51K ImJYkNOIELkAhwvqh7yxrAjabmfkcRGt4EpxE0g== Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 06 Aug 2024 22:05:28 -0700 WDCIronportException: Internal Received: from avri-office.ad.shared (HELO avri-office.sdcorp.global.sandisk.com) ([10.45.31.142]) by uls-op-cesaip02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 06 Aug 2024 23:05:06 -0700 From: Avri Altman To: Ulf Hansson , linux-mmc@vger.kernel.org Cc: Ricky WU , Avri Altman Subject: [PATCH v2 08/10] mmc: core: Allow mmc erase to carry large addresses Date: Wed, 7 Aug 2024 09:03:07 +0300 Message-Id: <20240807060309.2403023-9-avri.altman@wdc.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240807060309.2403023-1-avri.altman@wdc.com> References: <20240807060309.2403023-1-avri.altman@wdc.com> Precedence: bulk X-Mailing-List: linux-mmc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Preparing for SDUC, Allow the erase address to be larger beyond a 32 bit address. Signed-off-by: Avri Altman --- drivers/mmc/core/block.c | 6 ++++-- drivers/mmc/core/core.c | 18 ++++++++++-------- drivers/mmc/core/core.h | 2 +- 3 files changed, 15 insertions(+), 11 deletions(-) diff --git a/drivers/mmc/core/block.c b/drivers/mmc/core/block.c index abf1e8a124a5..55b9fc34fdd4 100644 --- a/drivers/mmc/core/block.c +++ b/drivers/mmc/core/block.c @@ -1154,7 +1154,8 @@ static void mmc_blk_issue_erase_rq(struct mmc_queue *mq, struct request *req, { struct mmc_blk_data *md = mq->blkdata; struct mmc_card *card = md->queue.card; - unsigned int from, nr; + unsigned int nr; + sector_t from; int err = 0; blk_status_t status = BLK_STS_OK; @@ -1209,7 +1210,8 @@ static void mmc_blk_issue_secdiscard_rq(struct mmc_queue *mq, { struct mmc_blk_data *md = mq->blkdata; struct mmc_card *card = md->queue.card; - unsigned int from, nr, arg; + unsigned int nr, arg; + sector_t from; int err = 0, type = MMC_BLK_SECDISCARD; blk_status_t status = BLK_STS_OK; diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c index 754e628b061b..8ea28a04e438 100644 --- a/drivers/mmc/core/core.c +++ b/drivers/mmc/core/core.c @@ -1616,8 +1616,8 @@ static unsigned int mmc_erase_timeout(struct mmc_card *card, return mmc_mmc_erase_timeout(card, arg, qty); } -static int mmc_do_erase(struct mmc_card *card, unsigned int from, - unsigned int to, unsigned int arg) +static int mmc_do_erase(struct mmc_card *card, sector_t from, + sector_t to, unsigned int arg) { struct mmc_command cmd = {}; unsigned int qty = 0, busy_timeout = 0; @@ -1718,18 +1718,19 @@ static int mmc_do_erase(struct mmc_card *card, unsigned int from, } static unsigned int mmc_align_erase_size(struct mmc_card *card, - unsigned int *from, - unsigned int *to, + sector_t *from, + sector_t *to, unsigned int nr) { - unsigned int from_new = *from, nr_new = nr, rem; + sector_t from_new = *from; + unsigned int nr_new = nr, rem; /* * When the 'card->erase_size' is power of 2, we can use round_up/down() * to align the erase size efficiently. */ if (is_power_of_2(card->erase_size)) { - unsigned int temp = from_new; + sector_t temp = from_new; from_new = round_up(temp, card->erase_size); rem = from_new - temp; @@ -1774,10 +1775,11 @@ static unsigned int mmc_align_erase_size(struct mmc_card *card, * * Caller must claim host before calling this function. */ -int mmc_erase(struct mmc_card *card, unsigned int from, unsigned int nr, +int mmc_erase(struct mmc_card *card, sector_t from, unsigned int nr, unsigned int arg) { - unsigned int rem, to = from + nr; + unsigned int rem; + sector_t to = from + nr; int err; if (!(card->csd.cmdclass & CCC_ERASE)) diff --git a/drivers/mmc/core/core.h b/drivers/mmc/core/core.h index 37091a6589ed..faae4b6404ad 100644 --- a/drivers/mmc/core/core.h +++ b/drivers/mmc/core/core.h @@ -116,7 +116,7 @@ bool mmc_is_req_done(struct mmc_host *host, struct mmc_request *mrq); int mmc_start_request(struct mmc_host *host, struct mmc_request *mrq); -int mmc_erase(struct mmc_card *card, unsigned int from, unsigned int nr, +int mmc_erase(struct mmc_card *card, sector_t from, unsigned int nr, unsigned int arg); int mmc_can_erase(struct mmc_card *card); int mmc_can_trim(struct mmc_card *card);