Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
To: Jisheng Zhang <Jisheng.Zhang@synaptics.com>
Cc: Stefan Wahren <stefan.wahren@i2se.com>,
	Catalin Marinas <catalin.marinas@arm.com>,
	Florian Fainelli <f.fainelli@gmail.com>,
	"will@kernel.org" <will@kernel.org>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>
Subject: Re: Limiting the DMA zone in arm64
Date: Thu, 11 Jul 2019 12:17:49 +0200	[thread overview]
Message-ID: <fdde1be14a9ad2ddd08effb74ce0c362a2040aaa.camel@suse.de> (raw)
In-Reply-To: <20190711180535.60e0cb77@xhacker.debian>


[-- Attachment #1.1: Type: text/plain, Size: 2152 bytes --]

On Thu, 2019-07-11 at 10:15 +0000, Jisheng Zhang wrote:
> On Thu, 11 Jul 2019 11:51:57 +0200
> Nicolas Saenz Julienne wrote:
> 
> > Hi,
> > 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.
> > 
> > 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?
> 
> maybe setting up of the dma-ranges in the soc bus in DT?
> 
> soc {
> 	compatible = "simple-bus";
> 	dma-ranges = <0 0x40000000 0 0x40000000 0x40000000>;
> ...
> }

They are set-up like this (in the RPi foundation downstream kernel):

soc {
	/* Emulate a contiguous 30-bit address range for DMA */
	dma-ranges = <0xc0000000  0x0 0x00000000  0x3c000000>;
	...
}

> > 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;
> > 
> > Regards,
> > Nicolas
> > 
> > 
> > 
> > _______________________________________________
> > linux-arm-kernel mailing list
> > linux-arm-kernel@lists.infradead.org
> > 
https://urldefense.proofpoint.com/v2/url?u=http-3A__lists.infradead.org_mailman_listinfo_linux-2Darm-2Dkernel&d=DwICAg&c=7dfBJ8cXbWjhc0BhImu8wQ&r=wlaKTGoVCDxOzHc2QUzpzGEf9oY3eidXlAe3OF1omvo&m=Wmuzr6hc5vH2mDGWO65GmjVfssfmIXNVvITrgjyYQIg&s=JeCwKaJWXU_gC66lnCTqMw9JlrV_t05V7axT8AEzNJA&e=


[-- Attachment #1.2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

[-- Attachment #2: Type: text/plain, Size: 176 bytes --]

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2019-07-11 10:17 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 [this message]
2019-07-11 10:17 ` Will Deacon
2019-07-11 11:10   ` Nicolas Saenz Julienne
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=fdde1be14a9ad2ddd08effb74ce0c362a2040aaa.camel@suse.de \
    --to=nsaenzjulienne@suse.de \
    --cc=Jisheng.Zhang@synaptics.com \
    --cc=catalin.marinas@arm.com \
    --cc=f.fainelli@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --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