xref: /freebsd/share/man/man4/ioat.4 (revision 6ca07079afcad5a0129c4bcf2662131fde11d823)
1e974f91cSConrad Meyer.\" Copyright (c) 2015 EMC / Isilon Storage Division
2e974f91cSConrad Meyer.\" All rights reserved.
3e974f91cSConrad Meyer.\"
4e974f91cSConrad Meyer.\" Redistribution and use in source and binary forms, with or without
5e974f91cSConrad Meyer.\" modification, are permitted provided that the following conditions
6e974f91cSConrad Meyer.\" are met:
7e974f91cSConrad Meyer.\" 1. Redistributions of source code must retain the above copyright
8e974f91cSConrad Meyer.\"    notice, this list of conditions and the following disclaimer.
9e974f91cSConrad Meyer.\" 2. Redistributions in binary form must reproduce the above copyright
10e974f91cSConrad Meyer.\"    notice, this list of conditions and the following disclaimer in the
11e974f91cSConrad Meyer.\"    documentation and/or other materials provided with the distribution.
12e974f91cSConrad Meyer.\"
13e974f91cSConrad Meyer.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
14e974f91cSConrad Meyer.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15e974f91cSConrad Meyer.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16e974f91cSConrad Meyer.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
17e974f91cSConrad Meyer.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18e974f91cSConrad Meyer.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19e974f91cSConrad Meyer.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20e974f91cSConrad Meyer.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21e974f91cSConrad Meyer.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22e974f91cSConrad Meyer.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23e974f91cSConrad Meyer.\" SUCH DAMAGE.
24e974f91cSConrad Meyer.\"
25e974f91cSConrad Meyer.\" $FreeBSD$
26e974f91cSConrad Meyer.\"
27*6ca07079SConrad Meyer.Dd January 14, 2016
28e974f91cSConrad Meyer.Dt IOAT 4
29e974f91cSConrad Meyer.Os
30e974f91cSConrad Meyer.Sh NAME
31e974f91cSConrad Meyer.Nm I/OAT
32e974f91cSConrad Meyer.Nd Intel I/O Acceleration Technology
33e974f91cSConrad Meyer.Sh SYNOPSIS
34faefad9cSConrad MeyerTo compile this driver into your kernel,
35faefad9cSConrad Meyerplace the following line in your kernel configuration file:
36faefad9cSConrad Meyer.Bd -ragged -offset indent
37e974f91cSConrad Meyer.Cd "device ioat"
38faefad9cSConrad Meyer.Ed
39faefad9cSConrad Meyer.Pp
40faefad9cSConrad MeyerOr, to load the driver as a module at boot, place the following line in
41faefad9cSConrad Meyer.Xr loader.conf 5 :
42faefad9cSConrad Meyer.Bd -literal -offset indent
43faefad9cSConrad Meyerioat_load="YES"
44faefad9cSConrad Meyer.Ed
45faefad9cSConrad Meyer.Pp
46e974f91cSConrad MeyerIn
47e974f91cSConrad Meyer.Xr loader.conf 5 :
48e974f91cSConrad Meyer.Pp
49e974f91cSConrad Meyer.Cd hw.ioat.force_legacy_interrupts=0
50e974f91cSConrad Meyer.Pp
51e974f91cSConrad MeyerIn
52e974f91cSConrad Meyer.Xr loader.conf 5 or
53e974f91cSConrad Meyer.Xr sysctl.conf 5 :
54e974f91cSConrad Meyer.Pp
55e974f91cSConrad Meyer.Cd hw.ioat.enable_ioat_test=0
56e974f91cSConrad Meyer.Cd hw.ioat.debug_level=0
57e974f91cSConrad Meyer(only critical errors; maximum of 3)
58e974f91cSConrad Meyer.Pp
59e974f91cSConrad Meyer.Ft typedef void
60faefad9cSConrad Meyer.Fn (*bus_dmaengine_callback_t) "void *arg" "int error"
61e974f91cSConrad Meyer.Pp
62e974f91cSConrad Meyer.Ft bus_dmaengine_t
63e974f91cSConrad Meyer.Fn ioat_get_dmaengine "uint32_t channel_index"
64e974f91cSConrad Meyer.Ft void
65faefad9cSConrad Meyer.Fn ioat_put_dmaengine "bus_dmaengine_t dmaengine"
665ca9fc2aSConrad Meyer.Ft int
6731bf2875SConrad Meyer.Fn ioat_get_hwversion "bus_dmaengine_t dmaengine"
68bd81fe68SConrad Meyer.Ft size_t
69bd81fe68SConrad Meyer.Fn ioat_get_max_io_size "bus_dmaengine_t dmaengine"
7031bf2875SConrad Meyer.Ft int
715ca9fc2aSConrad Meyer.Fn ioat_set_interrupt_coalesce "bus_dmaengine_t dmaengine" "uint16_t delay"
725ca9fc2aSConrad Meyer.Ft uint16_t
735ca9fc2aSConrad Meyer.Fn ioat_get_max_coalesce_period "bus_dmaengine_t dmaengine"
74faefad9cSConrad Meyer.Ft void
75e974f91cSConrad Meyer.Fn ioat_acquire "bus_dmaengine_t dmaengine"
761502e363SConrad Meyer.Ft int
771502e363SConrad Meyer.Fn ioat_acquire_reserve "bus_dmaengine_t dmaengine" "uint32_t n" "int mflags"
78e974f91cSConrad Meyer.Ft void
79e974f91cSConrad Meyer.Fn ioat_release "bus_dmaengine_t dmaengine"
80e974f91cSConrad Meyer.Ft struct bus_dmadesc *
81e974f91cSConrad Meyer.Fo ioat_copy
82e974f91cSConrad Meyer.Fa "bus_dmaengine_t dmaengine"
83e974f91cSConrad Meyer.Fa "bus_addr_t dst"
84e974f91cSConrad Meyer.Fa "bus_addr_t src"
85e974f91cSConrad Meyer.Fa "bus_size_t len"
86e974f91cSConrad Meyer.Fa "bus_dmaengine_callback_t callback_fn"
87e974f91cSConrad Meyer.Fa "void *callback_arg"
88e974f91cSConrad Meyer.Fa "uint32_t flags"
89e974f91cSConrad Meyer.Fc
90e974f91cSConrad Meyer.Ft struct bus_dmadesc *
919950fde0SConrad Meyer.Fo ioat_copy_8k_aligned
929950fde0SConrad Meyer.Fa "bus_dmaengine_t dmaengine"
939950fde0SConrad Meyer.Fa "bus_addr_t dst1"
949950fde0SConrad Meyer.Fa "bus_addr_t dst2"
959950fde0SConrad Meyer.Fa "bus_addr_t src1"
969950fde0SConrad Meyer.Fa "bus_addr_t src2"
979950fde0SConrad Meyer.Fa "bus_dmaengine_callback_t callback_fn"
989950fde0SConrad Meyer.Fa "void *callback_arg"
999950fde0SConrad Meyer.Fa "uint32_t flags"
1009950fde0SConrad Meyer.Fc
1019950fde0SConrad Meyer.Ft struct bus_dmadesc *
102faefad9cSConrad Meyer.Fo ioat_blockfill
103faefad9cSConrad Meyer.Fa "bus_dmaengine_t dmaengine"
104faefad9cSConrad Meyer.Fa "bus_addr_t dst"
105faefad9cSConrad Meyer.Fa "uint64_t fillpattern"
106faefad9cSConrad Meyer.Fa "bus_size_t len"
107faefad9cSConrad Meyer.Fa "bus_dmaengine_callback_t callback_fn"
108faefad9cSConrad Meyer.Fa "void *callback_arg"
109faefad9cSConrad Meyer.Fa "uint32_t flags"
110faefad9cSConrad Meyer.Fc
111faefad9cSConrad Meyer.Ft struct bus_dmadesc *
112e974f91cSConrad Meyer.Fo ioat_null
113e974f91cSConrad Meyer.Fa "bus_dmaengine_t dmaengine"
114e974f91cSConrad Meyer.Fa "bus_dmaengine_callback_t callback_fn"
115e974f91cSConrad Meyer.Fa "void *callback_arg"
116e974f91cSConrad Meyer.Fa "uint32_t flags"
117e974f91cSConrad Meyer.Fc
118e974f91cSConrad Meyer.Sh DESCRIPTION
119e974f91cSConrad MeyerThe
120e974f91cSConrad Meyer.Nm
121e974f91cSConrad Meyerdriver provides a kernel API to a variety of DMA engines on some Intel server
122e974f91cSConrad Meyerplatforms.
123e974f91cSConrad Meyer.Pp
124e974f91cSConrad MeyerThere is a number of DMA channels per CPU package.
125e974f91cSConrad Meyer(Typically 4 or 8.)
126e974f91cSConrad MeyerEach may be used independently.
127e974f91cSConrad MeyerOperations on a single channel proceed sequentially.
128e974f91cSConrad Meyer.Pp
129faefad9cSConrad MeyerBlockfill operations can be used to write a 64-bit pattern to memory.
130faefad9cSConrad Meyer.Pp
131faefad9cSConrad MeyerCopy operations can be used to offload memory copies to the DMA engines.
132e974f91cSConrad Meyer.Pp
133e974f91cSConrad MeyerNull operations do nothing, but may be used to test the interrupt and callback
134e974f91cSConrad Meyermechanism.
135e974f91cSConrad Meyer.Pp
136e974f91cSConrad MeyerAll operations can optionally trigger an interrupt at completion with the
137*6ca07079SConrad Meyer.Ar DMA_INT_EN
138e974f91cSConrad Meyerflag.
139e974f91cSConrad MeyerFor example, a user might submit multiple operations to the same channel and
140e974f91cSConrad Meyeronly enable an interrupt and callback for the last operation.
141faefad9cSConrad Meyer.Pp
1425ca9fc2aSConrad MeyerThe hardware can delay and coalesce interrupts on a given channel for a
1435ca9fc2aSConrad Meyerconfigurable period of time, in microseconds.
1445ca9fc2aSConrad MeyerThis may be desired to reduce the processing and interrupt overhead per
1455ca9fc2aSConrad Meyerdescriptor, especially for workflows consisting of many small operations.
1465ca9fc2aSConrad MeyerSoftware can control this on a per-channel basis with the
1475ca9fc2aSConrad Meyer.Fn ioat_set_interrupt_coalesce
1485ca9fc2aSConrad MeyerAPI.
1495ca9fc2aSConrad MeyerThe
1505ca9fc2aSConrad Meyer.Fn ioat_get_max_coalesce_period
1515ca9fc2aSConrad MeyerAPI can be used to determine the maximum coalescing period supported by the
1525ca9fc2aSConrad Meyerhardware, in microseconds.
1535ca9fc2aSConrad MeyerCurrent platforms support up to a 16.383 millisecond coalescing period.
1545ca9fc2aSConrad MeyerOptimal configuration will vary by workflow and desired operation latency.
1555ca9fc2aSConrad Meyer.Pp
156faefad9cSConrad MeyerAll operations are safe to use in a non-blocking context with the
157faefad9cSConrad Meyer.Ar DMA_NO_WAIT
158faefad9cSConrad Meyerflag.
159faefad9cSConrad Meyer(Of course, allocations may fail and operations requested with
160faefad9cSConrad Meyer.Ar DMA_NO_WAIT
161faefad9cSConrad Meyermay return NULL.)
162faefad9cSConrad Meyer.Pp
163*6ca07079SConrad MeyerOperations that depend on the result of prior operations should use
164*6ca07079SConrad Meyer.Ar DMA_FENCE .
165*6ca07079SConrad MeyerFor example, such a scenario can happen when two related DMA operations are
166*6ca07079SConrad Meyerqueued.
167*6ca07079SConrad MeyerFirst, a DMA copy to one location (A), followed directly by a DMA copy
168*6ca07079SConrad Meyerfrom A to B.
169*6ca07079SConrad MeyerIn this scenario, some classes of I/OAT hardware may prefetch A for the second
170*6ca07079SConrad Meyeroperation before it is written by the first operation.
171*6ca07079SConrad MeyerTo avoid reading a stale value in sequences of dependent operations, use
172*6ca07079SConrad Meyer.Ar DMA_FENCE .
173*6ca07079SConrad Meyer.Pp
174faefad9cSConrad MeyerAll operations, as well as
175faefad9cSConrad Meyer.Fn ioat_get_dmaengine ,
176faefad9cSConrad Meyercan return NULL in special circumstances.
177faefad9cSConrad MeyerFor example, if the
178faefad9cSConrad Meyer.Nm
179faefad9cSConrad Meyerdriver is being unloaded, or the administrator has induced a hardware reset, or
180faefad9cSConrad Meyera usage error has resulted in a hardware error state that needs to be recovered
181faefad9cSConrad Meyerfrom.
182faefad9cSConrad Meyer.Pp
183faefad9cSConrad MeyerIt is invalid to attempt to submit new DMA operations in a
184faefad9cSConrad Meyer.Fa bus_dmaengine_callback_t
185faefad9cSConrad Meyercontext.
186e974f91cSConrad Meyer.Sh USAGE
187e974f91cSConrad MeyerA typical user will lookup the DMA engine object for a given channel with
188e974f91cSConrad Meyer.Fn ioat_get_dmaengine .
189e974f91cSConrad MeyerWhen the user wants to offload a copy, they will first
190e974f91cSConrad Meyer.Fn ioat_acquire
191e974f91cSConrad Meyerthe
192e974f91cSConrad Meyer.Ar bus_dmaengine_t
193e974f91cSConrad Meyerobject for exclusive access to enqueue operations on that channel.
1941502e363SConrad MeyerOptionally, the user can reserve space by using
1951502e363SConrad Meyer.Fn ioat_acquire_reserve
1961502e363SConrad Meyerinstead.
1971502e363SConrad MeyerIf
1981502e363SConrad Meyer.Fn ioat_acquire_reserve
1991502e363SConrad Meyersucceeds, there is guaranteed to be room for
2001502e363SConrad Meyer.Fa N
2011502e363SConrad Meyernew operations in the internal ring buffer.
202e974f91cSConrad MeyerThen, they will submit one or more operations using
203faefad9cSConrad Meyer.Fn ioat_blockfill ,
204faefad9cSConrad Meyer.Fn ioat_copy ,
205e974f91cSConrad Meyeror
206e974f91cSConrad Meyer.Fn ioat_null .
2079950fde0SConrad MeyerAfter queuing one or more individual DMA operations, they will
208e974f91cSConrad Meyer.Fn ioat_release
209e974f91cSConrad Meyerthe
210e974f91cSConrad Meyer.Ar bus_dmaengine_t
211e974f91cSConrad Meyerto drop their exclusive access to the channel.
212e974f91cSConrad MeyerThe routine they provided for the
213e974f91cSConrad Meyer.Fa callback_fn
214e974f91cSConrad Meyerargument will be invoked with the provided
215e974f91cSConrad Meyer.Fa callback_arg
216e974f91cSConrad Meyerwhen the operation is complete.
217faefad9cSConrad MeyerWhen they are finished with the
218faefad9cSConrad Meyer.Ar bus_dmaengine_t ,
219faefad9cSConrad Meyerthe user should
220faefad9cSConrad Meyer.Fn ioat_put_dmaengine .
221faefad9cSConrad Meyer.Pp
222faefad9cSConrad MeyerUsers MUST NOT block between
223faefad9cSConrad Meyer.Fn ioat_acquire
224faefad9cSConrad Meyerand
225faefad9cSConrad Meyer.Fn ioat_release .
226faefad9cSConrad MeyerUsers SHOULD NOT hold
227faefad9cSConrad Meyer.Ar bus_dmaengine_t
228faefad9cSConrad Meyerreferences for a very long time to enable fault recovery and kernel module
229faefad9cSConrad Meyerunload.
230e974f91cSConrad Meyer.Pp
231e974f91cSConrad MeyerFor an example of usage, see
232e974f91cSConrad Meyer.Pa src/sys/dev/ioat/ioat_test.c .
233e974f91cSConrad Meyer.Sh FILES
234280186c7SChristian Brueffer.Bl -tag
235e974f91cSConrad Meyer.It Pa /dev/ioat_test
236e974f91cSConrad Meyertest device for
237e974f91cSConrad Meyer.Xr ioatcontrol 8
238e974f91cSConrad Meyer.El
239e974f91cSConrad Meyer.Sh SEE ALSO
240e974f91cSConrad Meyer.Xr ioatcontrol 8
241e974f91cSConrad Meyer.Sh HISTORY
242e974f91cSConrad MeyerThe
243e974f91cSConrad Meyer.Nm
244e974f91cSConrad Meyerdriver first appeared in
245e974f91cSConrad Meyer.Fx 11.0 .
246e974f91cSConrad Meyer.Sh AUTHORS
247e974f91cSConrad MeyerThe
248e974f91cSConrad Meyer.Nm
249e974f91cSConrad Meyerdriver was developed by
250e974f91cSConrad Meyer.An \&Jim Harris Aq Mt jimharris@FreeBSD.org ,
251faefad9cSConrad Meyer.An \&Carl Delsey Aq Mt carl.r.delsey@intel.com ,
252e974f91cSConrad Meyerand
253faefad9cSConrad Meyer.An \&Conrad Meyer Aq Mt cem@FreeBSD.org .
254e974f91cSConrad MeyerThis manual page was written by
255e974f91cSConrad Meyer.An \&Conrad Meyer Aq Mt cem@FreeBSD.org .
256e974f91cSConrad Meyer.Sh CAVEATS
257e974f91cSConrad MeyerCopy operation takes bus addresses as parameters, not virtual addresses.
258e974f91cSConrad Meyer.Pp
259faefad9cSConrad MeyerBuffers for individual copy operations must be physically contiguous.
260faefad9cSConrad Meyer.Pp
261faefad9cSConrad MeyerCopies larger than max transfer size (1MB, but may vary by hardware) are not
262faefad9cSConrad Meyersupported.
263e974f91cSConrad MeyerFuture versions will likely support this by breaking up the transfer into
264e974f91cSConrad Meyersmaller sizes.
265e974f91cSConrad Meyer.Sh BUGS
266e974f91cSConrad MeyerThe
267e974f91cSConrad Meyer.Nm
268faefad9cSConrad Meyerdriver only supports blockfill, copy, and null operations at this time.
269e974f91cSConrad MeyerThe driver does not yet support advanced DMA modes, such as XOR, that some
270e974f91cSConrad MeyerI/OAT devices support.
271