diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/pmu_gk20a.c | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/pmu_gk20a.c b/drivers/gpu/nvgpu/gk20a/pmu_gk20a.c index a2609dbb..f64aa608 100644 --- a/drivers/gpu/nvgpu/gk20a/pmu_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/pmu_gk20a.c | |||
@@ -1148,10 +1148,15 @@ static void get_pmu_init_msg_pmu_queue_params_v3(struct pmu_queue *queue, | |||
1148 | { | 1148 | { |
1149 | struct pmu_init_msg_pmu_v3 *init = | 1149 | struct pmu_init_msg_pmu_v3 *init = |
1150 | (struct pmu_init_msg_pmu_v3 *)pmu_init_msg; | 1150 | (struct pmu_init_msg_pmu_v3 *)pmu_init_msg; |
1151 | 1151 | u32 current_ptr = 0; | |
1152 | u8 i; | ||
1152 | queue->index = init->queue_index[id]; | 1153 | queue->index = init->queue_index[id]; |
1153 | queue->offset = init->queue_offset; | ||
1154 | queue->size = init->queue_size[id]; | 1154 | queue->size = init->queue_size[id]; |
1155 | if (id != 0) { | ||
1156 | for ( i = 0 ; i < id; i++) | ||
1157 | current_ptr += init->queue_size[i]; | ||
1158 | } | ||
1159 | queue->offset = init->queue_offset + current_ptr; | ||
1155 | } | 1160 | } |
1156 | 1161 | ||
1157 | static void *get_pmu_sequence_in_alloc_ptr_v3(struct pmu_sequence *seq) | 1162 | static void *get_pmu_sequence_in_alloc_ptr_v3(struct pmu_sequence *seq) |
@@ -2493,6 +2498,7 @@ static int pmu_queue_tail(struct pmu_gk20a *pmu, struct pmu_queue *queue, | |||
2493 | gk20a_writel(g, | 2498 | gk20a_writel(g, |
2494 | pwr_pmu_queue_tail_r(queue->index), | 2499 | pwr_pmu_queue_tail_r(queue->index), |
2495 | pwr_pmu_queue_tail_address_f(*tail)); | 2500 | pwr_pmu_queue_tail_address_f(*tail)); |
2501 | |||
2496 | } else { | 2502 | } else { |
2497 | if (!set) | 2503 | if (!set) |
2498 | *tail = pwr_pmu_msgq_tail_val_v( | 2504 | *tail = pwr_pmu_msgq_tail_val_v( |
@@ -2681,14 +2687,14 @@ static bool pmu_queue_is_empty(struct pmu_gk20a *pmu, | |||
2681 | static bool pmu_queue_has_room(struct pmu_gk20a *pmu, | 2687 | static bool pmu_queue_has_room(struct pmu_gk20a *pmu, |
2682 | struct pmu_queue *queue, u32 size, bool *need_rewind) | 2688 | struct pmu_queue *queue, u32 size, bool *need_rewind) |
2683 | { | 2689 | { |
2684 | u32 head, tail, free; | 2690 | u32 head, tail; |
2685 | bool rewind = false; | 2691 | bool rewind = false; |
2692 | int free; | ||
2686 | 2693 | ||
2687 | size = ALIGN(size, QUEUE_ALIGNMENT); | 2694 | size = ALIGN(size, QUEUE_ALIGNMENT); |
2688 | 2695 | ||
2689 | pmu_queue_head(pmu, queue, &head, QUEUE_GET); | 2696 | pmu_queue_head(pmu, queue, &head, QUEUE_GET); |
2690 | pmu_queue_tail(pmu, queue, &tail, QUEUE_GET); | 2697 | pmu_queue_tail(pmu, queue, &tail, QUEUE_GET); |
2691 | |||
2692 | if (head >= tail) { | 2698 | if (head >= tail) { |
2693 | free = queue->offset + queue->size - head; | 2699 | free = queue->offset + queue->size - head; |
2694 | free -= PMU_CMD_HDR_SIZE; | 2700 | free -= PMU_CMD_HDR_SIZE; |
@@ -2711,6 +2717,7 @@ static bool pmu_queue_has_room(struct pmu_gk20a *pmu, | |||
2711 | static int pmu_queue_push(struct pmu_gk20a *pmu, | 2717 | static int pmu_queue_push(struct pmu_gk20a *pmu, |
2712 | struct pmu_queue *queue, void *data, u32 size) | 2718 | struct pmu_queue *queue, void *data, u32 size) |
2713 | { | 2719 | { |
2720 | |||
2714 | gk20a_dbg_fn(""); | 2721 | gk20a_dbg_fn(""); |
2715 | 2722 | ||
2716 | if (!queue->opened && queue->oflag == OFLAG_WRITE){ | 2723 | if (!queue->opened && queue->oflag == OFLAG_WRITE){ |
@@ -3570,7 +3577,6 @@ static int pmu_process_init_msg(struct pmu_gk20a *pmu, | |||
3570 | 3577 | ||
3571 | pmu_copy_from_dmem(pmu, tail, | 3578 | pmu_copy_from_dmem(pmu, tail, |
3572 | (u8 *)&msg->hdr, PMU_MSG_HDR_SIZE, 0); | 3579 | (u8 *)&msg->hdr, PMU_MSG_HDR_SIZE, 0); |
3573 | |||
3574 | if (msg->hdr.unit_id != PMU_UNIT_INIT) { | 3580 | if (msg->hdr.unit_id != PMU_UNIT_INIT) { |
3575 | gk20a_err(dev_from_gk20a(g), | 3581 | gk20a_err(dev_from_gk20a(g), |
3576 | "expecting init msg"); | 3582 | "expecting init msg"); |
@@ -4359,6 +4365,7 @@ static int pmu_write_cmd(struct pmu_gk20a *pmu, struct pmu_cmd *cmd, | |||
4359 | 4365 | ||
4360 | queue = &pmu->queue[queue_id]; | 4366 | queue = &pmu->queue[queue_id]; |
4361 | 4367 | ||
4368 | |||
4362 | do { | 4369 | do { |
4363 | err = pmu_queue_open_write(pmu, queue, cmd->hdr.size); | 4370 | err = pmu_queue_open_write(pmu, queue, cmd->hdr.size); |
4364 | if (err == -EAGAIN && time_before(jiffies, end_jiffies)) | 4371 | if (err == -EAGAIN && time_before(jiffies, end_jiffies)) |
@@ -4372,6 +4379,7 @@ static int pmu_write_cmd(struct pmu_gk20a *pmu, struct pmu_cmd *cmd, | |||
4372 | 4379 | ||
4373 | pmu_queue_push(pmu, queue, cmd, cmd->hdr.size); | 4380 | pmu_queue_push(pmu, queue, cmd, cmd->hdr.size); |
4374 | 4381 | ||
4382 | |||
4375 | err = pmu_queue_close(pmu, queue, true); | 4383 | err = pmu_queue_close(pmu, queue, true); |
4376 | 4384 | ||
4377 | clean_up: | 4385 | clean_up: |