Re: [PATCH 4/4] sample/reserved_mem: Introduce a sample of struct page and dio support to no-map rmem

From: Arnd Bergmann
Date: Tue Jul 12 2022 - 08:11:25 EST


On Tue, Jul 12, 2022 at 12:55 PM Li Chen <me@linux.beauty> wrote:
> >
> > This is a common limitation that gets handled automatically by setting
> > the dma_mask of the device through the dma-ranges property in DT.
> > When the driver does dma_alloc_coherent() or similar to gets its buffer,
> > it will then allocate pages below this boundary.
>
> Thanks for the tip! I wasn't aware that dma-ranges can be used by devices other than PCIe controllers.

You should actually have dma-ranges listed in the parent of any DMA master
capable device, to list the exact DMA capabilities. Without this, devices
fall back to the default 32-bit address limit, which would be correct for your
video device but is often wrong in other devices.

Arnd