mirror of
git://nv-tegra.nvidia.com/linux-nvgpu.git
synced 2025-12-22 09:12:24 +03:00
gpu: nvgpu: move ctrl priv tracking to struct nvgpu_os_linux
Move ctrl node priv tracking variables from struct nvgpu_os_linux.ctrl to struct nvgpu_os_linux. This will unblock dev node creation without using the static data structures in struct nvgpu_os_linux. Jira NVGPU-5648 Change-Id: I57db0c601282534e6e2ea535d3ca27934f86fc2a Signed-off-by: Deepak Nibade <dnibade@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2428499 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
2a6c473fe6
commit
9082bcf3bd
@@ -78,8 +78,8 @@ static void nvgpu_init_vars(struct gk20a *g)
|
||||
/* Init the clock req count to 0 */
|
||||
nvgpu_atomic_set(&g->clk_arb_global_nr, 0);
|
||||
|
||||
nvgpu_mutex_init(&l->ctrl.privs_lock);
|
||||
nvgpu_init_list_node(&l->ctrl.privs);
|
||||
nvgpu_mutex_init(&l->ctrl_privs_lock);
|
||||
nvgpu_init_list_node(&l->ctrl_privs);
|
||||
|
||||
l->regs_saved = l->regs;
|
||||
l->bar1_saved = l->bar1;
|
||||
|
||||
@@ -147,9 +147,9 @@ free_ref:
|
||||
if (priv)
|
||||
nvgpu_kfree(g, priv);
|
||||
} else {
|
||||
nvgpu_mutex_acquire(&l->ctrl.privs_lock);
|
||||
nvgpu_list_add(&priv->list, &l->ctrl.privs);
|
||||
nvgpu_mutex_release(&l->ctrl.privs_lock);
|
||||
nvgpu_mutex_acquire(&l->ctrl_privs_lock);
|
||||
nvgpu_list_add(&priv->list, &l->ctrl_privs);
|
||||
nvgpu_mutex_release(&l->ctrl_privs_lock);
|
||||
}
|
||||
|
||||
return err;
|
||||
@@ -162,9 +162,9 @@ int gk20a_ctrl_dev_release(struct inode *inode, struct file *filp)
|
||||
|
||||
nvgpu_log_fn(g, " ");
|
||||
|
||||
nvgpu_mutex_acquire(&l->ctrl.privs_lock);
|
||||
nvgpu_mutex_acquire(&l->ctrl_privs_lock);
|
||||
nvgpu_list_del(&priv->list);
|
||||
nvgpu_mutex_release(&l->ctrl.privs_lock);
|
||||
nvgpu_mutex_release(&l->ctrl_privs_lock);
|
||||
|
||||
if (priv->clk_session)
|
||||
nvgpu_clk_arb_release_session(g, priv->clk_session);
|
||||
@@ -2108,10 +2108,10 @@ static void usermode_vma_close(struct vm_area_struct *vma)
|
||||
struct gk20a *g = priv->g;
|
||||
struct nvgpu_os_linux *l = nvgpu_os_linux_from_gk20a(g);
|
||||
|
||||
nvgpu_mutex_acquire(&l->ctrl.privs_lock);
|
||||
nvgpu_mutex_acquire(&l->ctrl_privs_lock);
|
||||
priv->usermode_vma.vma = NULL;
|
||||
priv->usermode_vma.vma_mapped = false;
|
||||
nvgpu_mutex_release(&l->ctrl.privs_lock);
|
||||
nvgpu_mutex_release(&l->ctrl_privs_lock);
|
||||
}
|
||||
|
||||
struct vm_operations_struct usermode_vma_ops = {
|
||||
@@ -2144,7 +2144,7 @@ int gk20a_ctrl_dev_mmap(struct file *filp, struct vm_area_struct *vma)
|
||||
return err;
|
||||
}
|
||||
|
||||
nvgpu_mutex_acquire(&l->ctrl.privs_lock);
|
||||
nvgpu_mutex_acquire(&l->ctrl_privs_lock);
|
||||
|
||||
vma->vm_flags |= VM_IO | VM_DONTCOPY | VM_DONTEXPAND | VM_NORESERVE |
|
||||
VM_DONTDUMP | VM_PFNMAP;
|
||||
@@ -2160,7 +2160,7 @@ int gk20a_ctrl_dev_mmap(struct file *filp, struct vm_area_struct *vma)
|
||||
vma->vm_private_data = priv;
|
||||
priv->usermode_vma.vma_mapped = true;
|
||||
}
|
||||
nvgpu_mutex_release(&l->ctrl.privs_lock);
|
||||
nvgpu_mutex_release(&l->ctrl_privs_lock);
|
||||
|
||||
gk20a_idle(g);
|
||||
|
||||
@@ -2231,12 +2231,12 @@ static void alter_usermode_mappings(struct gk20a *g, bool poweroff)
|
||||
struct gk20a_ctrl_priv *priv;
|
||||
struct nvgpu_os_linux *l = nvgpu_os_linux_from_gk20a(g);
|
||||
|
||||
nvgpu_mutex_acquire(&l->ctrl.privs_lock);
|
||||
nvgpu_list_for_each_entry(priv, &l->ctrl.privs,
|
||||
nvgpu_mutex_acquire(&l->ctrl_privs_lock);
|
||||
nvgpu_list_for_each_entry(priv, &l->ctrl_privs,
|
||||
gk20a_ctrl_priv, list) {
|
||||
alter_usermode_mapping(g, priv, poweroff);
|
||||
}
|
||||
nvgpu_mutex_release(&l->ctrl.privs_lock);
|
||||
nvgpu_mutex_release(&l->ctrl_privs_lock);
|
||||
}
|
||||
|
||||
void nvgpu_hide_usermode_for_poweroff(struct gk20a *g)
|
||||
|
||||
@@ -88,10 +88,6 @@ struct nvgpu_os_linux {
|
||||
struct {
|
||||
struct cdev cdev;
|
||||
struct device *node;
|
||||
/* see gk20a_ctrl_priv */
|
||||
struct nvgpu_list_node privs;
|
||||
/* guards modifications to the list and its contents */
|
||||
struct nvgpu_mutex privs_lock;
|
||||
} ctrl;
|
||||
|
||||
struct {
|
||||
@@ -136,6 +132,11 @@ struct nvgpu_os_linux {
|
||||
|
||||
dev_t cdev_region;
|
||||
|
||||
/* see gk20a_ctrl_priv */
|
||||
struct nvgpu_list_node ctrl_privs;
|
||||
/* guards modifications to the list and its contents */
|
||||
struct nvgpu_mutex ctrl_privs_lock;
|
||||
|
||||
struct devfreq *devfreq;
|
||||
|
||||
struct device_dma_parameters dma_parms;
|
||||
|
||||
@@ -97,8 +97,8 @@ static void vgpu_init_vars(struct gk20a *g, struct gk20a_platform *platform)
|
||||
|
||||
nvgpu_mutex_init(&priv->vgpu_clk_get_freq_lock);
|
||||
|
||||
nvgpu_mutex_init(&l->ctrl.privs_lock);
|
||||
nvgpu_init_list_node(&l->ctrl.privs);
|
||||
nvgpu_mutex_init(&l->ctrl_privs_lock);
|
||||
nvgpu_init_list_node(&l->ctrl_privs);
|
||||
|
||||
l->regs_saved = l->regs;
|
||||
l->bar1_saved = l->bar1;
|
||||
|
||||
Reference in New Issue
Block a user