diff options
author | Sourab Gupta <sourabg@nvidia.com> | 2018-05-01 08:41:14 -0400 |
---|---|---|
committer | mobile promotions <svcmobile_promotions@nvidia.com> | 2018-05-07 07:42:52 -0400 |
commit | bb7ed28ab17ce68c71838bc2aa3fd6e2a0a71a15 (patch) | |
tree | b91cdc8f08692c8193207ba15345930b4bd1a000 /drivers/gpu/nvgpu/common/linux/clk_arb_linux.h | |
parent | 35ec3008310c50b4a35a391371f4baff2e023a4e (diff) |
gpu: nvgpu: add worker for clk arb work handling
Implement a worker thread to replace the workqueue based
handling for clk arbiter update callbacks.
The work items scheduled with the thread are of two types,
update_vf_table and arb_update. Previously, there were two
workqueues for handling these two work struct's separately.
Now the single worker thread would process these two events.
If a work item of a particular type is scheduled to be run
on the worker, another instance of same type won't be
scheduled, which mirrors the linux workqueue behavior.
This also removes dependency on linux workqueues/work struct
and makes code portable to be used by QNX also.
Jira VQRM-3741
Change-Id: Ic27ce718c62c7d7c3f8820fbd1db386a159e28f2
Signed-off-by: Sourab Gupta <sourabg@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1706032
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/common/linux/clk_arb_linux.h')
-rw-r--r-- | drivers/gpu/nvgpu/common/linux/clk_arb_linux.h | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/drivers/gpu/nvgpu/common/linux/clk_arb_linux.h b/drivers/gpu/nvgpu/common/linux/clk_arb_linux.h index e5ada25d..464590d5 100644 --- a/drivers/gpu/nvgpu/common/linux/clk_arb_linux.h +++ b/drivers/gpu/nvgpu/common/linux/clk_arb_linux.h | |||
@@ -39,6 +39,18 @@ | |||
39 | * The defines here should finally move to clk_arb.h, once these are | 39 | * The defines here should finally move to clk_arb.h, once these are |
40 | * refactored to be free of Linux fields. | 40 | * refactored to be free of Linux fields. |
41 | */ | 41 | */ |
42 | |||
43 | enum clk_arb_work_item_type { | ||
44 | CLK_ARB_WORK_UPDATE_VF_TABLE, | ||
45 | CLK_ARB_WORK_UPDATE_ARB | ||
46 | }; | ||
47 | |||
48 | struct nvgpu_clk_arb_work_item { | ||
49 | enum clk_arb_work_item_type item_type; | ||
50 | struct nvgpu_clk_arb *arb; | ||
51 | struct nvgpu_list_node worker_item; | ||
52 | }; | ||
53 | |||
42 | struct nvgpu_clk_arb { | 54 | struct nvgpu_clk_arb { |
43 | struct nvgpu_spinlock sessions_lock; | 55 | struct nvgpu_spinlock sessions_lock; |
44 | struct nvgpu_spinlock users_lock; | 56 | struct nvgpu_spinlock users_lock; |
@@ -62,10 +74,8 @@ struct nvgpu_clk_arb { | |||
62 | u16 gpc2clk_min, gpc2clk_max; | 74 | u16 gpc2clk_min, gpc2clk_max; |
63 | u16 mclk_min, mclk_max; | 75 | u16 mclk_min, mclk_max; |
64 | 76 | ||
65 | struct work_struct update_fn_work; | 77 | struct nvgpu_clk_arb_work_item update_vf_table_work_item; |
66 | struct workqueue_struct *update_work_queue; | 78 | struct nvgpu_clk_arb_work_item update_arb_work_item; |
67 | struct work_struct vf_table_fn_work; | ||
68 | struct workqueue_struct *vf_table_work_queue; | ||
69 | 79 | ||
70 | struct nvgpu_cond request_wq; | 80 | struct nvgpu_cond request_wq; |
71 | 81 | ||
@@ -140,5 +150,14 @@ nvgpu_clk_dev_from_link(struct nvgpu_list_node *node) | |||
140 | ((uintptr_t)node - offsetof(struct nvgpu_clk_dev, link)); | 150 | ((uintptr_t)node - offsetof(struct nvgpu_clk_dev, link)); |
141 | }; | 151 | }; |
142 | 152 | ||
153 | static inline struct nvgpu_clk_arb_work_item * | ||
154 | nvgpu_clk_arb_work_item_from_worker_item(struct nvgpu_list_node *node) | ||
155 | { | ||
156 | return (struct nvgpu_clk_arb_work_item *) | ||
157 | ((uintptr_t)node - offsetof(struct nvgpu_clk_arb_work_item, worker_item)); | ||
158 | }; | ||
159 | |||
160 | void nvgpu_clk_arb_worker_enqueue(struct gk20a *g, | ||
161 | struct nvgpu_clk_arb_work_item *work_item); | ||
143 | #endif /* __NVGPU_CLK_ARB_LINUX_H__ */ | 162 | #endif /* __NVGPU_CLK_ARB_LINUX_H__ */ |
144 | 163 | ||