summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/gpu/nvgpu/gk20a/channel_gk20a.c12
-rw-r--r--drivers/gpu/nvgpu/gk20a/channel_gk20a.h10
-rw-r--r--drivers/gpu/nvgpu/gk20a/fifo_gk20a.c2
-rw-r--r--drivers/gpu/nvgpu/gk20a/fifo_gk20a.h2
-rw-r--r--drivers/gpu/nvgpu/vgpu/fifo_vgpu.c2
5 files changed, 18 insertions, 10 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/channel_gk20a.c b/drivers/gpu/nvgpu/gk20a/channel_gk20a.c
index 2facb595..cd49b4a9 100644
--- a/drivers/gpu/nvgpu/gk20a/channel_gk20a.c
+++ b/drivers/gpu/nvgpu/gk20a/channel_gk20a.c
@@ -92,10 +92,10 @@ static struct channel_gk20a *allocate_channel(struct fifo_gk20a *f)
92 platform = gk20a_get_platform(f->g->dev); 92 platform = gk20a_get_platform(f->g->dev);
93 93
94 nvgpu_mutex_acquire(&f->free_chs_mutex); 94 nvgpu_mutex_acquire(&f->free_chs_mutex);
95 if (!list_empty(&f->free_chs)) { 95 if (!nvgpu_list_empty(&f->free_chs)) {
96 ch = list_first_entry(&f->free_chs, struct channel_gk20a, 96 ch = nvgpu_list_first_entry(&f->free_chs, channel_gk20a,
97 free_chs); 97 free_chs);
98 list_del(&ch->free_chs); 98 nvgpu_list_del(&ch->free_chs);
99 WARN_ON(atomic_read(&ch->ref_count)); 99 WARN_ON(atomic_read(&ch->ref_count));
100 WARN_ON(ch->referenceable); 100 WARN_ON(ch->referenceable);
101 f->used_channels++; 101 f->used_channels++;
@@ -120,7 +120,7 @@ static void free_channel(struct fifo_gk20a *f,
120 /* refcount is zero here and channel is in a freed/dead state */ 120 /* refcount is zero here and channel is in a freed/dead state */
121 nvgpu_mutex_acquire(&f->free_chs_mutex); 121 nvgpu_mutex_acquire(&f->free_chs_mutex);
122 /* add to head to increase visibility of timing-related bugs */ 122 /* add to head to increase visibility of timing-related bugs */
123 list_add(&ch->free_chs, &f->free_chs); 123 nvgpu_list_add(&ch->free_chs, &f->free_chs);
124 f->used_channels--; 124 f->used_channels--;
125 nvgpu_mutex_release(&f->free_chs_mutex); 125 nvgpu_mutex_release(&f->free_chs_mutex);
126 126
@@ -3007,7 +3007,7 @@ int gk20a_init_channel_support(struct gk20a *g, u32 chid)
3007 if (err) 3007 if (err)
3008 goto fail_8; 3008 goto fail_8;
3009 3009
3010 list_add(&c->free_chs, &g->fifo.free_chs); 3010 nvgpu_list_add(&c->free_chs, &g->fifo.free_chs);
3011 3011
3012 return 0; 3012 return 0;
3013 3013
diff --git a/drivers/gpu/nvgpu/gk20a/channel_gk20a.h b/drivers/gpu/nvgpu/gk20a/channel_gk20a.h
index d530f47d..fd36ff1f 100644
--- a/drivers/gpu/nvgpu/gk20a/channel_gk20a.h
+++ b/drivers/gpu/nvgpu/gk20a/channel_gk20a.h
@@ -25,6 +25,7 @@
25#include <linux/stacktrace.h> 25#include <linux/stacktrace.h>
26#include <linux/wait.h> 26#include <linux/wait.h>
27#include <uapi/linux/nvgpu.h> 27#include <uapi/linux/nvgpu.h>
28#include <nvgpu/list.h>
28 29
29#include <nvgpu/lock.h> 30#include <nvgpu/lock.h>
30#include <nvgpu/timers.h> 31#include <nvgpu/timers.h>
@@ -157,7 +158,7 @@ struct channel_gk20a_ref_action {
157struct channel_gk20a { 158struct channel_gk20a {
158 struct gk20a *g; /* set only when channel is active */ 159 struct gk20a *g; /* set only when channel is active */
159 160
160 struct list_head free_chs; 161 struct nvgpu_list_node free_chs;
161 162
162 struct nvgpu_spinlock ref_obtain_lock; 163 struct nvgpu_spinlock ref_obtain_lock;
163 bool referenceable; 164 bool referenceable;
@@ -270,6 +271,13 @@ struct channel_gk20a {
270 bool is_privileged_channel; 271 bool is_privileged_channel;
271}; 272};
272 273
274static inline struct channel_gk20a *
275channel_gk20a_from_free_chs(struct nvgpu_list_node *node)
276{
277 return (struct channel_gk20a *)
278 ((uintptr_t)node - offsetof(struct channel_gk20a, free_chs));
279};
280
273static inline bool gk20a_channel_as_bound(struct channel_gk20a *ch) 281static inline bool gk20a_channel_as_bound(struct channel_gk20a *ch)
274{ 282{
275 return !!ch->vm; 283 return !!ch->vm;
diff --git a/drivers/gpu/nvgpu/gk20a/fifo_gk20a.c b/drivers/gpu/nvgpu/gk20a/fifo_gk20a.c
index 743bc1f5..6a9a22b2 100644
--- a/drivers/gpu/nvgpu/gk20a/fifo_gk20a.c
+++ b/drivers/gpu/nvgpu/gk20a/fifo_gk20a.c
@@ -935,7 +935,7 @@ static int gk20a_init_fifo_setup_sw(struct gk20a *g)
935 935
936 init_runlist(g, f); 936 init_runlist(g, f);
937 937
938 INIT_LIST_HEAD(&f->free_chs); 938 nvgpu_init_list_node(&f->free_chs);
939 nvgpu_mutex_init(&f->free_chs_mutex); 939 nvgpu_mutex_init(&f->free_chs_mutex);
940 940
941 if (g->ops.mm.is_bar1_supported(g)) 941 if (g->ops.mm.is_bar1_supported(g))
diff --git a/drivers/gpu/nvgpu/gk20a/fifo_gk20a.h b/drivers/gpu/nvgpu/gk20a/fifo_gk20a.h
index 06269fa5..a399e95f 100644
--- a/drivers/gpu/nvgpu/gk20a/fifo_gk20a.h
+++ b/drivers/gpu/nvgpu/gk20a/fifo_gk20a.h
@@ -169,7 +169,7 @@ struct fifo_gk20a {
169 unsigned int used_channels; 169 unsigned int used_channels;
170 struct channel_gk20a *channel; 170 struct channel_gk20a *channel;
171 /* zero-kref'd channels here */ 171 /* zero-kref'd channels here */
172 struct list_head free_chs; 172 struct nvgpu_list_node free_chs;
173 struct nvgpu_mutex free_chs_mutex; 173 struct nvgpu_mutex free_chs_mutex;
174 struct nvgpu_mutex gr_reset_mutex; 174 struct nvgpu_mutex gr_reset_mutex;
175 175
diff --git a/drivers/gpu/nvgpu/vgpu/fifo_vgpu.c b/drivers/gpu/nvgpu/vgpu/fifo_vgpu.c
index 497f8c91..cfe9322e 100644
--- a/drivers/gpu/nvgpu/vgpu/fifo_vgpu.c
+++ b/drivers/gpu/nvgpu/vgpu/fifo_vgpu.c
@@ -296,7 +296,7 @@ static int vgpu_init_fifo_setup_sw(struct gk20a *g)
296 296
297 init_runlist(g, f); 297 init_runlist(g, f);
298 298
299 INIT_LIST_HEAD(&f->free_chs); 299 nvgpu_init_list_node(&f->free_chs);
300 nvgpu_mutex_init(&f->free_chs_mutex); 300 nvgpu_mutex_init(&f->free_chs_mutex);
301 301
302 for (chid = 0; chid < f->num_channels; chid++) { 302 for (chid = 0; chid < f->num_channels; chid++) {