gpu: nvgpu: allocate object context for specific GR instance

Add new API nvgpu_get_gpu_instance_id_from_cdev() that returns GPU
instance id from nvgpu_cdev pointer.

Store cdev pointer in channel private data channel_priv and ctrl node
private data gk20a_ctrl_priv.

Update below functions to pass cdev pointer :
__gk20a_channel_open()
gk20a_channel_open_ioctl()

In gk20a_channel_ioctl(), extract gpu instance id using cdev pointer
stored in channel_priv and new API nvgpu_get_gpu_instance_id_from_cdev().
Extract GR instance id using nvgpu_grmgr_get_gr_instance_id()

Invoke context creation API inside nvgpu_gr_exec_with_err_for_instance()
so that context is created with correct GR instance id.

Jira NVGPU-5648

Change-Id: I5a4e79165e021b56181d08105b2185306a19703b
Signed-off-by: Deepak Nibade <dnibade@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2435465
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-22 12:13:00 +05:30
committed by Alex Waterman
parent 69948919b7
commit d0a1f30e66
5 changed files with 41 additions and 9 deletions

View File

@@ -79,6 +79,7 @@ struct gk20a_ctrl_priv {
struct device *dev;
struct gk20a *g;
struct nvgpu_clk_session *clk_session;
struct nvgpu_cdev *cdev;
struct nvgpu_list_node list;
struct {
@@ -133,6 +134,7 @@ int gk20a_ctrl_dev_open(struct inode *inode, struct file *filp)
}
filp->private_data = priv;
priv->dev = dev_from_gk20a(g);
priv->cdev = cdev;
/*
* We dont close the arbiter fd's after driver teardown to support
* GPU_LOST events, so we store g here, instead of dereferencing the
@@ -1964,7 +1966,7 @@ long gk20a_ctrl_dev_ioctl(struct file *filp, unsigned int cmd, unsigned long arg
case NVGPU_GPU_IOCTL_OPEN_CHANNEL:
/* this arg type here, but ..gpu_open_channel_args in nvgpu.h
* for consistency - they are the same */
err = gk20a_channel_open_ioctl(g,
err = gk20a_channel_open_ioctl(g, priv->cdev,
(struct nvgpu_channel_open_args *)buf);
break;
case NVGPU_GPU_IOCTL_FLUSH_L2: