Skip to content

Commit 486088b

Browse files
committed
Merge tag 'standardize-docs' of git://git.lwn.net/linux
Pull documentation format standardization from Jonathan Corbet: "This series converts a number of top-level documents to the RST format without incorporating them into the Sphinx tree. The hope is to bring some uniformity to kernel documentation and, perhaps more importantly, have our existing docs serve as an example of the desired formatting for those that will be added later. Mauro has gone through and fixed up a lot of top-level documentation files to make them conform to the RST format, but without moving or renaming them in any way. This will help when we incorporate the ones we want to keep into the Sphinx doctree, but the real purpose is to bring a bit of uniformity to our documentation and let the top-level docs serve as examples for those writing new ones" * tag 'standardize-docs' of git://git.lwn.net/linux: (84 commits) docs: kprobes.txt: Fix whitespacing tee.txt: standardize document format cgroup-v2.txt: standardize document format dell_rbu.txt: standardize document format zorro.txt: standardize document format xz.txt: standardize document format xillybus.txt: standardize document format vfio.txt: standardize document format vfio-mediated-device.txt: standardize document format unaligned-memory-access.txt: standardize document format this_cpu_ops.txt: standardize document format svga.txt: standardize document format static-keys.txt: standardize document format smsc_ece1099.txt: standardize document format SM501.txt: standardize document format siphash.txt: standardize document format sgi-ioc4.txt: standardize document format SAK.txt: standardize document format rpmsg.txt: standardize document format robust-futexes.txt: standardize document format ...
2 parents 52f6c58 + 43e5f7e commit 486088b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

81 files changed

+6263
-4731
lines changed

Documentation/DMA-API-HOWTO.txt

Lines changed: 88 additions & 65 deletions
Large diffs are not rendered by default.

Documentation/DMA-API.txt

Lines changed: 329 additions & 251 deletions
Large diffs are not rendered by default.

Documentation/DMA-ISA-LPC.txt

Lines changed: 36 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,20 @@
1-
DMA with ISA and LPC devices
2-
============================
1+
============================
2+
DMA with ISA and LPC devices
3+
============================
34

4-
Pierre Ossman <[email protected]>
5+
:Author: Pierre Ossman <[email protected]>
56

67
This document describes how to do DMA transfers using the old ISA DMA
78
controller. Even though ISA is more or less dead today the LPC bus
89
uses the same DMA system so it will be around for quite some time.
910

10-
Part I - Headers and dependencies
11-
---------------------------------
11+
Headers and dependencies
12+
------------------------
1213

13-
To do ISA style DMA you need to include two headers:
14+
To do ISA style DMA you need to include two headers::
1415

15-
#include <linux/dma-mapping.h>
16-
#include <asm/dma.h>
16+
#include <linux/dma-mapping.h>
17+
#include <asm/dma.h>
1718

1819
The first is the generic DMA API used to convert virtual addresses to
1920
bus addresses (see Documentation/DMA-API.txt for details).
@@ -23,8 +24,8 @@ this is not present on all platforms make sure you construct your
2324
Kconfig to be dependent on ISA_DMA_API (not ISA) so that nobody tries
2425
to build your driver on unsupported platforms.
2526

26-
Part II - Buffer allocation
27-
---------------------------
27+
Buffer allocation
28+
-----------------
2829

2930
The ISA DMA controller has some very strict requirements on which
3031
memory it can access so extra care must be taken when allocating
@@ -47,8 +48,8 @@ __GFP_RETRY_MAYFAIL and __GFP_NOWARN to make the allocator try a bit harder.
4748
(This scarcity also means that you should allocate the buffer as
4849
early as possible and not release it until the driver is unloaded.)
4950

50-
Part III - Address translation
51-
------------------------------
51+
Address translation
52+
-------------------
5253

5354
To translate the virtual address to a bus address, use the normal DMA
5455
API. Do _not_ use isa_virt_to_phys() even though it does the same
@@ -61,8 +62,8 @@ Note: x86_64 had a broken DMA API when it came to ISA but has since
6162
been fixed. If your arch has problems then fix the DMA API instead of
6263
reverting to the ISA functions.
6364

64-
Part IV - Channels
65-
------------------
65+
Channels
66+
--------
6667

6768
A normal ISA DMA controller has 8 channels. The lower four are for
6869
8-bit transfers and the upper four are for 16-bit transfers.
@@ -80,8 +81,8 @@ The ability to use 16-bit or 8-bit transfers is _not_ up to you as a
8081
driver author but depends on what the hardware supports. Check your
8182
specs or test different channels.
8283

83-
Part V - Transfer data
84-
----------------------
84+
Transfer data
85+
-------------
8586

8687
Now for the good stuff, the actual DMA transfer. :)
8788

@@ -112,37 +113,37 @@ Once the DMA transfer is finished (or timed out) you should disable
112113
the channel again. You should also check get_dma_residue() to make
113114
sure that all data has been transferred.
114115

115-
Example:
116+
Example::
116117

117-
int flags, residue;
118+
int flags, residue;
118119

119-
flags = claim_dma_lock();
120+
flags = claim_dma_lock();
120121

121-
clear_dma_ff();
122+
clear_dma_ff();
122123

123-
set_dma_mode(channel, DMA_MODE_WRITE);
124-
set_dma_addr(channel, phys_addr);
125-
set_dma_count(channel, num_bytes);
124+
set_dma_mode(channel, DMA_MODE_WRITE);
125+
set_dma_addr(channel, phys_addr);
126+
set_dma_count(channel, num_bytes);
126127

127-
dma_enable(channel);
128+
dma_enable(channel);
128129

129-
release_dma_lock(flags);
130+
release_dma_lock(flags);
130131

131-
while (!device_done());
132+
while (!device_done());
132133

133-
flags = claim_dma_lock();
134+
flags = claim_dma_lock();
134135

135-
dma_disable(channel);
136+
dma_disable(channel);
136137

137-
residue = dma_get_residue(channel);
138-
if (residue != 0)
139-
printk(KERN_ERR "driver: Incomplete DMA transfer!"
140-
" %d bytes left!\n", residue);
138+
residue = dma_get_residue(channel);
139+
if (residue != 0)
140+
printk(KERN_ERR "driver: Incomplete DMA transfer!"
141+
" %d bytes left!\n", residue);
141142

142-
release_dma_lock(flags);
143+
release_dma_lock(flags);
143144

144-
Part VI - Suspend/resume
145-
------------------------
145+
Suspend/resume
146+
--------------
146147

147148
It is the driver's responsibility to make sure that the machine isn't
148149
suspended while a DMA transfer is in progress. Also, all DMA settings

Documentation/DMA-attributes.txt

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
DMA attributes
2-
==============
1+
==============
2+
DMA attributes
3+
==============
34

45
This document describes the semantics of the DMA attributes that are
56
defined in linux/dma-mapping.h.
@@ -108,6 +109,7 @@ This is a hint to the DMA-mapping subsystem that it's probably not worth
108109
the time to try to allocate memory to in a way that gives better TLB
109110
efficiency (AKA it's not worth trying to build the mapping out of larger
110111
pages). You might want to specify this if:
112+
111113
- You know that the accesses to this memory won't thrash the TLB.
112114
You might know that the accesses are likely to be sequential or
113115
that they aren't sequential but it's unlikely you'll ping-pong
@@ -121,11 +123,12 @@ pages). You might want to specify this if:
121123
the mapping to have a short lifetime then it may be worth it to
122124
optimize allocation (avoid coming up with large pages) instead of
123125
getting the slight performance win of larger pages.
126+
124127
Setting this hint doesn't guarantee that you won't get huge pages, but it
125128
means that we won't try quite as hard to get them.
126129

127-
NOTE: At the moment DMA_ATTR_ALLOC_SINGLE_PAGES is only implemented on ARM,
128-
though ARM64 patches will likely be posted soon.
130+
.. note:: At the moment DMA_ATTR_ALLOC_SINGLE_PAGES is only implemented on ARM,
131+
though ARM64 patches will likely be posted soon.
129132

130133
DMA_ATTR_NO_WARN
131134
----------------
@@ -142,10 +145,10 @@ problem at all, depending on the implementation of the retry mechanism.
142145
So, this provides a way for drivers to avoid those error messages on calls
143146
where allocation failures are not a problem, and shouldn't bother the logs.
144147

145-
NOTE: At the moment DMA_ATTR_NO_WARN is only implemented on PowerPC.
148+
.. note:: At the moment DMA_ATTR_NO_WARN is only implemented on PowerPC.
146149

147150
DMA_ATTR_PRIVILEGED
148-
------------------------------
151+
-------------------
149152

150153
Some advanced peripherals such as remote processors and GPUs perform
151154
accesses to DMA buffers in both privileged "supervisor" and unprivileged

0 commit comments

Comments
 (0)