diff options
Diffstat (limited to 'drivers/gpu')
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/ctrl_gk20a.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/ctrl_gk20a.c b/drivers/gpu/nvgpu/gk20a/ctrl_gk20a.c index 5660f521..defa4fdd 100644 --- a/drivers/gpu/nvgpu/gk20a/ctrl_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/ctrl_gk20a.c | |||
@@ -582,11 +582,24 @@ static int gk20a_ctrl_vsm_mapping(struct gk20a *g, | |||
582 | { | 582 | { |
583 | int err = 0; | 583 | int err = 0; |
584 | struct gr_gk20a *gr = &g->gr; | 584 | struct gr_gk20a *gr = &g->gr; |
585 | size_t write_size = gr->no_of_sm * sizeof(struct sm_info); | 585 | size_t write_size = gr->no_of_sm * |
586 | sizeof(struct nvgpu_gpu_vsms_mapping_entry); | ||
587 | struct nvgpu_gpu_vsms_mapping_entry *vsms_buf; | ||
588 | u32 i; | ||
589 | |||
590 | vsms_buf = kzalloc(write_size, GFP_KERNEL); | ||
591 | if (vsms_buf == NULL) | ||
592 | return -ENOMEM; | ||
593 | |||
594 | for (i = 0; i < gr->no_of_sm; i++) { | ||
595 | vsms_buf[i].gpc_index = gr->sm_to_cluster[i].gpc_index; | ||
596 | vsms_buf[i].tpc_index = gr->sm_to_cluster[i].tpc_index; | ||
597 | } | ||
586 | 598 | ||
587 | err = copy_to_user((void __user *)(uintptr_t) | 599 | err = copy_to_user((void __user *)(uintptr_t) |
588 | args->vsms_map_buf_addr, | 600 | args->vsms_map_buf_addr, |
589 | gr->sm_to_cluster, write_size); | 601 | vsms_buf, write_size); |
602 | kfree(vsms_buf); | ||
590 | 603 | ||
591 | return err; | 604 | return err; |
592 | } | 605 | } |