[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20191015102346.GA9071@infradead.org>
Date: Tue, 15 Oct 2019 03:23:46 -0700
From: Christoph Hellwig <hch@...radead.org>
To: Nicolas Saenz Julienne <nsaenzjulienne@...e.de>
Cc: Robin Murphy <robin.murphy@....com>,
linux-arm-kernel@...ts.infradead.org,
bcm-kernel-feedback-list@...adcom.com,
linux-rpi-kernel@...ts.infradead.org,
iommu@...ts.linux-foundation.org, linux-kernel@...r.kernel.org,
hch@...radead.org, mbrugger@...e.com, f.fainelli@...il.com,
wahrenst@....net, Russell King <linux@...linux.org.uk>
Subject: Re: [PATCH RFC 4/5] dma/direct: check for overflows in ARM's
dma_capable()
On Mon, Oct 14, 2019 at 08:31:06PM +0200, Nicolas Saenz Julienne wrote:
> The Raspberry Pi 4 has a 1GB ZONE_DMA area starting at address
> 0x00000000 and a mapping between physical and DMA memory offset by
> 0xc0000000. It transpires that, on non LPAE systems, any attempt to
> translate physical addresses outside of ZONE_DMA will result in an
> overflow. The resulting DMA addresses will not be detected by arm's
> dma_capable() as they still fit in the device's DMA mask.
>
> Fix this by failing to validate a DMA address smaller than the lowest
> possible DMA address.
I think the main problem here is that arm doesn't respect the
bus_dma_mask. If you replace the arm version of dma_capable with
the generic one, does that fi the issue for you as well?
We need to untangle the various macros arm uses for the direct mapping
and eventually we should be able to use the linux/dma-direct.h helpers
directly. Here is a branch with some simple preps I had. Freshly
rebased, not actually tested:
http://git.infradead.org/users/hch/misc.git/shortlog/refs/heads/arm-generic-dma-preps
Powered by blists - more mailing lists