public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Nam Cao <namcao@linutronix.de>
To: Simon Glass <sjg@chromium.org>, Tom Rini <trini@konsulko.com>,
	Mattijs Korpershoek <mkorpershoek@baylibre.com>,
	Ion Agorria <ion@agorria.com>,
	Svyatoslav Ryhel <clamor95@gmail.com>,
	Nam Cao <namcao@linutronix.de>,
	Mayuresh Chitale <mchitale@ventanamicro.com>,
	Sean Anderson <seanga2@gmail.com>,
	AKASHI Takahiro <akashi.tkhro@gmail.com>,
	Javier Fernandez Pastrana <javier.pastrana@linutronix.de>,
	u-boot@lists.denx.de
Subject: [PATCH 0/2] Fix boot failure due to misaligned DMA buffer
Date: Wed,  6 Nov 2024 17:34:30 +0100	[thread overview]
Message-ID: <cover.1730909884.git.namcao@linutronix.de> (raw)

Hi,

We observed the following sporadic boot failure while booting from MMC
device:

=> boot
CACHE: Misaligned operation at range [9efa25f8, 9efa27f8]
CACHE: Misaligned operation at range [9efa25f8, 9efa27f8]
CACHE: Misaligned operation at range [9efa25f8, 9efa27f8]
CACHE: Misaligned operation at range [9efa25f8, 9efa27f8]
** Booting bootflow 'mmc@2194000.bootdev.part_1' with extlinux
Ignoring unknown command: �D���D��
Boot failed (err=-14)

The reason is because while allocating buffer to read a file from MMC,
alignment of 1 byte is used. Thus, the buffer doesn't work for performing
DMA, and garbage data is read.

While looking at this issue, I also noticed that if no alignment specified
(align=0) then fs_read_alloc() is documented to use the default. But the
default is no alignment. Therefore, other users of fs_read_alloc() which
specify align=0 may be broken as well.

The first patch changes the default to align the buffer suitable for DMA.

The second patch changes extlinux_read_bootflow() to use the default
alignment.

Nam Cao (2):
  fs: Use ARCH_DMA_MINALIGN as default alignment for fs_read_alloc()
  boot: extlinux: Fix unaligned buffer for reading data from file system

 boot/bootmeth_extlinux.c | 2 +-
 fs/fs.c                  | 4 ++++
 2 files changed, 5 insertions(+), 1 deletion(-)

-- 
2.39.5


             reply	other threads:[~2024-11-06 20:19 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-06 16:34 Nam Cao [this message]
2024-11-06 16:34 ` [PATCH 1/2] fs: Use ARCH_DMA_MINALIGN as default alignment for fs_read_alloc() Nam Cao
2024-11-07 13:44   ` Simon Glass
2024-11-07 13:54     ` Nam Cao
2024-11-06 16:34 ` [PATCH 2/2] boot: extlinux: Fix unaligned buffer for reading data from file system Nam Cao
2024-11-07 13:44   ` Simon Glass
2024-11-07 13:57     ` Nam Cao

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=cover.1730909884.git.namcao@linutronix.de \
    --to=namcao@linutronix.de \
    --cc=akashi.tkhro@gmail.com \
    --cc=clamor95@gmail.com \
    --cc=ion@agorria.com \
    --cc=javier.pastrana@linutronix.de \
    --cc=mchitale@ventanamicro.com \
    --cc=mkorpershoek@baylibre.com \
    --cc=seanga2@gmail.com \
    --cc=sjg@chromium.org \
    --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