gpu: nvgpu: use instance specific max subctx count

Store nvgpu_cdev pointer in struct tsg_private and assign it in
nvgpu_ioctl_tsg_open.

In gk20a_tsg_ioctl_bind_channel_ex(), extract gpu_instance_id from
cdev pointer and then extract instance specific max VEID count from
gpu_instance_id.

Use this max veid count to validate subcontext id coming from user.

Jira NVGPU-5648

Change-Id: I71cea5180e1ced1a72818d160f1a951c1c6ec770
Signed-off-by: Deepak Nibade <dnibade@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2438925
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 12:14:45 +05:30
committed by Alex Waterman
parent dacdaf0778
commit dbad874d9e
3 changed files with 22 additions and 9 deletions

View File

@@ -639,7 +639,7 @@ clean_up:
return err;
}
static int gk20a_ctrl_open_tsg(struct gk20a *g,
static int gk20a_ctrl_open_tsg(struct gk20a *g, struct nvgpu_cdev *cdev,
struct nvgpu_gpu_open_tsg_args *args)
{
int err;
@@ -660,7 +660,7 @@ static int gk20a_ctrl_open_tsg(struct gk20a *g,
goto clean_up;
}
err = nvgpu_ioctl_tsg_open(g, file);
err = nvgpu_ioctl_tsg_open(g, cdev, file);
if (err)
goto clean_up_file;
@@ -2047,7 +2047,7 @@ long gk20a_ctrl_dev_ioctl(struct file *filp, unsigned int cmd, unsigned long arg
(struct nvgpu_alloc_as_args *)buf);
break;
case NVGPU_GPU_IOCTL_OPEN_TSG:
err = gk20a_ctrl_open_tsg(g,
err = gk20a_ctrl_open_tsg(g, priv->cdev,
(struct nvgpu_gpu_open_tsg_args *)buf);
break;
case NVGPU_GPU_IOCTL_GET_TPC_MASKS: