aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRussell King <rmk+kernel@arm.linux.org.uk>2015-07-24 05:21:02 -0400
committerRussell King <rmk+kernel@arm.linux.org.uk>2015-08-11 13:45:00 -0400
commitefaa6e266ba70439da00e7f1c8a218e243ae140a (patch)
treebd7d7d35ba8575eccfcc01d2338e2a91c8357ff5
parent21caf3a765b0a88f8fedf63b36e5d15683b73fe5 (diff)
firmware: qcom_scm-32: replace open-coded call to __cpuc_flush_dcache_area()
Rathe rthan directly accessing architecture internal functions, provide an "method"-centric wrapper for qcom_scm-32 to do what's necessary to ensure that the secure monitor can see the data. This is called "secure_flush_area" and ensures that the specified memory area is coherent across the secure boundary. Acked-by: Andy Gross <agross@codeaurora.org> Reviewed-by: Stephen Boyd <sboyd@codeaurora.org> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
-rw-r--r--arch/arm/include/asm/cacheflush.h17
-rw-r--r--drivers/firmware/qcom_scm-32.c4
2 files changed, 18 insertions, 3 deletions
diff --git a/arch/arm/include/asm/cacheflush.h b/arch/arm/include/asm/cacheflush.h
index c5230a44eeca..d5525bfc7e3e 100644
--- a/arch/arm/include/asm/cacheflush.h
+++ b/arch/arm/include/asm/cacheflush.h
@@ -502,4 +502,21 @@ static inline void set_kernel_text_ro(void) { }
502void flush_uprobe_xol_access(struct page *page, unsigned long uaddr, 502void flush_uprobe_xol_access(struct page *page, unsigned long uaddr,
503 void *kaddr, unsigned long len); 503 void *kaddr, unsigned long len);
504 504
505/**
506 * secure_flush_area - ensure coherency across the secure boundary
507 * @addr: virtual address
508 * @size: size of region
509 *
510 * Ensure that the specified area of memory is coherent across the secure
511 * boundary from the non-secure side. This is used when calling secure
512 * firmware where the secure firmware does not ensure coherency.
513 */
514static inline void secure_flush_area(const void *addr, size_t size)
515{
516 phys_addr_t phys = __pa(addr);
517
518 __cpuc_flush_dcache_area((void *)addr, size);
519 outer_flush_range(phys, phys + size);
520}
521
505#endif 522#endif
diff --git a/drivers/firmware/qcom_scm-32.c b/drivers/firmware/qcom_scm-32.c
index 1bd6f9c34331..29e6850665eb 100644
--- a/drivers/firmware/qcom_scm-32.c
+++ b/drivers/firmware/qcom_scm-32.c
@@ -24,7 +24,6 @@
24#include <linux/err.h> 24#include <linux/err.h>
25#include <linux/qcom_scm.h> 25#include <linux/qcom_scm.h>
26 26
27#include <asm/outercache.h>
28#include <asm/cacheflush.h> 27#include <asm/cacheflush.h>
29 28
30#include "qcom_scm.h" 29#include "qcom_scm.h"
@@ -219,8 +218,7 @@ static int __qcom_scm_call(const struct qcom_scm_command *cmd)
219 * Flush the command buffer so that the secure world sees 218 * Flush the command buffer so that the secure world sees
220 * the correct data. 219 * the correct data.
221 */ 220 */
222 __cpuc_flush_dcache_area((void *)cmd, cmd->len); 221 secure_flush_area(cmd, cmd->len);
223 outer_flush_range(cmd_addr, cmd_addr + cmd->len);
224 222
225 ret = smc(cmd_addr); 223 ret = smc(cmd_addr);
226 if (ret < 0) 224 if (ret < 0)