@@ -92,13 +92,20 @@ for alignment, like queue heads needing to be aligned on N-byte boundaries.
9292Part Ic - DMA addressing limitations
9393------------------------------------
9494
95+ DMA mask is a bit mask of the addressable region for the device. In other words,
96+ if applying the DMA mask (a bitwise AND operation) to the DMA address of a
97+ memory region does not clear any bits in the address, then the device can
98+ perform DMA to that memory region.
99+
100+ All the below functions which set a DMA mask may fail if the requested mask
101+ cannot be used with the device, or if the device is not capable of doing DMA.
102+
95103::
96104
97105 int
98106 dma_set_mask_and_coherent(struct device *dev, u64 mask)
99107
100- Checks to see if the mask is possible and updates the device
101- streaming and coherent DMA mask parameters if it is.
108+ Updates both streaming and coherent DMA masks.
102109
103110Returns: 0 if successful and a negative error if not.
104111
@@ -107,8 +114,7 @@ Returns: 0 if successful and a negative error if not.
107114 int
108115 dma_set_mask(struct device *dev, u64 mask)
109116
110- Checks to see if the mask is possible and updates the device
111- parameters if it is.
117+ Updates only the streaming DMA mask.
112118
113119Returns: 0 if successful and a negative error if not.
114120
@@ -117,8 +123,7 @@ Returns: 0 if successful and a negative error if not.
117123 int
118124 dma_set_coherent_mask(struct device *dev, u64 mask)
119125
120- Checks to see if the mask is possible and updates the device
121- parameters if it is.
126+ Updates only the coherent DMA mask.
122127
123128Returns: 0 if successful and a negative error if not.
124129
@@ -173,7 +178,7 @@ transfer memory ownership. Returns %false if those calls can be skipped.
173178 unsigned long
174179 dma_get_merge_boundary(struct device *dev);
175180
176- Returns the DMA merge boundary. If the device cannot merge any the DMA address
181+ Returns the DMA merge boundary. If the device cannot merge any DMA address
177182segments, the function returns 0.
178183
179184Part Id - Streaming DMA mappings
@@ -207,16 +212,12 @@ DMA_BIDIRECTIONAL direction isn't known
207212 this API should be obtained from sources which guarantee it to be
208213 physically contiguous (like kmalloc).
209214
210- Further, the DMA address of the memory must be within the
211- dma_mask of the device (the dma_mask is a bit mask of the
212- addressable region for the device, i.e., if the DMA address of
213- the memory ANDed with the dma_mask is still equal to the DMA
214- address, then the device can perform DMA to the memory). To
215- ensure that the memory allocated by kmalloc is within the dma_mask,
216- the driver may specify various platform-dependent flags to restrict
217- the DMA address range of the allocation (e.g., on x86, GFP_DMA
218- guarantees to be within the first 16MB of available DMA addresses,
219- as required by ISA devices).
215+ Further, the DMA address of the memory must be within the dma_mask of
216+ the device. To ensure that the memory allocated by kmalloc is within
217+ the dma_mask, the driver may specify various platform-dependent flags
218+ to restrict the DMA address range of the allocation (e.g., on x86,
219+ GFP_DMA guarantees to be within the first 16MB of available DMA
220+ addresses, as required by ISA devices).
220221
221222 Note also that the above constraints on physical contiguity and
222223 dma_mask may not apply if the platform has an IOMMU (a device which
0 commit comments