gpu: nvgpu: gv11b: Kernel iface for Dynamic TPC-PG

This patch adds kernel interface for dynamic TPC-PG feature.
User-space needs to send TPC-PG args to kernel via ioctl.

Dynamic TPC-PG feature will allow every context to specify the
number of TPC's it will use to run its workload.
This way, graphics driver can power off non-required TPC's
if a particular context has light to medium workload.

JIRA GPUT19x-16

Change-Id: Id4846245a6414b719599d04784cbe2ca5282f4ad
Signed-off-by: Deepak Goyal <dgoyal@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1575848
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Alex Waterman <alexw@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Vijayakumar Subbu <vsubbu@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Deepak Goyal
2017-10-27 14:51:17 +05:30
committed by mobile promotions
parent f472922b35
commit 730ba218c1
3 changed files with 29 additions and 5 deletions

View File

@@ -28,6 +28,7 @@ static int gv11b_tsg_ioctl_bind_channel_ex(struct gk20a *g,
struct nvgpu_os_linux *l = nvgpu_os_linux_from_gk20a(g); struct nvgpu_os_linux *l = nvgpu_os_linux_from_gk20a(g);
struct gk20a_sched_ctrl *sched = &l->sched_ctrl; struct gk20a_sched_ctrl *sched = &l->sched_ctrl;
struct channel_gk20a *ch; struct channel_gk20a *ch;
struct gr_gk20a *gr = &g->gr;
int err = 0; int err = 0;
nvgpu_log(g, gpu_dbg_fn | gpu_dbg_sched, "tsgid=%u", tsg->tsgid); nvgpu_log(g, gpu_dbg_fn | gpu_dbg_sched, "tsgid=%u", tsg->tsgid);
@@ -48,6 +49,22 @@ static int gv11b_tsg_ioctl_bind_channel_ex(struct gk20a *g,
err = -EINVAL; err = -EINVAL;
goto idle; goto idle;
} }
if (arg->tpc_pg_enabled && (!tsg->t19x.tpc_num_initialized)) {
if ((arg->num_active_tpcs > gr->max_tpc_count) ||
!(arg->num_active_tpcs)) {
nvgpu_err(g, "Invalid num of active TPCs");
err = -EINVAL;
goto ch_put;
}
tsg->t19x.tpc_num_initialized = true;
tsg->t19x.num_active_tpcs = arg->num_active_tpcs;
tsg->t19x.tpc_pg_enabled = true;
} else {
tsg->t19x.tpc_pg_enabled = false;
nvgpu_log(g, gpu_dbg_info, "dynamic TPC-PG not enabled");
}
if (arg->subcontext_id < g->fifo.t19x.max_subctx_count) { if (arg->subcontext_id < g->fifo.t19x.max_subctx_count) {
ch->t19x.subctx_id = arg->subcontext_id; ch->t19x.subctx_id = arg->subcontext_id;
} else { } else {

View File

@@ -22,9 +22,15 @@
* DEALINGS IN THE SOFTWARE. * DEALINGS IN THE SOFTWARE.
*/ */
#ifndef _NVGPU_TSG_T19X_H_ #ifndef __NVGPU_TSG_T19X_H__
#define _NVGPU_TSG_T19X_H_ #define __NVGPU_TSG_T19X_H__
#include "common/linux/ioctl_tsg_t19x.h" #include <nvgpu/types.h>
struct tsg_t19x {
u32 num_active_tpcs;
u8 tpc_pg_enabled;
bool tpc_num_initialized;
};
#endif #endif

View File

@@ -44,8 +44,9 @@ struct nvgpu_tsg_bind_channel_ex_args {
/* in: VEID in Volta */ /* in: VEID in Volta */
__u32 subcontext_id; __u32 subcontext_id;
__u32 num_active_tpcs;
__u64 reserved[2]; __u8 tpc_pg_enabled;
__u8 reserved[11];
}; };
#define NVGPU_TSG_IOCTL_BIND_CHANNEL_EX \ #define NVGPU_TSG_IOCTL_BIND_CHANNEL_EX \