diff options
author | Deepak Goyal <dgoyal@nvidia.com> | 2018-05-07 02:12:33 -0400 |
---|---|---|
committer | mobile promotions <svcmobile_promotions@nvidia.com> | 2018-05-09 07:40:28 -0400 |
commit | f9e55fbaf66c024125a19e1a773a1a4f0e9648f4 (patch) | |
tree | 9df8d81c214e5208b5a9b3e4ddc45e345a2128d0 /drivers/gpu/nvgpu/common/linux | |
parent | a1a8ceca0c5cdc8484e4da66019c066be716f9c8 (diff) |
gpu: nvgpu: Add LDIV slowdown factor in INIT cmd.
PMU ucode is updated to include LDIV slowdown factor in gr_init_param command.
- Defined a new version gr_init_param_v2.
- Updated the PMU FW version code.
- Set the LDIV slowdown factor to 0x1e by default.
- Added sysfs entry to program ldiv_slowdown factor at runtime.
Bug 200391931
Change-Id: Ic66049588c3b20e934faff3f29283f66c30303e4
Signed-off-by: Deepak Goyal <dgoyal@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1674208
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/common/linux')
-rw-r--r-- | drivers/gpu/nvgpu/common/linux/driver_common.c | 1 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/common/linux/platform_gk20a.h | 3 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/common/linux/platform_gp10b_tegra.c | 3 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/common/linux/sysfs.c | 55 |
4 files changed, 61 insertions, 1 deletions
diff --git a/drivers/gpu/nvgpu/common/linux/driver_common.c b/drivers/gpu/nvgpu/common/linux/driver_common.c index c3663117..53789423 100644 --- a/drivers/gpu/nvgpu/common/linux/driver_common.c +++ b/drivers/gpu/nvgpu/common/linux/driver_common.c | |||
@@ -159,6 +159,7 @@ static void nvgpu_init_pm_vars(struct gk20a *g) | |||
159 | g->support_pmu = support_gk20a_pmu(dev_from_gk20a(g)); | 159 | g->support_pmu = support_gk20a_pmu(dev_from_gk20a(g)); |
160 | g->can_railgate = platform->can_railgate_init; | 160 | g->can_railgate = platform->can_railgate_init; |
161 | g->railgate_delay = platform->railgate_delay_init; | 161 | g->railgate_delay = platform->railgate_delay_init; |
162 | g->ldiv_slowdown_factor = platform->ldiv_slowdown_factor_init; | ||
162 | __nvgpu_set_enabled(g, NVGPU_PMU_PERFMON, platform->enable_perfmon); | 163 | __nvgpu_set_enabled(g, NVGPU_PMU_PERFMON, platform->enable_perfmon); |
163 | 164 | ||
164 | /* set default values to aelpg parameters */ | 165 | /* set default values to aelpg parameters */ |
diff --git a/drivers/gpu/nvgpu/common/linux/platform_gk20a.h b/drivers/gpu/nvgpu/common/linux/platform_gk20a.h index 43afbbf9..dec79b87 100644 --- a/drivers/gpu/nvgpu/common/linux/platform_gk20a.h +++ b/drivers/gpu/nvgpu/common/linux/platform_gk20a.h | |||
@@ -74,6 +74,9 @@ struct gk20a_platform { | |||
74 | /* Delay before rail gated */ | 74 | /* Delay before rail gated */ |
75 | int railgate_delay_init; | 75 | int railgate_delay_init; |
76 | 76 | ||
77 | /* init value for slowdown factor */ | ||
78 | u8 ldiv_slowdown_factor_init; | ||
79 | |||
77 | /* Second Level Clock Gating: true = enable false = disable */ | 80 | /* Second Level Clock Gating: true = enable false = disable */ |
78 | bool enable_slcg; | 81 | bool enable_slcg; |
79 | 82 | ||
diff --git a/drivers/gpu/nvgpu/common/linux/platform_gp10b_tegra.c b/drivers/gpu/nvgpu/common/linux/platform_gp10b_tegra.c index 96acf24b..6e54d00b 100644 --- a/drivers/gpu/nvgpu/common/linux/platform_gp10b_tegra.c +++ b/drivers/gpu/nvgpu/common/linux/platform_gp10b_tegra.c | |||
@@ -370,6 +370,9 @@ struct gk20a_platform gp10b_tegra_platform = { | |||
370 | /* power management configuration */ | 370 | /* power management configuration */ |
371 | .railgate_delay_init = 500, | 371 | .railgate_delay_init = 500, |
372 | 372 | ||
373 | /* ldiv slowdown factor */ | ||
374 | .ldiv_slowdown_factor_init = SLOWDOWN_FACTOR_FPDIV_BY16, | ||
375 | |||
373 | /* power management configuration */ | 376 | /* power management configuration */ |
374 | .can_railgate_init = true, | 377 | .can_railgate_init = true, |
375 | .enable_elpg = true, | 378 | .enable_elpg = true, |
diff --git a/drivers/gpu/nvgpu/common/linux/sysfs.c b/drivers/gpu/nvgpu/common/linux/sysfs.c index 6709285d..1f6da803 100644 --- a/drivers/gpu/nvgpu/common/linux/sysfs.c +++ b/drivers/gpu/nvgpu/common/linux/sysfs.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2011-2017, NVIDIA CORPORATION. All rights reserved. | 2 | * Copyright (c) 2011-2018, NVIDIA CORPORATION. All rights reserved. |
3 | * | 3 | * |
4 | * This program is free software; you can redistribute it and/or modify it | 4 | * This program is free software; you can redistribute it and/or modify it |
5 | * under the terms and conditions of the GNU General Public License, | 5 | * under the terms and conditions of the GNU General Public License, |
@@ -504,6 +504,58 @@ static ssize_t elpg_enable_read(struct device *dev, | |||
504 | 504 | ||
505 | static DEVICE_ATTR(elpg_enable, ROOTRW, elpg_enable_read, elpg_enable_store); | 505 | static DEVICE_ATTR(elpg_enable, ROOTRW, elpg_enable_read, elpg_enable_store); |
506 | 506 | ||
507 | static ssize_t ldiv_slowdown_factor_store(struct device *dev, | ||
508 | struct device_attribute *attr, const char *buf, size_t count) | ||
509 | { | ||
510 | struct gk20a *g = get_gk20a(dev); | ||
511 | unsigned long val = 0; | ||
512 | int err; | ||
513 | |||
514 | if (kstrtoul(buf, 10, &val) < 0) { | ||
515 | nvgpu_err(g, "parse error for input SLOWDOWN factor\n"); | ||
516 | return -EINVAL; | ||
517 | } | ||
518 | |||
519 | if (val >= SLOWDOWN_FACTOR_FPDIV_BYMAX) { | ||
520 | nvgpu_err(g, "Invalid SLOWDOWN factor\n"); | ||
521 | return -EINVAL; | ||
522 | } | ||
523 | |||
524 | if (val == g->ldiv_slowdown_factor) | ||
525 | return count; | ||
526 | |||
527 | if (!g->power_on) { | ||
528 | g->ldiv_slowdown_factor = val; | ||
529 | } else { | ||
530 | err = gk20a_busy(g); | ||
531 | if (err) | ||
532 | return -EAGAIN; | ||
533 | |||
534 | g->ldiv_slowdown_factor = val; | ||
535 | |||
536 | if (g->ops.pmu.pmu_pg_init_param) | ||
537 | g->ops.pmu.pmu_pg_init_param(g, | ||
538 | PMU_PG_ELPG_ENGINE_ID_GRAPHICS); | ||
539 | |||
540 | gk20a_idle(g); | ||
541 | } | ||
542 | |||
543 | nvgpu_info(g, "ldiv_slowdown_factor is %x\n", g->ldiv_slowdown_factor); | ||
544 | |||
545 | return count; | ||
546 | } | ||
547 | |||
548 | static ssize_t ldiv_slowdown_factor_read(struct device *dev, | ||
549 | struct device_attribute *attr, char *buf) | ||
550 | { | ||
551 | struct gk20a *g = get_gk20a(dev); | ||
552 | |||
553 | return snprintf(buf, PAGE_SIZE, "%d\n", g->ldiv_slowdown_factor); | ||
554 | } | ||
555 | |||
556 | static DEVICE_ATTR(ldiv_slowdown_factor, ROOTRW, | ||
557 | ldiv_slowdown_factor_read, ldiv_slowdown_factor_store); | ||
558 | |||
507 | static ssize_t mscg_enable_store(struct device *dev, | 559 | static ssize_t mscg_enable_store(struct device *dev, |
508 | struct device_attribute *attr, const char *buf, size_t count) | 560 | struct device_attribute *attr, const char *buf, size_t count) |
509 | { | 561 | { |
@@ -1114,6 +1166,7 @@ int nvgpu_create_sysfs(struct device *dev) | |||
1114 | error |= device_create_file(dev, &dev_attr_elpg_enable); | 1166 | error |= device_create_file(dev, &dev_attr_elpg_enable); |
1115 | error |= device_create_file(dev, &dev_attr_mscg_enable); | 1167 | error |= device_create_file(dev, &dev_attr_mscg_enable); |
1116 | error |= device_create_file(dev, &dev_attr_emc3d_ratio); | 1168 | error |= device_create_file(dev, &dev_attr_emc3d_ratio); |
1169 | error |= device_create_file(dev, &dev_attr_ldiv_slowdown_factor); | ||
1117 | #ifdef CONFIG_TEGRA_DVFS | 1170 | #ifdef CONFIG_TEGRA_DVFS |
1118 | error |= device_create_file(dev, &dev_attr_fmax_at_vmin_safe); | 1171 | error |= device_create_file(dev, &dev_attr_fmax_at_vmin_safe); |
1119 | #endif | 1172 | #endif |