From owner-freebsd-hackers@freebsd.org Fri Dec 14 16:16:29 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 C984A133A823; Fri, 14 Dec 2018 16:16:29 +0000 (UTC) (envelope-from asomers@gmail.com) Received: from mail-lj1-f194.google.com (mail-lj1-f194.google.com [209.85.208.194]) (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 48CD384A2F; Fri, 14 Dec 2018 16:16:29 +0000 (UTC) (envelope-from asomers@gmail.com) Received: by mail-lj1-f194.google.com with SMTP id v1-v6so5395173ljd.0; Fri, 14 Dec 2018 08:16:29 -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=Jejr1c7PhunWb6ZkdwVBhQmtzlD9MaCe/Ck1w0V5Dwg=; b=jiSu97OWKztqzjVVqx7NwM9M6G8hknqWcJjta33V+gUqGWhwwpcagn3l+w50xDSE1Q 1YjKsVYTioKf7v+jfwHgpOTQMzjBXpTWlMAF0tc0Hn3vQeEFR+hP5TggJL9JrpKyW5/J wd7Beccgr5i1Lml2WgT949IcuMuAY+E5LliR1LPAmMALuv8dQjLGQIxlAvgjh3bJzNS5 43+yBhPcuATvUkm1UrGFuKQVcZvb2IldQI02fVIp3RtQbTIIHM9+GGkM1RcuOvbCxNJI IovRtpljcyLV8QqG5e9FSCU+rVVkh+h6Y2JdoXzVqwOWQu272VxjBl8l1VcgZ1f+g7AV bryA== X-Gm-Message-State: AA+aEWaj88PM60PNqBQQVbtEsqMffIQEjAWsJ0XMbA+aPHafXWUWzZ/D ySZQvrO8LFf4Qd6sTrY35O29UxqMPxT0oJBQ6B4= X-Google-Smtp-Source: AFSGD/WsMu2bPw9w1+XIV72/rjnbYssNNFytmXEiqxqw/uhw5rhUCOgaDuuPkibDlI+EMVgIoVaN/lUuVrjiCW3Bog4= X-Received: by 2002:a2e:5418:: with SMTP id i24-v6mr2414937ljb.51.1544803769469; Fri, 14 Dec 2018 08:09:29 -0800 (PST) MIME-Version: 1.0 References: <26df913b-a2f8-2709-1cec-d11ad7d113a8@pix.net> In-Reply-To: <26df913b-a2f8-2709-1cec-d11ad7d113a8@pix.net> From: Alan Somers Date: Fri, 14 Dec 2018 09:09:17 -0700 Message-ID: Subject: Re: How to use the DMA Engine in FreeBSD? To: Kurt Lidl Cc: Warner Losh , rajfbsd@gmail.com, "freebsd-hackers@freebsd.org" , freebsd-drivers@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 48CD384A2F X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-5.90 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-0.995,0]; NEURAL_HAM_SHORT(-0.90)[-0.902,0]; REPLY(-4.00)[] 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 16:16:30 -0000 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. * 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