Revert "Revert "ANDROID: dma-buf: Add support for mapping buffers with DMA attributes""

This reverts commit 9240b79354.

While the dma_map_attrs field is unused in the AOSP kernel, vendor
modules can use this field when mapping DMA buffers. For example, a driver
can use this field to pass in the DMA_ATTR_SKIP_CPU_SYNC DMA attribute
and have it propagate to the DMA layer so that it does not perform cache
maintenance when mapping the buffer.

This is particularly useful in the case where a driver may want to use
the dma_buf_[begin/end]_cpu_access_partial functions to apply cache
maintenance to a subset of the buffer, as opposed to the entire buffer.

Bug: 197668828
Change-Id: I6dad6b1f9090e92b491d2c88e50b638e34821972
Signed-off-by: Isaac J. Manjarres <isaacm@codeaurora.org>
This commit is contained in:
Isaac J. Manjarres
2021-08-24 15:55:03 -07:00
parent 999706352b
commit 0baaaa0ef9

View File

@@ -450,6 +450,8 @@ struct dma_buf_attach_ops {
* @importer_ops: importer operations for this attachment, if provided
* dma_buf_map/unmap_attachment() must be called with the dma_resv lock held.
* @importer_priv: importer specific attachment data.
* @dma_map_attrs: DMA attributes to be used when the exporter maps the buffer
* through dma_buf_map_attachment.
*
* This structure holds the attachment information between the dma_buf buffer
* and its user device(s). The list contains one attachment struct per device
@@ -470,6 +472,7 @@ struct dma_buf_attachment {
const struct dma_buf_attach_ops *importer_ops;
void *importer_priv;
void *priv;
unsigned long dma_map_attrs;
};
/**