mirror of
git://nv-tegra.nvidia.com/linux-nvgpu.git
synced 2025-12-24 02:22:34 +03:00
gpu: nvgpu: track dev nodes using dynamic linked list
Remove static dev node meta data from struct nvgpu_os_linux and replace it by a dynamic list. Struct nvgpu_os_linux will only keep track of list head and number of entries. Add new structure nvgpu_cdev to store meta data of each dev node and create/setup it dynamically in gk20a_user_init(). Once done, add the new node under list head maintained in nvgpu_os_linux. Add a static list dev_node_list[] that contains list of dev node names and file operations. This static list is used to create nvgpu_cdev data structures and to register new device nodes. Update all dev node open file operations (e.g. gk20a_as_dev_open()) to extract struct gk20a pointer from device pointer of dev node. gk20a device is the parent of dev node device. Jira NVGPU-5648 Change-Id: If070c3428afd6215e45b4919335d9f43e04c36f9 Signed-off-by: Deepak Nibade <dnibade@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2428500 Reviewed-by: automaticguardword <automaticguardword@nvidia.com> Reviewed-by: Alex Waterman <alexw@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:
committed by
Alex Waterman
parent
9082bcf3bd
commit
a3e39c685d
@@ -150,7 +150,7 @@ static int nvgpu_profiler_reserve_release(struct dbg_session_gk20a *dbg_s,
|
||||
|
||||
static int dbg_unbind_all_channels_gk20a(struct dbg_session_gk20a *dbg_s);
|
||||
|
||||
static int gk20a_dbg_gpu_do_dev_open(struct inode *inode,
|
||||
static int gk20a_dbg_gpu_do_dev_open(struct gk20a *g,
|
||||
struct file *filp, bool is_profiler);
|
||||
|
||||
unsigned int gk20a_dbg_gpu_dev_poll(struct file *filep, poll_table *wait)
|
||||
@@ -230,12 +230,14 @@ int gk20a_dbg_gpu_dev_release(struct inode *inode, struct file *filp)
|
||||
|
||||
int gk20a_prof_gpu_dev_open(struct inode *inode, struct file *filp)
|
||||
{
|
||||
struct nvgpu_os_linux *l = container_of(inode->i_cdev,
|
||||
struct nvgpu_os_linux, prof.cdev);
|
||||
struct gk20a *g = &l->g;
|
||||
struct gk20a *g;
|
||||
struct nvgpu_cdev *cdev;
|
||||
|
||||
cdev = container_of(inode->i_cdev, struct nvgpu_cdev, cdev);
|
||||
g = get_gk20a(cdev->node->parent);
|
||||
|
||||
nvgpu_log(g, gpu_dbg_fn | gpu_dbg_gpu_dbg, " ");
|
||||
return gk20a_dbg_gpu_do_dev_open(inode, filp, true /* is profiler */);
|
||||
return gk20a_dbg_gpu_do_dev_open(g, filp, true /* is profiler */);
|
||||
}
|
||||
|
||||
static int nvgpu_dbg_gpu_ioctl_timeout(struct dbg_session_gk20a *dbg_s,
|
||||
@@ -380,25 +382,15 @@ static int nvgpu_dbg_timeout_enable(struct dbg_session_gk20a *dbg_s,
|
||||
return err;
|
||||
}
|
||||
|
||||
static int gk20a_dbg_gpu_do_dev_open(struct inode *inode,
|
||||
static int gk20a_dbg_gpu_do_dev_open(struct gk20a *g,
|
||||
struct file *filp, bool is_profiler)
|
||||
{
|
||||
struct nvgpu_os_linux *l;
|
||||
struct dbg_session_gk20a_linux *dbg_session_linux;
|
||||
struct dbg_session_gk20a *dbg_s;
|
||||
struct gk20a *g;
|
||||
|
||||
struct device *dev;
|
||||
|
||||
int err;
|
||||
|
||||
if (!is_profiler)
|
||||
l = container_of(inode->i_cdev,
|
||||
struct nvgpu_os_linux, dbg.cdev);
|
||||
else
|
||||
l = container_of(inode->i_cdev,
|
||||
struct nvgpu_os_linux, prof.cdev);
|
||||
g = nvgpu_get(&l->g);
|
||||
g = nvgpu_get(g);
|
||||
if (!g)
|
||||
return -ENODEV;
|
||||
|
||||
@@ -2015,12 +2007,14 @@ static int nvgpu_dbg_gpu_cycle_stats_snapshot(struct dbg_session_gk20a *dbg_s,
|
||||
|
||||
int gk20a_dbg_gpu_dev_open(struct inode *inode, struct file *filp)
|
||||
{
|
||||
struct nvgpu_os_linux *l = container_of(inode->i_cdev,
|
||||
struct nvgpu_os_linux, dbg.cdev);
|
||||
struct gk20a *g = &l->g;
|
||||
struct gk20a *g;
|
||||
struct nvgpu_cdev *cdev;
|
||||
|
||||
cdev = container_of(inode->i_cdev, struct nvgpu_cdev, cdev);
|
||||
g = get_gk20a(cdev->node->parent);
|
||||
|
||||
nvgpu_log(g, gpu_dbg_fn | gpu_dbg_gpu_dbg, " ");
|
||||
return gk20a_dbg_gpu_do_dev_open(inode, filp, false /* not profiler */);
|
||||
return gk20a_dbg_gpu_do_dev_open(g, filp, false /* not profiler */);
|
||||
}
|
||||
|
||||
long gk20a_dbg_gpu_dev_ioctl(struct file *filp, unsigned int cmd,
|
||||
|
||||
Reference in New Issue
Block a user