[PATCH v7] PCI: rockchip: Add Rockchip RK356X host controller driver

Peter Geis pgwipeout at gmail.com
Thu Apr 29 13:16:48 BST 2021


On Thu, Apr 29, 2021 at 7:55 AM Christoph Hellwig <hch at infradead.org> wrote:
>
> On Thu, Apr 29, 2021 at 07:26:40AM -0400, Peter Geis wrote:
> > Good Morning! I'm trying to implement the MSI workaround in as sane a
> > method as possible.
> > Do you have a better way to have the kernel only allocate memory in
> > the lower regions?
> > (Without disabling everything above 4G altogether)
> > This chip only supports a maximum of 8G.
> > (I know, why they did it while maintaining a 32bit bus is beyond me).
>
>
> Please use dma_alloc_coherent to allocate the memory, the dma_addr_t
> return value is the address to be fed to the hardware.  Before doing
> that set the desired mask.  DMA_BIT_MASK(33) would get your 8GB.

Thanks!
Unfortunately this isn't actually DMA allocation, they were using
GFP_DMA32 as a hack to allocate regular kernel memory in the 32 bit
range.
It's in drivers/irqchip/irq-gic-v3-its.c for reference.
The functions are simply kcalloc(), kzalloc(), kzalloc_node(),
alloc_pages_node(), and alloc_pages().
I'd prefer not to have to rewrite this driver's entire memory
allocation system for one errata.

I'm following the code path for dma_alloc_coherent to see if anything
sticks out to me though.



More information about the Linux-rockchip mailing list