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>
Cc: Tom Rini <trini@konsulko.com>,
	Mattijs Korpershoek <mkorpershoek@baylibre.com>,
	Ion Agorria <ion@agorria.com>,
	Svyatoslav Ryhel <clamor95@gmail.com>,
	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: Re: [PATCH 2/2] boot: extlinux: Fix unaligned buffer for reading data from file system
Date: Thu, 7 Nov 2024 14:57:21 +0100	[thread overview]
Message-ID: <20241107135721.Ysrcbase@linutronix.de> (raw)
In-Reply-To: <CAFLszThMD+Gh6M8B7eqDSDRCSPOgDM25SY6qANHBhh50HFz5Lg@mail.gmail.com>

Hi Simon,

On Thu, Nov 07, 2024 at 06:44:30AM -0700, Simon Glass wrote:
> On Wed, 6 Nov 2024 at 09:34, Nam Cao <namcao@linutronix.de> wrote:
> >
> > extlinux_read_bootflow() allocates a buffer to read from file system
> > without any alignment.
> >
> > But for some block devices which transfer data via DMA, ARCH_DMA_MINALIGN
> > alignment is required. For example, due to misaligned buffer, the below
> > boot failure is observed.
> >
> > => 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)
> >
> > Change the alignment to default (which is ARCH_DMA_MINALIGN).
> >
> > Fixes: 31aefaf89a5b ("bootstd: Add an implementation of distro boot")
> > Signed-off-by: Nam Cao <namcao@linutronix.de>
> > Tested-by: Javier Fernandez Pastrana <javier.pastrana@linutronix.de>
> > ---
> >  boot/bootmeth_extlinux.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/boot/bootmeth_extlinux.c b/boot/bootmeth_extlinux.c
> > index ae0ad1d53e3..5424d179bf8 100644
> > --- a/boot/bootmeth_extlinux.c
> > +++ b/boot/bootmeth_extlinux.c
> > @@ -127,7 +127,7 @@ static int extlinux_read_bootflow(struct udevice *dev, struct bootflow *bflow)
> >                 return log_msg_ret("try", ret);
> >         size = bflow->size;
> >
> > -       ret = bootmeth_alloc_file(bflow, 0x10000, 1);
> > +       ret = bootmeth_alloc_file(bflow, 0x10000, 0);
> 
> Can you please use ARCH_DMA_MINALIGN here? Either that or update
> bootmeth_script to do the same  as here.

No preference from me. Let's just use ARCH_DMA_MINALIGN here.

Thanks for the comments,
Nam

      reply	other threads:[~2024-11-07 13:59 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-06 16:34 [PATCH 0/2] Fix boot failure due to misaligned DMA buffer Nam Cao
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 [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=20241107135721.Ysrcbase@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