summaryrefslogtreecommitdiff
path: root/plat/arm/css/common/css_scpi.c
diff options
context:
space:
mode:
authordanh-arm <dan.handley@arm.com>2016-02-18 18:36:00 +0000
committerdanh-arm <dan.handley@arm.com>2016-02-18 18:36:00 +0000
commit85df7e44ce3974e2c78d99e6ea31f047de6de445 (patch)
tree7c7c7583d24faf59bd66adc827ba7dd789877de0 /plat/arm/css/common/css_scpi.c
parent879599076e80c98c3d76b2c0c1efb6136a2f86b4 (diff)
parent74eb26e4098d0a1f5c6ef49c1355e99d80027f36 (diff)
Merge pull request #523 from jcastillo-arm/jc/genfw-791
ARM platforms: rationalise memory attributes of shared memory
Diffstat (limited to 'plat/arm/css/common/css_scpi.c')
-rw-r--r--plat/arm/css/common/css_scpi.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/plat/arm/css/common/css_scpi.c b/plat/arm/css/common/css_scpi.c
index 9e1f9738..02d573c9 100644
--- a/plat/arm/css/common/css_scpi.c
+++ b/plat/arm/css/common/css_scpi.c
@@ -56,10 +56,10 @@ static void scpi_secure_message_start(void)
static void scpi_secure_message_send(size_t payload_size)
{
- /* Make sure payload can be seen by SCP */
- if (MHU_PAYLOAD_CACHED)
- flush_dcache_range(SCPI_SHARED_MEM_AP_TO_SCP,
- sizeof(scpi_cmd_t) + payload_size);
+ /* Ensure that any write to the SCPI payload area is seen by SCP before
+ * we write to the MHU register. If these 2 writes were reordered by
+ * the CPU then SCP would read stale payload data */
+ dmbst();
mhu_secure_message_send(SCPI_MHU_SLOT_ID);
}
@@ -79,9 +79,10 @@ static void scpi_secure_message_receive(scpi_cmd_t *cmd)
panic();
}
- /* Make sure we don't read stale data */
- if (MHU_PAYLOAD_CACHED)
- inv_dcache_range(SCPI_SHARED_MEM_SCP_TO_AP, sizeof(*cmd));
+ /* Ensure that any read to the SCPI payload area is done after reading
+ * the MHU register. If these 2 reads were reordered then the CPU would
+ * read invalid payload data */
+ dmbld();
memcpy(cmd, (void *) SCPI_SHARED_MEM_SCP_TO_AP, sizeof(*cmd));
}