From nobody Fri Oct 10 02:41:50 2025 Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [185.203.201.7]) (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 CF94D294A11 for ; Mon, 16 Jun 2025 10:29:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.203.201.7 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750069763; cv=none; b=bPHyI5buyCtcPv/WGkoeFJXOht3RUOud9fFjgVU5llqSHIjVJSpUAsBmNgPe6PD3+wh5L/KQBvboBhOIcX70bn5G1/x19cyIaypTJFn3/jOqahjSOtiexJhN0hfURfbMo7M2ItgRXYNqFWknZjd20Z6fpeZgAh5HVFZdhQgBeuA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750069763; c=relaxed/simple; bh=BqfmnFlGx47i/Fb4Ot7l93J2aT1bI8O8B8tWiT7Gav0=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=pO0wIggdvQoUD3BqYqWHvx7uHax9KV4P6lfUzp67xloZxEl9Iuh+HhiuUuzWTcOaDKev3yt+UfGq8x77mRt6etR5WY8v7tDwhVoHQRRr8f+T3Z5i3o96L5ac7ZIds07bV+WZrXdyU+G5QU083v5/rvO5+qYBkQ+Oi5SB4y/1ZuQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de; spf=pass smtp.mailfrom=pengutronix.de; arc=none smtp.client-ip=185.203.201.7 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pengutronix.de Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1uR75b-0008T3-0A; Mon, 16 Jun 2025 12:29:19 +0200 Received: from dude04.red.stw.pengutronix.de ([2a0a:edc0:0:1101:1d::ac]) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1uR75a-003n31-0c; Mon, 16 Jun 2025 12:29:18 +0200 Received: from ore by dude04.red.stw.pengutronix.de with local (Exim 4.96) (envelope-from ) id 1uR75a-0072JP-0N; Mon, 16 Jun 2025 12:29:18 +0200 From: Oleksij Rempel To: Ulf Hansson Cc: Oleksij Rempel , kernel@pengutronix.de, linux-kernel@vger.kernel.org, linux-mmc@vger.kernel.org, Greg Kroah-Hartman , Mark Brown , "Rafael J. Wysocki" , =?UTF-8?q?S=C3=B8ren=20Andersen?= , Christian Loehle , Adrian Hunter , Avri Altman Subject: [PATCH v6 4/4] mmc: block: abort requests and suppress errors after undervoltage shutdown Date: Mon, 16 Jun 2025 12:29:17 +0200 Message-Id: <20250616102917.1677116-5-o.rempel@pengutronix.de> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250616102917.1677116-1-o.rempel@pengutronix.de> References: <20250616102917.1677116-1-o.rempel@pengutronix.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: ore@pengutronix.de X-SA-Exim-Scanned: No (on metis.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Extend the existing card removal checks in mmc_blk_mq_complete_rq() and mmc_mq_queue_rq() to also account for the undervoltage state. If the host has entered undervoltage shutdown, mark requests as quiet and abort them early to prevent unnecessary retries and error logging. This ensures no further operations are attempted on the card after an emergency stop. Signed-off-by: Oleksij Rempel --- drivers/mmc/core/block.c | 2 +- drivers/mmc/core/queue.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/mmc/core/block.c b/drivers/mmc/core/block.c index 9cc47bf94804..bc57bb8514f6 100644 --- a/drivers/mmc/core/block.c +++ b/drivers/mmc/core/block.c @@ -2129,7 +2129,7 @@ static void mmc_blk_mq_complete_rq(struct mmc_queue *= mq, struct request *req) } else if (mqrq->retries++ < MMC_MAX_RETRIES) { blk_mq_requeue_request(req, true); } else { - if (mmc_card_removed(mq->card)) + if (mmc_card_removed(mq->card) || mq->card->host->undervoltage) req->rq_flags |=3D RQF_QUIET; blk_mq_end_request(req, BLK_STS_IOERR); } diff --git a/drivers/mmc/core/queue.c b/drivers/mmc/core/queue.c index 284856c8f655..1dd71ea6927d 100644 --- a/drivers/mmc/core/queue.c +++ b/drivers/mmc/core/queue.c @@ -239,7 +239,7 @@ static blk_status_t mmc_mq_queue_rq(struct blk_mq_hw_ct= x *hctx, bool get_card, cqe_retune_ok; blk_status_t ret; =20 - if (mmc_card_removed(mq->card)) { + if (mmc_card_removed(mq->card) || mq->card->host->undervoltage) { req->rq_flags |=3D RQF_QUIET; return BLK_STS_IOERR; } --=20 2.39.5