From owner-freebsd-hackers@freebsd.org Fri Dec 14 23:04:03 2018 Return-Path: Delivered-To: freebsd-hackers@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2007C132381D; Fri, 14 Dec 2018 23:04:03 +0000 (UTC) (envelope-from lidl@pix.net) Received: from hydra.pix.net (hydra.pix.net [IPv6:2001:470:e254:11::4]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mail.pix.net", Issuer "Pix.Com Technologies LLC CA" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 737FC6F8F0; Fri, 14 Dec 2018 23:04:02 +0000 (UTC) (envelope-from lidl@pix.net) Received: from torb.pix.net ([IPv6:2001:470:e254:10:702f:25e8:7b4f:59c6]) (authenticated bits=0) by hydra.pix.net (8.15.2/8.15.2) with ESMTPA id wBEN3pBB083640; Fri, 14 Dec 2018 18:03:58 -0500 (EST) (envelope-from lidl@pix.net) X-Authentication-Warning: hydra.pix.net: Host [IPv6:2001:470:e254:10:702f:25e8:7b4f:59c6] claimed to be torb.pix.net Subject: Re: How to use the DMA Engine in FreeBSD? To: Alan Somers Cc: Warner Losh , rajfbsd@gmail.com, "freebsd-hackers@freebsd.org" , freebsd-drivers@freebsd.org References: <26df913b-a2f8-2709-1cec-d11ad7d113a8@pix.net> From: Kurt Lidl Message-ID: Date: Fri, 14 Dec 2018 18:03:51 -0500 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:60.0) Gecko/20100101 Thunderbird/60.3.3 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 Dec 2018 23:04:03 -0000 On 12/14/18 11:09 AM, Alan Somers wrote: > On Fri, Dec 14, 2018 at 8:36 AM Kurt Lidl wrote: >> >> On 12/13/18 10:53 AM, Warner Losh wrote: >>> On Thu, Dec 13, 2018, 3:04 AM Rajesh Kumar >> >>>> 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