diff options
author | Thierry Reding <treding@nvidia.com> | 2016-06-23 05:35:50 -0400 |
---|---|---|
committer | Thierry Reding <treding@nvidia.com> | 2016-06-23 05:59:30 -0400 |
commit | 0b8070d12ee2ef62e0b07213d843eb508fba966e (patch) | |
tree | 59322f17c817b8b17f36e47fec173beed68894a3 | |
parent | 6df633d0dc333ffce683f46f2856024479b170b9 (diff) |
gpu: host1x: Whitespace cleanup for readability
Insert a number of blank lines in places where they increase readability
of the code. Also collapse various variable declarations to shorten some
functions and finally rewrite some code for readability.
Signed-off-by: Thierry Reding <treding@nvidia.com>
-rw-r--r-- | drivers/gpu/host1x/cdma.c | 26 | ||||
-rw-r--r-- | drivers/gpu/host1x/debug.c | 28 | ||||
-rw-r--r-- | drivers/gpu/host1x/dev.c | 14 | ||||
-rw-r--r-- | drivers/gpu/host1x/hw/cdma_hw.c | 13 | ||||
-rw-r--r-- | drivers/gpu/host1x/hw/channel_hw.c | 2 | ||||
-rw-r--r-- | drivers/gpu/host1x/hw/debug_hw.c | 14 | ||||
-rw-r--r-- | drivers/gpu/host1x/hw/intr_hw.c | 6 | ||||
-rw-r--r-- | drivers/gpu/host1x/hw/syncpt_hw.c | 5 | ||||
-rw-r--r-- | drivers/gpu/host1x/job.c | 3 | ||||
-rw-r--r-- | drivers/gpu/host1x/syncpt.c | 24 |
10 files changed, 92 insertions, 43 deletions
diff --git a/drivers/gpu/host1x/cdma.c b/drivers/gpu/host1x/cdma.c index b83b0a04d9c5..c5d82a8a2ec9 100644 --- a/drivers/gpu/host1x/cdma.c +++ b/drivers/gpu/host1x/cdma.c | |||
@@ -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 | ||
@@ -249,6 +257,7 @@ static void update_cdma_locked(struct host1x_cdma *cdma) | |||
249 | struct push_buffer *pb = &cdma->push_buffer; | 257 | struct push_buffer *pb = &cdma->push_buffer; |
250 | 258 | ||
251 | host1x_pushbuffer_pop(pb, job->num_slots); | 259 | host1x_pushbuffer_pop(pb, job->num_slots); |
260 | |||
252 | if (cdma->event == CDMA_EVENT_PUSH_BUFFER_SPACE) | 261 | if (cdma->event == CDMA_EVENT_PUSH_BUFFER_SPACE) |
253 | signal = true; | 262 | signal = true; |
254 | } | 263 | } |
@@ -270,11 +279,9 @@ static void update_cdma_locked(struct host1x_cdma *cdma) | |||
270 | void host1x_cdma_update_sync_queue(struct host1x_cdma *cdma, | 279 | void host1x_cdma_update_sync_queue(struct host1x_cdma *cdma, |
271 | struct device *dev) | 280 | struct device *dev) |
272 | { | 281 | { |
273 | u32 restart_addr; | ||
274 | u32 syncpt_incrs; | ||
275 | struct host1x_job *job = NULL; | ||
276 | u32 syncpt_val; | ||
277 | 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; | ||
278 | 285 | ||
279 | syncpt_val = host1x_syncpt_load(cdma->timeout.syncpt); | 286 | syncpt_val = host1x_syncpt_load(cdma->timeout.syncpt); |
280 | 287 | ||
@@ -378,6 +385,7 @@ int host1x_cdma_init(struct host1x_cdma *cdma) | |||
378 | err = host1x_pushbuffer_init(&cdma->push_buffer); | 385 | err = host1x_pushbuffer_init(&cdma->push_buffer); |
379 | if (err) | 386 | if (err) |
380 | return err; | 387 | return err; |
388 | |||
381 | return 0; | 389 | return 0; |
382 | } | 390 | } |
383 | 391 | ||
@@ -422,6 +430,7 @@ int host1x_cdma_begin(struct host1x_cdma *cdma, struct host1x_job *job) | |||
422 | } | 430 | } |
423 | } | 431 | } |
424 | } | 432 | } |
433 | |||
425 | if (!cdma->running) | 434 | if (!cdma->running) |
426 | host1x_hw_cdma_start(host1x, cdma); | 435 | host1x_hw_cdma_start(host1x, cdma); |
427 | 436 | ||
@@ -452,6 +461,7 @@ void host1x_cdma_push(struct host1x_cdma *cdma, u32 op1, u32 op2) | |||
452 | slots_free = host1x_cdma_wait_locked(cdma, | 461 | slots_free = host1x_cdma_wait_locked(cdma, |
453 | CDMA_EVENT_PUSH_BUFFER_SPACE); | 462 | CDMA_EVENT_PUSH_BUFFER_SPACE); |
454 | } | 463 | } |
464 | |||
455 | cdma->slots_free = slots_free - 1; | 465 | cdma->slots_free = slots_free - 1; |
456 | cdma->slots_used++; | 466 | cdma->slots_used++; |
457 | host1x_pushbuffer_push(pb, op1, op2); | 467 | host1x_pushbuffer_push(pb, op1, op2); |
diff --git a/drivers/gpu/host1x/debug.c b/drivers/gpu/host1x/debug.c index 7bb86b92ff09..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; |
@@ -65,6 +70,7 @@ static void show_syncpts(struct host1x *m, struct output *o) | |||
65 | unsigned int i; | 70 | unsigned int i; |
66 | 71 | ||
67 | host1x_debug_output(o, "---- syncpts ----\n"); | 72 | host1x_debug_output(o, "---- syncpts ----\n"); |
73 | |||
68 | for (i = 0; i < host1x_syncpt_nb_pts(m); i++) { | 74 | for (i = 0; i < host1x_syncpt_nb_pts(m); i++) { |
69 | u32 max = host1x_syncpt_read_max(m->syncpt + i); | 75 | u32 max = host1x_syncpt_read_max(m->syncpt + i); |
70 | u32 min = host1x_syncpt_load(m->syncpt + i); | 76 | u32 min = host1x_syncpt_load(m->syncpt + i); |
@@ -118,7 +124,9 @@ static int host1x_debug_show_all(struct seq_file *s, void *unused) | |||
118 | .fn = write_to_seqfile, | 124 | .fn = write_to_seqfile, |
119 | .ctx = s | 125 | .ctx = s |
120 | }; | 126 | }; |
127 | |||
121 | show_all(s->private, &o); | 128 | show_all(s->private, &o); |
129 | |||
122 | return 0; | 130 | return 0; |
123 | } | 131 | } |
124 | 132 | ||
@@ -128,7 +136,9 @@ static int host1x_debug_show(struct seq_file *s, void *unused) | |||
128 | .fn = write_to_seqfile, | 136 | .fn = write_to_seqfile, |
129 | .ctx = s | 137 | .ctx = s |
130 | }; | 138 | }; |
139 | |||
131 | show_all_no_fifo(s->private, &o); | 140 | show_all_no_fifo(s->private, &o); |
141 | |||
132 | return 0; | 142 | return 0; |
133 | } | 143 | } |
134 | 144 | ||
@@ -138,10 +148,10 @@ static int host1x_debug_open_all(struct inode *inode, struct file *file) | |||
138 | } | 148 | } |
139 | 149 | ||
140 | static const struct file_operations host1x_debug_all_fops = { | 150 | static const struct file_operations host1x_debug_all_fops = { |
141 | .open = host1x_debug_open_all, | 151 | .open = host1x_debug_open_all, |
142 | .read = seq_read, | 152 | .read = seq_read, |
143 | .llseek = seq_lseek, | 153 | .llseek = seq_lseek, |
144 | .release = single_release, | 154 | .release = single_release, |
145 | }; | 155 | }; |
146 | 156 | ||
147 | static int host1x_debug_open(struct inode *inode, struct file *file) | 157 | static int host1x_debug_open(struct inode *inode, struct file *file) |
@@ -150,10 +160,10 @@ static int host1x_debug_open(struct inode *inode, struct file *file) | |||
150 | } | 160 | } |
151 | 161 | ||
152 | static const struct file_operations host1x_debug_fops = { | 162 | static const struct file_operations host1x_debug_fops = { |
153 | .open = host1x_debug_open, | 163 | .open = host1x_debug_open, |
154 | .read = seq_read, | 164 | .read = seq_read, |
155 | .llseek = seq_lseek, | 165 | .llseek = seq_lseek, |
156 | .release = single_release, | 166 | .release = single_release, |
157 | }; | 167 | }; |
158 | 168 | ||
159 | static void host1x_debugfs_init(struct host1x *host1x) | 169 | static void host1x_debugfs_init(struct host1x *host1x) |
@@ -205,6 +215,7 @@ void host1x_debug_dump(struct host1x *host1x) | |||
205 | struct output o = { | 215 | struct output o = { |
206 | .fn = write_to_printk | 216 | .fn = write_to_printk |
207 | }; | 217 | }; |
218 | |||
208 | show_all(host1x, &o); | 219 | show_all(host1x, &o); |
209 | } | 220 | } |
210 | 221 | ||
@@ -213,5 +224,6 @@ void host1x_debug_dump_syncpts(struct host1x *host1x) | |||
213 | struct output o = { | 224 | struct output o = { |
214 | .fn = write_to_printk | 225 | .fn = write_to_printk |
215 | }; | 226 | }; |
227 | |||
216 | show_syncpts(host1x, &o); | 228 | show_syncpts(host1x, &o); |
217 | } | 229 | } |
diff --git a/drivers/gpu/host1x/dev.c b/drivers/gpu/host1x/dev.c index 320caf99cff4..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 | ||
65 | static const struct host1x_info host1x01_info = { | 65 | static 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 | ||
75 | static const struct host1x_info host1x02_info = { | 75 | static const struct host1x_info host1x02_info = { |
diff --git a/drivers/gpu/host1x/hw/cdma_hw.c b/drivers/gpu/host1x/hw/cdma_hw.c index e0db00613bca..5c39f1b111f7 100644 --- a/drivers/gpu/host1x/hw/cdma_hw.c +++ b/drivers/gpu/host1x/hw/cdma_hw.c | |||
@@ -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 | ||
@@ -231,14 +234,11 @@ static void cdma_resume(struct host1x_cdma *cdma, u32 getptr) | |||
231 | */ | 234 | */ |
232 | static void cdma_timeout_handler(struct work_struct *work) | 235 | static 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); |
@@ -278,8 +278,8 @@ static void cdma_timeout_handler(struct work_struct *work) | |||
278 | } | 278 | } |
279 | 279 | ||
280 | dev_warn(host1x->dev, "%s: timeout: %u (%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); |
@@ -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 f359b7ec5e3c..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 | } |
diff --git a/drivers/gpu/host1x/hw/debug_hw.c b/drivers/gpu/host1x/hw/debug_hw.c index d2c96dd630ea..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 | ||
41 | static unsigned int show_channel_command(struct output *o, u32 val) | 41 | static 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: |
@@ -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)); |
@@ -293,6 +291,7 @@ static void host1x_debug_show_mlocks(struct host1x *host, struct output *o) | |||
293 | unsigned 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)); |
@@ -304,6 +303,7 @@ static void host1x_debug_show_mlocks(struct host1x *host, struct output *o) | |||
304 | else | 303 | else |
305 | host1x_debug_output(o, "%u: 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 f50c68957c12..dacb8009a605 100644 --- a/drivers/gpu/host1x/hw/intr_hw.c +++ b/drivers/gpu/host1x/hw/intr_hw.c | |||
@@ -72,8 +72,9 @@ static void _host1x_intr_disable_all_syncpt_intrs(struct host1x *host) | |||
72 | } | 72 | } |
73 | } | 73 | } |
74 | 74 | ||
75 | static int _host1x_intr_init_host_sync(struct host1x *host, u32 cpm, | 75 | static 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 | unsigned int i; | 79 | unsigned int i; |
79 | int err; | 80 | int err; |
@@ -137,6 +138,7 @@ static int _host1x_free_syncpt_irq(struct host1x *host) | |||
137 | 138 | ||
138 | for (i = 0; i < host->info->nb_pts; i++) | 139 | for (i = 0; i < host->info->nb_pts; i++) |
139 | cancel_work_sync(&host->syncpt[i].intr.work); | 140 | cancel_work_sync(&host->syncpt[i].intr.work); |
141 | |||
140 | return 0; | 142 | return 0; |
141 | } | 143 | } |
142 | 144 | ||
diff --git a/drivers/gpu/host1x/hw/syncpt_hw.c b/drivers/gpu/host1x/hw/syncpt_hw.c index 310f24fcd261..c93f74fcce72 100644 --- a/drivers/gpu/host1x/hw/syncpt_hw.c +++ b/drivers/gpu/host1x/hw/syncpt_hw.c | |||
@@ -88,6 +88,7 @@ static int syncpt_cpu_incr(struct host1x_syncpt *sp) | |||
88 | if (!host1x_syncpt_client_managed(sp) && | 88 | if (!host1x_syncpt_client_managed(sp) && |
89 | host1x_syncpt_idle(sp)) | 89 | host1x_syncpt_idle(sp)) |
90 | return -EINVAL; | 90 | return -EINVAL; |
91 | |||
91 | host1x_sync_writel(host, BIT_MASK(sp->id), | 92 | host1x_sync_writel(host, BIT_MASK(sp->id), |
92 | HOST1X_SYNC_SYNCPT_CPU_INCR(reg_offset)); | 93 | HOST1X_SYNC_SYNCPT_CPU_INCR(reg_offset)); |
93 | wmb(); | 94 | wmb(); |
@@ -98,10 +99,10 @@ static int syncpt_cpu_incr(struct host1x_syncpt *sp) | |||
98 | /* remove a wait pointed to by patch_addr */ | 99 | /* remove a wait pointed to by patch_addr */ |
99 | static int syncpt_patch_wait(struct host1x_syncpt *sp, void *patch_addr) | 100 | static int syncpt_patch_wait(struct host1x_syncpt *sp, void *patch_addr) |
100 | { | 101 | { |
101 | u32 override = host1x_class_host_wait_syncpt( | 102 | u32 override = host1x_class_host_wait_syncpt(HOST1X_SYNCPT_RESERVED, 0); |
102 | HOST1X_SYNCPT_RESERVED, 0); | ||
103 | 103 | ||
104 | *((u32 *)patch_addr) = override; | 104 | *((u32 *)patch_addr) = override; |
105 | |||
105 | return 0; | 106 | return 0; |
106 | } | 107 | } |
107 | 108 | ||
diff --git a/drivers/gpu/host1x/job.c b/drivers/gpu/host1x/job.c index 1bff367f8830..a91b7c4a6110 100644 --- a/drivers/gpu/host1x/job.c +++ b/drivers/gpu/host1x/job.c | |||
@@ -577,11 +577,12 @@ void host1x_job_unpin(struct host1x_job *job) | |||
577 | host1x_bo_unpin(unpin->bo, unpin->sgt); | 577 | host1x_bo_unpin(unpin->bo, unpin->sgt); |
578 | host1x_bo_put(unpin->bo); | 578 | host1x_bo_put(unpin->bo); |
579 | } | 579 | } |
580 | |||
580 | job->num_unpins = 0; | 581 | job->num_unpins = 0; |
581 | 582 | ||
582 | if (job->gather_copy_size) | 583 | if (job->gather_copy_size) |
583 | dma_free_wc(job->channel->dev, job->gather_copy_size, | 584 | dma_free_wc(job->channel->dev, job->gather_copy_size, |
584 | job->gather_copy_mapped, job->gather_copy); | 585 | job->gather_copy_mapped, job->gather_copy); |
585 | } | 586 | } |
586 | EXPORT_SYMBOL(host1x_job_unpin); | 587 | EXPORT_SYMBOL(host1x_job_unpin); |
587 | 588 | ||
diff --git a/drivers/gpu/host1x/syncpt.c b/drivers/gpu/host1x/syncpt.c index 7c4848f4ce59..73b43c25b04b 100644 --- a/drivers/gpu/host1x/syncpt.c +++ b/drivers/gpu/host1x/syncpt.c | |||
@@ -114,8 +114,10 @@ void host1x_syncpt_restore(struct host1x *host) | |||
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 | ||
@@ -181,6 +183,7 @@ EXPORT_SYMBOL(host1x_syncpt_incr); | |||
181 | static bool syncpt_load_min_is_expired(struct host1x_syncpt *sp, u32 thresh) | 183 | static bool syncpt_load_min_is_expired(struct host1x_syncpt *sp, u32 thresh) |
182 | { | 184 | { |
183 | host1x_hw_syncpt_load(sp->host, sp); | 185 | host1x_hw_syncpt_load(sp->host, sp); |
186 | |||
184 | return host1x_syncpt_is_expired(sp, thresh); | 187 | return host1x_syncpt_is_expired(sp, thresh); |
185 | } | 188 | } |
186 | 189 | ||
@@ -188,7 +191,7 @@ static bool syncpt_load_min_is_expired(struct host1x_syncpt *sp, u32 thresh) | |||
188 | * Main entrypoint for syncpoint value waits. | 191 | * Main entrypoint for syncpoint value waits. |
189 | */ | 192 | */ |
190 | int host1x_syncpt_wait(struct host1x_syncpt *sp, u32 thresh, long timeout, | 193 | int host1x_syncpt_wait(struct host1x_syncpt *sp, u32 thresh, long timeout, |
191 | u32 *value) | 194 | u32 *value) |
192 | { | 195 | { |
193 | DECLARE_WAIT_QUEUE_HEAD_ONSTACK(wq); | 196 | DECLARE_WAIT_QUEUE_HEAD_ONSTACK(wq); |
194 | void *ref; | 197 | void *ref; |
@@ -203,6 +206,7 @@ int host1x_syncpt_wait(struct host1x_syncpt *sp, u32 thresh, long timeout, | |||
203 | if (host1x_syncpt_is_expired(sp, thresh)) { | 206 | if (host1x_syncpt_is_expired(sp, thresh)) { |
204 | if (value) | 207 | if (value) |
205 | *value = host1x_syncpt_load(sp); | 208 | *value = host1x_syncpt_load(sp); |
209 | |||
206 | return 0; | 210 | return 0; |
207 | } | 211 | } |
208 | 212 | ||
@@ -211,6 +215,7 @@ int host1x_syncpt_wait(struct host1x_syncpt *sp, u32 thresh, long timeout, | |||
211 | if (host1x_syncpt_is_expired(sp, thresh)) { | 215 | if (host1x_syncpt_is_expired(sp, thresh)) { |
212 | if (value) | 216 | if (value) |
213 | *value = val; | 217 | *value = val; |
218 | |||
214 | goto done; | 219 | goto done; |
215 | } | 220 | } |
216 | 221 | ||
@@ -241,20 +246,27 @@ int host1x_syncpt_wait(struct host1x_syncpt *sp, u32 thresh, long timeout, | |||
241 | /* wait for the syncpoint, or timeout, or signal */ | 246 | /* wait for the syncpoint, or timeout, or signal */ |
242 | while (timeout) { | 247 | while (timeout) { |
243 | long check = min_t(long, SYNCPT_CHECK_PERIOD, timeout); | 248 | long check = min_t(long, SYNCPT_CHECK_PERIOD, timeout); |
244 | int remain = wait_event_interruptible_timeout(wq, | 249 | int remain; |
250 | |||
251 | remain = wait_event_interruptible_timeout(wq, | ||
245 | syncpt_load_min_is_expired(sp, thresh), | 252 | syncpt_load_min_is_expired(sp, thresh), |
246 | check); | 253 | check); |
247 | if (remain > 0 || host1x_syncpt_is_expired(sp, thresh)) { | 254 | if (remain > 0 || host1x_syncpt_is_expired(sp, thresh)) { |
248 | if (value) | 255 | if (value) |
249 | *value = host1x_syncpt_load(sp); | 256 | *value = host1x_syncpt_load(sp); |
257 | |||
250 | err = 0; | 258 | err = 0; |
259 | |||
251 | break; | 260 | break; |
252 | } | 261 | } |
262 | |||
253 | if (remain < 0) { | 263 | if (remain < 0) { |
254 | err = remain; | 264 | err = remain; |
255 | break; | 265 | break; |
256 | } | 266 | } |
267 | |||
257 | timeout -= check; | 268 | timeout -= check; |
269 | |||
258 | if (timeout && check_count <= MAX_STUCK_CHECK_COUNT) { | 270 | if (timeout && check_count <= MAX_STUCK_CHECK_COUNT) { |
259 | dev_warn(sp->host->dev, | 271 | dev_warn(sp->host->dev, |
260 | "%s: syncpoint id %u (%s) stuck waiting %d, timeout=%ld\n", | 272 | "%s: syncpoint id %u (%s) stuck waiting %d, timeout=%ld\n", |
@@ -262,11 +274,14 @@ int host1x_syncpt_wait(struct host1x_syncpt *sp, u32 thresh, long timeout, | |||
262 | thresh, timeout); | 274 | thresh, timeout); |
263 | 275 | ||
264 | host1x_debug_dump_syncpts(sp->host); | 276 | host1x_debug_dump_syncpts(sp->host); |
277 | |||
265 | if (check_count == MAX_STUCK_CHECK_COUNT) | 278 | if (check_count == MAX_STUCK_CHECK_COUNT) |
266 | host1x_debug_dump(sp->host); | 279 | host1x_debug_dump(sp->host); |
280 | |||
267 | check_count++; | 281 | check_count++; |
268 | } | 282 | } |
269 | } | 283 | } |
284 | |||
270 | host1x_intr_put_ref(sp->host, sp->id, ref); | 285 | host1x_intr_put_ref(sp->host, sp->id, ref); |
271 | 286 | ||
272 | done: | 287 | done: |
@@ -283,6 +298,7 @@ bool host1x_syncpt_is_expired(struct host1x_syncpt *sp, u32 thresh) | |||
283 | u32 future_val; | 298 | u32 future_val; |
284 | 299 | ||
285 | smp_rmb(); | 300 | smp_rmb(); |
301 | |||
286 | current_val = (u32)atomic_read(&sp->min_val); | 302 | current_val = (u32)atomic_read(&sp->min_val); |
287 | future_val = (u32)atomic_read(&sp->max_val); | 303 | future_val = (u32)atomic_read(&sp->max_val); |
288 | 304 | ||
@@ -381,6 +397,7 @@ struct host1x_syncpt *host1x_syncpt_request(struct device *dev, | |||
381 | unsigned long flags) | 397 | unsigned long flags) |
382 | { | 398 | { |
383 | struct host1x *host = dev_get_drvdata(dev->parent); | 399 | struct host1x *host = dev_get_drvdata(dev->parent); |
400 | |||
384 | return host1x_syncpt_alloc(host, dev, flags); | 401 | return host1x_syncpt_alloc(host, dev, flags); |
385 | } | 402 | } |
386 | EXPORT_SYMBOL(host1x_syncpt_request); | 403 | EXPORT_SYMBOL(host1x_syncpt_request); |
@@ -415,6 +432,7 @@ void host1x_syncpt_deinit(struct host1x *host) | |||
415 | u32 host1x_syncpt_read_max(struct host1x_syncpt *sp) | 432 | u32 host1x_syncpt_read_max(struct host1x_syncpt *sp) |
416 | { | 433 | { |
417 | smp_rmb(); | 434 | smp_rmb(); |
435 | |||
418 | return (u32)atomic_read(&sp->max_val); | 436 | return (u32)atomic_read(&sp->max_val); |
419 | } | 437 | } |
420 | EXPORT_SYMBOL(host1x_syncpt_read_max); | 438 | EXPORT_SYMBOL(host1x_syncpt_read_max); |
@@ -425,6 +443,7 @@ EXPORT_SYMBOL(host1x_syncpt_read_max); | |||
425 | u32 host1x_syncpt_read_min(struct host1x_syncpt *sp) | 443 | u32 host1x_syncpt_read_min(struct host1x_syncpt *sp) |
426 | { | 444 | { |
427 | smp_rmb(); | 445 | smp_rmb(); |
446 | |||
428 | return (u32)atomic_read(&sp->min_val); | 447 | return (u32)atomic_read(&sp->min_val); |
429 | } | 448 | } |
430 | EXPORT_SYMBOL(host1x_syncpt_read_min); | 449 | EXPORT_SYMBOL(host1x_syncpt_read_min); |
@@ -454,6 +473,7 @@ struct host1x_syncpt *host1x_syncpt_get(struct host1x *host, unsigned int id) | |||
454 | { | 473 | { |
455 | if (host->info->nb_pts < id) | 474 | if (host->info->nb_pts < id) |
456 | return NULL; | 475 | return NULL; |
476 | |||
457 | return host->syncpt + id; | 477 | return host->syncpt + id; |
458 | } | 478 | } |
459 | EXPORT_SYMBOL(host1x_syncpt_get); | 479 | EXPORT_SYMBOL(host1x_syncpt_get); |