From a27e202402ff88e196c4241683277821ced6082b Mon Sep 17 00:00:00 2001 From: Ninad Malwade Date: Thu, 24 Mar 2022 16:57:38 +0800 Subject: [PATCH] nvgpu: reorder the check for same mask value After the board boots up, we have a specific set of settings for each power mode which contains, fbp, tpc mask values, cpu, gpu frequencies etc. So, we need to make sure to provide all the setting values for each mode so that those will be applied correctly. So, the fbp, tpc, gpc mask could be same in different power modes and since the golden image context check which comes before is returning -ENODEV, the nvpmodel service fails to set the power mode. Thus, we need to compare whether the fbp and gpc mask values are same before we check for the golden image context. Bug 3581634 Change-Id: I3fb1398d47cd37bf49ad70cf80b057d4b80dec04 Signed-off-by: Ninad Malwade Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2686490 Reviewed-by: Divya Singhatwaria Reviewed-by: svcacv GVS: Gerrit_Virtual_Submit --- drivers/gpu/nvgpu/os/linux/sysfs.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/drivers/gpu/nvgpu/os/linux/sysfs.c b/drivers/gpu/nvgpu/os/linux/sysfs.c index 0f330432b..f5c4a4031 100644 --- a/drivers/gpu/nvgpu/os/linux/sysfs.c +++ b/drivers/gpu/nvgpu/os/linux/sysfs.c @@ -862,6 +862,11 @@ static ssize_t gpc_pg_mask_store(struct device *dev, return -EINVAL; } + if (val == g->gpc_pg_mask) { + nvgpu_info(g, "no value change, same mask already set"); + goto exit; + } + if (g->gr != NULL) { gr_golden_image = nvgpu_gr_get_golden_image_ptr(g); } @@ -874,11 +879,6 @@ static ssize_t gpc_pg_mask_store(struct device *dev, return -ENODEV; } - if (val == g->gpc_pg_mask) { - nvgpu_info(g, "no value change, same mask already set"); - goto exit; - } - if (platform->set_gpc_pg_mask != NULL) { err = platform->set_gpc_pg_mask(dev, val); if (err != 0) { @@ -942,6 +942,11 @@ static ssize_t fbp_pg_mask_store(struct device *dev, return -EINVAL; } + if (val == g->fbp_pg_mask) { + nvgpu_info(g, "no value change, same mask already set"); + goto exit; + } + if (g->gr != NULL) { gr_golden_image = nvgpu_gr_get_golden_image_ptr(g); } @@ -954,11 +959,6 @@ static ssize_t fbp_pg_mask_store(struct device *dev, return -ENODEV; } - if (val == g->fbp_pg_mask) { - nvgpu_info(g, "no value change, same mask already set"); - goto exit; - } - if (platform->set_fbp_pg_mask != NULL) { err = platform->set_fbp_pg_mask(dev, val); if (err != 0) {