From: linux@arm.linux.org.uk (Russell King - ARM Linux)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/2] DMA: fix AMBA PL08x driver issue with 64bit DMA address type
Date: Thu, 15 Aug 2013 22:15:15 +0100 [thread overview]
Message-ID: <20130815211515.GF23006@n2100.arm.linux.org.uk> (raw)
In-Reply-To: <520D430E.2050803@linaro.org>
On Thu, Aug 15, 2013 at 11:07:26PM +0200, Andre Przywara wrote:
> On 08/14/2013 09:13 PM, Rob Herring wrote:
>> On Wed, Aug 14, 2013 at 8:00 AM, Russell King - ARM Linux
>> <linux@arm.linux.org.uk> wrote:
>>> NAK.
>>
>> This patch has nothing to do with dma masks or your dma mask series.
>> The code deals with bus alignment and cleans up the code to do
>> alignment operations in a sane way compared to modulo operator. The
>> only thing 64-bit dma_addr_t did was expose crap code.
>
> I agree. Actually I'd see the DMA mask thing just as an opportunity to
> fix this code, not as the reason. I guess there are gazillions of
> drivers in the ARM world which have problems with any address related
> variable being bigger than 32bit, and those should all be fixed
> eventually.
No they shouldn't. If the DMA address registers are 32-bit, then the
DMA engine can *only* handle 32-bit addresses.
That's partly the point of my patch set: if the DMA registers are 32-bit,
then the device driver should set a 32-bit DMA mask to tell the rest of
the kernel that this driver only supports 32-bit addresses.
If DMA bus addresses of 0-4G translates to memory in the range (say) of
4G-8G physical, and you have memory in the region of 4G-8G, then that
should work. At the moment, it doesn't - and that's what those patches
address.
The fact that the PL08x driver was ending up with DMA addresses in the
4G-8G range is a bug. DMA addresses after mapping are supposed to be
the _exact_ value you program into the hardware. If that value is not,
then the DMA API is buggy for that platform.
That all said, yes this patch is mostly fine, except:
>>>> +static int bus_addr_offset(struct pl08x_bus_data *bus)
>>>> +{
>>>> + return bus->addr & (bus->buswidth - 1);
>>>> +}
that this is a poor name for this function - and we don't need it because
we have a generic form of this - IS_ALIGNED(). Is there any reason to
re-code what's already provided?
next prev parent reply other threads:[~2013-08-15 21:15 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-08-14 12:52 [PATCH 0/2] DMA: AMBA PL08x DMA driver fixes due to ARCH_DMA_ADDR_T_64BIT Andre Przywara
2013-08-14 12:52 ` [PATCH 1/2] DMA: fix AMBA PL08x driver issue with 64bit DMA address type Andre Przywara
2013-08-14 13:00 ` Russell King - ARM Linux
2013-08-14 19:13 ` Rob Herring
2013-08-15 21:07 ` Andre Przywara
2013-08-15 21:15 ` Russell King - ARM Linux [this message]
2013-08-19 10:19 ` [PATCH v2] DMA: fix AMBA PL08x compilation " Andre Przywara
2013-08-19 13:26 ` Rob Herring
2013-08-21 6:17 ` Vinod Koul
2013-08-21 21:01 ` [PATCH 1/2] DMA: fix AMBA PL08x driver " Linus Walleij
2013-08-21 21:22 ` Andre Przywara
2013-08-21 21:49 ` Matt Sealey
2013-08-14 12:52 ` [PATCH 2/2] DMA: fix printk warning in AMBA PL08x DMA driver Andre Przywara
2013-08-14 13:00 ` Russell King - ARM Linux
2013-08-14 13:00 ` [PATCH 0/2] DMA: AMBA PL08x DMA driver fixes due to ARCH_DMA_ADDR_T_64BIT Russell King - ARM Linux
2013-08-14 14:05 ` Rob Herring
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=20130815211515.GF23006@n2100.arm.linux.org.uk \
--to=linux@arm.linux.org.uk \
--cc=linux-arm-kernel@lists.infradead.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;
as well as URLs for NNTP newsgroup(s).