Re: IOMMU, DMA and legacy PCI board

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 2016-01-15 at 18:41 +0300, Matwey V. Kornilov wrote:
> Hello,
> 
> I am sorry, if I am asking this in a wrong place. I have an legacy
> custom PCI board, which requires contiguous DMA memory region (about 4
> MB) and does not support scatter/gather.
> 
> As contiguous DMA region cannot be allocated with the guaranty,
> currently, the issue is solved by using mem= kernel command line
> argument and using 'hidden memory' within first 3GB of RAM.
> 
> Happily, I have the kernel module source codes.
> I am not quite familiar with the internals of IOMMU. The question is the
> following. Is it possible to use IOMMU to emulate contiguous DMA region
> consisted of smaller chunks on the other side?
> If it is possible in theory, how could my PCI device driver use existing
> kernel API to implement this?


Your question is really better directed to the iommu list (cc'd) since
you don't appear to be doing anything KVM related.  It sounds like what
you want is the contiguous memory allocator (cma), see:

http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/include/linux/dma-contiguous.h

I believe if you specify the size of the available cma using the cma=
boot option then the driver can use the standard DMA API
dma_alloc_coherent().  If you want to be more in control of the address
space for the device you can use the IOMMU API which would give you
control to dynamically add buffers to a contiguous address space for
your device.  cma does not require an iommu, the IOMMU API does.
Thanks,

Alex
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux