mirror of
git://nv-tegra.nvidia.com/linux-nvgpu.git
synced 2025-12-24 02:22:34 +03:00
gpu: nvgpu: maintain authorized devices in TSG
When the TSG is successfully created first time or is opened with share token, the device instance id associated with the CTRL fd will be added to the TSG private data structure as authorized device instance ids. This is used for a security check when creating a TSG share token with nvgpu_tsg_get_share_token. Bug 3677982 JIRA NVGPU-8681 Change-Id: I67bb0514e1272dab15023cd3828a6a51e9a4c928 Signed-off-by: Sagar Kamble <skamble@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2792080 Reviewed-by: svcacv <svcacv@nvidia.com> Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com> Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com> Reviewed-by: svc-mobile-misra <svc-mobile-misra@nvidia.com> Reviewed-by: Scott Long <scottl@nvidia.com> Reviewed-by: Vijayakumar Subbu <vsubbu@nvidia.com> GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
This commit is contained in:
committed by
mobile promotions
parent
6e2b592ab9
commit
675edd5053
@@ -705,7 +705,7 @@ clean_up:
|
||||
return err;
|
||||
}
|
||||
|
||||
static int gk20a_ctrl_open_tsg(struct gk20a *g, struct nvgpu_cdev *cdev,
|
||||
static int gk20a_ctrl_open_tsg(struct gk20a *g, struct gk20a_ctrl_priv *priv,
|
||||
struct nvgpu_gpu_open_tsg_args *args)
|
||||
{
|
||||
int err;
|
||||
@@ -726,7 +726,7 @@ static int gk20a_ctrl_open_tsg(struct gk20a *g, struct nvgpu_cdev *cdev,
|
||||
goto clean_up;
|
||||
}
|
||||
|
||||
err = nvgpu_ioctl_tsg_open(g, cdev, file);
|
||||
err = nvgpu_ioctl_tsg_open(g, priv, priv->cdev, file);
|
||||
if (err)
|
||||
goto clean_up_file;
|
||||
|
||||
@@ -2450,7 +2450,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, priv->cdev,
|
||||
err = gk20a_ctrl_open_tsg(g, priv,
|
||||
(struct nvgpu_gpu_open_tsg_args *)buf);
|
||||
break;
|
||||
case NVGPU_GPU_IOCTL_GET_TPC_MASKS:
|
||||
@@ -2798,3 +2798,10 @@ void nvgpu_restore_usermode_for_poweron(struct gk20a *g)
|
||||
{
|
||||
alter_usermode_mappings(g, false);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_NVGPU_TSG_SHARING
|
||||
u64 nvgpu_gpu_get_device_instance_id(struct gk20a_ctrl_priv *priv)
|
||||
{
|
||||
return priv ? priv->device_instance_id : 0ULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user