All of lore.kernel.org
 help / color / mirror / Atom feed
From: Heiko Stuebner <heiko@sntech.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v2 1/3] board_f: Add mach specific DMA address check function.
Date: Wed, 22 May 2019 13:29:02 +0200	[thread overview]
Message-ID: <1628818.2cZUyaLG7x@phil> (raw)
In-Reply-To: <CAPnjgZ2am6ER1hss5eqwdrcnxKmcidmU4SfunpDDkaQZHiBWNg@mail.gmail.com>

Hi Simon,

Am Samstag, 18. Mai 2019, 18:08:58 CEST schrieb Simon Glass:
> On Tue, 7 May 2019 at 09:59, Christoph Muellner
> <christoph.muellner@theobroma-systems.com> wrote:
> >
> > From: Christoph Müllner <christoph.muellner@theobroma-systems.com>
> >
> > Some machines have limited DMA engines, which cannot deal
> > with arbitrary addresses. This patch introduces a function
> > to model these restrictions on a machine level.
> >
> > Signed-off-by: Christoph Müllner <christoph.muellner@theobroma-systems.com>
> > Signed-off-by: Christoph Muellner <christoph.muellner@theobroma-systems.com>
> > ---
> >
> > Changes in v2: None
> >
> >  common/board_f.c | 5 +++++
> >  include/init.h   | 2 ++
> >  2 files changed, 7 insertions(+)
> >
> 
> Can we handle this with driver model somehow? How does the kernel
> handle it?

The problem Christoph is trying to solve here is doing a mmc transfer
from mmc to the sram (not main memory), which cannot use dma.
So this exact problem doesn't happen in the kernel itself.

But back in veyron times we had a similar dma issue with anything accessing
that area as dma hung the system, but the solution was just reserving the
memblock:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=b21bcfc9fda56bac573367d18ce3e4dbf3cdedf9

As the commit describes, other options would've been soc-settings
also going around the kernel's driver model or limiting the dma-able
memory even more (to 2GB), so we opted to just reserve the upper 16MB
completely.


> Is there a device-tree binding for the DMA node that could
> provide this information.

I don't think so. At least in the kernel affecting the dma-mask is a
setting for the using component (mmc, gmac, whatever), so would
mean adapting every device doing dma ... and even then there wasn't
a dt-binding for something like that, which in turn would've required
to adapt every driver to set a specific per-soc dma-mask for Rockchip
compatibles - hence the "simple" reserve above was the least intrusive
option.


> Also, where is this function called from?

In the theobroma u-boot it gets called from the bouncebuffer right now
	https://git.theobroma-systems.com/puma-u-boot.git/commit/?id=d68222d45b4e7f55f500f5e28722cb4304ecde96
to check if the mmc drivers can dma directly or needs to use the
bouncebuffer for reaching something like the sram.


Heiko

  reply	other threads:[~2019-05-22 11:29 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-07 15:59 [U-Boot] [PATCH v2 1/3] board_f: Add mach specific DMA address check function Christoph Muellner
2019-05-07 15:59 ` [U-Boot] [PATCH v2 2/3] bouncebuf: Add DMA validation check to addr_aligned() Christoph Muellner
2019-05-07 15:59 ` [U-Boot] [PATCH v2 3/3] rk3399: Add restriction for DMA-able addresses Christoph Muellner
2019-05-18 16:08 ` [U-Boot] [PATCH v2 1/3] board_f: Add mach specific DMA address check function Simon Glass
2019-05-22 11:29   ` Heiko Stuebner [this message]
2019-05-22 22:57     ` Simon Glass
2019-05-23  8:53       ` Christoph Müllner

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=1628818.2cZUyaLG7x@phil \
    --to=heiko@sntech.de \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.