aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/host1x
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/host1x')
-rw-r--r--drivers/gpu/host1x/cdma.c42
-rw-r--r--drivers/gpu/host1x/channel.c5
-rw-r--r--drivers/gpu/host1x/debug.c38
-rw-r--r--drivers/gpu/host1x/dev.c16
-rw-r--r--drivers/gpu/host1x/dev.h38
-rw-r--r--drivers/gpu/host1x/hw/cdma_hw.c23
-rw-r--r--drivers/gpu/host1x/hw/channel_hw.c5
-rw-r--r--drivers/gpu/host1x/hw/debug_hw.c36
-rw-r--r--drivers/gpu/host1x/hw/intr_hw.c30
-rw-r--r--drivers/gpu/host1x/hw/syncpt_hw.c10
-rw-r--r--drivers/gpu/host1x/intr.c16
-rw-r--r--drivers/gpu/host1x/intr.h4
-rw-r--r--drivers/gpu/host1x/job.c8
-rw-r--r--drivers/gpu/host1x/syncpt.c58
-rw-r--r--drivers/gpu/host1x/syncpt.h8
15 files changed, 205 insertions, 132 deletions
diff --git a/drivers/gpu/host1x/cdma.c b/drivers/gpu/host1x/cdma.c
index a18db4d5347c..c5d82a8a2ec9 100644
--- a/drivers/gpu/host1x/cdma.c
+++ b/drivers/gpu/host1x/cdma.c
@@ -96,12 +96,12 @@ fail:
96 */ 96 */
97static void host1x_pushbuffer_push(struct push_buffer *pb, u32 op1, u32 op2) 97static void host1x_pushbuffer_push(struct push_buffer *pb, u32 op1, u32 op2)
98{ 98{
99 u32 pos = pb->pos; 99 u32 *p = (u32 *)((void *)pb->mapped + pb->pos);
100 u32 *p = (u32 *)((void *)pb->mapped + pos); 100
101 WARN_ON(pos == pb->fence); 101 WARN_ON(pb->pos == pb->fence);
102 *(p++) = op1; 102 *(p++) = op1;
103 *(p++) = op2; 103 *(p++) = op2;
104 pb->pos = (pos + 8) & (pb->size_bytes - 1); 104 pb->pos = (pb->pos + 8) & (pb->size_bytes - 1);
105} 105}
106 106
107/* 107/*
@@ -134,14 +134,19 @@ unsigned int host1x_cdma_wait_locked(struct host1x_cdma *cdma,
134 enum cdma_event event) 134 enum cdma_event event)
135{ 135{
136 for (;;) { 136 for (;;) {
137 struct push_buffer *pb = &cdma->push_buffer;
137 unsigned int space; 138 unsigned int space;
138 139
139 if (event == CDMA_EVENT_SYNC_QUEUE_EMPTY) 140 switch (event) {
141 case CDMA_EVENT_SYNC_QUEUE_EMPTY:
140 space = list_empty(&cdma->sync_queue) ? 1 : 0; 142 space = list_empty(&cdma->sync_queue) ? 1 : 0;
141 else if (event == CDMA_EVENT_PUSH_BUFFER_SPACE) { 143 break;
142 struct push_buffer *pb = &cdma->push_buffer; 144
145 case CDMA_EVENT_PUSH_BUFFER_SPACE:
143 space = host1x_pushbuffer_space(pb); 146 space = host1x_pushbuffer_space(pb);
144 } else { 147 break;
148
149 default:
145 WARN_ON(1); 150 WARN_ON(1);
146 return -EINVAL; 151 return -EINVAL;
147 } 152 }
@@ -159,12 +164,14 @@ unsigned int host1x_cdma_wait_locked(struct host1x_cdma *cdma,
159 mutex_lock(&cdma->lock); 164 mutex_lock(&cdma->lock);
160 continue; 165 continue;
161 } 166 }
167
162 cdma->event = event; 168 cdma->event = event;
163 169
164 mutex_unlock(&cdma->lock); 170 mutex_unlock(&cdma->lock);
165 down(&cdma->sem); 171 down(&cdma->sem);
166 mutex_lock(&cdma->lock); 172 mutex_lock(&cdma->lock);
167 } 173 }
174
168 return 0; 175 return 0;
169} 176}
170 177
@@ -234,6 +241,7 @@ static void update_cdma_locked(struct host1x_cdma *cdma)
234 /* Start timer on next pending syncpt */ 241 /* Start timer on next pending syncpt */
235 if (job->timeout) 242 if (job->timeout)
236 cdma_start_timer_locked(cdma, job); 243 cdma_start_timer_locked(cdma, job);
244
237 break; 245 break;
238 } 246 }
239 247
@@ -247,7 +255,9 @@ static void update_cdma_locked(struct host1x_cdma *cdma)
247 /* Pop push buffer slots */ 255 /* Pop push buffer slots */
248 if (job->num_slots) { 256 if (job->num_slots) {
249 struct push_buffer *pb = &cdma->push_buffer; 257 struct push_buffer *pb = &cdma->push_buffer;
258
250 host1x_pushbuffer_pop(pb, job->num_slots); 259 host1x_pushbuffer_pop(pb, job->num_slots);
260
251 if (cdma->event == CDMA_EVENT_PUSH_BUFFER_SPACE) 261 if (cdma->event == CDMA_EVENT_PUSH_BUFFER_SPACE)
252 signal = true; 262 signal = true;
253 } 263 }
@@ -269,11 +279,9 @@ static void update_cdma_locked(struct host1x_cdma *cdma)
269void host1x_cdma_update_sync_queue(struct host1x_cdma *cdma, 279void host1x_cdma_update_sync_queue(struct host1x_cdma *cdma,
270 struct device *dev) 280 struct device *dev)
271{ 281{
272 u32 restart_addr;
273 u32 syncpt_incrs;
274 struct host1x_job *job = NULL;
275 u32 syncpt_val;
276 struct host1x *host1x = cdma_to_host1x(cdma); 282 struct host1x *host1x = cdma_to_host1x(cdma);
283 u32 restart_addr, syncpt_incrs, syncpt_val;
284 struct host1x_job *job = NULL;
277 285
278 syncpt_val = host1x_syncpt_load(cdma->timeout.syncpt); 286 syncpt_val = host1x_syncpt_load(cdma->timeout.syncpt);
279 287
@@ -342,9 +350,11 @@ void host1x_cdma_update_sync_queue(struct host1x_cdma *cdma,
342 syncpt_val += syncpt_incrs; 350 syncpt_val += syncpt_incrs;
343 } 351 }
344 352
345 /* The following sumbits from the same client may be dependent on the 353 /*
354 * The following sumbits from the same client may be dependent on the
346 * failed submit and therefore they may fail. Force a small timeout 355 * failed submit and therefore they may fail. Force a small timeout
347 * to make the queue cleanup faster */ 356 * to make the queue cleanup faster.
357 */
348 358
349 list_for_each_entry_from(job, &cdma->sync_queue, list) 359 list_for_each_entry_from(job, &cdma->sync_queue, list)
350 if (job->client == cdma->timeout.client) 360 if (job->client == cdma->timeout.client)
@@ -375,6 +385,7 @@ int host1x_cdma_init(struct host1x_cdma *cdma)
375 err = host1x_pushbuffer_init(&cdma->push_buffer); 385 err = host1x_pushbuffer_init(&cdma->push_buffer);
376 if (err) 386 if (err)
377 return err; 387 return err;
388
378 return 0; 389 return 0;
379} 390}
380 391
@@ -410,6 +421,7 @@ int host1x_cdma_begin(struct host1x_cdma *cdma, struct host1x_job *job)
410 /* init state on first submit with timeout value */ 421 /* init state on first submit with timeout value */
411 if (!cdma->timeout.initialized) { 422 if (!cdma->timeout.initialized) {
412 int err; 423 int err;
424
413 err = host1x_hw_cdma_timeout_init(host1x, cdma, 425 err = host1x_hw_cdma_timeout_init(host1x, cdma,
414 job->syncpt_id); 426 job->syncpt_id);
415 if (err) { 427 if (err) {
@@ -418,6 +430,7 @@ int host1x_cdma_begin(struct host1x_cdma *cdma, struct host1x_job *job)
418 } 430 }
419 } 431 }
420 } 432 }
433
421 if (!cdma->running) 434 if (!cdma->running)
422 host1x_hw_cdma_start(host1x, cdma); 435 host1x_hw_cdma_start(host1x, cdma);
423 436
@@ -448,6 +461,7 @@ void host1x_cdma_push(struct host1x_cdma *cdma, u32 op1, u32 op2)
448 slots_free = host1x_cdma_wait_locked(cdma, 461 slots_free = host1x_cdma_wait_locked(cdma,
449 CDMA_EVENT_PUSH_BUFFER_SPACE); 462 CDMA_EVENT_PUSH_BUFFER_SPACE);
450 } 463 }
464
451 cdma->slots_free = slots_free - 1; 465 cdma->slots_free = slots_free - 1;
452 cdma->slots_used++; 466 cdma->slots_used++;
453 host1x_pushbuffer_push(pb, op1, op2); 467 host1x_pushbuffer_push(pb, op1, op2);
diff --git a/drivers/gpu/host1x/channel.c b/drivers/gpu/host1x/channel.c
index b4ae3affb987..8f437d924c10 100644
--- a/drivers/gpu/host1x/channel.c
+++ b/drivers/gpu/host1x/channel.c
@@ -83,9 +83,10 @@ EXPORT_SYMBOL(host1x_channel_put);
83struct host1x_channel *host1x_channel_request(struct device *dev) 83struct host1x_channel *host1x_channel_request(struct device *dev)
84{ 84{
85 struct host1x *host = dev_get_drvdata(dev->parent); 85 struct host1x *host = dev_get_drvdata(dev->parent);
86 int max_channels = host->info->nb_channels; 86 unsigned int max_channels = host->info->nb_channels;
87 struct host1x_channel *channel = NULL; 87 struct host1x_channel *channel = NULL;
88 int index, err; 88 unsigned long index;
89 int err;
89 90
90 mutex_lock(&host->chlist_mutex); 91 mutex_lock(&host->chlist_mutex);
91 92
diff --git a/drivers/gpu/host1x/debug.c b/drivers/gpu/host1x/debug.c
index ee3d12b51c50..d9330fcc62ad 100644
--- a/drivers/gpu/host1x/debug.c
+++ b/drivers/gpu/host1x/debug.c
@@ -39,6 +39,7 @@ void host1x_debug_output(struct output *o, const char *fmt, ...)
39 va_start(args, fmt); 39 va_start(args, fmt);
40 len = vsnprintf(o->buf, sizeof(o->buf), fmt, args); 40 len = vsnprintf(o->buf, sizeof(o->buf), fmt, args);
41 va_end(args); 41 va_end(args);
42
42 o->fn(o->ctx, o->buf, len); 43 o->fn(o->ctx, o->buf, len);
43} 44}
44 45
@@ -48,13 +49,17 @@ static int show_channels(struct host1x_channel *ch, void *data, bool show_fifo)
48 struct output *o = data; 49 struct output *o = data;
49 50
50 mutex_lock(&ch->reflock); 51 mutex_lock(&ch->reflock);
52
51 if (ch->refcount) { 53 if (ch->refcount) {
52 mutex_lock(&ch->cdma.lock); 54 mutex_lock(&ch->cdma.lock);
55
53 if (show_fifo) 56 if (show_fifo)
54 host1x_hw_show_channel_fifo(m, ch, o); 57 host1x_hw_show_channel_fifo(m, ch, o);
58
55 host1x_hw_show_channel_cdma(m, ch, o); 59 host1x_hw_show_channel_cdma(m, ch, o);
56 mutex_unlock(&ch->cdma.lock); 60 mutex_unlock(&ch->cdma.lock);
57 } 61 }
62
58 mutex_unlock(&ch->reflock); 63 mutex_unlock(&ch->reflock);
59 64
60 return 0; 65 return 0;
@@ -62,22 +67,27 @@ static int show_channels(struct host1x_channel *ch, void *data, bool show_fifo)
62 67
63static void show_syncpts(struct host1x *m, struct output *o) 68static void show_syncpts(struct host1x *m, struct output *o)
64{ 69{
65 int i; 70 unsigned int i;
71
66 host1x_debug_output(o, "---- syncpts ----\n"); 72 host1x_debug_output(o, "---- syncpts ----\n");
73
67 for (i = 0; i < host1x_syncpt_nb_pts(m); i++) { 74 for (i = 0; i < host1x_syncpt_nb_pts(m); i++) {
68 u32 max = host1x_syncpt_read_max(m->syncpt + i); 75 u32 max = host1x_syncpt_read_max(m->syncpt + i);
69 u32 min = host1x_syncpt_load(m->syncpt + i); 76 u32 min = host1x_syncpt_load(m->syncpt + i);
77
70 if (!min && !max) 78 if (!min && !max)
71 continue; 79 continue;
72 host1x_debug_output(o, "id %d (%s) min %d max %d\n", 80
81 host1x_debug_output(o, "id %u (%s) min %d max %d\n",
73 i, m->syncpt[i].name, min, max); 82 i, m->syncpt[i].name, min, max);
74 } 83 }
75 84
76 for (i = 0; i < host1x_syncpt_nb_bases(m); i++) { 85 for (i = 0; i < host1x_syncpt_nb_bases(m); i++) {
77 u32 base_val; 86 u32 base_val;
87
78 base_val = host1x_syncpt_load_wait_base(m->syncpt + i); 88 base_val = host1x_syncpt_load_wait_base(m->syncpt + i);
79 if (base_val) 89 if (base_val)
80 host1x_debug_output(o, "waitbase id %d val %d\n", i, 90 host1x_debug_output(o, "waitbase id %u val %d\n", i,
81 base_val); 91 base_val);
82 } 92 }
83 93
@@ -114,7 +124,9 @@ static int host1x_debug_show_all(struct seq_file *s, void *unused)
114 .fn = write_to_seqfile, 124 .fn = write_to_seqfile,
115 .ctx = s 125 .ctx = s
116 }; 126 };
127
117 show_all(s->private, &o); 128 show_all(s->private, &o);
129
118 return 0; 130 return 0;
119} 131}
120 132
@@ -124,7 +136,9 @@ static int host1x_debug_show(struct seq_file *s, void *unused)
124 .fn = write_to_seqfile, 136 .fn = write_to_seqfile,
125 .ctx = s 137 .ctx = s
126 }; 138 };
139
127 show_all_no_fifo(s->private, &o); 140 show_all_no_fifo(s->private, &o);
141
128 return 0; 142 return 0;
129} 143}
130 144
@@ -134,10 +148,10 @@ static int host1x_debug_open_all(struct inode *inode, struct file *file)
134} 148}
135 149
136static const struct file_operations host1x_debug_all_fops = { 150static const struct file_operations host1x_debug_all_fops = {
137 .open = host1x_debug_open_all, 151 .open = host1x_debug_open_all,
138 .read = seq_read, 152 .read = seq_read,
139 .llseek = seq_lseek, 153 .llseek = seq_lseek,
140 .release = single_release, 154 .release = single_release,
141}; 155};
142 156
143static int host1x_debug_open(struct inode *inode, struct file *file) 157static int host1x_debug_open(struct inode *inode, struct file *file)
@@ -146,10 +160,10 @@ static int host1x_debug_open(struct inode *inode, struct file *file)
146} 160}
147 161
148static const struct file_operations host1x_debug_fops = { 162static const struct file_operations host1x_debug_fops = {
149 .open = host1x_debug_open, 163 .open = host1x_debug_open,
150 .read = seq_read, 164 .read = seq_read,
151 .llseek = seq_lseek, 165 .llseek = seq_lseek,
152 .release = single_release, 166 .release = single_release,
153}; 167};
154 168
155static void host1x_debugfs_init(struct host1x *host1x) 169static void host1x_debugfs_init(struct host1x *host1x)
@@ -201,6 +215,7 @@ void host1x_debug_dump(struct host1x *host1x)
201 struct output o = { 215 struct output o = {
202 .fn = write_to_printk 216 .fn = write_to_printk
203 }; 217 };
218
204 show_all(host1x, &o); 219 show_all(host1x, &o);
205} 220}
206 221
@@ -209,5 +224,6 @@ void host1x_debug_dump_syncpts(struct host1x *host1x)
209 struct output o = { 224 struct output o = {
210 .fn = write_to_printk 225 .fn = write_to_printk
211 }; 226 };
227
212 show_syncpts(host1x, &o); 228 show_syncpts(host1x, &o);
213} 229}
diff --git a/drivers/gpu/host1x/dev.c b/drivers/gpu/host1x/dev.c
index ff348690df94..a62317af76ad 100644
--- a/drivers/gpu/host1x/dev.c
+++ b/drivers/gpu/host1x/dev.c
@@ -63,13 +63,13 @@ u32 host1x_ch_readl(struct host1x_channel *ch, u32 r)
63} 63}
64 64
65static const struct host1x_info host1x01_info = { 65static const struct host1x_info host1x01_info = {
66 .nb_channels = 8, 66 .nb_channels = 8,
67 .nb_pts = 32, 67 .nb_pts = 32,
68 .nb_mlocks = 16, 68 .nb_mlocks = 16,
69 .nb_bases = 8, 69 .nb_bases = 8,
70 .init = host1x01_init, 70 .init = host1x01_init,
71 .sync_offset = 0x3000, 71 .sync_offset = 0x3000,
72 .dma_mask = DMA_BIT_MASK(32), 72 .dma_mask = DMA_BIT_MASK(32),
73}; 73};
74 74
75static const struct host1x_info host1x02_info = { 75static const struct host1x_info host1x02_info = {
@@ -102,7 +102,7 @@ static const struct host1x_info host1x05_info = {
102 .dma_mask = DMA_BIT_MASK(34), 102 .dma_mask = DMA_BIT_MASK(34),
103}; 103};
104 104
105static struct of_device_id host1x_of_match[] = { 105static const struct of_device_id host1x_of_match[] = {
106 { .compatible = "nvidia,tegra210-host1x", .data = &host1x05_info, }, 106 { .compatible = "nvidia,tegra210-host1x", .data = &host1x05_info, },
107 { .compatible = "nvidia,tegra124-host1x", .data = &host1x04_info, }, 107 { .compatible = "nvidia,tegra124-host1x", .data = &host1x04_info, },
108 { .compatible = "nvidia,tegra114-host1x", .data = &host1x02_info, }, 108 { .compatible = "nvidia,tegra114-host1x", .data = &host1x02_info, },
diff --git a/drivers/gpu/host1x/dev.h b/drivers/gpu/host1x/dev.h
index dace124994bb..5220510f39da 100644
--- a/drivers/gpu/host1x/dev.h
+++ b/drivers/gpu/host1x/dev.h
@@ -45,7 +45,7 @@ struct host1x_cdma_ops {
45 void (*start)(struct host1x_cdma *cdma); 45 void (*start)(struct host1x_cdma *cdma);
46 void (*stop)(struct host1x_cdma *cdma); 46 void (*stop)(struct host1x_cdma *cdma);
47 void (*flush)(struct host1x_cdma *cdma); 47 void (*flush)(struct host1x_cdma *cdma);
48 int (*timeout_init)(struct host1x_cdma *cdma, u32 syncpt_id); 48 int (*timeout_init)(struct host1x_cdma *cdma, unsigned int syncpt);
49 void (*timeout_destroy)(struct host1x_cdma *cdma); 49 void (*timeout_destroy)(struct host1x_cdma *cdma);
50 void (*freeze)(struct host1x_cdma *cdma); 50 void (*freeze)(struct host1x_cdma *cdma);
51 void (*resume)(struct host1x_cdma *cdma, u32 getptr); 51 void (*resume)(struct host1x_cdma *cdma, u32 getptr);
@@ -82,21 +82,21 @@ struct host1x_intr_ops {
82 int (*init_host_sync)(struct host1x *host, u32 cpm, 82 int (*init_host_sync)(struct host1x *host, u32 cpm,
83 void (*syncpt_thresh_work)(struct work_struct *work)); 83 void (*syncpt_thresh_work)(struct work_struct *work));
84 void (*set_syncpt_threshold)( 84 void (*set_syncpt_threshold)(
85 struct host1x *host, u32 id, u32 thresh); 85 struct host1x *host, unsigned int id, u32 thresh);
86 void (*enable_syncpt_intr)(struct host1x *host, u32 id); 86 void (*enable_syncpt_intr)(struct host1x *host, unsigned int id);
87 void (*disable_syncpt_intr)(struct host1x *host, u32 id); 87 void (*disable_syncpt_intr)(struct host1x *host, unsigned int id);
88 void (*disable_all_syncpt_intrs)(struct host1x *host); 88 void (*disable_all_syncpt_intrs)(struct host1x *host);
89 int (*free_syncpt_irq)(struct host1x *host); 89 int (*free_syncpt_irq)(struct host1x *host);
90}; 90};
91 91
92struct host1x_info { 92struct host1x_info {
93 int nb_channels; /* host1x: num channels supported */ 93 unsigned int nb_channels; /* host1x: number of channels supported */
94 int nb_pts; /* host1x: num syncpoints supported */ 94 unsigned int nb_pts; /* host1x: number of syncpoints supported */
95 int nb_bases; /* host1x: num syncpoints supported */ 95 unsigned int nb_bases; /* host1x: number of syncpoint bases supported */
96 int nb_mlocks; /* host1x: number of mlocks */ 96 unsigned int nb_mlocks; /* host1x: number of mlocks supported */
97 int (*init)(struct host1x *); /* initialize per SoC ops */ 97 int (*init)(struct host1x *host1x); /* initialize per SoC ops */
98 int sync_offset; 98 unsigned int sync_offset; /* offset of syncpoint registers */
99 u64 dma_mask; /* mask of addressable memory */ 99 u64 dma_mask; /* mask of addressable memory */
100}; 100};
101 101
102struct host1x { 102struct host1x {
@@ -109,7 +109,6 @@ struct host1x {
109 struct clk *clk; 109 struct clk *clk;
110 110
111 struct mutex intr_mutex; 111 struct mutex intr_mutex;
112 struct workqueue_struct *intr_wq;
113 int intr_syncpt_irq; 112 int intr_syncpt_irq;
114 113
115 const struct host1x_syncpt_ops *syncpt_op; 114 const struct host1x_syncpt_ops *syncpt_op;
@@ -183,19 +182,20 @@ static inline int host1x_hw_intr_init_host_sync(struct host1x *host, u32 cpm,
183} 182}
184 183
185static inline void host1x_hw_intr_set_syncpt_threshold(struct host1x *host, 184static inline void host1x_hw_intr_set_syncpt_threshold(struct host1x *host,
186 u32 id, u32 thresh) 185 unsigned int id,
186 u32 thresh)
187{ 187{
188 host->intr_op->set_syncpt_threshold(host, id, thresh); 188 host->intr_op->set_syncpt_threshold(host, id, thresh);
189} 189}
190 190
191static inline void host1x_hw_intr_enable_syncpt_intr(struct host1x *host, 191static inline void host1x_hw_intr_enable_syncpt_intr(struct host1x *host,
192 u32 id) 192 unsigned int id)
193{ 193{
194 host->intr_op->enable_syncpt_intr(host, id); 194 host->intr_op->enable_syncpt_intr(host, id);
195} 195}
196 196
197static inline void host1x_hw_intr_disable_syncpt_intr(struct host1x *host, 197static inline void host1x_hw_intr_disable_syncpt_intr(struct host1x *host,
198 u32 id) 198 unsigned int id)
199{ 199{
200 host->intr_op->disable_syncpt_intr(host, id); 200 host->intr_op->disable_syncpt_intr(host, id);
201} 201}
@@ -212,9 +212,9 @@ static inline int host1x_hw_intr_free_syncpt_irq(struct host1x *host)
212 212
213static inline int host1x_hw_channel_init(struct host1x *host, 213static inline int host1x_hw_channel_init(struct host1x *host,
214 struct host1x_channel *channel, 214 struct host1x_channel *channel,
215 int chid) 215 unsigned int id)
216{ 216{
217 return host->channel_op->init(channel, host, chid); 217 return host->channel_op->init(channel, host, id);
218} 218}
219 219
220static inline int host1x_hw_channel_submit(struct host1x *host, 220static inline int host1x_hw_channel_submit(struct host1x *host,
@@ -243,9 +243,9 @@ static inline void host1x_hw_cdma_flush(struct host1x *host,
243 243
244static inline int host1x_hw_cdma_timeout_init(struct host1x *host, 244static inline int host1x_hw_cdma_timeout_init(struct host1x *host,
245 struct host1x_cdma *cdma, 245 struct host1x_cdma *cdma,
246 u32 syncpt_id) 246 unsigned int syncpt)
247{ 247{
248 return host->cdma_op->timeout_init(cdma, syncpt_id); 248 return host->cdma_op->timeout_init(cdma, syncpt);
249} 249}
250 250
251static inline void host1x_hw_cdma_timeout_destroy(struct host1x *host, 251static inline void host1x_hw_cdma_timeout_destroy(struct host1x *host,
diff --git a/drivers/gpu/host1x/hw/cdma_hw.c b/drivers/gpu/host1x/hw/cdma_hw.c
index 305ea8f3382d..659c1bbfeeba 100644
--- a/drivers/gpu/host1x/hw/cdma_hw.c
+++ b/drivers/gpu/host1x/hw/cdma_hw.c
@@ -41,7 +41,7 @@ static void cdma_timeout_cpu_incr(struct host1x_cdma *cdma, u32 getptr,
41{ 41{
42 struct host1x *host1x = cdma_to_host1x(cdma); 42 struct host1x *host1x = cdma_to_host1x(cdma);
43 struct push_buffer *pb = &cdma->push_buffer; 43 struct push_buffer *pb = &cdma->push_buffer;
44 u32 i; 44 unsigned int i;
45 45
46 for (i = 0; i < syncpt_incrs; i++) 46 for (i = 0; i < syncpt_incrs; i++)
47 host1x_syncpt_incr(cdma->timeout.syncpt); 47 host1x_syncpt_incr(cdma->timeout.syncpt);
@@ -58,6 +58,7 @@ static void cdma_timeout_cpu_incr(struct host1x_cdma *cdma, u32 getptr,
58 &pb->phys, getptr); 58 &pb->phys, getptr);
59 getptr = (getptr + 8) & (pb->size_bytes - 1); 59 getptr = (getptr + 8) & (pb->size_bytes - 1);
60 } 60 }
61
61 wmb(); 62 wmb();
62} 63}
63 64
@@ -162,12 +163,14 @@ static void cdma_stop(struct host1x_cdma *cdma)
162 struct host1x_channel *ch = cdma_to_channel(cdma); 163 struct host1x_channel *ch = cdma_to_channel(cdma);
163 164
164 mutex_lock(&cdma->lock); 165 mutex_lock(&cdma->lock);
166
165 if (cdma->running) { 167 if (cdma->running) {
166 host1x_cdma_wait_locked(cdma, CDMA_EVENT_SYNC_QUEUE_EMPTY); 168 host1x_cdma_wait_locked(cdma, CDMA_EVENT_SYNC_QUEUE_EMPTY);
167 host1x_ch_writel(ch, HOST1X_CHANNEL_DMACTRL_DMASTOP, 169 host1x_ch_writel(ch, HOST1X_CHANNEL_DMACTRL_DMASTOP,
168 HOST1X_CHANNEL_DMACTRL); 170 HOST1X_CHANNEL_DMACTRL);
169 cdma->running = false; 171 cdma->running = false;
170 } 172 }
173
171 mutex_unlock(&cdma->lock); 174 mutex_unlock(&cdma->lock);
172} 175}
173 176
@@ -213,11 +216,11 @@ static void cdma_resume(struct host1x_cdma *cdma, u32 getptr)
213 u32 cmdproc_stop; 216 u32 cmdproc_stop;
214 217
215 dev_dbg(host1x->dev, 218 dev_dbg(host1x->dev,
216 "resuming channel (id %d, DMAGET restart = 0x%x)\n", 219 "resuming channel (id %u, DMAGET restart = 0x%x)\n",
217 ch->id, getptr); 220 ch->id, getptr);
218 221
219 cmdproc_stop = host1x_sync_readl(host1x, HOST1X_SYNC_CMDPROC_STOP); 222 cmdproc_stop = host1x_sync_readl(host1x, HOST1X_SYNC_CMDPROC_STOP);
220 cmdproc_stop &= ~(BIT(ch->id)); 223 cmdproc_stop &= ~BIT(ch->id);
221 host1x_sync_writel(host1x, cmdproc_stop, HOST1X_SYNC_CMDPROC_STOP); 224 host1x_sync_writel(host1x, cmdproc_stop, HOST1X_SYNC_CMDPROC_STOP);
222 225
223 cdma->torndown = false; 226 cdma->torndown = false;
@@ -231,14 +234,11 @@ static void cdma_resume(struct host1x_cdma *cdma, u32 getptr)
231 */ 234 */
232static void cdma_timeout_handler(struct work_struct *work) 235static void cdma_timeout_handler(struct work_struct *work)
233{ 236{
237 u32 prev_cmdproc, cmdproc_stop, syncpt_val;
234 struct host1x_cdma *cdma; 238 struct host1x_cdma *cdma;
235 struct host1x *host1x; 239 struct host1x *host1x;
236 struct host1x_channel *ch; 240 struct host1x_channel *ch;
237 241
238 u32 syncpt_val;
239
240 u32 prev_cmdproc, cmdproc_stop;
241
242 cdma = container_of(to_delayed_work(work), struct host1x_cdma, 242 cdma = container_of(to_delayed_work(work), struct host1x_cdma,
243 timeout.wq); 243 timeout.wq);
244 host1x = cdma_to_host1x(cdma); 244 host1x = cdma_to_host1x(cdma);
@@ -277,9 +277,9 @@ static void cdma_timeout_handler(struct work_struct *work)
277 return; 277 return;
278 } 278 }
279 279
280 dev_warn(host1x->dev, "%s: timeout: %d (%s), HW thresh %d, done %d\n", 280 dev_warn(host1x->dev, "%s: timeout: %u (%s), HW thresh %d, done %d\n",
281 __func__, cdma->timeout.syncpt->id, cdma->timeout.syncpt->name, 281 __func__, cdma->timeout.syncpt->id, cdma->timeout.syncpt->name,
282 syncpt_val, cdma->timeout.syncpt_val); 282 syncpt_val, cdma->timeout.syncpt_val);
283 283
284 /* stop HW, resetting channel/module */ 284 /* stop HW, resetting channel/module */
285 host1x_hw_cdma_freeze(host1x, cdma); 285 host1x_hw_cdma_freeze(host1x, cdma);
@@ -291,7 +291,7 @@ static void cdma_timeout_handler(struct work_struct *work)
291/* 291/*
292 * Init timeout resources 292 * Init timeout resources
293 */ 293 */
294static int cdma_timeout_init(struct host1x_cdma *cdma, u32 syncpt_id) 294static int cdma_timeout_init(struct host1x_cdma *cdma, unsigned int syncpt)
295{ 295{
296 INIT_DELAYED_WORK(&cdma->timeout.wq, cdma_timeout_handler); 296 INIT_DELAYED_WORK(&cdma->timeout.wq, cdma_timeout_handler);
297 cdma->timeout.initialized = true; 297 cdma->timeout.initialized = true;
@@ -306,6 +306,7 @@ static void cdma_timeout_destroy(struct host1x_cdma *cdma)
306{ 306{
307 if (cdma->timeout.initialized) 307 if (cdma->timeout.initialized)
308 cancel_delayed_work(&cdma->timeout.wq); 308 cancel_delayed_work(&cdma->timeout.wq);
309
309 cdma->timeout.initialized = false; 310 cdma->timeout.initialized = false;
310} 311}
311 312
diff --git a/drivers/gpu/host1x/hw/channel_hw.c b/drivers/gpu/host1x/hw/channel_hw.c
index 946c332c3906..5e8df78b7acd 100644
--- a/drivers/gpu/host1x/hw/channel_hw.c
+++ b/drivers/gpu/host1x/hw/channel_hw.c
@@ -46,6 +46,7 @@ static void trace_write_gather(struct host1x_cdma *cdma, struct host1x_bo *bo,
46 */ 46 */
47 for (i = 0; i < words; i += TRACE_MAX_LENGTH) { 47 for (i = 0; i < words; i += TRACE_MAX_LENGTH) {
48 u32 num_words = min(words - i, TRACE_MAX_LENGTH); 48 u32 num_words = min(words - i, TRACE_MAX_LENGTH);
49
49 offset += i * sizeof(u32); 50 offset += i * sizeof(u32);
50 51
51 trace_host1x_cdma_push_gather(dev_name(dev), bo, 52 trace_host1x_cdma_push_gather(dev_name(dev), bo,
@@ -66,6 +67,7 @@ static void submit_gathers(struct host1x_job *job)
66 struct host1x_job_gather *g = &job->gathers[i]; 67 struct host1x_job_gather *g = &job->gathers[i];
67 u32 op1 = host1x_opcode_gather(g->words); 68 u32 op1 = host1x_opcode_gather(g->words);
68 u32 op2 = g->base + g->offset; 69 u32 op2 = g->base + g->offset;
70
69 trace_write_gather(cdma, g->bo, g->offset, op1 & 0xffff); 71 trace_write_gather(cdma, g->bo, g->offset, op1 & 0xffff);
70 host1x_cdma_push(cdma, op1, op2); 72 host1x_cdma_push(cdma, op1, op2);
71 } 73 }
@@ -75,7 +77,8 @@ static inline void synchronize_syncpt_base(struct host1x_job *job)
75{ 77{
76 struct host1x *host = dev_get_drvdata(job->channel->dev->parent); 78 struct host1x *host = dev_get_drvdata(job->channel->dev->parent);
77 struct host1x_syncpt *sp = host->syncpt + job->syncpt_id; 79 struct host1x_syncpt *sp = host->syncpt + job->syncpt_id;
78 u32 id, value; 80 unsigned int id;
81 u32 value;
79 82
80 value = host1x_syncpt_read_max(sp); 83 value = host1x_syncpt_read_max(sp);
81 id = sp->base->id; 84 id = sp->base->id;
diff --git a/drivers/gpu/host1x/hw/debug_hw.c b/drivers/gpu/host1x/hw/debug_hw.c
index cc3f1825c735..7a4a3286e4a7 100644
--- a/drivers/gpu/host1x/hw/debug_hw.c
+++ b/drivers/gpu/host1x/hw/debug_hw.c
@@ -40,8 +40,7 @@ enum {
40 40
41static unsigned int show_channel_command(struct output *o, u32 val) 41static unsigned int show_channel_command(struct output *o, u32 val)
42{ 42{
43 unsigned mask; 43 unsigned int mask, subop;
44 unsigned subop;
45 44
46 switch (val >> 28) { 45 switch (val >> 28) {
47 case HOST1X_OPCODE_SETCLASS: 46 case HOST1X_OPCODE_SETCLASS:
@@ -51,12 +50,11 @@ static unsigned int show_channel_command(struct output *o, u32 val)
51 val >> 6 & 0x3ff, 50 val >> 6 & 0x3ff,
52 val >> 16 & 0xfff, mask); 51 val >> 16 & 0xfff, mask);
53 return hweight8(mask); 52 return hweight8(mask);
54 } else {
55 host1x_debug_output(o, "SETCL(class=%03x)\n",
56 val >> 6 & 0x3ff);
57 return 0;
58 } 53 }
59 54
55 host1x_debug_output(o, "SETCL(class=%03x)\n", val >> 6 & 0x3ff);
56 return 0;
57
60 case HOST1X_OPCODE_INCR: 58 case HOST1X_OPCODE_INCR:
61 host1x_debug_output(o, "INCR(offset=%03x, [", 59 host1x_debug_output(o, "INCR(offset=%03x, [",
62 val >> 16 & 0xfff); 60 val >> 16 & 0xfff);
@@ -143,7 +141,8 @@ static void show_channel_gathers(struct output *o, struct host1x_cdma *cdma)
143 struct host1x_job *job; 141 struct host1x_job *job;
144 142
145 list_for_each_entry(job, &cdma->sync_queue, list) { 143 list_for_each_entry(job, &cdma->sync_queue, list) {
146 int i; 144 unsigned int i;
145
147 host1x_debug_output(o, "\n%p: JOB, syncpt_id=%d, syncpt_val=%d, first_get=%08x, timeout=%d num_slots=%d, num_handles=%d\n", 146 host1x_debug_output(o, "\n%p: JOB, syncpt_id=%d, syncpt_val=%d, first_get=%08x, timeout=%d num_slots=%d, num_handles=%d\n",
148 job, job->syncpt_id, job->syncpt_end, 147 job, job->syncpt_id, job->syncpt_end,
149 job->first_get, job->timeout, 148 job->first_get, job->timeout,
@@ -190,7 +189,7 @@ static void host1x_debug_show_channel_cdma(struct host1x *host,
190 cbread = host1x_sync_readl(host, HOST1X_SYNC_CBREAD(ch->id)); 189 cbread = host1x_sync_readl(host, HOST1X_SYNC_CBREAD(ch->id));
191 cbstat = host1x_sync_readl(host, HOST1X_SYNC_CBSTAT(ch->id)); 190 cbstat = host1x_sync_readl(host, HOST1X_SYNC_CBSTAT(ch->id));
192 191
193 host1x_debug_output(o, "%d-%s: ", ch->id, dev_name(ch->dev)); 192 host1x_debug_output(o, "%u-%s: ", ch->id, dev_name(ch->dev));
194 193
195 if (HOST1X_CHANNEL_DMACTRL_DMASTOP_V(dmactrl) || 194 if (HOST1X_CHANNEL_DMACTRL_DMASTOP_V(dmactrl) ||
196 !ch->cdma.push_buffer.mapped) { 195 !ch->cdma.push_buffer.mapped) {
@@ -200,14 +199,13 @@ static void host1x_debug_show_channel_cdma(struct host1x *host,
200 199
201 if (HOST1X_SYNC_CBSTAT_CBCLASS_V(cbstat) == HOST1X_CLASS_HOST1X && 200 if (HOST1X_SYNC_CBSTAT_CBCLASS_V(cbstat) == HOST1X_CLASS_HOST1X &&
202 HOST1X_SYNC_CBSTAT_CBOFFSET_V(cbstat) == 201 HOST1X_SYNC_CBSTAT_CBOFFSET_V(cbstat) ==
203 HOST1X_UCLASS_WAIT_SYNCPT) 202 HOST1X_UCLASS_WAIT_SYNCPT)
204 host1x_debug_output(o, "waiting on syncpt %d val %d\n", 203 host1x_debug_output(o, "waiting on syncpt %d val %d\n",
205 cbread >> 24, cbread & 0xffffff); 204 cbread >> 24, cbread & 0xffffff);
206 else if (HOST1X_SYNC_CBSTAT_CBCLASS_V(cbstat) == 205 else if (HOST1X_SYNC_CBSTAT_CBCLASS_V(cbstat) ==
207 HOST1X_CLASS_HOST1X && 206 HOST1X_CLASS_HOST1X &&
208 HOST1X_SYNC_CBSTAT_CBOFFSET_V(cbstat) == 207 HOST1X_SYNC_CBSTAT_CBOFFSET_V(cbstat) ==
209 HOST1X_UCLASS_WAIT_SYNCPT_BASE) { 208 HOST1X_UCLASS_WAIT_SYNCPT_BASE) {
210
211 base = (cbread >> 16) & 0xff; 209 base = (cbread >> 16) & 0xff;
212 baseval = 210 baseval =
213 host1x_sync_readl(host, HOST1X_SYNC_SYNCPT_BASE(base)); 211 host1x_sync_readl(host, HOST1X_SYNC_SYNCPT_BASE(base));
@@ -236,7 +234,7 @@ static void host1x_debug_show_channel_fifo(struct host1x *host,
236 u32 val, rd_ptr, wr_ptr, start, end; 234 u32 val, rd_ptr, wr_ptr, start, end;
237 unsigned int data_count = 0; 235 unsigned int data_count = 0;
238 236
239 host1x_debug_output(o, "%d: fifo:\n", ch->id); 237 host1x_debug_output(o, "%u: fifo:\n", ch->id);
240 238
241 val = host1x_ch_readl(ch, HOST1X_CHANNEL_FIFOSTAT); 239 val = host1x_ch_readl(ch, HOST1X_CHANNEL_FIFOSTAT);
242 host1x_debug_output(o, "FIFOSTAT %08x\n", val); 240 host1x_debug_output(o, "FIFOSTAT %08x\n", val);
@@ -290,20 +288,22 @@ static void host1x_debug_show_channel_fifo(struct host1x *host,
290 288
291static void host1x_debug_show_mlocks(struct host1x *host, struct output *o) 289static void host1x_debug_show_mlocks(struct host1x *host, struct output *o)
292{ 290{
293 int i; 291 unsigned int i;
294 292
295 host1x_debug_output(o, "---- mlocks ----\n"); 293 host1x_debug_output(o, "---- mlocks ----\n");
294
296 for (i = 0; i < host1x_syncpt_nb_mlocks(host); i++) { 295 for (i = 0; i < host1x_syncpt_nb_mlocks(host); i++) {
297 u32 owner = 296 u32 owner =
298 host1x_sync_readl(host, HOST1X_SYNC_MLOCK_OWNER(i)); 297 host1x_sync_readl(host, HOST1X_SYNC_MLOCK_OWNER(i));
299 if (HOST1X_SYNC_MLOCK_OWNER_CH_OWNS_V(owner)) 298 if (HOST1X_SYNC_MLOCK_OWNER_CH_OWNS_V(owner))
300 host1x_debug_output(o, "%d: locked by channel %d\n", 299 host1x_debug_output(o, "%u: locked by channel %u\n",
301 i, HOST1X_SYNC_MLOCK_OWNER_CHID_V(owner)); 300 i, HOST1X_SYNC_MLOCK_OWNER_CHID_V(owner));
302 else if (HOST1X_SYNC_MLOCK_OWNER_CPU_OWNS_V(owner)) 301 else if (HOST1X_SYNC_MLOCK_OWNER_CPU_OWNS_V(owner))
303 host1x_debug_output(o, "%d: locked by cpu\n", i); 302 host1x_debug_output(o, "%u: locked by cpu\n", i);
304 else 303 else
305 host1x_debug_output(o, "%d: unlocked\n", i); 304 host1x_debug_output(o, "%u: unlocked\n", i);
306 } 305 }
306
307 host1x_debug_output(o, "\n"); 307 host1x_debug_output(o, "\n");
308} 308}
309 309
diff --git a/drivers/gpu/host1x/hw/intr_hw.c b/drivers/gpu/host1x/hw/intr_hw.c
index e1e31e9e67cd..dacb8009a605 100644
--- a/drivers/gpu/host1x/hw/intr_hw.c
+++ b/drivers/gpu/host1x/hw/intr_hw.c
@@ -38,14 +38,14 @@ static void host1x_intr_syncpt_handle(struct host1x_syncpt *syncpt)
38 host1x_sync_writel(host, BIT_MASK(id), 38 host1x_sync_writel(host, BIT_MASK(id),
39 HOST1X_SYNC_SYNCPT_THRESH_CPU0_INT_STATUS(BIT_WORD(id))); 39 HOST1X_SYNC_SYNCPT_THRESH_CPU0_INT_STATUS(BIT_WORD(id)));
40 40
41 queue_work(host->intr_wq, &syncpt->intr.work); 41 schedule_work(&syncpt->intr.work);
42} 42}
43 43
44static irqreturn_t syncpt_thresh_isr(int irq, void *dev_id) 44static irqreturn_t syncpt_thresh_isr(int irq, void *dev_id)
45{ 45{
46 struct host1x *host = dev_id; 46 struct host1x *host = dev_id;
47 unsigned long reg; 47 unsigned long reg;
48 int i, id; 48 unsigned int i, id;
49 49
50 for (i = 0; i < DIV_ROUND_UP(host->info->nb_pts, 32); i++) { 50 for (i = 0; i < DIV_ROUND_UP(host->info->nb_pts, 32); i++) {
51 reg = host1x_sync_readl(host, 51 reg = host1x_sync_readl(host,
@@ -62,7 +62,7 @@ static irqreturn_t syncpt_thresh_isr(int irq, void *dev_id)
62 62
63static void _host1x_intr_disable_all_syncpt_intrs(struct host1x *host) 63static void _host1x_intr_disable_all_syncpt_intrs(struct host1x *host)
64{ 64{
65 u32 i; 65 unsigned int i;
66 66
67 for (i = 0; i < DIV_ROUND_UP(host->info->nb_pts, 32); ++i) { 67 for (i = 0; i < DIV_ROUND_UP(host->info->nb_pts, 32); ++i) {
68 host1x_sync_writel(host, 0xffffffffu, 68 host1x_sync_writel(host, 0xffffffffu,
@@ -72,10 +72,12 @@ static void _host1x_intr_disable_all_syncpt_intrs(struct host1x *host)
72 } 72 }
73} 73}
74 74
75static int _host1x_intr_init_host_sync(struct host1x *host, u32 cpm, 75static int
76 void (*syncpt_thresh_work)(struct work_struct *)) 76_host1x_intr_init_host_sync(struct host1x *host, u32 cpm,
77 void (*syncpt_thresh_work)(struct work_struct *))
77{ 78{
78 int i, err; 79 unsigned int i;
80 int err;
79 81
80 host1x_hw_intr_disable_all_syncpt_intrs(host); 82 host1x_hw_intr_disable_all_syncpt_intrs(host);
81 83
@@ -106,18 +108,21 @@ static int _host1x_intr_init_host_sync(struct host1x *host, u32 cpm,
106} 108}
107 109
108static void _host1x_intr_set_syncpt_threshold(struct host1x *host, 110static void _host1x_intr_set_syncpt_threshold(struct host1x *host,
109 u32 id, u32 thresh) 111 unsigned int id,
112 u32 thresh)
110{ 113{
111 host1x_sync_writel(host, thresh, HOST1X_SYNC_SYNCPT_INT_THRESH(id)); 114 host1x_sync_writel(host, thresh, HOST1X_SYNC_SYNCPT_INT_THRESH(id));
112} 115}
113 116
114static void _host1x_intr_enable_syncpt_intr(struct host1x *host, u32 id) 117static void _host1x_intr_enable_syncpt_intr(struct host1x *host,
118 unsigned int id)
115{ 119{
116 host1x_sync_writel(host, BIT_MASK(id), 120 host1x_sync_writel(host, BIT_MASK(id),
117 HOST1X_SYNC_SYNCPT_THRESH_INT_ENABLE_CPU0(BIT_WORD(id))); 121 HOST1X_SYNC_SYNCPT_THRESH_INT_ENABLE_CPU0(BIT_WORD(id)));
118} 122}
119 123
120static void _host1x_intr_disable_syncpt_intr(struct host1x *host, u32 id) 124static void _host1x_intr_disable_syncpt_intr(struct host1x *host,
125 unsigned int id)
121{ 126{
122 host1x_sync_writel(host, BIT_MASK(id), 127 host1x_sync_writel(host, BIT_MASK(id),
123 HOST1X_SYNC_SYNCPT_THRESH_INT_DISABLE(BIT_WORD(id))); 128 HOST1X_SYNC_SYNCPT_THRESH_INT_DISABLE(BIT_WORD(id)));
@@ -127,8 +132,13 @@ static void _host1x_intr_disable_syncpt_intr(struct host1x *host, u32 id)
127 132
128static int _host1x_free_syncpt_irq(struct host1x *host) 133static int _host1x_free_syncpt_irq(struct host1x *host)
129{ 134{
135 unsigned int i;
136
130 devm_free_irq(host->dev, host->intr_syncpt_irq, host); 137 devm_free_irq(host->dev, host->intr_syncpt_irq, host);
131 flush_workqueue(host->intr_wq); 138
139 for (i = 0; i < host->info->nb_pts; i++)
140 cancel_work_sync(&host->syncpt[i].intr.work);
141
132 return 0; 142 return 0;
133} 143}
134 144
diff --git a/drivers/gpu/host1x/hw/syncpt_hw.c b/drivers/gpu/host1x/hw/syncpt_hw.c
index 56e85395ac24..c93f74fcce72 100644
--- a/drivers/gpu/host1x/hw/syncpt_hw.c
+++ b/drivers/gpu/host1x/hw/syncpt_hw.c
@@ -26,8 +26,9 @@
26 */ 26 */
27static void syncpt_restore(struct host1x_syncpt *sp) 27static void syncpt_restore(struct host1x_syncpt *sp)
28{ 28{
29 u32 min = host1x_syncpt_read_min(sp);
29 struct host1x *host = sp->host; 30 struct host1x *host = sp->host;
30 int min = host1x_syncpt_read_min(sp); 31
31 host1x_sync_writel(host, min, HOST1X_SYNC_SYNCPT(sp->id)); 32 host1x_sync_writel(host, min, HOST1X_SYNC_SYNCPT(sp->id));
32} 33}
33 34
@@ -37,6 +38,7 @@ static void syncpt_restore(struct host1x_syncpt *sp)
37static void syncpt_restore_wait_base(struct host1x_syncpt *sp) 38static void syncpt_restore_wait_base(struct host1x_syncpt *sp)
38{ 39{
39 struct host1x *host = sp->host; 40 struct host1x *host = sp->host;
41
40 host1x_sync_writel(host, sp->base_val, 42 host1x_sync_writel(host, sp->base_val,
41 HOST1X_SYNC_SYNCPT_BASE(sp->id)); 43 HOST1X_SYNC_SYNCPT_BASE(sp->id));
42} 44}
@@ -47,6 +49,7 @@ static void syncpt_restore_wait_base(struct host1x_syncpt *sp)
47static void syncpt_read_wait_base(struct host1x_syncpt *sp) 49static void syncpt_read_wait_base(struct host1x_syncpt *sp)
48{ 50{
49 struct host1x *host = sp->host; 51 struct host1x *host = sp->host;
52
50 sp->base_val = 53 sp->base_val =
51 host1x_sync_readl(host, HOST1X_SYNC_SYNCPT_BASE(sp->id)); 54 host1x_sync_readl(host, HOST1X_SYNC_SYNCPT_BASE(sp->id));
52} 55}
@@ -85,6 +88,7 @@ static int syncpt_cpu_incr(struct host1x_syncpt *sp)
85 if (!host1x_syncpt_client_managed(sp) && 88 if (!host1x_syncpt_client_managed(sp) &&
86 host1x_syncpt_idle(sp)) 89 host1x_syncpt_idle(sp))
87 return -EINVAL; 90 return -EINVAL;
91
88 host1x_sync_writel(host, BIT_MASK(sp->id), 92 host1x_sync_writel(host, BIT_MASK(sp->id),
89 HOST1X_SYNC_SYNCPT_CPU_INCR(reg_offset)); 93 HOST1X_SYNC_SYNCPT_CPU_INCR(reg_offset));
90 wmb(); 94 wmb();
@@ -95,10 +99,10 @@ static int syncpt_cpu_incr(struct host1x_syncpt *sp)
95/* remove a wait pointed to by patch_addr */ 99/* remove a wait pointed to by patch_addr */
96static int syncpt_patch_wait(struct host1x_syncpt *sp, void *patch_addr) 100static int syncpt_patch_wait(struct host1x_syncpt *sp, void *patch_addr)
97{ 101{
98 u32 override = host1x_class_host_wait_syncpt( 102 u32 override = host1x_class_host_wait_syncpt(HOST1X_SYNCPT_RESERVED, 0);
99 HOST1X_SYNCPT_RESERVED, 0);
100 103
101 *((u32 *)patch_addr) = override; 104 *((u32 *)patch_addr) = override;
105
102 return 0; 106 return 0;
103} 107}
104 108
diff --git a/drivers/gpu/host1x/intr.c b/drivers/gpu/host1x/intr.c
index 2491bf82e30c..8b4fad0ab35d 100644
--- a/drivers/gpu/host1x/intr.c
+++ b/drivers/gpu/host1x/intr.c
@@ -122,18 +122,20 @@ static void action_submit_complete(struct host1x_waitlist *waiter)
122static void action_wakeup(struct host1x_waitlist *waiter) 122static void action_wakeup(struct host1x_waitlist *waiter)
123{ 123{
124 wait_queue_head_t *wq = waiter->data; 124 wait_queue_head_t *wq = waiter->data;
125
125 wake_up(wq); 126 wake_up(wq);
126} 127}
127 128
128static void action_wakeup_interruptible(struct host1x_waitlist *waiter) 129static void action_wakeup_interruptible(struct host1x_waitlist *waiter)
129{ 130{
130 wait_queue_head_t *wq = waiter->data; 131 wait_queue_head_t *wq = waiter->data;
132
131 wake_up_interruptible(wq); 133 wake_up_interruptible(wq);
132} 134}
133 135
134typedef void (*action_handler)(struct host1x_waitlist *waiter); 136typedef void (*action_handler)(struct host1x_waitlist *waiter);
135 137
136static action_handler action_handlers[HOST1X_INTR_ACTION_COUNT] = { 138static const action_handler action_handlers[HOST1X_INTR_ACTION_COUNT] = {
137 action_submit_complete, 139 action_submit_complete,
138 action_wakeup, 140 action_wakeup,
139 action_wakeup_interruptible, 141 action_wakeup_interruptible,
@@ -209,7 +211,7 @@ static void syncpt_thresh_work(struct work_struct *work)
209 host1x_syncpt_load(host->syncpt + id)); 211 host1x_syncpt_load(host->syncpt + id));
210} 212}
211 213
212int host1x_intr_add_action(struct host1x *host, u32 id, u32 thresh, 214int host1x_intr_add_action(struct host1x *host, unsigned int id, u32 thresh,
213 enum host1x_intr_action action, void *data, 215 enum host1x_intr_action action, void *data,
214 struct host1x_waitlist *waiter, void **ref) 216 struct host1x_waitlist *waiter, void **ref)
215{ 217{
@@ -254,7 +256,7 @@ int host1x_intr_add_action(struct host1x *host, u32 id, u32 thresh,
254 return 0; 256 return 0;
255} 257}
256 258
257void host1x_intr_put_ref(struct host1x *host, u32 id, void *ref) 259void host1x_intr_put_ref(struct host1x *host, unsigned int id, void *ref)
258{ 260{
259 struct host1x_waitlist *waiter = ref; 261 struct host1x_waitlist *waiter = ref;
260 struct host1x_syncpt *syncpt; 262 struct host1x_syncpt *syncpt;
@@ -277,9 +279,6 @@ int host1x_intr_init(struct host1x *host, unsigned int irq_sync)
277 279
278 mutex_init(&host->intr_mutex); 280 mutex_init(&host->intr_mutex);
279 host->intr_syncpt_irq = irq_sync; 281 host->intr_syncpt_irq = irq_sync;
280 host->intr_wq = create_workqueue("host_syncpt");
281 if (!host->intr_wq)
282 return -ENOMEM;
283 282
284 for (id = 0; id < nb_pts; ++id) { 283 for (id = 0; id < nb_pts; ++id) {
285 struct host1x_syncpt *syncpt = host->syncpt + id; 284 struct host1x_syncpt *syncpt = host->syncpt + id;
@@ -288,7 +287,7 @@ int host1x_intr_init(struct host1x *host, unsigned int irq_sync)
288 INIT_LIST_HEAD(&syncpt->intr.wait_head); 287 INIT_LIST_HEAD(&syncpt->intr.wait_head);
289 snprintf(syncpt->intr.thresh_irq_name, 288 snprintf(syncpt->intr.thresh_irq_name,
290 sizeof(syncpt->intr.thresh_irq_name), 289 sizeof(syncpt->intr.thresh_irq_name),
291 "host1x_sp_%02d", id); 290 "host1x_sp_%02u", id);
292 } 291 }
293 292
294 host1x_intr_start(host); 293 host1x_intr_start(host);
@@ -299,7 +298,6 @@ int host1x_intr_init(struct host1x *host, unsigned int irq_sync)
299void host1x_intr_deinit(struct host1x *host) 298void host1x_intr_deinit(struct host1x *host)
300{ 299{
301 host1x_intr_stop(host); 300 host1x_intr_stop(host);
302 destroy_workqueue(host->intr_wq);
303} 301}
304 302
305void host1x_intr_start(struct host1x *host) 303void host1x_intr_start(struct host1x *host)
@@ -342,7 +340,7 @@ void host1x_intr_stop(struct host1x *host)
342 if (!list_empty(&syncpt[id].intr.wait_head)) { 340 if (!list_empty(&syncpt[id].intr.wait_head)) {
343 /* output diagnostics */ 341 /* output diagnostics */
344 mutex_unlock(&host->intr_mutex); 342 mutex_unlock(&host->intr_mutex);
345 pr_warn("%s cannot stop syncpt intr id=%d\n", 343 pr_warn("%s cannot stop syncpt intr id=%u\n",
346 __func__, id); 344 __func__, id);
347 return; 345 return;
348 } 346 }
diff --git a/drivers/gpu/host1x/intr.h b/drivers/gpu/host1x/intr.h
index 2b8adf016a05..1370c2bb75b8 100644
--- a/drivers/gpu/host1x/intr.h
+++ b/drivers/gpu/host1x/intr.h
@@ -75,7 +75,7 @@ struct host1x_waitlist {
75 * 75 *
76 * This is a non-blocking api. 76 * This is a non-blocking api.
77 */ 77 */
78int host1x_intr_add_action(struct host1x *host, u32 id, u32 thresh, 78int host1x_intr_add_action(struct host1x *host, unsigned int id, u32 thresh,
79 enum host1x_intr_action action, void *data, 79 enum host1x_intr_action action, void *data,
80 struct host1x_waitlist *waiter, void **ref); 80 struct host1x_waitlist *waiter, void **ref);
81 81
@@ -84,7 +84,7 @@ int host1x_intr_add_action(struct host1x *host, u32 id, u32 thresh,
84 * You must call this if you passed non-NULL as ref. 84 * You must call this if you passed non-NULL as ref.
85 * @ref the ref returned from host1x_intr_add_action() 85 * @ref the ref returned from host1x_intr_add_action()
86 */ 86 */
87void host1x_intr_put_ref(struct host1x *host, u32 id, void *ref); 87void host1x_intr_put_ref(struct host1x *host, unsigned int id, void *ref);
88 88
89/* Initialize host1x sync point interrupt */ 89/* Initialize host1x sync point interrupt */
90int host1x_intr_init(struct host1x *host, unsigned int irq_sync); 90int host1x_intr_init(struct host1x *host, unsigned int irq_sync);
diff --git a/drivers/gpu/host1x/job.c b/drivers/gpu/host1x/job.c
index b4515d544039..a91b7c4a6110 100644
--- a/drivers/gpu/host1x/job.c
+++ b/drivers/gpu/host1x/job.c
@@ -161,7 +161,7 @@ static int do_waitchks(struct host1x_job *job, struct host1x *host,
161 161
162 if (host1x_syncpt_is_expired(sp, wait->thresh)) { 162 if (host1x_syncpt_is_expired(sp, wait->thresh)) {
163 dev_dbg(host->dev, 163 dev_dbg(host->dev,
164 "drop WAIT id %d (%s) thresh 0x%x, min 0x%x\n", 164 "drop WAIT id %u (%s) thresh 0x%x, min 0x%x\n",
165 wait->syncpt_id, sp->name, wait->thresh, 165 wait->syncpt_id, sp->name, wait->thresh,
166 host1x_syncpt_read_min(sp)); 166 host1x_syncpt_read_min(sp));
167 167
@@ -464,6 +464,7 @@ static inline int copy_gathers(struct host1x_job *job, struct device *dev)
464 464
465 for (i = 0; i < job->num_gathers; i++) { 465 for (i = 0; i < job->num_gathers; i++) {
466 struct host1x_job_gather *g = &job->gathers[i]; 466 struct host1x_job_gather *g = &job->gathers[i];
467
467 size += g->words * sizeof(u32); 468 size += g->words * sizeof(u32);
468 } 469 }
469 470
@@ -514,6 +515,7 @@ int host1x_job_pin(struct host1x_job *job, struct device *dev)
514 bitmap_zero(waitchk_mask, host1x_syncpt_nb_pts(host)); 515 bitmap_zero(waitchk_mask, host1x_syncpt_nb_pts(host));
515 for (i = 0; i < job->num_waitchk; i++) { 516 for (i = 0; i < job->num_waitchk; i++) {
516 u32 syncpt_id = job->waitchk[i].syncpt_id; 517 u32 syncpt_id = job->waitchk[i].syncpt_id;
518
517 if (syncpt_id < host1x_syncpt_nb_pts(host)) 519 if (syncpt_id < host1x_syncpt_nb_pts(host))
518 set_bit(syncpt_id, waitchk_mask); 520 set_bit(syncpt_id, waitchk_mask);
519 } 521 }
@@ -571,14 +573,16 @@ void host1x_job_unpin(struct host1x_job *job)
571 573
572 for (i = 0; i < job->num_unpins; i++) { 574 for (i = 0; i < job->num_unpins; i++) {
573 struct host1x_job_unpin_data *unpin = &job->unpins[i]; 575 struct host1x_job_unpin_data *unpin = &job->unpins[i];
576
574 host1x_bo_unpin(unpin->bo, unpin->sgt); 577 host1x_bo_unpin(unpin->bo, unpin->sgt);
575 host1x_bo_put(unpin->bo); 578 host1x_bo_put(unpin->bo);
576 } 579 }
580
577 job->num_unpins = 0; 581 job->num_unpins = 0;
578 582
579 if (job->gather_copy_size) 583 if (job->gather_copy_size)
580 dma_free_wc(job->channel->dev, job->gather_copy_size, 584 dma_free_wc(job->channel->dev, job->gather_copy_size,
581 job->gather_copy_mapped, job->gather_copy); 585 job->gather_copy_mapped, job->gather_copy);
582} 586}
583EXPORT_SYMBOL(host1x_job_unpin); 587EXPORT_SYMBOL(host1x_job_unpin);
584 588
diff --git a/drivers/gpu/host1x/syncpt.c b/drivers/gpu/host1x/syncpt.c
index 6b7fdc1e2ed0..95589328ad52 100644
--- a/drivers/gpu/host1x/syncpt.c
+++ b/drivers/gpu/host1x/syncpt.c
@@ -73,7 +73,7 @@ static struct host1x_syncpt *host1x_syncpt_alloc(struct host1x *host,
73 return NULL; 73 return NULL;
74 } 74 }
75 75
76 name = kasprintf(GFP_KERNEL, "%02d-%s", sp->id, 76 name = kasprintf(GFP_KERNEL, "%02u-%s", sp->id,
77 dev ? dev_name(dev) : NULL); 77 dev ? dev_name(dev) : NULL);
78 if (!name) 78 if (!name)
79 return NULL; 79 return NULL;
@@ -110,12 +110,14 @@ EXPORT_SYMBOL(host1x_syncpt_incr_max);
110void host1x_syncpt_restore(struct host1x *host) 110void host1x_syncpt_restore(struct host1x *host)
111{ 111{
112 struct host1x_syncpt *sp_base = host->syncpt; 112 struct host1x_syncpt *sp_base = host->syncpt;
113 u32 i; 113 unsigned int i;
114 114
115 for (i = 0; i < host1x_syncpt_nb_pts(host); i++) 115 for (i = 0; i < host1x_syncpt_nb_pts(host); i++)
116 host1x_hw_syncpt_restore(host, sp_base + i); 116 host1x_hw_syncpt_restore(host, sp_base + i);
117
117 for (i = 0; i < host1x_syncpt_nb_bases(host); i++) 118 for (i = 0; i < host1x_syncpt_nb_bases(host); i++)
118 host1x_hw_syncpt_restore_wait_base(host, sp_base + i); 119 host1x_hw_syncpt_restore_wait_base(host, sp_base + i);
120
119 wmb(); 121 wmb();
120} 122}
121 123
@@ -126,7 +128,7 @@ void host1x_syncpt_restore(struct host1x *host)
126void host1x_syncpt_save(struct host1x *host) 128void host1x_syncpt_save(struct host1x *host)
127{ 129{
128 struct host1x_syncpt *sp_base = host->syncpt; 130 struct host1x_syncpt *sp_base = host->syncpt;
129 u32 i; 131 unsigned int i;
130 132
131 for (i = 0; i < host1x_syncpt_nb_pts(host); i++) { 133 for (i = 0; i < host1x_syncpt_nb_pts(host); i++) {
132 if (host1x_syncpt_client_managed(sp_base + i)) 134 if (host1x_syncpt_client_managed(sp_base + i))
@@ -146,6 +148,7 @@ void host1x_syncpt_save(struct host1x *host)
146u32 host1x_syncpt_load(struct host1x_syncpt *sp) 148u32 host1x_syncpt_load(struct host1x_syncpt *sp)
147{ 149{
148 u32 val; 150 u32 val;
151
149 val = host1x_hw_syncpt_load(sp->host, sp); 152 val = host1x_hw_syncpt_load(sp->host, sp);
150 trace_host1x_syncpt_load_min(sp->id, val); 153 trace_host1x_syncpt_load_min(sp->id, val);
151 154
@@ -157,10 +160,9 @@ u32 host1x_syncpt_load(struct host1x_syncpt *sp)
157 */ 160 */
158u32 host1x_syncpt_load_wait_base(struct host1x_syncpt *sp) 161u32 host1x_syncpt_load_wait_base(struct host1x_syncpt *sp)
159{ 162{
160 u32 val;
161 host1x_hw_syncpt_load_wait_base(sp->host, sp); 163 host1x_hw_syncpt_load_wait_base(sp->host, sp);
162 val = sp->base_val; 164
163 return val; 165 return sp->base_val;
164} 166}
165 167
166/* 168/*
@@ -179,6 +181,7 @@ EXPORT_SYMBOL(host1x_syncpt_incr);
179static bool syncpt_load_min_is_expired(struct host1x_syncpt *sp, u32 thresh) 181static bool syncpt_load_min_is_expired(struct host1x_syncpt *sp, u32 thresh)
180{ 182{
181 host1x_hw_syncpt_load(sp->host, sp); 183 host1x_hw_syncpt_load(sp->host, sp);
184
182 return host1x_syncpt_is_expired(sp, thresh); 185 return host1x_syncpt_is_expired(sp, thresh);
183} 186}
184 187
@@ -186,7 +189,7 @@ static bool syncpt_load_min_is_expired(struct host1x_syncpt *sp, u32 thresh)
186 * Main entrypoint for syncpoint value waits. 189 * Main entrypoint for syncpoint value waits.
187 */ 190 */
188int host1x_syncpt_wait(struct host1x_syncpt *sp, u32 thresh, long timeout, 191int host1x_syncpt_wait(struct host1x_syncpt *sp, u32 thresh, long timeout,
189 u32 *value) 192 u32 *value)
190{ 193{
191 DECLARE_WAIT_QUEUE_HEAD_ONSTACK(wq); 194 DECLARE_WAIT_QUEUE_HEAD_ONSTACK(wq);
192 void *ref; 195 void *ref;
@@ -201,6 +204,7 @@ int host1x_syncpt_wait(struct host1x_syncpt *sp, u32 thresh, long timeout,
201 if (host1x_syncpt_is_expired(sp, thresh)) { 204 if (host1x_syncpt_is_expired(sp, thresh)) {
202 if (value) 205 if (value)
203 *value = host1x_syncpt_load(sp); 206 *value = host1x_syncpt_load(sp);
207
204 return 0; 208 return 0;
205 } 209 }
206 210
@@ -209,6 +213,7 @@ int host1x_syncpt_wait(struct host1x_syncpt *sp, u32 thresh, long timeout,
209 if (host1x_syncpt_is_expired(sp, thresh)) { 213 if (host1x_syncpt_is_expired(sp, thresh)) {
210 if (value) 214 if (value)
211 *value = val; 215 *value = val;
216
212 goto done; 217 goto done;
213 } 218 }
214 219
@@ -239,32 +244,42 @@ int host1x_syncpt_wait(struct host1x_syncpt *sp, u32 thresh, long timeout,
239 /* wait for the syncpoint, or timeout, or signal */ 244 /* wait for the syncpoint, or timeout, or signal */
240 while (timeout) { 245 while (timeout) {
241 long check = min_t(long, SYNCPT_CHECK_PERIOD, timeout); 246 long check = min_t(long, SYNCPT_CHECK_PERIOD, timeout);
242 int remain = wait_event_interruptible_timeout(wq, 247 int remain;
248
249 remain = wait_event_interruptible_timeout(wq,
243 syncpt_load_min_is_expired(sp, thresh), 250 syncpt_load_min_is_expired(sp, thresh),
244 check); 251 check);
245 if (remain > 0 || host1x_syncpt_is_expired(sp, thresh)) { 252 if (remain > 0 || host1x_syncpt_is_expired(sp, thresh)) {
246 if (value) 253 if (value)
247 *value = host1x_syncpt_load(sp); 254 *value = host1x_syncpt_load(sp);
255
248 err = 0; 256 err = 0;
257
249 break; 258 break;
250 } 259 }
260
251 if (remain < 0) { 261 if (remain < 0) {
252 err = remain; 262 err = remain;
253 break; 263 break;
254 } 264 }
265
255 timeout -= check; 266 timeout -= check;
267
256 if (timeout && check_count <= MAX_STUCK_CHECK_COUNT) { 268 if (timeout && check_count <= MAX_STUCK_CHECK_COUNT) {
257 dev_warn(sp->host->dev, 269 dev_warn(sp->host->dev,
258 "%s: syncpoint id %d (%s) stuck waiting %d, timeout=%ld\n", 270 "%s: syncpoint id %u (%s) stuck waiting %d, timeout=%ld\n",
259 current->comm, sp->id, sp->name, 271 current->comm, sp->id, sp->name,
260 thresh, timeout); 272 thresh, timeout);
261 273
262 host1x_debug_dump_syncpts(sp->host); 274 host1x_debug_dump_syncpts(sp->host);
275
263 if (check_count == MAX_STUCK_CHECK_COUNT) 276 if (check_count == MAX_STUCK_CHECK_COUNT)
264 host1x_debug_dump(sp->host); 277 host1x_debug_dump(sp->host);
278
265 check_count++; 279 check_count++;
266 } 280 }
267 } 281 }
282
268 host1x_intr_put_ref(sp->host, sp->id, ref); 283 host1x_intr_put_ref(sp->host, sp->id, ref);
269 284
270done: 285done:
@@ -279,7 +294,9 @@ bool host1x_syncpt_is_expired(struct host1x_syncpt *sp, u32 thresh)
279{ 294{
280 u32 current_val; 295 u32 current_val;
281 u32 future_val; 296 u32 future_val;
297
282 smp_rmb(); 298 smp_rmb();
299
283 current_val = (u32)atomic_read(&sp->min_val); 300 current_val = (u32)atomic_read(&sp->min_val);
284 future_val = (u32)atomic_read(&sp->max_val); 301 future_val = (u32)atomic_read(&sp->max_val);
285 302
@@ -341,14 +358,14 @@ int host1x_syncpt_init(struct host1x *host)
341{ 358{
342 struct host1x_syncpt_base *bases; 359 struct host1x_syncpt_base *bases;
343 struct host1x_syncpt *syncpt; 360 struct host1x_syncpt *syncpt;
344 int i; 361 unsigned int i;
345 362
346 syncpt = devm_kzalloc(host->dev, sizeof(*syncpt) * host->info->nb_pts, 363 syncpt = devm_kcalloc(host->dev, host->info->nb_pts, sizeof(*syncpt),
347 GFP_KERNEL); 364 GFP_KERNEL);
348 if (!syncpt) 365 if (!syncpt)
349 return -ENOMEM; 366 return -ENOMEM;
350 367
351 bases = devm_kzalloc(host->dev, sizeof(*bases) * host->info->nb_bases, 368 bases = devm_kcalloc(host->dev, host->info->nb_bases, sizeof(*bases),
352 GFP_KERNEL); 369 GFP_KERNEL);
353 if (!bases) 370 if (!bases)
354 return -ENOMEM; 371 return -ENOMEM;
@@ -378,6 +395,7 @@ struct host1x_syncpt *host1x_syncpt_request(struct device *dev,
378 unsigned long flags) 395 unsigned long flags)
379{ 396{
380 struct host1x *host = dev_get_drvdata(dev->parent); 397 struct host1x *host = dev_get_drvdata(dev->parent);
398
381 return host1x_syncpt_alloc(host, dev, flags); 399 return host1x_syncpt_alloc(host, dev, flags);
382} 400}
383EXPORT_SYMBOL(host1x_syncpt_request); 401EXPORT_SYMBOL(host1x_syncpt_request);
@@ -398,8 +416,9 @@ EXPORT_SYMBOL(host1x_syncpt_free);
398 416
399void host1x_syncpt_deinit(struct host1x *host) 417void host1x_syncpt_deinit(struct host1x *host)
400{ 418{
401 int i;
402 struct host1x_syncpt *sp = host->syncpt; 419 struct host1x_syncpt *sp = host->syncpt;
420 unsigned int i;
421
403 for (i = 0; i < host->info->nb_pts; i++, sp++) 422 for (i = 0; i < host->info->nb_pts; i++, sp++)
404 kfree(sp->name); 423 kfree(sp->name);
405} 424}
@@ -407,10 +426,11 @@ void host1x_syncpt_deinit(struct host1x *host)
407/* 426/*
408 * Read max. It indicates how many operations there are in queue, either in 427 * Read max. It indicates how many operations there are in queue, either in
409 * channel or in a software thread. 428 * channel or in a software thread.
410 * */ 429 */
411u32 host1x_syncpt_read_max(struct host1x_syncpt *sp) 430u32 host1x_syncpt_read_max(struct host1x_syncpt *sp)
412{ 431{
413 smp_rmb(); 432 smp_rmb();
433
414 return (u32)atomic_read(&sp->max_val); 434 return (u32)atomic_read(&sp->max_val);
415} 435}
416EXPORT_SYMBOL(host1x_syncpt_read_max); 436EXPORT_SYMBOL(host1x_syncpt_read_max);
@@ -421,6 +441,7 @@ EXPORT_SYMBOL(host1x_syncpt_read_max);
421u32 host1x_syncpt_read_min(struct host1x_syncpt *sp) 441u32 host1x_syncpt_read_min(struct host1x_syncpt *sp)
422{ 442{
423 smp_rmb(); 443 smp_rmb();
444
424 return (u32)atomic_read(&sp->min_val); 445 return (u32)atomic_read(&sp->min_val);
425} 446}
426EXPORT_SYMBOL(host1x_syncpt_read_min); 447EXPORT_SYMBOL(host1x_syncpt_read_min);
@@ -431,25 +452,26 @@ u32 host1x_syncpt_read(struct host1x_syncpt *sp)
431} 452}
432EXPORT_SYMBOL(host1x_syncpt_read); 453EXPORT_SYMBOL(host1x_syncpt_read);
433 454
434int host1x_syncpt_nb_pts(struct host1x *host) 455unsigned int host1x_syncpt_nb_pts(struct host1x *host)
435{ 456{
436 return host->info->nb_pts; 457 return host->info->nb_pts;
437} 458}
438 459
439int host1x_syncpt_nb_bases(struct host1x *host) 460unsigned int host1x_syncpt_nb_bases(struct host1x *host)
440{ 461{
441 return host->info->nb_bases; 462 return host->info->nb_bases;
442} 463}
443 464
444int host1x_syncpt_nb_mlocks(struct host1x *host) 465unsigned int host1x_syncpt_nb_mlocks(struct host1x *host)
445{ 466{
446 return host->info->nb_mlocks; 467 return host->info->nb_mlocks;
447} 468}
448 469
449struct host1x_syncpt *host1x_syncpt_get(struct host1x *host, u32 id) 470struct host1x_syncpt *host1x_syncpt_get(struct host1x *host, unsigned int id)
450{ 471{
451 if (host->info->nb_pts < id) 472 if (host->info->nb_pts < id)
452 return NULL; 473 return NULL;
474
453 return host->syncpt + id; 475 return host->syncpt + id;
454} 476}
455EXPORT_SYMBOL(host1x_syncpt_get); 477EXPORT_SYMBOL(host1x_syncpt_get);
diff --git a/drivers/gpu/host1x/syncpt.h b/drivers/gpu/host1x/syncpt.h
index 9056465ecd3f..f719205105ac 100644
--- a/drivers/gpu/host1x/syncpt.h
+++ b/drivers/gpu/host1x/syncpt.h
@@ -37,7 +37,7 @@ struct host1x_syncpt_base {
37}; 37};
38 38
39struct host1x_syncpt { 39struct host1x_syncpt {
40 int id; 40 unsigned int id;
41 atomic_t min_val; 41 atomic_t min_val;
42 atomic_t max_val; 42 atomic_t max_val;
43 u32 base_val; 43 u32 base_val;
@@ -58,13 +58,13 @@ int host1x_syncpt_init(struct host1x *host);
58void host1x_syncpt_deinit(struct host1x *host); 58void host1x_syncpt_deinit(struct host1x *host);
59 59
60/* Return number of sync point supported. */ 60/* Return number of sync point supported. */
61int host1x_syncpt_nb_pts(struct host1x *host); 61unsigned int host1x_syncpt_nb_pts(struct host1x *host);
62 62
63/* Return number of wait bases supported. */ 63/* Return number of wait bases supported. */
64int host1x_syncpt_nb_bases(struct host1x *host); 64unsigned int host1x_syncpt_nb_bases(struct host1x *host);
65 65
66/* Return number of mlocks supported. */ 66/* Return number of mlocks supported. */
67int host1x_syncpt_nb_mlocks(struct host1x *host); 67unsigned int host1x_syncpt_nb_mlocks(struct host1x *host);
68 68
69/* 69/*
70 * Check sync point sanity. If max is larger than min, there have too many 70 * Check sync point sanity. If max is larger than min, there have too many