From 85ff2a31eba0c2716bab0f0ca7075d3e738fd40a Mon Sep 17 00:00:00 2001 From: Aparna Das Date: Wed, 17 May 2017 10:57:59 -0700 Subject: gpu: nvgpu: vgpu: use ivm to send auxiliary data RM server retrieves auxiliary data only from IVM. Modify IVC commands to send auxiliary data to RM server using IVM and not as a part command message. VFND-4166 Change-Id: I9bfe33cf9301f7c70709318b810c622ec57b1cdf Signed-off-by: Aparna Das Reviewed-on: http://git-master/r/1484130 Reviewed-by: svcboomerang Tested-by: svcboomerang --- drivers/gpu/nvgpu/vgpu/gr_vgpu.c | 49 ++++++++++++++++++++++------------------ 1 file changed, 27 insertions(+), 22 deletions(-) (limited to 'drivers/gpu/nvgpu/vgpu/gr_vgpu.c') diff --git a/drivers/gpu/nvgpu/vgpu/gr_vgpu.c b/drivers/gpu/nvgpu/vgpu/gr_vgpu.c index dd515f41..42af9ee1 100644 --- a/drivers/gpu/nvgpu/vgpu/gr_vgpu.c +++ b/drivers/gpu/nvgpu/vgpu/gr_vgpu.c @@ -1100,41 +1100,47 @@ static int vgpu_gr_suspend_resume_contexts(struct gk20a *g, int *ctx_resident_ch_fd, u32 cmd) { struct dbg_session_channel_data *ch_data; - struct tegra_vgpu_cmd_msg *msg; + struct tegra_vgpu_cmd_msg msg; struct tegra_vgpu_suspend_resume_contexts *p; - size_t size_out = offsetof(struct tegra_vgpu_cmd_msg, - params.suspend_contexts.chids); - size_t size_in; size_t n; int channel_fd = -1; int err = 0; + void *handle = NULL; + u16 *oob; + size_t oob_size; nvgpu_mutex_acquire(&g->dbg_sessions_lock); nvgpu_mutex_acquire(&dbg_s->ch_list_lock); + handle = tegra_gr_comm_oob_get_ptr(TEGRA_GR_COMM_CTX_CLIENT, + tegra_gr_comm_get_server_vmid(), TEGRA_VGPU_QUEUE_CMD, + (void **)&oob, &oob_size); + if (!handle) { + err = -EINVAL; + goto done; + } + n = 0; list_for_each_entry(ch_data, &dbg_s->ch_list, ch_entry) n++; - size_in = size_out + n * sizeof(u16); - - msg = nvgpu_kmalloc(g, size_in); - if (!msg) - return -ENOMEM; + if (oob_size < n * sizeof(u16)) { + err = -ENOMEM; + goto done; + } - msg->cmd = cmd; - msg->handle = vgpu_get_handle(g); - p = &msg->params.suspend_contexts; + msg.cmd = cmd; + msg.handle = vgpu_get_handle(g); + p = &msg.params.suspend_contexts; p->num_channels = n; n = 0; - list_for_each_entry(ch_data, &dbg_s->ch_list, ch_entry) { - p->chids[n++] = (u16)ch_data->chid; - } + list_for_each_entry(ch_data, &dbg_s->ch_list, ch_entry) + oob[n++] = (u16)ch_data->chid; - err = vgpu_comm_sendrecv(msg, size_in, size_out); - if (err || msg->ret) { + err = vgpu_comm_sendrecv(&msg, sizeof(msg), sizeof(msg)); + if (err || msg.ret) { err = -ENOMEM; - goto fail; + goto done; } if (p->resident_chid != (u16)~0) { @@ -1146,13 +1152,12 @@ static int vgpu_gr_suspend_resume_contexts(struct gk20a *g, } } -fail: +done: + if (handle) + tegra_gr_comm_oob_put_ptr(handle); nvgpu_mutex_release(&dbg_s->ch_list_lock); nvgpu_mutex_release(&g->dbg_sessions_lock); - *ctx_resident_ch_fd = channel_fd; - nvgpu_kfree(g, msg); - return err; } -- cgit v1.2.2