From 0baaaa0ef905a013f4ee5eba74e29be699c10412 Mon Sep 17 00:00:00 2001 From: "Isaac J. Manjarres" Date: Tue, 24 Aug 2021 15:55:03 -0700 Subject: [PATCH] Revert "Revert "ANDROID: dma-buf: Add support for mapping buffers with DMA attributes"" This reverts commit 9240b79354edf05a2ff5750c0be67bbee27cefe1. 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 --- include/linux/dma-buf.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/include/linux/dma-buf.h b/include/linux/dma-buf.h index fbfb364c7c72..bbb5116e6c02 100644 --- a/include/linux/dma-buf.h +++ b/include/linux/dma-buf.h @@ -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; }; /**