gpu: nvgpu: return instance specific max subctx count

nvgpu_channel_get_max_subctx_count() right now always returns max subctx
count for 0th instance. Update this function to return max subctx count
for GPU instance for which channel is allocated.

For CE channels that are allocated and managed by nvgpu, cdev pointer is
not set in channel private data (since it is assigned in OS specific
code). For those channels continue returning max subctx count for 0th
instance. CE channels should not need subcontexts anyways.

Add nvgpu_cdev pointer in struct nvgpu_channel_linux. Assign it in
__gk20a_channel_open() and clear it in gk20a_channel_release()

Move code to get runlist and gpu_instance_id after nvgpu_get() call.
Accesses to gk20a pointer should always come after nvgpu_get().
Also add a debug print to dump runlist_id and gpu_instance_id being
used for channel.

Jira NVGPU-5648

Change-Id: Idf58ccefdb7dc9fec78100f79c647e5a00b8fb29
Signed-off-by: Deepak Nibade <dnibade@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2438924
Reviewed-by: automaticguardword <automaticguardword@nvidia.com>
Reviewed-by: Lakshmanan M <lm@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
This commit is contained in:
Deepak Nibade
2020-10-30 11:57:03 +05:30
committed by Alex Waterman
parent 8803c33f27
commit dacdaf0778
3 changed files with 30 additions and 6 deletions

View File

@@ -33,6 +33,7 @@
#include "channel.h"
#include "ioctl_channel.h"
#include "ioctl.h"
#include "os_linux.h"
#include "dmabuf_priv.h"
@@ -631,10 +632,19 @@ u32 nvgpu_get_gpfifo_entry_size(void)
u32 nvgpu_channel_get_max_subctx_count(struct nvgpu_channel *ch)
{
struct nvgpu_channel_linux *priv = ch->os_priv;
struct gk20a *g = ch->g;
u32 gpu_instance_id;
return nvgpu_grmgr_get_gpu_instance_max_veid_count(g,
0U);
if (priv->cdev == NULL) {
/* CE channels reserved by nvgpu do not have cdev pointer */
return nvgpu_grmgr_get_gpu_instance_max_veid_count(g, 0U);
}
gpu_instance_id = nvgpu_get_gpu_instance_id_from_cdev(g, priv->cdev);
nvgpu_assert(gpu_instance_id < g->mig.num_gpu_instances);
return nvgpu_grmgr_get_gpu_instance_max_veid_count(g, gpu_instance_id);
}
#ifdef CONFIG_DEBUG_FS