lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID:
 <PH7PR16MB6196112328A147FC59643B76E5CD2@PH7PR16MB6196.namprd16.prod.outlook.com>
Date: Thu, 27 Feb 2025 07:50:38 +0000
From: Avri Altman <Avri.Altman@...disk.com>
To: Guan Wang <guan.wang.jy@...il.com>, Ulf Hansson <ulf.hansson@...aro.org>
CC: Avri Altman <avri.altman@....com>, Adrian Hunter
	<adrian.hunter@...el.com>, Linus Walleij <linus.walleij@...aro.org>, Jens
 Axboe <axboe@...nel.dk>, "guan.wang.jy@...esas.com"
	<guan.wang.jy@...esas.com>, "linux-mmc@...r.kernel.org"
	<linux-mmc@...r.kernel.org>, "linux-kernel@...r.kernel.org"
	<linux-kernel@...r.kernel.org>
Subject: RE: [PATCH] mmc: block: add reset workaround for partition switch
 failures

Hi,
> Some eMMC devices (e.g., BGSD4R and AIM20F) may enter an unresponsive
> state
> after encountering CRC errors during RPMB writes (CMD25). This prevents the
> device from switching back to the main partition via CMD6, blocking further
> I/O operations.
Different cards on the same platform?
Can you share which platform, and few lines from the log supporting your analysis?

> 
> The root cause is suspected to be a firmware/hardware issue in specific
> eMMC models. A workaround is to perform a hardware reset via
> mmc_hw_reset()
> when the partition switch fails, followed by a retry.
Same fw bug in 2 different products?

Why do we need to fix it here?
The ioctl will eventually return an error, and reset is needed anyway.
If the eMMC is the primary storage,  the platform is rebooting without being aware what went wrong.

Thanks,
Avri

> 
> Add a workaround that:
> 1. If initial partition switch fails after rpmb access
> 2. Performs mmc card reset using mmc_hw_reset()
> 3. Retries switching to main partition
> This helps resolve cases where the device becomes unresponsive after
> RPMB operations.
> 
> Signed-off-by: Guan Wang <guan.wang.jy@...esas.com>
> ---
>  drivers/mmc/core/block.c | 20 ++++++++++++++++++--
>  1 file changed, 18 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/mmc/core/block.c b/drivers/mmc/core/block.c
> index 4830628510e6..29388786624c 100644
> --- a/drivers/mmc/core/block.c
> +++ b/drivers/mmc/core/block.c
> @@ -1174,8 +1174,24 @@ static void mmc_blk_issue_drv_op(struct
> mmc_queue *mq, struct request *req)
>  				break;
>  		}
>  		/* Always switch back to main area after RPMB access */
> -		if (rpmb_ioctl)
> -			mmc_blk_part_switch(card, 0);
> +		if (rpmb_ioctl) {
> +			if (mmc_blk_part_switch(card, 0)) {
> +				pr_warn("%s: failed to switch back to main
> area, will reset and switch again\n",
> +						md->disk->disk_name);
> +
> +				/*
> +				 * Reset eMMC device if partition switch fails.
> +				 * Some eMMC devices may get stuck by write
> CRC error in RPMB,
> +				 * preventing switch back to main partition.
> This workaround
> +				 * helps recover from this error state.
> +				 */
> +				mmc_hw_reset(card);
> +
> +				if (mmc_blk_part_switch(card, 0))
> +					pr_err("%s: failed to switch back to
> main area even after reset\n",
> +						   md->disk->disk_name);
> +			}
> +		}
>  		else if (card->reenable_cmdq && !card->ext_csd.cmdq_en)
>  			mmc_cmdq_enable(card);
>  		break;
> --
> 2.25.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ