dma-debug: check scatterlist segments
Drivers/subsystems creating scatterlists for DMA should be taking care to respect the scatter-gather limitations of the appropriate device, as described by dma_parms. A DMA API implementation cannot feasibly split a scatterlist into *more* entries than originally passed, so it is not well defined what they should do when given a segment larger than the limit they are also required to respect. Conversely, devices which are less limited than the rather conservative defaults, or indeed have no limitations at all (e.g. GPUs with their own internal MMU), should be encouraged to set appropriate dma_parms, as they may get more efficient DMA mapping performance out of it. Signed-off-by: Robin Murphy <robin.murphy@arm.com> Signed-off-by: Christoph Hellwig <hch@lst.de>
This commit is contained in:

committed by
Christoph Hellwig

parent
7f5c1ea3b7
commit
78c47830a5
@@ -1651,6 +1651,23 @@ config DMA_API_DEBUG
|
||||
|
||||
If unsure, say N.
|
||||
|
||||
config DMA_API_DEBUG_SG
|
||||
bool "Debug DMA scatter-gather usage"
|
||||
default y
|
||||
depends on DMA_API_DEBUG
|
||||
help
|
||||
Perform extra checking that callers of dma_map_sg() have respected the
|
||||
appropriate segment length/boundary limits for the given device when
|
||||
preparing DMA scatterlists.
|
||||
|
||||
This is particularly likely to have been overlooked in cases where the
|
||||
dma_map_sg() API is used for general bulk mapping of pages rather than
|
||||
preparing literal scatter-gather descriptors, where there is a risk of
|
||||
unexpected behaviour from DMA API implementations if the scatterlist
|
||||
is technically out-of-spec.
|
||||
|
||||
If unsure, say N.
|
||||
|
||||
menuconfig RUNTIME_TESTING_MENU
|
||||
bool "Runtime Testing"
|
||||
def_bool y
|
||||
|
Reference in New Issue
Block a user