From owner-freebsd-hackers@freebsd.org Sat Dec 15 01:02:24 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 0EDF81327C11; Sat, 15 Dec 2018 01:02:24 +0000 (UTC) (envelope-from asomers@gmail.com) Received: from mail-lj1-f196.google.com (mail-lj1-f196.google.com [209.85.208.196]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7C9DD73C45; Sat, 15 Dec 2018 01:02:23 +0000 (UTC) (envelope-from asomers@gmail.com) Received: by mail-lj1-f196.google.com with SMTP id e5-v6so6408691lja.4; Fri, 14 Dec 2018 17:02:23 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=YksFTx6dp36biHe3ZqVMIxRi4GshjX65ibeFAbvHzfY=; b=h567i4G4KICLYY+A4tASOncpzX/1BwFyCPyMa2N1MG/wnfMfDvPmS9cJQUik5ZEAlI ryP4FurOyNzZKjKQnpWZ4oPpe7mL8Pu65Z2VX0GEB4ZYgy+RiJQxYrXgCJ++RJlJAfRy ee4vqOr5BW3xd7/SD0LdKnrdC1Cs+I7K/gt14hwu6vy9jmWx2jaEPZlBtM5p3pACStH8 HV12bdhxXaKpepNBMzLHdIdHfNLPDDFr2l/GLqThLEXch2GkYBj2JIxpNquhH4sP29oB vXEBLQZW02vTD+eyue6F5n+V/1J/VuE8EG+D9IJkNHKLEw+N0Vt0YIOvehqvQ8XhTPko bRhA== X-Gm-Message-State: AA+aEWaNTy8x3R5p5e5CnyqgJ1cHg1ksYwJK4qzTSPXtNFsjgkre9HmJ E7FWCp8WPsAIVG2nFk+uf3sOaF5da2hRcQxOwvmOsA== X-Google-Smtp-Source: AFSGD/WCE+5K7BcFi8Cyl8coRf9Ci1dJ3movDX6EU4eW5/DExTIryXBDKYKIp0ZTlnqJelU5MVUGiHNyhnpofchi1QA= X-Received: by 2002:a2e:94ce:: with SMTP id r14-v6mr2635221ljh.34.1544831841853; Fri, 14 Dec 2018 15:57:21 -0800 (PST) MIME-Version: 1.0 References: <26df913b-a2f8-2709-1cec-d11ad7d113a8@pix.net> In-Reply-To: From: Alan Somers Date: Fri, 14 Dec 2018 16:57:09 -0700 Message-ID: Subject: Re: How to use the DMA Engine in FreeBSD? To: Kurt Lidl Cc: Warner Losh , Rajesh Kumar , "freebsd-hackers@freebsd.org" , freebsd-drivers@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 7C9DD73C45 X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-6.99 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.99)[-0.993,0]; REPLY(-4.00)[]; NEURAL_HAM_LONG(-1.00)[-0.997,0] 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: Sat, 15 Dec 2018 01:02:24 -0000 On Fri, Dec 14, 2018 at 4:04 PM Kurt Lidl wrote: > > 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 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