提交 affabe05 编写于 作者: Z Zhou Guanghui 提交者: Yang Yingliang

ascend: share pool: Remove unnecessary params of sp_unshare

ascend inclusion
category: feature
bugzilla: https://gitee.com/openeuler/kernel/issues/I4EUVI
CVE: NA

-------------------------------------------------------

Remove unnecessary params(pid, spg_id) of sp_unshare.
Signed-off-by: NZhou Guanghui <zhouguanghui1@huawei.com>
Reviewed-by: NDing Tianhong <dingtianhong@huawei.com>
Reviewed-by: NWeilong Chen <chenweilong@huawei.com>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
上级 c0f0bb55
...@@ -216,7 +216,7 @@ extern int sp_free(unsigned long addr); ...@@ -216,7 +216,7 @@ extern int sp_free(unsigned long addr);
extern void *sp_make_share_k2u(unsigned long kva, unsigned long size, extern void *sp_make_share_k2u(unsigned long kva, unsigned long size,
unsigned long sp_flags, int pid, int spg_id); unsigned long sp_flags, int pid, int spg_id);
extern void *sp_make_share_u2k(unsigned long uva, unsigned long size, int pid); extern void *sp_make_share_u2k(unsigned long uva, unsigned long size, int pid);
extern int sp_unshare(unsigned long va, unsigned long size, int pid, int spg_id); extern int sp_unshare(unsigned long va, unsigned long size);
extern void sp_area_drop(struct vm_area_struct *vma); extern void sp_area_drop(struct vm_area_struct *vma);
......
...@@ -2705,7 +2705,7 @@ EXPORT_SYMBOL_GPL(sp_make_share_u2k); ...@@ -2705,7 +2705,7 @@ EXPORT_SYMBOL_GPL(sp_make_share_u2k);
* *
* This also means we must trust DVPP channel destroy and guard worker code. * This also means we must trust DVPP channel destroy and guard worker code.
*/ */
static int sp_unshare_uva(unsigned long uva, unsigned long size, int pid, int spg_id) static int sp_unshare_uva(unsigned long uva, unsigned long size)
{ {
int ret = 0; int ret = 0;
bool found = false; bool found = false;
...@@ -2752,11 +2752,6 @@ static int sp_unshare_uva(unsigned long uva, unsigned long size, int pid, int sp ...@@ -2752,11 +2752,6 @@ static int sp_unshare_uva(unsigned long uva, unsigned long size, int pid, int sp
} }
if (spa->type == SPA_TYPE_K2TASK) { if (spa->type == SPA_TYPE_K2TASK) {
if (spg_id != SPG_ID_NONE && spg_id != SPG_ID_DEFAULT) {
pr_err_ratelimited("share pool: unshare uva(to task) failed, invalid spg id %d\n", spg_id);
ret = -EINVAL;
goto out_drop_area;
}
if (!spa->mm) { if (!spa->mm) {
pr_err_ratelimited("share pool: unshare uva(to task) failed, none spa owner\n"); pr_err_ratelimited("share pool: unshare uva(to task) failed, none spa owner\n");
...@@ -2808,12 +2803,6 @@ static int sp_unshare_uva(unsigned long uva, unsigned long size, int pid, int sp ...@@ -2808,12 +2803,6 @@ static int sp_unshare_uva(unsigned long uva, unsigned long size, int pid, int sp
sp_update_process_stat(current, false, spa); sp_update_process_stat(current, false, spa);
} else if (spa->type == SPA_TYPE_K2SPG) { } else if (spa->type == SPA_TYPE_K2SPG) {
if (spg_id < 0) {
pr_err_ratelimited("share pool: unshare uva(to group) failed, invalid spg id %d\n", spg_id);
ret = -EINVAL;
goto out_drop_area;
}
down_read(&spa->spg->rw_lock); down_read(&spa->spg->rw_lock);
/* always allow kthread and dvpp channel destroy procedure */ /* always allow kthread and dvpp channel destroy procedure */
if (current->mm) { if (current->mm) {
...@@ -2921,14 +2910,12 @@ static int sp_unshare_kva(unsigned long kva, unsigned long size) ...@@ -2921,14 +2910,12 @@ static int sp_unshare_kva(unsigned long kva, unsigned long size)
* sp_make_share_{k2u,u2k}(). * sp_make_share_{k2u,u2k}().
* @va: the specified virtual address of memory * @va: the specified virtual address of memory
* @size: the size of unshared memory * @size: the size of unshared memory
* @pid: the pid of the specified process if the VA is user address
* @spg_id: the ID of the specified sp_group if the VA is user address
* *
* Use spg_id of current thread if spg_id == SPG_ID_DEFAULT. * Use spg_id of current thread if spg_id == SPG_ID_DEFAULT.
* *
* Return: 0 for success, -errno on failure. * Return: 0 for success, -errno on failure.
*/ */
int sp_unshare(unsigned long va, unsigned long size, int pid, int spg_id) int sp_unshare(unsigned long va, unsigned long size)
{ {
int ret = 0; int ret = 0;
...@@ -2936,7 +2923,7 @@ int sp_unshare(unsigned long va, unsigned long size, int pid, int spg_id) ...@@ -2936,7 +2923,7 @@ int sp_unshare(unsigned long va, unsigned long size, int pid, int spg_id)
if (va < TASK_SIZE) { if (va < TASK_SIZE) {
/* user address */ /* user address */
ret = sp_unshare_uva(va, size, pid, spg_id); ret = sp_unshare_uva(va, size);
} else if (va >= VA_START) { } else if (va >= VA_START) {
/* kernel address */ /* kernel address */
ret = sp_unshare_kva(va, size); ret = sp_unshare_kva(va, size);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册