gpu: nvgpu: add channel.get_vmid gops

Add a channel.get_vmid gops so that we can pass the proper VMID to
gr.fecs_trace.bind_channel in virtualized environments.

Jira GVSCI-14708

Change-Id: Ifc4e6aafa33fa7274bdeb000e8c0fd1a7fc849c7
Signed-off-by: Austin Tajiri <atajiri@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2780108
Reviewed-by: Sagar Kamble <skamble@nvidia.com>
Reviewed-by: Vijayakumar Subbu <vsubbu@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>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
This commit is contained in:
Austin Tajiri
2022-09-17 06:56:29 +00:00
committed by mobile promotions
parent 5bb56723be
commit 3761c468ad
2 changed files with 12 additions and 2 deletions

View File

@@ -242,12 +242,21 @@ int nvgpu_gr_setup_alloc_obj_ctx(struct nvgpu_channel *c, u32 class_num,
#ifdef CONFIG_NVGPU_FECS_TRACE
if (g->ops.gr.fecs_trace.bind_channel && !c->vpr) {
u32 vmid = 0U;
if (nvgpu_is_enabled(g, NVGPU_SUPPORT_TSG_SUBCONTEXTS)) {
gr_subctx = nvgpu_tsg_subctx_get_gr_subctx(c->subctx);
}
if (g->ops.channel.get_vmid != NULL) {
err = g->ops.channel.get_vmid(c, &vmid);
if (err != 0) {
nvgpu_warn(g, "failed to get vmid from channel. chid=%u", c->chid);
}
}
err = g->ops.gr.fecs_trace.bind_channel(g, &c->inst_block,
gr_subctx, gr_ctx, mappings, tsg->tgid, 0);
gr_subctx, gr_ctx, mappings, tsg->tgid, vmid);
if (err != 0) {
nvgpu_warn(g,
"fail to bind channel for ctxsw trace");

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019-2020, NVIDIA CORPORATION. All rights reserved.
* Copyright (c) 2019-2022, NVIDIA CORPORATION. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@@ -142,6 +142,7 @@ struct gops_channel {
void (*reset_faulted)(struct gk20a *g, struct nvgpu_channel *ch,
bool eng, bool pbdma);
void (*clear)(struct nvgpu_channel *ch);
int (*get_vmid)(struct nvgpu_channel *ch, u32 *vmid);
#ifdef CONFIG_NVGPU_KERNEL_MODE_SUBMIT
int (*set_syncpt)(struct nvgpu_channel *ch);