aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorAlex Elder <elder@linaro.org>2014-04-21 17:53:05 -0400
committerMatt Porter <mporter@linaro.org>2014-04-25 08:51:33 -0400
commit6c90f10864d1f7492ebe4c90465a9c9797ce649e (patch)
tree9d953197ee4c05b5ea59470a4728dea46d793bc6 /arch
parentc64756cca2fb4da96fcc71e376d712297aedc4a2 (diff)
ARM: bcm: have bcm_kona_smc() return request result
Currently it is assumed that SEC_ROM_RET_OK is the only valid "good" result of a secure monitor request. However the values that can be returned by a secure monitor request are dependent on which service id was provided. We therefore should handle the result in a request-dependent way. The most natural way to do that is to have the initiator of the request--where bcm_kona_smc() is called--handle the result in a way appropriate to the request. An "smc" operation must be performed only on core 0, while the request can be initiated from any core. To pass back the request result, we add a new field to the bcm_kona_smc_data structure, and have bcm_kona_smc() return that value rather than 0. There's only one caller right now. Move the existing check of the result out of __bcm_kona_smc() and into the kona_l2_cache_init() where the SSAPI_ENABLE_L2_CACHE request is initiated. Signed-off-by: Alex Elder <elder@linaro.org> Reviewed-by: Tim Kryger <tim.kryger@linaro.org> Reviewed-by: Markus Mayer <markus.mayer@linaro.org> Reviewed-by: Matt Porter <mporter@linaro.org> Signed-off-by: Matt Porter <mporter@linaro.org>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/mach-bcm/bcm_kona_smc.c12
-rw-r--r--arch/arm/mach-bcm/kona.c8
2 files changed, 12 insertions, 8 deletions
diff --git a/arch/arm/mach-bcm/bcm_kona_smc.c b/arch/arm/mach-bcm/bcm_kona_smc.c
index 0d2bfe2bcfa8..47cf360f985b 100644
--- a/arch/arm/mach-bcm/bcm_kona_smc.c
+++ b/arch/arm/mach-bcm/bcm_kona_smc.c
@@ -30,6 +30,7 @@ struct bcm_kona_smc_data {
30 unsigned arg1; 30 unsigned arg1;
31 unsigned arg2; 31 unsigned arg2;
32 unsigned arg3; 32 unsigned arg3;
33 unsigned result;
33}; 34};
34 35
35static const struct of_device_id bcm_kona_smc_ids[] __initconst = { 36static const struct of_device_id bcm_kona_smc_ids[] __initconst = {
@@ -80,7 +81,6 @@ static void __bcm_kona_smc(void *info)
80{ 81{
81 struct bcm_kona_smc_data *data = info; 82 struct bcm_kona_smc_data *data = info;
82 u32 *args = bcm_smc_buffer; 83 u32 *args = bcm_smc_buffer;
83 int rc;
84 84
85 BUG_ON(smp_processor_id() != 0); 85 BUG_ON(smp_processor_id() != 0);
86 BUG_ON(!args); 86 BUG_ON(!args);
@@ -94,11 +94,8 @@ static void __bcm_kona_smc(void *info)
94 /* Flush caches for input data passed to Secure Monitor */ 94 /* Flush caches for input data passed to Secure Monitor */
95 flush_cache_all(); 95 flush_cache_all();
96 96
97 /* Trap into Secure Monitor */ 97 /* Trap into Secure Monitor and record the request result */
98 rc = bcm_kona_smc_asm(data->service_id, bcm_smc_buffer_phys); 98 data->result = bcm_kona_smc_asm(data->service_id, bcm_smc_buffer_phys);
99
100 if (rc != SEC_ROM_RET_OK)
101 pr_err("Secure Monitor call failed (0x%x)!\n", rc);
102} 99}
103 100
104unsigned bcm_kona_smc(unsigned service_id, unsigned arg0, unsigned arg1, 101unsigned bcm_kona_smc(unsigned service_id, unsigned arg0, unsigned arg1,
@@ -111,6 +108,7 @@ unsigned bcm_kona_smc(unsigned service_id, unsigned arg0, unsigned arg1,
111 data.arg1 = arg1; 108 data.arg1 = arg1;
112 data.arg2 = arg2; 109 data.arg2 = arg2;
113 data.arg3 = arg3; 110 data.arg3 = arg3;
111 data.result = 0;
114 112
115 /* 113 /*
116 * Due to a limitation of the secure monitor, we must use the SMP 114 * Due to a limitation of the secure monitor, we must use the SMP
@@ -123,5 +121,5 @@ unsigned bcm_kona_smc(unsigned service_id, unsigned arg0, unsigned arg1,
123 121
124 put_cpu(); 122 put_cpu();
125 123
126 return 0; 124 return data.result;
127} 125}
diff --git a/arch/arm/mach-bcm/kona.c b/arch/arm/mach-bcm/kona.c
index 768bc2837bf5..ecdd71340a46 100644
--- a/arch/arm/mach-bcm/kona.c
+++ b/arch/arm/mach-bcm/kona.c
@@ -19,6 +19,7 @@
19 19
20void __init kona_l2_cache_init(void) 20void __init kona_l2_cache_init(void)
21{ 21{
22 unsigned int result;
22 int ret; 23 int ret;
23 24
24 if (!IS_ENABLED(CONFIG_CACHE_L2X0)) 25 if (!IS_ENABLED(CONFIG_CACHE_L2X0))
@@ -31,7 +32,12 @@ void __init kona_l2_cache_init(void)
31 return; 32 return;
32 } 33 }
33 34
34 bcm_kona_smc(SSAPI_ENABLE_L2_CACHE, 0, 0, 0, 0); 35 result = bcm_kona_smc(SSAPI_ENABLE_L2_CACHE, 0, 0, 0, 0);
36 if (result != SEC_ROM_RET_OK) {
37 pr_err("Secure Monitor call failed (%u)! Skipping L2 init.\n",
38 result);
39 return;
40 }
35 41
36 /* 42 /*
37 * The aux_val and aux_mask have no effect since L2 cache is already 43 * The aux_val and aux_mask have no effect since L2 cache is already