[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20190717153135.15507-1-nsaenzjulienne@suse.de>
Date: Wed, 17 Jul 2019 17:31:31 +0200
From: Nicolas Saenz Julienne <nsaenzjulienne@...e.de>
To: linux-arm-kernel@...ts.infradead.org,
Robin Murphy <robin.murphy@....com>,
iommu@...ts.linux-foundation.org
Cc: catalin.marinas@....com, will@...nel.org, m.szyprowski@...sung.com,
hch@....de, phil@...pberrypi.org, stefan.wahren@...e.com,
f.fainelli@...il.com, mbrugger@...e.com,
Jisheng.Zhang@...aptics.com,
Nicolas Saenz Julienne <nsaenzjulienne@...e.de>,
linux-kernel@...r.kernel.org
Subject: [RFC 0/4] Raspberry Pi 4 DMA addressing support
Hi all,
this series attempts to address some issues we found while bringing up the new
Raspberry Pi 4 in arm64 and it's intended to serve as a follow up to this:
https://www.spinics.net/lists/arm-kernel/msg740650.html
The new Raspberry Pi 4 has up to 4GB of ram but most devices can only address
the first GB of ram: the DMA address range is 0xc0000000-0xfc000000 which is
aliased to the first GB of memory 0x00000000-0x3c000000. Note that only some
devices have this limitations, the ARM cores, PCIe, GENET, and 40-bit DMA
channels have a wider view of the address space.
This is solved in arm32 by setting up the correct '.dma_zone_size = SZ_1G'
which takes care of the allocating the coherent memory area at the right spot
and also is taken into account in the arch specific 'dma_map_ops'.
Unfortunately there is no such thing as '.dma_zone_size' in arm64, to make
things worse it's assumed that all devices will be able to adress the first 4GB
of memory.
This raises two issues: the coherent memory reserves are located in an area not
accessible by most devices, and DMA streaming's dma_supported(), which fails
for most devices since it's min_mask isn't properly set. Note that the rest if
DMA streaming works fine thanks to the help of swiotlb.
On one hand I've implemented a function that parses the 'dma-range' on all
interconnects and tries to select a location for the coherent memory reserves
that'll fit all devices. I made the algorithm as simple as possible, based on
the existing devices limitations.
On the other I've added a new variable in dma-direct that allows modifying the
min_mask during the init process and taken care of setting it accordingly in
the arm64's init code.
Regards,
Nicolas
---
Nicolas Saenz Julienne (4):
arm64: mm: use arm64_dma_phys_limit instead of calling max_zone_dma_phys()
arm64: mm: parse dma-ranges in order to better estimate arm64_dma_phys_limit
dma-direct: add dma_direct_min_mask
arm64: mm: set direct_dma_min_mask according to dma-ranges
arch/arm64/mm/init.c | 69 ++++++++++++++++++++++++++++++++++++++++----
kernel/dma/direct.c | 4 ++-
2 files changed, 67 insertions(+), 6 deletions(-)
--
2.22.0
Powered by blists - more mailing lists