From d255c64f50f368aa8b4f8988a50b1b083b8dec9d Mon Sep 17 00:00:00 2001 From: Seshendra Gadagottu Date: Tue, 24 Aug 2021 12:06:26 -0700 Subject: [PATCH] gpu: nvgpu: ga10x: update pdiv_duration for thermal To keep pdiv_duration at 15usec between steps at 102MHz utilsclk, update stepping duration value from 0xBF4 to 0x5FA for ga10x. Bug 200757274 Change-Id: I333a5b0b35307402a734a7eafc4ab13d20316cd1 Signed-off-by: Seshendra Gadagottu Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2584539 Reviewed-by: svc-mobile-coverity Reviewed-by: svc-mobile-misra Reviewed-by: svc-mobile-cert Reviewed-by: svc_kernel_abi Reviewed-by: Seema Khowala Reviewed-by: mobile promotions GVS: Gerrit_Virtual_Submit Tested-by: mobile promotions --- drivers/gpu/nvgpu/hal/init/hal_ga100.c | 2 ++ drivers/gpu/nvgpu/hal/init/hal_ga10b.c | 2 ++ drivers/gpu/nvgpu/hal/init/hal_gv11b.c | 2 ++ drivers/gpu/nvgpu/hal/therm/therm_ga10b.h | 3 ++- drivers/gpu/nvgpu/hal/therm/therm_ga10b_fusa.c | 8 +++++++- drivers/gpu/nvgpu/hal/therm/therm_gv11b.h | 3 ++- drivers/gpu/nvgpu/hal/therm/therm_gv11b_fusa.c | 8 +++++++- drivers/gpu/nvgpu/include/nvgpu/gops/therm.h | 1 + 8 files changed, 25 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/nvgpu/hal/init/hal_ga100.c b/drivers/gpu/nvgpu/hal/init/hal_ga100.c index ccb3189ce..30d999b09 100644 --- a/drivers/gpu/nvgpu/hal/init/hal_ga100.c +++ b/drivers/gpu/nvgpu/hal/init/hal_ga100.c @@ -1248,6 +1248,8 @@ static const struct gops_mm ga100_ops_mm = { static const struct gops_therm ga100_ops_therm = { .therm_max_fpdiv_factor = ga10b_therm_max_fpdiv_factor, + .therm_grad_stepping_pdiv_duration = + ga10b_therm_grad_stepping_pdiv_duration, .init_therm_support = nvgpu_init_therm_support, /* PROD values match with H/W INIT values */ .init_elcg_mode = gv11b_therm_init_elcg_mode, diff --git a/drivers/gpu/nvgpu/hal/init/hal_ga10b.c b/drivers/gpu/nvgpu/hal/init/hal_ga10b.c index b288c3278..b84dbf9c4 100644 --- a/drivers/gpu/nvgpu/hal/init/hal_ga10b.c +++ b/drivers/gpu/nvgpu/hal/init/hal_ga10b.c @@ -1236,6 +1236,8 @@ static const struct gops_mm ga10b_ops_mm = { static const struct gops_therm ga10b_ops_therm = { .therm_max_fpdiv_factor = ga10b_therm_max_fpdiv_factor, + .therm_grad_stepping_pdiv_duration = + ga10b_therm_grad_stepping_pdiv_duration, .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/init/hal_gv11b.c b/drivers/gpu/nvgpu/hal/init/hal_gv11b.c index c8e106a0a..80a610e4b 100644 --- a/drivers/gpu/nvgpu/hal/init/hal_gv11b.c +++ b/drivers/gpu/nvgpu/hal/init/hal_gv11b.c @@ -1083,6 +1083,8 @@ static const struct gops_mm gv11b_ops_mm = { static const struct gops_therm gv11b_ops_therm = { .therm_max_fpdiv_factor = gv11b_therm_max_fpdiv_factor, + .therm_grad_stepping_pdiv_duration = + gv11b_therm_grad_stepping_pdiv_duration, .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_ga10b.h b/drivers/gpu/nvgpu/hal/therm/therm_ga10b.h index aca47a667..c7fad5b0c 100644 --- a/drivers/gpu/nvgpu/hal/therm/therm_ga10b.h +++ b/drivers/gpu/nvgpu/hal/therm/therm_ga10b.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved. + * Copyright (c) 2020-2021, 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"), @@ -25,6 +25,7 @@ struct gk20a; u32 ga10b_therm_max_fpdiv_factor(void); +u32 ga10b_therm_grad_stepping_pdiv_duration(void); int ga10b_elcg_init_idle_filters(struct gk20a *g); #endif /* THERM_GA10B_H */ diff --git a/drivers/gpu/nvgpu/hal/therm/therm_ga10b_fusa.c b/drivers/gpu/nvgpu/hal/therm/therm_ga10b_fusa.c index 739f9ed14..37e6d42e3 100644 --- a/drivers/gpu/nvgpu/hal/therm/therm_ga10b_fusa.c +++ b/drivers/gpu/nvgpu/hal/therm/therm_ga10b_fusa.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved. + * Copyright (c) 2020-2021, 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"), @@ -34,6 +34,12 @@ #include u32 ga10b_therm_max_fpdiv_factor(void) +{ + /* minimum duration between steps 15usec * UTILSCLK@102 MHz */ + return 0x5FA; +} + +u32 ga10b_therm_grad_stepping_pdiv_duration(void) { return therm_grad_stepping_table_slowdown_factor0_fpdiv_by31_f(); } diff --git a/drivers/gpu/nvgpu/hal/therm/therm_gv11b.h b/drivers/gpu/nvgpu/hal/therm/therm_gv11b.h index febde15d7..953fd0fe4 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-2020, NVIDIA CORPORATION. All rights reserved. + * Copyright (c) 2017-2021, 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"), @@ -27,5 +27,6 @@ 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); +u32 gv11b_therm_grad_stepping_pdiv_duration(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 5fcd9d8e0..d56c86261 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-2020, NVIDIA CORPORATION. All rights reserved. + * Copyright (c) 2015-2021, 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"), @@ -191,3 +191,9 @@ u32 gv11b_therm_max_fpdiv_factor(void) { return therm_grad_stepping_table_slowdown_factor0_fpdiv_by32_f(); } + +u32 gv11b_therm_grad_stepping_pdiv_duration(void) +{ + /* minimum duration between steps 15usec * UTILSCLK@204 MHz */ + return 0xBF4; +} diff --git a/drivers/gpu/nvgpu/include/nvgpu/gops/therm.h b/drivers/gpu/nvgpu/include/nvgpu/gops/therm.h index 9cdec4271..dbdf3e0d7 100644 --- a/drivers/gpu/nvgpu/include/nvgpu/gops/therm.h +++ b/drivers/gpu/nvgpu/include/nvgpu/gops/therm.h @@ -137,6 +137,7 @@ struct gops_therm { void (*therm_debugfs_init)(struct gk20a *g); #endif u32 (*therm_max_fpdiv_factor)(void); + u32 (*therm_grad_stepping_pdiv_duration)(void); void (*get_internal_sensor_curr_temp)(struct gk20a *g, u32 *temp_f24_8); /** @endcond DOXYGEN_SHOULD_SKIP_THIS */ };