aboutsummaryrefslogtreecommitdiff
path: root/drivers/soc
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/soc')
-rw-r--r--drivers/soc/qcom/scm.c21
1 files changed, 12 insertions, 9 deletions
diff --git a/drivers/soc/qcom/scm.c b/drivers/soc/qcom/scm.c
index b067c9baf4e2..fc36e8db1ab5 100644
--- a/drivers/soc/qcom/scm.c
+++ b/drivers/soc/qcom/scm.c
@@ -36,7 +36,7 @@
#define SCM_EBUSY -55
#define SCM_V2_EBUSY -12
-static atomic_t scm_call_count = ATOMIC_INIT(0);
+static DEFINE_PER_CPU(atomic_t, scm_call_count);
static DEFINE_MUTEX(scm_lock);
/*
@@ -433,11 +433,12 @@ static int ___scm_call_armv8_64(u64 x0, u64 x1, u64 x2, u64 x3, u64 x4, u64 x5,
static int __scm_call_armv8_64(u64 x0, u64 x1, u64 x2, u64 x3, u64 x4, u64 x5,
u64 *ret1, u64 *ret2, u64 *ret3)
{
+ atomic_t *cnt = per_cpu_ptr(&scm_call_count, raw_smp_processor_id());
int ret;
- atomic_inc(&scm_call_count);
+ atomic_inc(cnt);
ret = ___scm_call_armv8_64(x0, x1, x2, x3, x4, x5, ret1, ret2, ret3);
- atomic_dec(&scm_call_count);
+ atomic_dec(cnt);
return ret;
}
@@ -495,11 +496,12 @@ static int ___scm_call_armv8_32(u32 w0, u32 w1, u32 w2, u32 w3, u32 w4, u32 w5,
static int __scm_call_armv8_32(u32 w0, u32 w1, u32 w2, u32 w3, u32 w4, u32 w5,
u64 *ret1, u64 *ret2, u64 *ret3)
{
+ atomic_t *cnt = per_cpu_ptr(&scm_call_count, raw_smp_processor_id());
int ret;
- atomic_inc(&scm_call_count);
+ atomic_inc(cnt);
ret = ___scm_call_armv8_32(w0, w1, w2, w3, w4, w5, ret1, ret2, ret3);
- atomic_dec(&scm_call_count);
+ atomic_dec(cnt);
return ret;
}
@@ -557,11 +559,12 @@ static int __scm_call_armv8_32(u32 w0, u32 w1, u32 w2, u32 w3, u32 w4, u32 w5,
static int __scm_call_armv8_32(u32 w0, u32 w1, u32 w2, u32 w3, u32 w4, u32 w5,
u64 *ret1, u64 *ret2, u64 *ret3)
{
+ atomic_t *cnt = per_cpu_ptr(&scm_call_count, raw_smp_processor_id());
int ret;
- atomic_inc(&scm_call_count);
+ atomic_inc(cnt);
ret = ___scm_call_armv8_32(w0, w1, w2, w3, w4, w5, ret1, ret2, ret3);
- atomic_dec(&scm_call_count);
+ atomic_dec(cnt);
return ret;
}
@@ -1352,7 +1355,7 @@ inline int scm_enable_mem_protection(void)
#endif
EXPORT_SYMBOL(scm_enable_mem_protection);
-bool under_scm_call(void)
+bool under_scm_call(int cpu)
{
- return atomic_read(&scm_call_count);
+ return atomic_read(per_cpu_ptr(&scm_call_count, cpu));
}