mirror of
git://nv-tegra.nvidia.com/linux-nvgpu.git
synced 2025-12-25 11:04:51 +03:00
gpu: nvgpu: gp10b: cache gpu clk rate
Cache the rate used in clk_set_rate(). Return that cached rate on clk_get_rate(), don't read from hardware. This cached rate is used to avoid duplicate requests to clk_set_rate(). Motivation is to support multiple governors for gpu clk. Reading clock from hardware is unreliable in multi-governor situation. Relying on hardware clock value could mislead the kernel gpu governor in its scaling calculations. Bug 2051688 Change-Id: I116b0ef73c51121b57ef36d08b6c67f49fdbf656 Signed-off-by: Arun Kannan <akannan@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/1662759 Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com> Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
committed by
mobile promotions
parent
ac40d082e8
commit
7f819a9ba7
@@ -55,6 +55,8 @@ struct gk20a_platform {
|
||||
/* Should be populated at probe. */
|
||||
bool can_elpg;
|
||||
|
||||
unsigned long cached_rate;
|
||||
|
||||
/* Should be populated at probe. */
|
||||
bool has_syncpoints;
|
||||
/* Debugfs knob for forcing syncpt support off in runtime. */
|
||||
|
||||
@@ -53,11 +53,13 @@ gp10b_freq_table[GP10B_MAX_SUPPORTED_FREQS / GP10B_FREQ_SELECT_STEP];
|
||||
|
||||
#define EMC_BW_RATIO (TEGRA_GP10B_BW_PER_FREQ / TEGRA_DDR4_BW_PER_FREQ)
|
||||
|
||||
#define GPCCLK_INIT_RATE 1000000000
|
||||
|
||||
static struct {
|
||||
char *name;
|
||||
unsigned long default_rate;
|
||||
} tegra_gp10b_clocks[] = {
|
||||
{"gpu", 1000000000},
|
||||
{"gpu", GPCCLK_INIT_RATE},
|
||||
{"gpu_sys", 204000000} };
|
||||
|
||||
static void gr_gp10b_remove_sysfs(struct device *dev);
|
||||
@@ -335,7 +337,7 @@ static unsigned long gp10b_get_clk_rate(struct device *dev)
|
||||
{
|
||||
struct gk20a_platform *platform = gk20a_get_platform(dev);
|
||||
|
||||
return clk_get_rate(platform->clk[0]);
|
||||
return platform->cached_rate;
|
||||
|
||||
}
|
||||
|
||||
@@ -357,8 +359,14 @@ static long gp10b_round_clk_rate(struct device *dev, unsigned long rate)
|
||||
static int gp10b_set_clk_rate(struct device *dev, unsigned long rate)
|
||||
{
|
||||
struct gk20a_platform *platform = gk20a_get_platform(dev);
|
||||
int ret;
|
||||
|
||||
return clk_set_rate(platform->clk[0], rate);
|
||||
ret = clk_set_rate(platform->clk[0], rate);
|
||||
|
||||
if (!ret)
|
||||
platform->cached_rate = rate;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int gp10b_clk_get_freqs(struct device *dev,
|
||||
@@ -416,6 +424,8 @@ struct gk20a_platform gp10b_tegra_platform = {
|
||||
.enable_elcg = true,
|
||||
.enable_aelpg = true,
|
||||
|
||||
.cached_rate = GPCCLK_INIT_RATE,
|
||||
|
||||
/* ptimer src frequency in hz*/
|
||||
.ptimer_src_freq = 31250000,
|
||||
|
||||
|
||||
Reference in New Issue
Block a user