diff options
Diffstat (limited to 'arch/arm/mach-qcom')
-rw-r--r-- | arch/arm/mach-qcom/scm.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/arch/arm/mach-qcom/scm.c b/arch/arm/mach-qcom/scm.c index c08786ebf116..ec37b037e69c 100644 --- a/arch/arm/mach-qcom/scm.c +++ b/arch/arm/mach-qcom/scm.c | |||
@@ -196,12 +196,12 @@ static int __scm_call(const struct scm_command *cmd) | |||
196 | u32 cmd_addr = virt_to_phys(cmd); | 196 | u32 cmd_addr = virt_to_phys(cmd); |
197 | 197 | ||
198 | /* | 198 | /* |
199 | * Flush the entire cache here so callers don't have to remember | 199 | * Flush the command buffer so that the secure world sees |
200 | * to flush the cache when passing physical addresses to the secure | 200 | * the correct data. |
201 | * side in the buffer. | ||
202 | */ | 201 | */ |
203 | flush_cache_all(); | 202 | __cpuc_flush_dcache_area((void *)cmd, cmd->len); |
204 | outer_flush_all(); | 203 | outer_flush_range(cmd_addr, cmd_addr + cmd->len); |
204 | |||
205 | ret = smc(cmd_addr); | 205 | ret = smc(cmd_addr); |
206 | if (ret < 0) | 206 | if (ret < 0) |
207 | ret = scm_remap_error(ret); | 207 | ret = scm_remap_error(ret); |
@@ -238,6 +238,13 @@ static void scm_inv_range(unsigned long start, unsigned long end) | |||
238 | * @resp_len: length of the response buffer | 238 | * @resp_len: length of the response buffer |
239 | * | 239 | * |
240 | * Sends a command to the SCM and waits for the command to finish processing. | 240 | * Sends a command to the SCM and waits for the command to finish processing. |
241 | * | ||
242 | * A note on cache maintenance: | ||
243 | * Note that any buffers that are expected to be accessed by the secure world | ||
244 | * must be flushed before invoking scm_call and invalidated in the cache | ||
245 | * immediately after scm_call returns. Cache maintenance on the command and | ||
246 | * response buffers is taken care of by scm_call; however, callers are | ||
247 | * responsible for any other cached buffers passed over to the secure world. | ||
241 | */ | 248 | */ |
242 | int scm_call(u32 svc_id, u32 cmd_id, const void *cmd_buf, size_t cmd_len, | 249 | int scm_call(u32 svc_id, u32 cmd_id, const void *cmd_buf, size_t cmd_len, |
243 | void *resp_buf, size_t resp_len) | 250 | void *resp_buf, size_t resp_len) |