mirror of
https://github.com/rd-stuffs/msm-4.14.git
synced 2025-02-20 11:45:48 +08:00
hwspinlock: Add support to parse spin lock id
The current implementation will use hard coded spin lock id which will cause conflicts when gvm want to access hardware spink lock while communicating with remote host over dedicated smem partition area. Adding support to parse spin lock id from dt entry. This will help to configure unique spin lock id for gvm. Change-Id: I8001c6339a2d823109177dedbfceef9a5bdc2d51 Signed-off-by: Arun Prakash <app@codeaurora.org>
This commit is contained in:
parent
3aa681b633
commit
84248bd660
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2013, The Linux Foundation. All rights reserved.
|
* Copyright (c) 2013,2020, The Linux Foundation. All rights reserved.
|
||||||
* Copyright (c) 2015, Sony Mobile Communications AB
|
* Copyright (c) 2015, Sony Mobile Communications AB
|
||||||
*
|
*
|
||||||
* This software is licensed under the terms of the GNU General Public
|
* This software is licensed under the terms of the GNU General Public
|
||||||
@ -28,13 +28,19 @@
|
|||||||
#define QCOM_MUTEX_APPS_PROC_ID 1
|
#define QCOM_MUTEX_APPS_PROC_ID 1
|
||||||
#define QCOM_MUTEX_NUM_LOCKS 32
|
#define QCOM_MUTEX_NUM_LOCKS 32
|
||||||
|
|
||||||
|
/**
|
||||||
|
* setting default mutex id as QCOM_MUTEX_APPS_PROC_ID
|
||||||
|
* and will override this value if dt entry is found
|
||||||
|
*/
|
||||||
|
static u32 qcom_mutex_lock_id = QCOM_MUTEX_APPS_PROC_ID;
|
||||||
|
|
||||||
static int qcom_hwspinlock_trylock(struct hwspinlock *lock)
|
static int qcom_hwspinlock_trylock(struct hwspinlock *lock)
|
||||||
{
|
{
|
||||||
struct regmap_field *field = lock->priv;
|
struct regmap_field *field = lock->priv;
|
||||||
u32 lock_owner;
|
u32 lock_owner;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
ret = regmap_field_write(field, QCOM_MUTEX_APPS_PROC_ID);
|
ret = regmap_field_write(field, qcom_mutex_lock_id);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
@ -42,7 +48,7 @@ static int qcom_hwspinlock_trylock(struct hwspinlock *lock)
|
|||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
return lock_owner == QCOM_MUTEX_APPS_PROC_ID;
|
return lock_owner == qcom_mutex_lock_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void qcom_hwspinlock_unlock(struct hwspinlock *lock)
|
static void qcom_hwspinlock_unlock(struct hwspinlock *lock)
|
||||||
@ -57,7 +63,7 @@ static void qcom_hwspinlock_unlock(struct hwspinlock *lock)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lock_owner != QCOM_MUTEX_APPS_PROC_ID) {
|
if (lock_owner != qcom_mutex_lock_id) {
|
||||||
pr_err("%s: spinlock not owned by us (actual owner is %d)\n",
|
pr_err("%s: spinlock not owned by us (actual owner is %d)\n",
|
||||||
__func__, lock_owner);
|
__func__, lock_owner);
|
||||||
}
|
}
|
||||||
@ -88,6 +94,7 @@ static int qcom_hwspinlock_probe(struct platform_device *pdev)
|
|||||||
size_t array_size;
|
size_t array_size;
|
||||||
u32 stride;
|
u32 stride;
|
||||||
u32 base;
|
u32 base;
|
||||||
|
u32 mutex_id;
|
||||||
int ret;
|
int ret;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@ -114,6 +121,10 @@ static int qcom_hwspinlock_probe(struct platform_device *pdev)
|
|||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ret = of_property_read_u32(pdev->dev.of_node, "mutex-id", &mutex_id);
|
||||||
|
if (!ret)
|
||||||
|
qcom_mutex_lock_id = mutex_id;
|
||||||
|
|
||||||
array_size = QCOM_MUTEX_NUM_LOCKS * sizeof(struct hwspinlock);
|
array_size = QCOM_MUTEX_NUM_LOCKS * sizeof(struct hwspinlock);
|
||||||
bank = devm_kzalloc(&pdev->dev, sizeof(*bank) + array_size, GFP_KERNEL);
|
bank = devm_kzalloc(&pdev->dev, sizeof(*bank) + array_size, GFP_KERNEL);
|
||||||
if (!bank)
|
if (!bank)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user