blob: b92fab342dbb7501b890a4c4245047b5312eaabd [file] [log] [blame]
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: "Isaac J. Manjarres" <isaacm@codeaurora.org>
Date: Tue, 24 Aug 2021 15:55:03 -0700
Subject: 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.
[CPNOTE: 06/09/21] Lee: Required by vendor - upstream?
Bug: 197668828
Change-Id: I6dad6b1f9090e92b491d2c88e50b638e34821972
Signed-off-by: Isaac J. Manjarres <isaacm@codeaurora.org>
---
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
--- a/include/linux/dma-buf.h
+++ b/include/linux/dma-buf.h
@@ -559,6 +559,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
@@ -579,6 +581,7 @@ struct dma_buf_attachment {
const struct dma_buf_attach_ops *importer_ops;
void *importer_priv;
void *priv;
+ unsigned long dma_map_attrs;
};
/**