void flush_uprobe_xol_access(struct page *page, unsigned long uaddr,
                             void *kaddr, unsigned long len);
 
+/**
+ * secure_flush_area - ensure coherency across the secure boundary
+ * @addr: virtual address
+ * @size: size of region
+ *
+ * Ensure that the specified area of memory is coherent across the secure
+ * boundary from the non-secure side.  This is used when calling secure
+ * firmware where the secure firmware does not ensure coherency.
+ */
+static inline void secure_flush_area(const void *addr, size_t size)
+{
+       phys_addr_t phys = __pa(addr);
+
+       __cpuc_flush_dcache_area((void *)addr, size);
+       outer_flush_range(phys, phys + size);
+}
+
 #endif
 
 #include <linux/err.h>
 #include <linux/qcom_scm.h>
 
-#include <asm/outercache.h>
 #include <asm/cacheflush.h>
 
 #include "qcom_scm.h"
         * Flush the command buffer so that the secure world sees
         * the correct data.
         */
-       __cpuc_flush_dcache_area((void *)cmd, cmd->len);
-       outer_flush_range(cmd_addr, cmd_addr + cmd->len);
+       secure_flush_area(cmd, cmd->len);
 
        ret = smc(cmd_addr);
        if (ret < 0)