Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 14 Dec 2018 16:57:09 -0700
From:      Alan Somers <asomers@freebsd.org>
To:        Kurt Lidl <lidl@pix.net>
Cc:        Warner Losh <imp@bsdimp.com>, Rajesh Kumar <rajfbsd@gmail.com>,  "freebsd-hackers@freebsd.org" <freebsd-hackers@freebsd.org>, freebsd-drivers@freebsd.org
Subject:   Re: How to use the DMA Engine in FreeBSD?
Message-ID:  <CAOtMX2ih2kUUBoa4h7cp7kwjODF=gwAmOfwbvh14MV5dx2-nWw@mail.gmail.com>
In-Reply-To: <c98d4aff-851c-1e38-ed64-1f58e0adc9df@pix.net>
References:  <CAAO%2BANOty8FeOR7VQdXmxWy5y288pm=Q4cswHJ1BbgT2h1cUWg@mail.gmail.com> <CANCZdfrEv9o6_ydp9Qe73O1v6NqHFtivHpw4m2PKhTyAVaPR9g@mail.gmail.com> <26df913b-a2f8-2709-1cec-d11ad7d113a8@pix.net> <CAOtMX2jXMz3D8_JvOk4M2DrEZDP8sztgy2bdBuv-yNwz9zR2JQ@mail.gmail.com> <c98d4aff-851c-1e38-ed64-1f58e0adc9df@pix.net>

next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, Dec 14, 2018 at 4:04 PM Kurt Lidl <lidl@pix.net> wrote:
>
> On 12/14/18 11:09 AM, Alan Somers wrote:
> > On Fri, Dec 14, 2018 at 8:36 AM Kurt Lidl <lidl@pix.net> wrote:
> >>
> >> On 12/13/18 10:53 AM, Warner Losh wrote:
> >>> On Thu, Dec 13, 2018, 3:04 AM Rajesh Kumar <rajfbsd@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.
>
> root@busybox: locate ioatcontrol
> /usr/src/tools/tools/ioat/ioatcontrol.8
> /usr/src/tools/tools/ioat/ioatcontrol.c
>
> > * In what context are callbacks called?  Are they called from a signal
> > handler, or in a separate thread, or something else?
>
> I don't know.
>
> > * Why isn't ioat.h installed?
>
> I don't know that either, but it is in the source tree:
>
> root@busybox: locate ioat.h
> /usr/src/sys/dev/ioat/ioat.h
>
> > * Are "interrupts" synonymous with callbacks?
> > * Do you have a rough idea for about the minimum buffer size that
> > makes sense to use with ioat?
>
> I don't know that either -- I was mostly just pointing out that the
> facility and driver existed for (some) Intel server hardware.  Mostly
> I'm aware of this because I was surprised when a machine I using this
> summer started reporting this hardware, and I wasn't familiar with it.
>
> Good luck.
>
> -Kurt

Oh, I see.  ioat(4) can't be used from userland at all.  It's strictly
an in-kernel API.  The man page should probably be moved to section 9.
I'll take it up with cem.
-Alan



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAOtMX2ih2kUUBoa4h7cp7kwjODF=gwAmOfwbvh14MV5dx2-nWw>