]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
common: DMA-mapping: add DMA_ATTR_PRIVILEGED attribute
authorMitchel Humpherys <mitchelh@codeaurora.org>
Fri, 6 Jan 2017 13:28:11 +0000 (18:58 +0530)
committerWill Deacon <will.deacon@arm.com>
Thu, 19 Jan 2017 15:56:19 +0000 (15:56 +0000)
This patch adds the DMA_ATTR_PRIVILEGED attribute to the DMA-mapping
subsystem.

Some advanced peripherals such as remote processors and GPUs perform
accesses to DMA buffers in both privileged "supervisor" and unprivileged
"user" modes.  This attribute is used to indicate to the DMA-mapping
subsystem that the buffer is fully accessible at the elevated privilege
level (and ideally inaccessible or at least read-only at the
lesser-privileged levels).

Cc: linux-doc@vger.kernel.org
Reviewed-by: Robin Murphy <robin.murphy@arm.com>
Tested-by: Robin Murphy <robin.murphy@arm.com>
Acked-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Mitchel Humpherys <mitchelh@codeaurora.org>
Signed-off-by: Will Deacon <will.deacon@arm.com>
Documentation/DMA-attributes.txt
include/linux/dma-mapping.h

index 98bf7ac29aad8fff65e88bc6b1e6c2a6fc3a5033..44c6bc496eee6b140a779afa7b159c0a261326b9 100644 (file)
@@ -143,3 +143,13 @@ So, this provides a way for drivers to avoid those error messages on calls
 where allocation failures are not a problem, and shouldn't bother the logs.
 
 NOTE: At the moment DMA_ATTR_NO_WARN is only implemented on PowerPC.
+
+DMA_ATTR_PRIVILEGED
+------------------------------
+
+Some advanced peripherals such as remote processors and GPUs perform
+accesses to DMA buffers in both privileged "supervisor" and unprivileged
+"user" modes.  This attribute is used to indicate to the DMA-mapping
+subsystem that the buffer is fully accessible at the elevated privilege
+level (and ideally inaccessible or at least read-only at the
+lesser-privileged levels).
index 10c5a17b1f51ec33203e64df50282b7a85fde619..c24721a33b4c5d7816d1da34d3440a2d0d67be2c 100644 (file)
  */
 #define DMA_ATTR_NO_WARN       (1UL << 8)
 
+/*
+ * DMA_ATTR_PRIVILEGED: used to indicate that the buffer is fully
+ * accessible at an elevated privilege level (and ideally inaccessible or
+ * at least read-only at lesser-privileged levels).
+ */
+#define DMA_ATTR_PRIVILEGED            (1UL << 9)
+
 /*
  * A dma_addr_t can hold any valid DMA or bus address for the platform.
  * It can be given to a device to use as a DMA source or target.  A CPU cannot