* IOMMU, DMA and legacy PCI board
@ 2016-01-15 15:41 Matwey V. Kornilov
2016-01-15 16:14 ` Alex Williamson
0 siblings, 1 reply; 2+ messages in thread
From: Matwey V. Kornilov @ 2016-01-15 15:41 UTC (permalink / raw)
To: kvm
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?
Thank you.
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: IOMMU, DMA and legacy PCI board
2016-01-15 15:41 IOMMU, DMA and legacy PCI board Matwey V. Kornilov
@ 2016-01-15 16:14 ` Alex Williamson
0 siblings, 0 replies; 2+ messages in thread
From: Alex Williamson @ 2016-01-15 16:14 UTC (permalink / raw)
To: Matwey V. Kornilov, kvm; +Cc: iommu
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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-01-15 16:14 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-01-15 15:41 IOMMU, DMA and legacy PCI board Matwey V. Kornilov
2016-01-15 16:14 ` Alex Williamson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).