From: Mark Kettenis <mark.kettenis@xs4all.nl>
To: Tom Rini <trini@konsulko.com>
Cc: ilias.apalodimas@linaro.org, sjg@chromium.org,
xypron.glpk@gmx.de, e@freeshell.de,
rayagonda.kokatanur@broadcom.com, andy.tang@nxp.com,
mingkai.hu@nxp.com, Ashish.Kumar@nxp.com, priyanka.jain@nxp.com,
wasim.khan@nxp.com, udit.agarwal@nxp.com,
meenakshi.aggarwal@nxp.com, patrick.delaunay@foss.st.com,
patrice.chotard@foss.st.com, Manish.Tomar@nxp.com,
matt@traverse.com.au, caleb.connolly@linaro.org,
tien.fong.chee@altera.com, michal.simek@amd.com,
sumit.garg@kernel.org, patrick.rudolph@9elements.com,
alif.zakuan.yuslaimi@intel.com, Oliver.Gaskell@analog.com,
duje.mihanovic@skole.hr, robert.marko@sartura.hr,
lukas.funke@weidmueller.com, peng.fan@nxp.com,
jj251510319013@gmail.com, adrianox@gmail.com,
sughosh.ganu@linaro.org, vincent.stehle@arm.com,
raymond.mao@linaro.org, maks.mishinfz@gmail.com,
semen.protsenko@linaro.org, u-boot@lists.denx.de,
uboot-stm32@st-md-mailman.stormreply.com
Subject: Re: [PATCH] efi_loader: remove EFI_BOUNCE_BUFFER
Date: Fri, 28 Mar 2025 18:15:27 +0100 [thread overview]
Message-ID: <87wmc95b68.fsf@bloch.sibelius.xs4all.nl> (raw)
In-Reply-To: <20250328160419.GX93000@bill-the-cat> (message from Tom Rini on Fri, 28 Mar 2025 10:04:19 -0600)
> Date: Fri, 28 Mar 2025 10:04:19 -0600
> From: Tom Rini <trini@konsulko.com>
>
> On Fri, Mar 28, 2025 at 02:26:39PM +0200, Ilias Apalodimas wrote:
> > On Fri, 28 Mar 2025 at 13:34, Simon Glass <sjg@chromium.org> wrote:
> > >
> > > Hi Ilias,
> > >
> > > On Thu, 27 Mar 2025 at 15:19, Ilias Apalodimas
> > > <ilias.apalodimas@linaro.org> wrote:
> > > >
> > > > Hi Simon
> > > >
> > > > On Thu, 27 Mar 2025 at 15:33, Simon Glass <sjg@chromium.org> wrote:
> > > > >
> > > > > Hi Ilias,
> > > > >
> > > > > On Wed, 26 Mar 2025 at 02:37, Ilias Apalodimas
> > > > > <ilias.apalodimas@linaro.org> wrote:
> > > > > >
> > > > > > Hi Heinrich,
> > > > > >
> > > > > > On Mon, 24 Mar 2025 at 19:50, Heinrich Schuchardt <xypron.glpk@gmx.de> wrote:
> > > > > > >
> > > > > > > On 17.03.25 14:38, Ilias Apalodimas wrote:
> > > > > > >
> > > > > > > %s/EFI_BOUNCE_BUFFER/CONFIG_EFI_LOADER_BOUNCE_BUFFER/
> > > > > > >
> > > > > > > > The EFI subsystem defines its own bounce buffer for devices that
> > > > > > > > can't transfer data > 4GB. U-Boot already has a generic BOUNCE_BUFFER
> > > > > > > > which can be reused instead of defining another symbol.
> > > > > > > > The only limitation for EFI is that we don't know how big the file a user
> > > > > > > > chooses to transfer is and as a result we can't depend on allocating the
> > > > > > > > memory from the malloc area, which can prove too small.
> > > > > > > >
> > > > > > > > So allocate an EFI buffer of the correct size and pass it to the DM,
> > > > > > > > which already supports bounce buffering via bounce_buffer_start_extalign()
> > > > > > >
> > > > > > > Looking at
> > > > > > >
> > > > > > > if (IS_ENABLED(CONFIG_BOUNCE_BUFFER) && desc->bb) {
> > > > > > >
> > > > > > > in drivers/block/blk-uclass.c the bounce buffer has to be explicitly
> > > > > > > enabled by the device driver. Only the scsi drivers sets bb = true.
> > > > > > >
> > > > > > > Cf. 81bd22e935dc ("rockchip: block: blk-uclass: add bounce buffer flag
> > > > > > > to blk_desc")
> > > > > > >
> > > > > > > Which device-drivers of the boards mentioned below do actually need
> > > > > > > bounce buffering?
> > > > > >
> > > > > > Unfortunately, I don't have any of the hardware to test and I havent
> > > > > > worked with that platform much.
> > > > > > That 'bb' variable and the fact that EFI needs bigger allocations is
> > > > > > why I ended up allocationg properly aligned memory from the EFI
> > > > > > subsystem. But as Mark pointed out, the cache flush is a no go for
> > > > > > now, so I'll drop this and see if I find time to rework the bounce
> > > > > > buffer logic overall
> > > > >
> > > > > There was quite a bit of discussion about all this in the context of
> > > > > my attempt to just add a message to warn the user[1]
> > > > >
> > > > > We might consider adding an event to reserve memory before relocation,
> > > > > along with a way to discover (in board_r) where the memory was
> > > > > allocated. That would make the solution more generic.
> > > >
> > > > I am not sure what you are trying to solve here. The EFI bounce buffer
> > > > after the LMB patches can't overwrite memory, nor can it be
> > > > overwritten.
> > >
> > > I am thinking of we can create a single implementation of the
> > > bouncebuf logic which also works for EFI.
> > >
> > > I think the two sane things to do are:
> > > - restrict U-Boot to using memory below 4GB for platforms which have
> > > the DMA limitation
> >
> > You don't need that. The bounce buf code has a callback you can use to
> > define the limitations
> >
> > > - create (in board_f) a special region below 4GB for use with the
> > > bouncebuf logic
> >
> > The only problem with EFI is that you don't know how much memory it
> > needs and we can't use the existing memalign calls. So if we replace
> > that memalign in the bounce buffer code, with an lmb reservation we
> > have everything we need.
>
> It's not even an EFI problem is it?
Fundamentall, yes, this isn't an EFI problem.
> You could hit the same problem reading a file from a filesystem
> outside of EFI too.
Yes, but we tend to choose the addresses in the env variables that are
used in the more traditional boot methods to prevent this.
> These specific SoCs just aren't heavily exercised is one of the
> challenges I think and so it's possible that we have a few things to
> yet improve in the bounce buffer code (which was added for other
> SoCs and done as generic enough starting point for others).
The existing bounce buffer code was written to solve a completely
different problem. But it could indeed be generalized to solve this
problem as well. That requires somebody willing to work on a larger
set of actual hardware that includes SoC with cache-coherency
challanges (which is what the current bounce buffer implementation is
there for) and SoCs with DMA addressing challenges.
next prev parent reply other threads:[~2025-03-28 18:13 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-17 13:38 [PATCH] efi_loader: remove EFI_BOUNCE_BUFFER Ilias Apalodimas
2025-03-17 16:18 ` Mark Kettenis
2025-03-17 19:06 ` Ilias Apalodimas
2025-03-23 21:51 ` Mark Kettenis
2025-03-24 17:50 ` Heinrich Schuchardt
2025-03-26 8:36 ` Ilias Apalodimas
2025-03-27 13:33 ` Simon Glass
2025-03-27 21:19 ` Ilias Apalodimas
2025-03-28 11:34 ` Simon Glass
2025-03-28 12:26 ` Ilias Apalodimas
2025-03-28 16:04 ` Tom Rini
2025-03-28 16:17 ` Heinrich Schuchardt
2025-03-28 16:25 ` Tom Rini
2025-03-28 17:15 ` Mark Kettenis [this message]
2025-03-29 9:05 ` Ilias Apalodimas
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=87wmc95b68.fsf@bloch.sibelius.xs4all.nl \
--to=mark.kettenis@xs4all.nl \
--cc=Ashish.Kumar@nxp.com \
--cc=Manish.Tomar@nxp.com \
--cc=Oliver.Gaskell@analog.com \
--cc=adrianox@gmail.com \
--cc=alif.zakuan.yuslaimi@intel.com \
--cc=andy.tang@nxp.com \
--cc=caleb.connolly@linaro.org \
--cc=duje.mihanovic@skole.hr \
--cc=e@freeshell.de \
--cc=ilias.apalodimas@linaro.org \
--cc=jj251510319013@gmail.com \
--cc=lukas.funke@weidmueller.com \
--cc=maks.mishinfz@gmail.com \
--cc=matt@traverse.com.au \
--cc=meenakshi.aggarwal@nxp.com \
--cc=michal.simek@amd.com \
--cc=mingkai.hu@nxp.com \
--cc=patrice.chotard@foss.st.com \
--cc=patrick.delaunay@foss.st.com \
--cc=patrick.rudolph@9elements.com \
--cc=peng.fan@nxp.com \
--cc=priyanka.jain@nxp.com \
--cc=rayagonda.kokatanur@broadcom.com \
--cc=raymond.mao@linaro.org \
--cc=robert.marko@sartura.hr \
--cc=semen.protsenko@linaro.org \
--cc=sjg@chromium.org \
--cc=sughosh.ganu@linaro.org \
--cc=sumit.garg@kernel.org \
--cc=tien.fong.chee@altera.com \
--cc=trini@konsulko.com \
--cc=u-boot@lists.denx.de \
--cc=uboot-stm32@st-md-mailman.stormreply.com \
--cc=udit.agarwal@nxp.com \
--cc=vincent.stehle@arm.com \
--cc=wasim.khan@nxp.com \
--cc=xypron.glpk@gmx.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