mirror of
git://nv-tegra.nvidia.com/linux-nvgpu.git
synced 2025-12-24 10:34:43 +03:00
gpu: nvgpu: add FLCG support for PERFMON
Add FLCG register programming for PERFMON Jira NVGPU-7228 Change-Id: Ia1b3b2976c65c44f718789bcfbef4cad7e0718b3 Signed-off-by: Sagar Kadamati <skadamati@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2712095 Tested-by: Rajesh Devaraj <rdevaraj@nvidia.com> Reviewed-by: Antony Clince Alex <aalex@nvidia.com> Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com> Reviewed-by: svc-mobile-misra <svc-mobile-misra@nvidia.com> Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com> Reviewed-by: Ankur Kishore <ankkishore@nvidia.com> GVS: Gerrit_Virtual_Submit
This commit is contained in:
committed by
mobile promotions
parent
8ed2431646
commit
fdba1eef10
@@ -188,6 +188,8 @@ static void nvgpu_init_pm_vars(struct gk20a *g)
|
||||
* Set up initial power settings. For non-slicon platforms, disable
|
||||
* power features and for silicon platforms, read from platform data
|
||||
*/
|
||||
g->flcg_enabled =
|
||||
nvgpu_platform_is_silicon(g) ? platform->enable_flcg : false;
|
||||
g->slcg_enabled =
|
||||
nvgpu_platform_is_silicon(g) ? platform->enable_slcg : false;
|
||||
g->blcg_enabled =
|
||||
@@ -203,6 +205,8 @@ static void nvgpu_init_pm_vars(struct gk20a *g)
|
||||
|
||||
nvgpu_set_enabled(g, NVGPU_GPU_CAN_ELCG,
|
||||
nvgpu_platform_is_silicon(g) ? platform->can_elcg : false);
|
||||
nvgpu_set_enabled(g, NVGPU_GPU_CAN_FLCG,
|
||||
nvgpu_platform_is_silicon(g) ? platform->can_flcg : false);
|
||||
nvgpu_set_enabled(g, NVGPU_GPU_CAN_SLCG,
|
||||
nvgpu_platform_is_silicon(g) ? platform->can_slcg : false);
|
||||
nvgpu_set_enabled(g, NVGPU_GPU_CAN_BLCG,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* GK20A Platform (SoC) Interface
|
||||
*
|
||||
* Copyright (c) 2014-2021, NVIDIA CORPORATION. All rights reserved.
|
||||
* Copyright (c) 2014-2022, NVIDIA CORPORATION. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
@@ -133,6 +133,9 @@ struct gk20a_platform {
|
||||
/* init value for slowdown factor */
|
||||
u8 ldiv_slowdown_factor_init;
|
||||
|
||||
/* First Level Clock Gating: true = enable false = disable */
|
||||
bool enable_flcg;
|
||||
|
||||
/* Second Level Clock Gating: true = enable false = disable */
|
||||
bool enable_slcg;
|
||||
|
||||
@@ -142,6 +145,9 @@ struct gk20a_platform {
|
||||
/* Engine Level Clock Gating: true = enable flase = disable */
|
||||
bool enable_elcg;
|
||||
|
||||
/* Should be populated at probe. */
|
||||
bool can_flcg;
|
||||
|
||||
/* Should be populated at probe. */
|
||||
bool can_slcg;
|
||||
|
||||
|
||||
@@ -182,6 +182,45 @@ static ssize_t slcg_enable_read(struct device *dev,
|
||||
|
||||
static DEVICE_ATTR(slcg_enable, ROOTRW, slcg_enable_read, slcg_enable_store);
|
||||
|
||||
static ssize_t flcg_enable_store(struct device *dev,
|
||||
struct device_attribute *attr, const char *buf, size_t count)
|
||||
{
|
||||
struct gk20a *g = get_gk20a(dev);
|
||||
unsigned long val = 0;
|
||||
int err;
|
||||
|
||||
if (kstrtoul(buf, 10, &val) < 0)
|
||||
return -EINVAL;
|
||||
|
||||
err = gk20a_busy(g);
|
||||
if (err) {
|
||||
return err;
|
||||
}
|
||||
|
||||
if (val) {
|
||||
nvgpu_cg_flcg_set_flcg_enabled(g, true);
|
||||
} else {
|
||||
nvgpu_cg_flcg_set_flcg_enabled(g, false);
|
||||
}
|
||||
|
||||
gk20a_idle(g);
|
||||
|
||||
nvgpu_info(g, "FLCG is %s.", val ? "enabled" :
|
||||
"disabled");
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
static ssize_t flcg_enable_read(struct device *dev,
|
||||
struct device_attribute *attr, char *buf)
|
||||
{
|
||||
struct gk20a *g = get_gk20a(dev);
|
||||
|
||||
return snprintf(buf, NVGPU_CPU_PAGE_SIZE, "%d\n", g->flcg_enabled ? 1 : 0);
|
||||
}
|
||||
|
||||
static DEVICE_ATTR(flcg_enable, ROOTRW, flcg_enable_read, flcg_enable_store);
|
||||
|
||||
static ssize_t ptimer_scale_factor_show(struct device *dev,
|
||||
struct device_attribute *attr,
|
||||
char *buf)
|
||||
@@ -1447,6 +1486,7 @@ void nvgpu_remove_sysfs(struct device *dev)
|
||||
device_remove_file(dev, &dev_attr_elcg_enable);
|
||||
device_remove_file(dev, &dev_attr_blcg_enable);
|
||||
device_remove_file(dev, &dev_attr_slcg_enable);
|
||||
device_remove_file(dev, &dev_attr_flcg_enable);
|
||||
device_remove_file(dev, &dev_attr_ptimer_scale_factor);
|
||||
device_remove_file(dev, &dev_attr_ptimer_ref_freq);
|
||||
device_remove_file(dev, &dev_attr_ptimer_src_freq);
|
||||
@@ -1515,6 +1555,7 @@ int nvgpu_create_sysfs(struct device *dev)
|
||||
error |= device_create_file(dev, &dev_attr_elcg_enable);
|
||||
error |= device_create_file(dev, &dev_attr_blcg_enable);
|
||||
error |= device_create_file(dev, &dev_attr_slcg_enable);
|
||||
error |= device_create_file(dev, &dev_attr_flcg_enable);
|
||||
error |= device_create_file(dev, &dev_attr_ptimer_scale_factor);
|
||||
error |= device_create_file(dev, &dev_attr_ptimer_ref_freq);
|
||||
error |= device_create_file(dev, &dev_attr_ptimer_src_freq);
|
||||
|
||||
Reference in New Issue
Block a user