From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796379434; b=qFnuy9Ij9gVFj3GqvKNPYIjDPSVJFI3OVnp24rIegmkKQUTuA8BZJr3z2WgXHjctk05d 4Id3afIajycRbT/is/9BTe6/CK+GNPBSv+Gf6BH0tM4iLhaV3s+yL+1MFiDlQMLJlZtLX 729oXsNca/uRSBr6Y8RViZLLO+wVD1Ka5uWysyAIRbSQjPbPBvxtG7hDX1u1b9n4bxLvn s3Ec37sBteKm4PSulJm170w5g6mdAw5+KpVVFYGadZvO3p2HoBxgSwxrzDwvX7PO0EZRO 9nY4Xb/RmYxV5ekqJWb7T+gBzWUE9LSVP6ZOiwnXB57pKHgoigIINlEUq1jCwjYfLeg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796379434; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=c3UQCozu/4mInv2QYH2s717uNHYT95nBDH6K7HU8JNg=; b=FwRsqkPvZrCxLK566XITpViYlqNAZD4KnnonQyCJNPh+ww/9G7cnBsDkbPEwirUT3DC0 DDH1TO84anD0i48X43C91GmfXzN57Tki6rAVab7Y6fKbW6Kl6hc6e6v76NsEpLC0qu16n /MeZFBErygXB+JBfcsxyeOK31Ux0s5OEsJU0UrfmUvvzRLXQnQfYvRAabmABg9x48EJQZ a/mFCNhNYPhBh6ehMCn3jBEUZzQfChJ+ocem2Cm/CEIvLnyoV1RptJAEb002iCU+Wmy+Y K96xbwwKmqB9Z6b2a85M8uixrzI27jNPyhz0iHWDigMTUTZAzPorGFmIC9YIcSZOskA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=Wao+HipG; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1B89F606A335; Fri, 4 Dec 2026 10:17:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=Wao+HipG Received: by smtp.kernel.org (Postfix) with ESMTPSA id 89A6B1F000CE; Fri, 4 Dec 2026 10:17:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796379434; bh=c3UQCozu/4mInv2QYH2s717uNHYT95nBDH6K7HU8JNg=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=Wao+HipGPfSGhUK9rvyY1XwTuYP1kVwYcxtrqEbN840Wq9ctZtYOyPbx34ffdAOEs Vuj33LsFjZnHr8BZx/qi9R/o5dstoU95AVvCmxsDHk/B1m3A3Br4e/NIWZ//weDc9Z Du7grqsJjRlZwq/9288oPHXTgAT0AU9ZFCYVdHwQ= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Olivier Louvignes , Ulf Hansson , Sasha Levin Subject: [PATCH 6.12 019/555] mmc: jz4740: Remove the host before resetting the controller Date: Fri, 4 Dec 2026 19:01:02 +0900 Message-ID: <20261204100604.871912835@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100603.988357525@linuxfoundation.org> References: <20261204100603.988357525@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: stable@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.12-stable review patch. If anyone has any objections, please let me know. ------------------ From: Olivier Louvignes [ Upstream commit 6b8b1e8827837bf4cf1f87219038fddae9e81b0b ] jz4740_mmc_remove() masks every interrupt and resets the controller before mmc_remove_host(), which removes the card and lets the card's driver send its last commands. Those commands then run on a controller that was just reset, and can wait out the driver's 5 s request timeout. With an SDIO card that cost 5 s on every unbind: on a HiBy R1 (Ingenic X1600, a BCM43430A1 driven by brcmfmac), the CMD52 that sdio_release_irq() sends from brcmfmac's remove waited 5.1 s. The command had finished (END_CMD_RES set in MSC_STAT), but MSC_IMASK read 0xffffffff although the request had unmasked END_CMD_RES. MSC_STAT can still show IS_RESETTING after jz4740_mmc_reset() returns, so the reset most likely completed after that write and undid it. Remove the host first, then quiesce the controller, as other host drivers do. On the R1, unbinding the Wi-Fi's MSC now takes 0.65 s. Fixes: 61bfbdb85687 ("MMC: Add support for the controller on JZ4740 SoCs.") Cc: stable@vger.kernel.org Signed-off-by: Olivier Louvignes Signed-off-by: Ulf Hansson [ sashal: Kept del_timer_sync() instead of upstream's timer_delete_sync() in the context line, since the older timer API is what this tree uses. ] Signed-off-by: Sasha Levin --- drivers/mmc/host/jz4740_mmc.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/mmc/host/jz4740_mmc.c b/drivers/mmc/host/jz4740_mmc.c index 6a45991ca056f..9e8be3894e496 100644 --- a/drivers/mmc/host/jz4740_mmc.c +++ b/drivers/mmc/host/jz4740_mmc.c @@ -1162,12 +1162,13 @@ static void jz4740_mmc_remove(struct platform_device *pdev) { struct jz4740_mmc_host *host = platform_get_drvdata(pdev); + /* The card's driver may still send commands as it goes */ + mmc_remove_host(host->mmc); + del_timer_sync(&host->timeout_timer); jz4740_mmc_set_irq_enabled(host, 0xff, false); jz4740_mmc_reset(host); - mmc_remove_host(host->mmc); - free_irq(host->irq, host); if (host->use_dma) -- 2.53.0