From: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
To: Will Deacon <will@kernel.org>
Cc: Stefan Wahren <stefan.wahren@i2se.com>,
Florian Fainelli <f.fainelli@gmail.com>,
marc.zyngier@arm.com, andre.przywara@arm.com,
phil@raspberrypi.org, Matthias Brugger <mbrugger@suse.com>,
Catalin Marinas <catalin.marinas@arm.com>,
robin.murphy@arm.com,
linux-arm-kernel <linux-arm-kernel@lists.infradead.org>
Subject: Re: Limiting the DMA zone in arm64
Date: Thu, 11 Jul 2019 13:10:41 +0200 [thread overview]
Message-ID: <ba2796eab34eb4ec4a25e7c137faac851776c778.camel@suse.de> (raw)
In-Reply-To: <20190711101717.meoyqu5h2zdptypf@willie-the-truck>
Hi Will, thanks for your response.
[+ Matthias and Phill who might be interested ]
On Thu, 2019-07-11 at 11:17 +0100, Will Deacon wrote:
> Hi Nicolas,
>
> [+Robin, Andrew and Marc since we've been playing with getting arm64 Linux
> up and running too]
>
> On Thu, Jul 11, 2019 at 11:51:57AM +0200, Nicolas Saenz Julienne wrote:
> > I'm trying to bring up the new RPi4 on arm64, and running into issues with
> > DMA
> > allocations. The device has up to 4GB of ram, but AFAIK only the first GB of
> > ram can be used for DMA: the DMA address range is 0xc0000000-0xffffffff
> > which
> > is aliased to the first GB of memory 0x00000000-0x40000000.
>
> Do you know for sure that these aliases are equivalant and so it's
> inconsequential if we use the lower addresses for DMA?
No, they are not exactly equivalent, see the 'dma-ranges' I posted on my other
reply. I was being overly generic to make the explanation simpler. The actual
size of the aliasing is smaller.
That said, I don't think using the lower addresses would work for DMA. I tested
some transfers and the offset is clearly being taken into account.
> Also, does this
> limitation apply to all DMA-capable peripherals, or just some of them?
I infer from '.dma_zone_size = SZ_1G' and dma-ranges that it's a device wide
limitation. Maybe Phill can contradict me.
> > This is solved in arm32 using a board file with '.dma_zone_size = SZ_1G'.
> > But I
> > haven't found any similar mechanism for arm64. Any suggestions?
> >
> > Just it case it helps understand the issue, I managed to get things going by
> > doing the following:
> >
> > diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c
> > index f3c795278def..ec3cb7b76a76 100644
> > --- a/arch/arm64/mm/init.c
> > +++ b/arch/arm64/mm/init.c
> > @@ -407,7 +407,8 @@ void __init arm64_memblock_init(void)
> >
> > /* 4GB maximum for 32-bit only capable devices */
> > if (IS_ENABLED(CONFIG_ZONE_DMA32))
> > - arm64_dma_phys_limit = max_zone_dma_phys();
> > + arm64_dma_phys_limit = 0x40000000;
> > else
> > arm64_dma_phys_limit = PHYS_MASK + 1;
>
> My superficial understanding (mainly from talking to Robin, who actually
> knows how this works), is that we'd need to extend our support for
> dma-ranges in order to limit ZONE_DMA32 as you're proposing above.
Noted.
> However, this may not help for streaming DMA, where we need to force
everything
> above 1G through a bounce buffer and likely requires something weird like
> a 30-bit DMA mask.
>
> Do you know how streaming DMA is handled in the 32-bit port for rpi4?
Not really, I'll have a look and come back to you.
Regards,
Nicolas
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2019-07-11 11:10 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-11 9:51 Limiting the DMA zone in arm64 Nicolas Saenz Julienne
2019-07-11 10:15 ` Jisheng Zhang
2019-07-11 10:17 ` Nicolas Saenz Julienne
2019-07-11 10:17 ` Will Deacon
2019-07-11 11:10 ` Nicolas Saenz Julienne [this message]
2019-07-11 13:32 ` Phil Elwell
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=ba2796eab34eb4ec4a25e7c137faac851776c778.camel@suse.de \
--to=nsaenzjulienne@suse.de \
--cc=andre.przywara@arm.com \
--cc=catalin.marinas@arm.com \
--cc=f.fainelli@gmail.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=marc.zyngier@arm.com \
--cc=mbrugger@suse.com \
--cc=phil@raspberrypi.org \
--cc=robin.murphy@arm.com \
--cc=stefan.wahren@i2se.com \
--cc=will@kernel.org \
/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