forked from torvalds/linux
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
lib/scatterlist: Provide a DMA page iterator
Commit 2db76d7 ("lib/scatterlist: sg_page_iter: support sg lists w/o backing pages") introduced the sg_page_iter_dma_address() function without providing a way to use it in the general case. If the sg_dma_len() is not equal to the sg length callers cannot safely use the for_each_sg_page/sg_page_iter_dma_address combination. Resolve this API mistake by providing a DMA specific iterator, for_each_sg_dma_page(), that uses the right length so sg_page_iter_dma_address() works as expected with all sglists. A new iterator type is introduced to provide compile-time safety against wrongly mixing accessors and iterators. Acked-by: Christoph Hellwig <[email protected]> (for scatterlist) Acked-by: Thomas Hellstrom <[email protected]> Acked-by: Sakari Ailus <[email protected]> (ipu3-cio2) Signed-off-by: Jason Gunthorpe <[email protected]>
- Loading branch information
1 parent
f368ff1
commit d901b27
Showing
5 changed files
with
76 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -311,7 +311,13 @@ static dma_addr_t __vmw_piter_dma_addr(struct vmw_piter *viter) | |
|
||
static dma_addr_t __vmw_piter_sg_addr(struct vmw_piter *viter) | ||
{ | ||
return sg_page_iter_dma_address(&viter->iter); | ||
/* | ||
* FIXME: This driver wrongly mixes DMA and CPU SG list iteration and | ||
* needs revision. See | ||
* https://lore.kernel.org/lkml/[email protected]/ | ||
*/ | ||
return sg_page_iter_dma_address( | ||
container_of(&viter->iter, struct sg_dma_page_iter, base)); | ||
} | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters