From: Lee Jones <lee@kernel.org>
To: Eric Anholt <eric@anholt.net>
Cc: Stephen Warren <swarren@wwwdotorg.org>,
linux-arm-kernel@lists.infradead.org,
linux-rpi-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, popcornmix@gmail.com
Subject: Re: [PATCH] ARM: bcm2835: Use 0x4 prefix for DMA bus addresses to SDRAM.
Date: Wed, 13 May 2015 09:51:19 +0100 [thread overview]
Message-ID: <20150513085119.GD3394@x1> (raw)
In-Reply-To: <87wq0mol7e.fsf@eliezer.anholt.net>
On Tue, 05 May 2015, Eric Anholt wrote:
> Stephen Warren <swarren@wwwdotorg.org> writes:
>
> > On 05/04/2015 01:33 PM, Eric Anholt wrote:
> >> There exists a tiny MMU, configurable only by the VC (running the
> >> closed firmware), which maps from the ARM's physical addresses to bus
> >> addresses. These bus addresses determine the caching behavior in the
> >> VC's L1/L2 (note: separate from the ARM's L1/L2) according to the top
> >> 2 bits. The bits in the bus address mean:
> >>
> >> From the VideoCore processor:
> >> 0x0... L1 and L2 cache allocating and coherent
> >> 0x4... L1 non-allocating, but coherent. L2 allocating and coherent
> >> 0x8... L1 non-allocating, but coherent. L2 non-allocating, but coherent
> >> 0xc... SDRAM alias. Cache is bypassed. Not L1 or L2 allocating or coherent
> >>
> >> From the GPU peripherals (note: all peripherals bypass the L1
> >> cache. The ARM will see this view once through the VC MMU):
> >> 0x0... Do not use
> >> 0x4... L1 non-allocating, and incoherent. L2 allocating and coherent.
> >> 0x8... L1 non-allocating, and incoherent. L2 non-allocating, but coherent
> >> 0xc... SDRAM alias. Cache is bypassed. Not L1 or L2 allocating or coherent
> >>
> >> The 2835 firmware always configures the MMU to turn ARM physical
> >> addresses with 0x0 top bits to 0x4, meaning present in L2 but
> >> incoherent with L1. However, any bus addresses we were generating in
> >> the kernel to be passed to a device had 0x0 bits. That would be a
> >> reserved (possibly totally incoherent) value if sent to a GPU
> >> peripheral like USB, or L1 allocating if sent to the VC (like a
> >> firmware property request). By setting dma-ranges, all of the devices
> >> below it get a dev->dma_pfn_offset, so that dma_alloc_coherent() and
> >> friends return addresses with 0x4 bits and avoid cache incoherency.
> >>
> >> This matches the behavior in the downstream 2708 kernel (see
> >> BUS_OFFSET in arch/arm/mach-bcm2708/include/mach/memory.h).
> >
> >> diff --git a/arch/arm/boot/dts/bcm2835.dtsi b/arch/arm/boot/dts/bcm2835.dtsi
> >
> >> #address-cells = <1>;
> >> #size-cells = <1>;
> >> ranges = <0x7e000000 0x20000000 0x02000000>;
> >> + dma-ranges = <0x40000000 0x00000000 0x1f000000>;
> >
> > Oh well that's a nice and simple patch; I had been avoiding looking into
> > fixing the kernel for this since I was worried it'd be rather complex!
> >
> > I'm puzzled why the length cell of ranges and dma-ranges differs though?
> > Assuming there's a good explanation for that,
>
> Nope, you're right, it should be 0x20000000. '0x1f' came from going
> back from the '0x3f' on the pi2, but pi2 just has a chunk lost to the
> bus mapping.
So are you going to fix this and send another patch?
next prev parent reply other threads:[~2015-05-13 8:51 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-04 19:33 [PATCH] ARM: bcm2835: Use 0x4 prefix for DMA bus addresses to SDRAM Eric Anholt
2015-05-04 20:25 ` Noralf Trønnes
2015-05-05 0:07 ` Eric Anholt
2015-05-05 13:33 ` Noralf Trønnes
2015-05-05 19:31 ` Stephen Warren
2015-05-05 19:29 ` Stephen Warren
2015-05-05 19:53 ` Eric Anholt
2015-05-13 8:51 ` Lee Jones [this message]
2015-05-13 17:41 ` Eric Anholt
2015-05-05 20:10 ` [PATCH v2] " Eric Anholt
2015-05-14 8:43 ` Lee Jones
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=20150513085119.GD3394@x1 \
--to=lee@kernel.org \
--cc=eric@anholt.net \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rpi-kernel@lists.infradead.org \
--cc=popcornmix@gmail.com \
--cc=swarren@wwwdotorg.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