From 001e9a2695cdde77f065076e70d49cdc2b7eb83f Mon Sep 17 00:00:00 2001 From: Divya Date: Tue, 7 Jun 2022 08:21:07 +0000 Subject: [PATCH] gpu: nvgpu: update tpc-pg support - Add tpc count variable in the platform struct to store the number of tpcs present in the chip. This count is needed before GPU boots to provide support for static TPC-PG feature. - Remove valid_tpc_pg_mask and valid_gpc_fbp_pg_mask variable from gk20a struct as it is already taken care in platform struct. JIRA NVGPU-8210 Change-Id: Ic04af4b7c24f5e790c52708c117e45a3bb0d1810 Signed-off-by: Divya Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2725960 (cherry picked from commit e9cfae46eb7788e6d12ccd9354ecc46753aba5ce) Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2728941 Reviewed-by: svcacv Reviewed-by: svc-mobile-coverity Reviewed-by: svc-mobile-cert Reviewed-by: Mahantesh Kumbar GVS: Gerrit_Virtual_Submit --- drivers/gpu/nvgpu/include/nvgpu/gk20a.h | 9 --------- drivers/gpu/nvgpu/os/linux/driver_common.c | 7 ------- drivers/gpu/nvgpu/os/linux/platform_gk20a.h | 3 +++ drivers/gpu/nvgpu/os/linux/sysfs.c | 2 +- 4 files changed, 4 insertions(+), 17 deletions(-) diff --git a/drivers/gpu/nvgpu/include/nvgpu/gk20a.h b/drivers/gpu/nvgpu/include/nvgpu/gk20a.h index e696e61b5..c1313a493 100644 --- a/drivers/gpu/nvgpu/include/nvgpu/gk20a.h +++ b/drivers/gpu/nvgpu/include/nvgpu/gk20a.h @@ -787,15 +787,6 @@ struct gk20a { bool can_tpc_pg; bool can_fbp_pg; bool can_gpc_pg; - - /* - * Valid config array for tpc pg mask - * and gpc/fbp mask. These valid values - * are chip specific and calculated based - * on available number of GPC, FBP and TPC - */ - u32 valid_tpc_pg_mask[MAX_PG_TPC_CONFIGS]; - u32 valid_gpc_fbp_pg_mask[MAX_PG_GPC_FBP_CONFIGS]; #endif #ifdef CONFIG_NVGPU_DGPU diff --git a/drivers/gpu/nvgpu/os/linux/driver_common.c b/drivers/gpu/nvgpu/os/linux/driver_common.c index 47eb19a58..bb862c0a2 100644 --- a/drivers/gpu/nvgpu/os/linux/driver_common.c +++ b/drivers/gpu/nvgpu/os/linux/driver_common.c @@ -182,7 +182,6 @@ static void nvgpu_init_timeslice(struct gk20a *g) static void nvgpu_init_pm_vars(struct gk20a *g) { struct gk20a_platform *platform = dev_get_drvdata(dev_from_gk20a(g)); - u32 i = 0; /* * Set up initial power settings. For non-slicon platforms, disable @@ -235,12 +234,6 @@ static void nvgpu_init_pm_vars(struct gk20a *g) g->can_tpc_pg = platform->can_tpc_pg; g->can_gpc_pg = platform->can_gpc_pg; g->can_fbp_pg = platform->can_fbp_pg; - - for (i = 0; i < MAX_PG_TPC_CONFIGS; i++) - g->valid_tpc_pg_mask[i] = platform->valid_tpc_pg_mask[i]; - - for (i = 0; i < MAX_PG_GPC_FBP_CONFIGS; i++) - g->valid_gpc_fbp_pg_mask[i] = platform->valid_gpc_fbp_pg_mask[i]; #endif g->ldiv_slowdown_factor = platform->ldiv_slowdown_factor_init; /* if default delay is not set, set default delay to 500msec */ diff --git a/drivers/gpu/nvgpu/os/linux/platform_gk20a.h b/drivers/gpu/nvgpu/os/linux/platform_gk20a.h index e827c8c48..a9255fa87 100644 --- a/drivers/gpu/nvgpu/os/linux/platform_gk20a.h +++ b/drivers/gpu/nvgpu/os/linux/platform_gk20a.h @@ -126,6 +126,9 @@ struct gk20a_platform { /* Valid GPC-PG and FBP-PG mask */ u32 valid_gpc_fbp_pg_mask[MAX_PG_GPC_FBP_CONFIGS]; + + /* available TPC count in a chip */ + u32 tpc_count; #endif /* Delay before rail gated */ int railgate_delay_init; diff --git a/drivers/gpu/nvgpu/os/linux/sysfs.c b/drivers/gpu/nvgpu/os/linux/sysfs.c index bb521cac6..47f6861f8 100644 --- a/drivers/gpu/nvgpu/os/linux/sysfs.c +++ b/drivers/gpu/nvgpu/os/linux/sysfs.c @@ -1123,7 +1123,7 @@ static ssize_t tpc_pg_mask_store(struct device *dev, != 0) { nvgpu_err(g, "golden image size already initialized"); nvgpu_mutex_release(&g->static_pg_lock); - return -ENODEV; + return -EINVAL; } if (platform->set_tpc_pg_mask != NULL) {