gpu: nvgpu: configure nvgpu lpwr with module parameters

Support nvgpu lpwr configuration with module
parameter, setting for each lpwr feature
would be profiled with bit operation.

module parameter: lpwr_enable
┌───────┬───────┬───────────────────────────────────────────┐
│  Bit  │ Reset │ Description                               │
╞═══════╪═══════╪═══════════════════════════════════════════╡
│ 0:1   │ 0x0   │ BLCG enablement.                          │
│       │       │ 0b00, 0b01: default platform configuration│
│       │       │ 0b10: disable feature                     │
│       │       │ 0b11: enable feature                      │
├───────┼───────┼───────────────────────────────────────────┤
│ 2:3   │ 0x0   │ ELCG enablement                           │
│       │       │ 0b00, 0b01: default platform configuration│
│       │       │ 0b10: disable feature                     │
│       │       │ 0b11: enable feature                      │
├───────┼───────┼───────────────────────────────────────────┤
│ 4:5   │ 0x0   │ ELPG enablement.                          │
│       │       │ 0b00, 0b01: default platform configuration│
│       │       │ 0b10: disable feature                     │
│       │       │ 0b11: enable feature                      │
├───────┼───────┼───────────────────────────────────────────┤
│ 6:7   │ 0x0   │ FLCG enablement.                          │
│       │       │ 0b00, 0b01: default platform configuration│
│       │       │ 0b10: disable feature                     │
│       │       │ 0b11: enable feature                      │
├───────┼───────┼───────────────────────────────────────────┤
│ 8:9   │ 0x0   │ SLCG enalement.                           │
│       │       │ 0b00, 0b01: default platform configuration│
│       │       │ 0b10: disable feature                     │
│       │       │ 0b11: enable feature                      │
├───────┼───────┼───────────────────────────────────────────┤
│ 10:11 │ 0x0   │ AELPG enablement.                         │
│       │       │ 0b00, 0b01: default platform configuration│
│       │       │ 0b10: disable feature                     │
│       │       │ 0b11: enable feature                      │
├───────┼───────┼───────────────────────────────────────────┤
│ 12:13 │ 0x0   │ MSCG enablement.                          │
│       │       │ 0b00, 0b01: default platform configuration│
│       │       │ 0b10: disable feature                     │
│       │       │ 0b11: enable feature                      │
└───────┴───────┴───────────────────────────────────────────┘

Bug 4084478

Change-Id: I7f1e506fec3196d3b4f90006dc2f4162da6c4990
Signed-off-by: shaochunk <shaochunk@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2978579
Reviewed-by: Vijayakumar Subbu <vsubbu@nvidia.com>
Reviewed-by: Divya Singhatwaria <dsinghatwari@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
This commit is contained in:
shaochunk
2023-09-12 11:51:19 +08:00
committed by mobile promotions
parent f2afbafcfd
commit d28dda7149
3 changed files with 47 additions and 0 deletions

View File

@@ -45,8 +45,16 @@
#include "sysfs.h"
#include "ioctl.h"
#include "scale.h"
#include "driver_common.h"
#define EMC3D_DEFAULT_RATIO 750
#define NVGPU_BLCG_ENABLEMENT BIT(1)
#define NVGPU_ELCG_ENABLEMENT BIT(3)
#define NVGPU_ELPG_ENABLEMENT BIT(5)
#define NVGPU_FLCG_ENABLEMENT BIT(7)
#define NVGPU_SLCG_ENABLEMENT BIT(9)
#define NVGPU_AELPG_ENABLEMENT BIT(11)
#define NVGPU_MSCG_ENABLEMENT BIT(13)
void nvgpu_kernel_restart(void *cmd)
{
@@ -225,6 +233,35 @@ static void nvgpu_init_pm_vars(struct gk20a *g)
struct device *dev = dev_from_gk20a(g);
struct gk20a_platform *platform = dev_get_drvdata(dev);
/* Consider the power setting from module parameter */
platform->enable_blcg = nvgpu_lpwr_enable & NVGPU_BLCG_ENABLEMENT ?
nvgpu_lpwr_enable & (NVGPU_BLCG_ENABLEMENT >> 1) :
platform->enable_blcg;
platform->enable_elcg = nvgpu_lpwr_enable & NVGPU_ELCG_ENABLEMENT ?
nvgpu_lpwr_enable & (NVGPU_ELCG_ENABLEMENT >> 1) :
platform->enable_elcg;
platform->enable_elpg = nvgpu_lpwr_enable & NVGPU_ELPG_ENABLEMENT ?
nvgpu_lpwr_enable & (NVGPU_ELPG_ENABLEMENT >> 1) :
platform->enable_elpg;
platform->enable_flcg = nvgpu_lpwr_enable & NVGPU_FLCG_ENABLEMENT ?
nvgpu_lpwr_enable & (NVGPU_FLCG_ENABLEMENT >> 1) :
platform->enable_flcg;
platform->enable_slcg = nvgpu_lpwr_enable & NVGPU_SLCG_ENABLEMENT ?
nvgpu_lpwr_enable & (NVGPU_SLCG_ENABLEMENT >> 1) :
platform->enable_slcg;
platform->enable_aelpg = nvgpu_lpwr_enable & NVGPU_AELPG_ENABLEMENT ?
nvgpu_lpwr_enable & (NVGPU_AELPG_ENABLEMENT >> 1) :
platform->enable_aelpg;
platform->enable_mscg = nvgpu_lpwr_enable & NVGPU_MSCG_ENABLEMENT ?
nvgpu_lpwr_enable & (NVGPU_MSCG_ENABLEMENT >> 1) :
platform->enable_mscg;
/*
* Set up initial power settings. For non-slicon platforms, disable
* power features and for silicon platforms, read from platform data