[PATCH] Add support for CONFIG_ARM64_DMA_USE_IOMMU.

Arnd Bergmann arnd at arndb.de
Fri Apr 10 14:53:53 PDT 2015


On Monday 23 March 2015 21:28:45 Suman Tripathi wrote:
> > My first suggestion would be to separate this from IOMMU support
> > completely
> > as you don't really have an IOMMU. The easiest way to deal with hardware
> > like this is to use swiotlb with a fixed mapping. This is also the only
> > way to deal with any devices that may have multiple outstanding DMAs
> > (PCI, SATA, USB, ...).
> I guess you are talking about the swiotlb force idea ?  That's really
> good but I think we should make configuring  swiotlb force per device
> otherwise it applies to all devices ??

Sorry for the late reply, I was still catching up on email after
my vacation.

The swiotlb is automatically enabled for all devices that have a DMA mask
smaller than the available memory. There is no need to force that at
all. All you have to do is to put devices that have the same limitation
regarding their DMA space on a common device node, and set the dma-ranges
property of the bus node to correctly describe the mapping.

For devices that have a real iommu, or that are on a 64-bit DMA capable
bus, you model that bus correctly in DT and set the dma-ranges to
cover that address space.

The default dma_mask is 32-bit wide, so for devices that have exactly
32-bit (4GB) visibility into physical memory, you don't actually need
to do anything. Only devices that you want to access a larger address
space have to be on a bus node with the larger dma-ranges, and they
need to call dma_set_mask_and_coherent() with the mask that the device
supports itself (which may be more than the bus can handle).

	Arnd



More information about the linux-arm-kernel mailing list