How to use the DMA Engine in FreeBSD?

Alan Somers asomers at freebsd.org
Fri Dec 14 16:16:30 UTC 2018


On Fri, Dec 14, 2018 at 8:36 AM Kurt Lidl <lidl at pix.net> wrote:
>
> On 12/13/18 10:53 AM, Warner Losh wrote:
> > On Thu, Dec 13, 2018, 3:04 AM Rajesh Kumar <rajfbsd at gmail.com wrote:
> >
> >> Hi,
> >>
> >> Is there any good documentation available to understand the existing
> >> support, API's and how-to use the DMA Engine in FreeBSD?
> >>
> >
> >
> > Usually you just use pci busmastering and it just works.
> >
> > I am trying to write a test driver which will use DMA Engine to do the data
> >> transfer (rather than plain memcpy which involves cpu).  Can anyone point
> >> to any driver implementation which has similar functions implemented?  I
> >> see references to SYS_RES_DRQ to allocate DMA channels and play around. But
> >> that seems to be specific to ISA. Can it be used for PCI drivers as well?
> >>
> >
> > No. ISA DMA is only for really old hardware without it's own DMA engine.
> >
> > Look at the busdma api/man page.
>
> For some Intel based server hardware, there is the "ioat" driver, which
> allows for user code to schedule DMA operations.  See ioat(4) for
> details, including a pointer to the test program.
>
> -Kurt

ioat(4) looks cool.  But the man page is vague on a few points.  Do
you know the answers to these questions?
* What happened to ioatcontrol(8)?  It's reference by the man page,
but doesn't exist anywhere.
* In what context are callbacks called?  Are they called from a signal
handler, or in a separate thread, or something else?
* Why isn't ioat.h installed?
* Are "interrupts" synonymous with callbacks?
* Do you have a rough idea for about the minimum buffer size that
makes sense to use with ioat?

-Alan


More information about the freebsd-hackers mailing list