Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

dmaengine: Add support for per channel coherency handling

If the DMA device supports per channel coherency configuration (a channel
can be configured to have coherent or not coherent view) then a single
device (the DMA controller's device) can not be used for dma_api for all
channels as channels can have different coherency.

Introduce custom_dma_mapping flag for the dma_chan and a new helper to get
the device pointer to be used for dma_api for the given channel.

Client drivers should be updated to be able to support per channel
coherency by:

- dma_map_single(chan->device->dev, ptr, size, DMA_TO_DEVICE);
+ struct device *dma_dev = dmaengine_get_dma_device(chan);
+
+ dma_map_single(dma_dev, ptr, size, DMA_TO_DEVICE);

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Link: https://lore.kernel.org/r/20201208090440.31792-9-peter.ujfalusi@ti.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>

authored by

Peter Ujfalusi and committed by
Vinod Koul
ab650ef6 4f910c03

+12
+12
include/linux/dmaengine.h
··· 357 357 * @chan: driver channel device 358 358 * @device: sysfs device 359 359 * @dev_id: parent dma_device dev_id 360 + * @chan_dma_dev: The channel is using custom/different dma-mapping 361 + * compared to the parent dma_device 360 362 */ 361 363 struct dma_chan_dev { 362 364 struct dma_chan *chan; 363 365 struct device device; 364 366 int dev_id; 367 + bool chan_dma_dev; 365 368 }; 366 369 367 370 /** ··· 1621 1618 return "invalid"; 1622 1619 } 1623 1620 } 1621 + 1622 + static inline struct device *dmaengine_get_dma_device(struct dma_chan *chan) 1623 + { 1624 + if (chan->dev->chan_dma_dev) 1625 + return &chan->dev->device; 1626 + 1627 + return chan->device->dev; 1628 + } 1629 + 1624 1630 #endif /* DMAENGINE_H */