From c9a964aefdabde6c9443812b3e2f04db17deb5ea Mon Sep 17 00:00:00 2001 From: Sagar Kamble Date: Mon, 5 Oct 2020 16:52:32 +0530 Subject: [PATCH] gpu: nvgpu: move emc frequency floor setup under CONFIG_TEGRA_BWMGR API to set/remove emc frequency floor is defined under the config CONFIG_TEGRA_BWMGR. Add that config guard in railgate/unrailgate. Bug 200602747 Change-Id: I375f266a9926dc525102178761ffeade47cc6a66 Signed-off-by: Sagar Kamble Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2423517 Reviewed-by: automaticguardword Reviewed-by: Deepak Nibade Reviewed-by: mobile promotions Tested-by: mobile promotions --- .../gpu/nvgpu/os/linux/platform_gp10b_tegra.c | 15 ++++++++++---- .../gpu/nvgpu/os/linux/platform_gv11b_tegra.c | 20 ++++++++++++++----- 2 files changed, 26 insertions(+), 9 deletions(-) diff --git a/drivers/gpu/nvgpu/os/linux/platform_gp10b_tegra.c b/drivers/gpu/nvgpu/os/linux/platform_gp10b_tegra.c index 91f650230..3b5eec5d3 100644 --- a/drivers/gpu/nvgpu/os/linux/platform_gp10b_tegra.c +++ b/drivers/gpu/nvgpu/os/linux/platform_gp10b_tegra.c @@ -293,7 +293,7 @@ void gp10b_tegra_clks_control(struct device *dev, bool enable) static int gp10b_tegra_railgate(struct device *dev) { -#ifdef TEGRA186_POWER_DOMAIN_GPU +#ifdef CONFIG_TEGRA_BWMGR struct gk20a_platform *platform = gk20a_get_platform(dev); struct gk20a_scale_profile *profile = platform->g->scale_profile; @@ -302,7 +302,9 @@ static int gp10b_tegra_railgate(struct device *dev) tegra_bwmgr_set_emc( (struct tegra_bwmgr_client *)profile->private_data, 0, TEGRA_BWMGR_SET_EMC_FLOOR); +#endif +#ifdef TEGRA186_POWER_DOMAIN_GPU if (tegra_bpmp_running() && tegra_powergate_is_powered(TEGRA186_POWER_DOMAIN_GPU)) { gp10b_tegra_clks_control(dev, false); @@ -317,24 +319,29 @@ static int gp10b_tegra_railgate(struct device *dev) static int gp10b_tegra_unrailgate(struct device *dev) { int ret = 0; -#ifdef TEGRA186_POWER_DOMAIN_GPU +#ifdef CONFIG_TEGRA_BWMGR struct gk20a_platform *platform = gk20a_get_platform(dev); struct gk20a_scale_profile *profile = platform->g->scale_profile; +#endif +#ifdef TEGRA186_POWER_DOMAIN_GPU if (tegra_bpmp_running()) { ret = tegra_unpowergate_partition(TEGRA186_POWER_DOMAIN_GPU); gp10b_tegra_clks_control(dev, true); } +#else + gp10b_tegra_clks_control(dev, true); +#endif +#ifdef CONFIG_TEGRA_BWMGR /* to start with set emc frequency floor to max rate*/ if (profile) tegra_bwmgr_set_emc( (struct tegra_bwmgr_client *)profile->private_data, tegra_bwmgr_get_max_emc_rate(), TEGRA_BWMGR_SET_EMC_FLOOR); -#else - gp10b_tegra_clks_control(dev, true); #endif + return ret; } diff --git a/drivers/gpu/nvgpu/os/linux/platform_gv11b_tegra.c b/drivers/gpu/nvgpu/os/linux/platform_gv11b_tegra.c index 6311c9f10..a0b50fb23 100644 --- a/drivers/gpu/nvgpu/os/linux/platform_gv11b_tegra.c +++ b/drivers/gpu/nvgpu/os/linux/platform_gv11b_tegra.c @@ -166,16 +166,21 @@ static bool gv11b_tegra_is_railgated(struct device *dev) static int gv11b_tegra_railgate(struct device *dev) { #ifdef TEGRA194_POWER_DOMAIN_GPU + struct gk20a *g = get_gk20a(dev); +#endif + +#ifdef CONFIG_TEGRA_BWMGR struct gk20a_platform *platform = gk20a_get_platform(dev); struct gk20a_scale_profile *profile = platform->g->scale_profile; - struct gk20a *g = get_gk20a(dev); /* remove emc frequency floor */ if (profile) tegra_bwmgr_set_emc( (struct tegra_bwmgr_client *)profile->private_data, 0, TEGRA_BWMGR_SET_EMC_FLOOR); +#endif +#ifdef TEGRA194_POWER_DOMAIN_GPU if (tegra_bpmp_running()) { nvgpu_log(g, gpu_dbg_info, "bpmp running"); if (!tegra_powergate_is_powered(TEGRA194_POWER_DOMAIN_GPU)) { @@ -197,10 +202,12 @@ static int gv11b_tegra_railgate(struct device *dev) static int gv11b_tegra_unrailgate(struct device *dev) { int ret = 0; -#ifdef TEGRA194_POWER_DOMAIN_GPU +#ifdef CONFIG_TEGRA_BWMGR struct gk20a_platform *platform = gk20a_get_platform(dev); - struct gk20a *g = get_gk20a(dev); struct gk20a_scale_profile *profile = platform->g->scale_profile; +#endif +#ifdef TEGRA194_POWER_DOMAIN_GPU + struct gk20a *g = get_gk20a(dev); if (tegra_bpmp_running()) { nvgpu_log(g, gpu_dbg_info, "bpmp running"); @@ -214,16 +221,19 @@ static int gv11b_tegra_unrailgate(struct device *dev) } else { nvgpu_log(g, gpu_dbg_info, "bpmp not running"); } +#else + gp10b_tegra_clks_control(dev, true); +#endif +#ifdef CONFIG_TEGRA_BWMGR /* to start with set emc frequency floor to max rate*/ if (profile) tegra_bwmgr_set_emc( (struct tegra_bwmgr_client *)profile->private_data, tegra_bwmgr_get_max_emc_rate(), TEGRA_BWMGR_SET_EMC_FLOOR); -#else - gp10b_tegra_clks_control(dev, true); #endif + return ret; }