From da8ee8d61535ced3bd6b9d9203b5c1fe1b58a26e Mon Sep 17 00:00:00 2001 From: Antony Clince Alex Date: Mon, 16 Mar 2020 17:15:53 +0530 Subject: [PATCH] gpu: nvgpu: add therm_max_fpdiv_factor gops.therm Use therm_max_fpdiv_factor gops.therm for nvgpu-next to get the maximum fp_div_factor. Jira NVGPU-4860 Signed-off-by: Antony Clince Alex Change-Id: If0e9b82f5b61289e226ceeff386fc88763af66e2 Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2313336 Tested-by: mobile promotions Reviewed-by: mobile promotions --- drivers/gpu/nvgpu/hal/init/hal_gv11b.c | 1 + drivers/gpu/nvgpu/hal/therm/therm_gv11b.h | 3 ++- drivers/gpu/nvgpu/hal/therm/therm_gv11b_fusa.c | 15 ++++++++++----- drivers/gpu/nvgpu/include/nvgpu/gops_therm.h | 1 + 4 files changed, 14 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/nvgpu/hal/init/hal_gv11b.c b/drivers/gpu/nvgpu/hal/init/hal_gv11b.c index be5474be5..1a2c3dd81 100644 --- a/drivers/gpu/nvgpu/hal/init/hal_gv11b.c +++ b/drivers/gpu/nvgpu/hal/init/hal_gv11b.c @@ -1193,6 +1193,7 @@ NVGPU_COV_WHITELIST_BLOCK_END(NVGPU_MISRA(Rule, 8_7)) } }, .therm = { + .therm_max_fpdiv_factor = gv11b_therm_max_fpdiv_factor, .init_therm_support = nvgpu_init_therm_support, .init_therm_setup_hw = gv11b_init_therm_setup_hw, .init_elcg_mode = gv11b_therm_init_elcg_mode, diff --git a/drivers/gpu/nvgpu/hal/therm/therm_gv11b.h b/drivers/gpu/nvgpu/hal/therm/therm_gv11b.h index 7058af9fb..febde15d7 100644 --- a/drivers/gpu/nvgpu/hal/therm/therm_gv11b.h +++ b/drivers/gpu/nvgpu/hal/therm/therm_gv11b.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, NVIDIA CORPORATION. All rights reserved. + * Copyright (c) 2017-2020, NVIDIA CORPORATION. All rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -26,5 +26,6 @@ struct gk20a; int gv11b_elcg_init_idle_filters(struct gk20a *g); int gv11b_init_therm_setup_hw(struct gk20a *g); void gv11b_therm_init_elcg_mode(struct gk20a *g, u32 mode, u32 engine); +u32 gv11b_therm_max_fpdiv_factor(void); #endif /* THERM_GV11B_H */ diff --git a/drivers/gpu/nvgpu/hal/therm/therm_gv11b_fusa.c b/drivers/gpu/nvgpu/hal/therm/therm_gv11b_fusa.c index ca1d16245..7c3001a46 100644 --- a/drivers/gpu/nvgpu/hal/therm/therm_gv11b_fusa.c +++ b/drivers/gpu/nvgpu/hal/therm/therm_gv11b_fusa.c @@ -1,7 +1,7 @@ /* * GV11B Therm * - * Copyright (c) 2015-2019, NVIDIA CORPORATION. All rights reserved. + * Copyright (c) 2015-2020, NVIDIA CORPORATION. All rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -66,13 +66,13 @@ int gv11b_init_therm_setup_hw(struct gk20a *g) therm_grad_stepping_table_slowdown_factor0_f( therm_grad_stepping_table_slowdown_factor0_fpdiv_by16_f()) | therm_grad_stepping_table_slowdown_factor1_f( - therm_grad_stepping_table_slowdown_factor0_fpdiv_by32_f()) | + g->ops.therm.therm_max_fpdiv_factor()) | therm_grad_stepping_table_slowdown_factor2_f( - therm_grad_stepping_table_slowdown_factor0_fpdiv_by32_f()) | + g->ops.therm.therm_max_fpdiv_factor()) | therm_grad_stepping_table_slowdown_factor3_f( - therm_grad_stepping_table_slowdown_factor0_fpdiv_by32_f()) | + g->ops.therm.therm_max_fpdiv_factor()) | therm_grad_stepping_table_slowdown_factor4_f( - therm_grad_stepping_table_slowdown_factor0_fpdiv_by32_f())); + g->ops.therm.therm_max_fpdiv_factor())); v = nvgpu_readl(g, therm_clk_timing_r(0)); v |= therm_clk_timing_grad_slowdown_enabled_f(); @@ -184,3 +184,8 @@ int gv11b_elcg_init_idle_filters(struct gk20a *g) return 0; } + +u32 gv11b_therm_max_fpdiv_factor(void) +{ + return therm_grad_stepping_table_slowdown_factor0_fpdiv_by32_f(); +} diff --git a/drivers/gpu/nvgpu/include/nvgpu/gops_therm.h b/drivers/gpu/nvgpu/include/nvgpu/gops_therm.h index 6b03cee2c..756a0f5d7 100644 --- a/drivers/gpu/nvgpu/include/nvgpu/gops_therm.h +++ b/drivers/gpu/nvgpu/include/nvgpu/gops_therm.h @@ -129,6 +129,7 @@ struct gops_therm { #ifdef CONFIG_DEBUG_FS void (*therm_debugfs_init)(struct gk20a *g); #endif + u32 (*therm_max_fpdiv_factor)(void); /** @endcond DOXYGEN_SHOULD_SKIP_THIS */ };