All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Kamal Dasu" <kamal.dasu@broadcom.com>
Cc: devicetree@vger.kernel.org, robh@kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH v7 3/3] mmc: core: Honor keep-power-in-suspend and reset-card-at-resume for (e)MMC
Date: Wed, 05 Aug 2026 22:38:03 +0000	[thread overview]
Message-ID: <20260805223804.544C81F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260805222500.2567801-4-kamal.dasu@broadcom.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] The fast-path in `_mmc_suspend()` for `MMC_POWEROFF_SUSPEND` sets the suspended state but leaves the card powered on. If a shutdown, undervoltage, or unbind event occurs while the card is runtime-suspended, the pre-existing early exit (`if (mmc_card_suspended(host->card)) goto out;`) causes the function to return immediately. This bypasses the critical `mmc_poweroff_notify()` (which sends `EXT_CSD_POWER_OFF_LONG`) and `mmc_power_off()`, directly violating the commit message's claim that these events "still need the normal power-off path".
--

--- Patch [3]: [PATCH v7 3/3] mmc: core: Honor keep-power-in-suspend and reset-card-at-resume for (e)MMC ---
commit 50bf6f999dd980cb9368096f4fc9122b882d9a42
Author: Kamal Dasu <kamal.dasu@broadcom.com>

mmc: core: Honor keep-power-in-suspend and reset-card-at-resume for (e)MMC

This patch introduces support for keep-power-in-suspend and
reset-card-at-resume in the core (e)MMC suspend/resume paths. It adds a
fast-path in _mmc_suspend() that leaves the card powered on if these
capabilities are set, and a corresponding reset block in _mmc_resume().

Link: https://lore.kernel.org/r/20260413180551.3683969-1-florian.fainelli@broadcom.com/

> diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c
> index 05444ecf3909f..62cc009f2a2bf 100644
> --- a/drivers/mmc/core/mmc.c
> +++ b/drivers/mmc/core/mmc.c

[ ... ]

> @@ -2157,6 +2157,33 @@ static int _mmc_suspend(struct mmc_host *host, enum mmc_poweroff_type pm_type)
>  			goto out;
>  	}
>  
> +	/*
> +	 * Keep the card powered across an actual suspend; shutdown, unbind
> +	 * and undervoltage still need the normal power-off path below,
> +	 * since they aren't guaranteed a subsequent _mmc_resume().
> +	 *
> +	 * Check pm_caps, not pm_flags: unlike SDIO, (e)MMC has no
> +	 * per-function driver to request this via
> +	 * sdio_set_host_pm_flags(), so it's a fixed platform trait here.
> +	 *
> +	 * Require MMC_CAP2_RESET_AT_RESUME too: without it, _mmc_resume()
> +	 * has no way to bring the host back to a state mmc_init_card() can
> +	 * use, since mmc_power_up() no-ops when power_mode is already
> +	 * MMC_POWER_ON. Keeping power without also resetting at resume is
> +	 * not a safe combination for this driver.
> +	 */
> +	if (pm_type == MMC_POWEROFF_SUSPEND &&
> +	    (host->pm_caps & MMC_PM_KEEP_POWER) &&
> +	    (host->caps2 & MMC_CAP2_RESET_AT_RESUME)) {
> +		if (!mmc_host_is_spi(host))
> +			err = mmc_deselect_cards(host);
> +		if (!err) {
> +			host->pm_flags |= MMC_PM_KEEP_POWER;
> +			mmc_card_set_suspended(host->card);
> +		}
> +		goto out;
> +	}

[Severity: High]
Does this fast-path interact incorrectly with the early exit at the top of
_mmc_suspend()?

If the host is configured with MMC_PM_KEEP_POWER and MMC_CAP2_RESET_AT_RESUME,
and the eMMC enters runtime suspend, this fast-path marks the card as suspended
but intentionally leaves the power on.

If a subsequent system shutdown, unbind, or undervoltage event occurs,
_mmc_suspend() will be called again. However, since mmc_card_suspended()
is now true, the function will hit the early exit:

	if (mmc_card_suspended(host->card))
		goto out;

Will this bypass mmc_poweroff_notify() and mmc_power_off() entirely,
despite the comment indicating that shutdown, unbind, and undervoltage
still need the normal power-off path?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260805222500.2567801-1-kamal.dasu@broadcom.com?part=3

      reply	other threads:[~2026-08-05 22:38 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-05 22:24 [PATCH v7 0/3] mmc: core: Keep the card powered across suspend when firmware needs it live Kamal Dasu
2026-08-05 22:24 ` [PATCH v7 1/3] dt-bindings: mmc: Extend keep-power-in-suspend beyond SDIO Kamal Dasu
2026-08-05 22:24 ` [PATCH v7 2/3] dt-bindings: mmc: Add reset-card-at-resume property Kamal Dasu
2026-08-05 22:30   ` sashiko-bot
2026-08-07 13:56   ` Rob Herring
2026-08-05 22:25 ` [PATCH v7 3/3] mmc: core: Honor keep-power-in-suspend and reset-card-at-resume for (e)MMC Kamal Dasu
2026-08-05 22:38   ` sashiko-bot [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260805223804.544C81F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=kamal.dasu@broadcom.com \
    --cc=robh@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.