U-Boot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Peng Fan <peng.fan@oss.nxp.com>
To: Jonas Karlman <jonas@kwiboo.se>
Cc: Peng Fan <peng.fan@nxp.com>,
	Jaehoon Chung <jh80.chung@samsung.com>,
	Tom Rini <trini@konsulko.com>,
	Kever Yang <kever.yang@rock-chips.com>,
	Heiko Stuebner <heiko@sntech.de>,
	u-boot@lists.denx.de
Subject: Re: [PATCH] mmc: sdhci: Fix possible Synchronous Abort using PIO mode
Date: Thu, 10 Apr 2025 20:28:44 +0800	[thread overview]
Message-ID: <20250410122844.GA311@nxa18884-linux> (raw)
In-Reply-To: <20250123214850.3085559-1-jonas@kwiboo.se>

Hi Jonas,

On Thu, Jan 23, 2025 at 09:48:48PM +0000, Jonas Karlman wrote:
>When MMC_SDHCI_SDMA=y or MMC_SDHCI_ADMA=y and PIO mode is used
>dma_unmap_single() is called on an unmapped address, 0x0. This may
>result in a Synchronous Abort:
>
>  ## Checking hash(es) for Image atf-1 ... sha256+ OK
>  CMD_SEND:16
>                  ARG                      0x00000200
>                  MMC_RSP_R1,5,6,7         0x00000900
>  CMD_SEND:18
>                  ARG                      0x00004005
>  "Synchronous Abort" handler, esr 0x96000147
>  elr: 00000000400015bc lr : 0000000040012b4c
>  x 0: 0000000000008000 x 1: 0000000000092600
>  x 2: 0000000000000040 x 3: 000000000000003f
>  x 4: 0000000000000030 x 5: 0000000000000001
>  x 6: 0000000000000001 x 7: 0000000000000000
>  x 8: 000000000000000a x 9: 0000000000000090
>  x10: 0000000043dffc68 x11: 0000000043c00440
>  x12: 0000000043c00440 x13: ffffffffbfe00000
>  x14: 000000000000031c x15: 0000000240000000
>  x16: 000000004001145c x17: 0000000000000032
>  x18: 0000000043dffef0 x19: 0000000043c00000
>  x20: 0000000043dffbc8 x21: 0000000000000000
>  x22: 00000000000f3d95 x23: 0000000000000002
>  x24: 0000000000000493 x25: 0000000000092600
>  x26: 0000000000000001 x27: 0000000000000001
>  x28: 0000000000000008 x29: 0000000043dffab0
>
>  Code: d2800082 9ac32042 d1000443 8a230000 (d5087620)
>  Resetting CPU ...
>
>  resetting ...
>
>Fix this by only dma_unmap_single() when DMA mode is used and
>sdhci_prepare_dma() has been called to map host->start_addr.
>
>Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
>---
> drivers/mmc/sdhci.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
>diff --git a/drivers/mmc/sdhci.c b/drivers/mmc/sdhci.c
>index 4833b5158c79..dc7f0724a7b6 100644
>--- a/drivers/mmc/sdhci.c
>+++ b/drivers/mmc/sdhci.c
>@@ -177,8 +177,10 @@ static int sdhci_transfer_data(struct sdhci_host *host, struct mmc_data *data)
> 	} while (!(stat & SDHCI_INT_DATA_END));
> 
> #if (CONFIG_IS_ENABLED(MMC_SDHCI_SDMA) || CONFIG_IS_ENABLED(MMC_SDHCI_ADMA))
>-	dma_unmap_single(host->start_addr, data->blocks * data->blocksize,
>-			 mmc_get_dma_dir(data));
>+	if (host->flags & USE_DMA) {
>+		dma_unmap_single(host->start_addr, data->blocks * data->blocksize,
>+				 mmc_get_dma_dir(data));
>+	}

Many platforms have MMC_SDHCI_SDMA enabled, but I not see USE_DMA is set.

So this change will make dma_unmap_single not being called for the platforms.

Will this introduce any issue?

Regards,
Peng

> #endif
> 
> 	return 0;
>-- 
>2.48.1
>

  reply	other threads:[~2025-04-10 11:20 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-23 21:48 [PATCH] mmc: sdhci: Fix possible Synchronous Abort using PIO mode Jonas Karlman
2025-04-10 12:28 ` Peng Fan [this message]
2025-04-10 13:31   ` Jonas Karlman
2025-04-11  3:54 ` Peng Fan (OSS)

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=20250410122844.GA311@nxa18884-linux \
    --to=peng.fan@oss.nxp.com \
    --cc=heiko@sntech.de \
    --cc=jh80.chung@samsung.com \
    --cc=jonas@kwiboo.se \
    --cc=kever.yang@rock-chips.com \
    --cc=peng.fan@nxp.com \
    --cc=trini@konsulko.com \
    --cc=u-boot@lists.denx.de \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox