nvgpu: set tpc_pg_mask only if it's changed

Set tpc_pg_mask only if it's different from the one which is set
earlier.

Bug 3463659

Change-Id: I8388e10ac0adcd56cf310c491c870614419bd18d
Signed-off-by: Ninad Malwade <nmalwade@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2641763
(cherry picked from commit 54adf26042)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2650592
Reviewed-by: Amulya Yarlagadda <ayarlagadda@nvidia.com>
GVS: Gerrit_Virtual_Submit
This commit is contained in:
Ninad Malwade
2021-12-14 18:30:25 +08:00
committed by Amulya Yarlagadda
parent 9446cfa320
commit 68a92468e2

View File

@@ -1006,6 +1006,9 @@ static ssize_t tpc_pg_mask_store(struct device *dev,
struct gk20a_platform *platform = dev_get_drvdata(dev);
unsigned long val = 0;
int err = 0;
u32 i;
/* hold the combined tpc pg mask */
u32 combined_tpc_pg_mask = 0x0U;
nvgpu_mutex_acquire(&g->static_pg_lock);
@@ -1015,6 +1018,16 @@ static ssize_t tpc_pg_mask_store(struct device *dev,
return -EINVAL;
}
for (i = 0U; i < MAX_PG_GPC; i++) {
combined_tpc_pg_mask = combined_tpc_pg_mask |
(g->tpc_pg_mask[i] << 4*i);
}
if (val == combined_tpc_pg_mask) {
nvgpu_info(g, "no value change, same mask already set");
goto exit;
}
if (nvgpu_is_powered_on(g)) {
nvgpu_err(g, "gpu is already powered on");
nvgpu_mutex_release(&g->static_pg_lock);
@@ -1029,6 +1042,8 @@ static ssize_t tpc_pg_mask_store(struct device *dev,
return -EINVAL;
}
}
exit:
nvgpu_mutex_release(&g->static_pg_lock);
return count;
}