diff options
author | Aparna Das <aparnad@nvidia.com> | 2017-05-17 13:57:59 -0400 |
---|---|---|
committer | svcboomerang <svcboomerang@nvidia.com> | 2017-05-24 06:47:18 -0400 |
commit | 608708c66724ff39e699b809a0241d13a6671c87 (patch) | |
tree | 5945d9c9aab3392e75162d2bd66c1496729fc84f /drivers/gpu/nvgpu/vgpu | |
parent | abba815d838905d8575ef8f8ff8381dfb9d9cb25 (diff) |
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 <aparnad@nvidia.com>
Reviewed-on: http://git-master/r/1485030
Reviewed-by: svcboomerang <svcboomerang@nvidia.com>
Tested-by: svcboomerang <svcboomerang@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/vgpu')
-rw-r--r-- | drivers/gpu/nvgpu/vgpu/fifo_vgpu.c | 40 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/vgpu/gr_vgpu.c | 49 |
2 files changed, 52 insertions, 37 deletions
diff --git a/drivers/gpu/nvgpu/vgpu/fifo_vgpu.c b/drivers/gpu/nvgpu/vgpu/fifo_vgpu.c index 5ea6a016..309a395a 100644 --- a/drivers/gpu/nvgpu/vgpu/fifo_vgpu.c +++ b/drivers/gpu/nvgpu/vgpu/fifo_vgpu.c | |||
@@ -461,28 +461,38 @@ static int vgpu_fifo_preempt_tsg(struct gk20a *g, u32 tsgid) | |||
461 | static int vgpu_submit_runlist(struct gk20a *g, u64 handle, u8 runlist_id, | 461 | static int vgpu_submit_runlist(struct gk20a *g, u64 handle, u8 runlist_id, |
462 | u16 *runlist, u32 num_entries) | 462 | u16 *runlist, u32 num_entries) |
463 | { | 463 | { |
464 | struct tegra_vgpu_cmd_msg *msg; | 464 | struct tegra_vgpu_cmd_msg msg; |
465 | struct tegra_vgpu_runlist_params *p; | 465 | struct tegra_vgpu_runlist_params *p; |
466 | size_t size = sizeof(*msg) + sizeof(*runlist) * num_entries; | ||
467 | char *ptr; | ||
468 | int err; | 466 | int err; |
467 | void *oob_handle; | ||
468 | void *oob; | ||
469 | size_t size, oob_size; | ||
470 | |||
471 | oob_handle = tegra_gr_comm_oob_get_ptr(TEGRA_GR_COMM_CTX_CLIENT, | ||
472 | tegra_gr_comm_get_server_vmid(), TEGRA_VGPU_QUEUE_CMD, | ||
473 | &oob, &oob_size); | ||
474 | if (!oob_handle) | ||
475 | return -EINVAL; | ||
476 | |||
477 | size = sizeof(*runlist) * num_entries; | ||
478 | if (oob_size < size) { | ||
479 | err = -ENOMEM; | ||
480 | goto done; | ||
481 | } | ||
469 | 482 | ||
470 | msg = nvgpu_kmalloc(g, size); | 483 | msg.cmd = TEGRA_VGPU_CMD_SUBMIT_RUNLIST; |
471 | if (!msg) | 484 | msg.handle = handle; |
472 | return -1; | 485 | p = &msg.params.runlist; |
473 | |||
474 | msg->cmd = TEGRA_VGPU_CMD_SUBMIT_RUNLIST; | ||
475 | msg->handle = handle; | ||
476 | p = &msg->params.runlist; | ||
477 | p->runlist_id = runlist_id; | 486 | p->runlist_id = runlist_id; |
478 | p->num_entries = num_entries; | 487 | p->num_entries = num_entries; |
479 | 488 | ||
480 | ptr = (char *)msg + sizeof(*msg); | 489 | memcpy(oob, runlist, size); |
481 | memcpy(ptr, runlist, sizeof(*runlist) * num_entries); | 490 | err = vgpu_comm_sendrecv(&msg, sizeof(msg), sizeof(msg)); |
482 | err = vgpu_comm_sendrecv(msg, size, sizeof(*msg)); | 491 | |
492 | err = (err || msg.ret) ? -1 : 0; | ||
483 | 493 | ||
484 | err = (err || msg->ret) ? -1 : 0; | 494 | done: |
485 | nvgpu_kfree(g, msg); | 495 | tegra_gr_comm_oob_put_ptr(oob_handle); |
486 | return err; | 496 | return err; |
487 | } | 497 | } |
488 | 498 | ||
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, | |||
1100 | int *ctx_resident_ch_fd, u32 cmd) | 1100 | int *ctx_resident_ch_fd, u32 cmd) |
1101 | { | 1101 | { |
1102 | struct dbg_session_channel_data *ch_data; | 1102 | struct dbg_session_channel_data *ch_data; |
1103 | struct tegra_vgpu_cmd_msg *msg; | 1103 | struct tegra_vgpu_cmd_msg msg; |
1104 | struct tegra_vgpu_suspend_resume_contexts *p; | 1104 | struct tegra_vgpu_suspend_resume_contexts *p; |
1105 | size_t size_out = offsetof(struct tegra_vgpu_cmd_msg, | ||
1106 | params.suspend_contexts.chids); | ||
1107 | size_t size_in; | ||
1108 | size_t n; | 1105 | size_t n; |
1109 | int channel_fd = -1; | 1106 | int channel_fd = -1; |
1110 | int err = 0; | 1107 | int err = 0; |
1108 | void *handle = NULL; | ||
1109 | u16 *oob; | ||
1110 | size_t oob_size; | ||
1111 | 1111 | ||
1112 | nvgpu_mutex_acquire(&g->dbg_sessions_lock); | 1112 | nvgpu_mutex_acquire(&g->dbg_sessions_lock); |
1113 | nvgpu_mutex_acquire(&dbg_s->ch_list_lock); | 1113 | nvgpu_mutex_acquire(&dbg_s->ch_list_lock); |
1114 | 1114 | ||
1115 | handle = tegra_gr_comm_oob_get_ptr(TEGRA_GR_COMM_CTX_CLIENT, | ||
1116 | tegra_gr_comm_get_server_vmid(), TEGRA_VGPU_QUEUE_CMD, | ||
1117 | (void **)&oob, &oob_size); | ||
1118 | if (!handle) { | ||
1119 | err = -EINVAL; | ||
1120 | goto done; | ||
1121 | } | ||
1122 | |||
1115 | n = 0; | 1123 | n = 0; |
1116 | list_for_each_entry(ch_data, &dbg_s->ch_list, ch_entry) | 1124 | list_for_each_entry(ch_data, &dbg_s->ch_list, ch_entry) |
1117 | n++; | 1125 | n++; |
1118 | 1126 | ||
1119 | size_in = size_out + n * sizeof(u16); | 1127 | if (oob_size < n * sizeof(u16)) { |
1120 | 1128 | err = -ENOMEM; | |
1121 | msg = nvgpu_kmalloc(g, size_in); | 1129 | goto done; |
1122 | if (!msg) | 1130 | } |
1123 | return -ENOMEM; | ||
1124 | 1131 | ||
1125 | msg->cmd = cmd; | 1132 | msg.cmd = cmd; |
1126 | msg->handle = vgpu_get_handle(g); | 1133 | msg.handle = vgpu_get_handle(g); |
1127 | p = &msg->params.suspend_contexts; | 1134 | p = &msg.params.suspend_contexts; |
1128 | p->num_channels = n; | 1135 | p->num_channels = n; |
1129 | n = 0; | 1136 | n = 0; |
1130 | list_for_each_entry(ch_data, &dbg_s->ch_list, ch_entry) { | 1137 | list_for_each_entry(ch_data, &dbg_s->ch_list, ch_entry) |
1131 | p->chids[n++] = (u16)ch_data->chid; | 1138 | oob[n++] = (u16)ch_data->chid; |
1132 | } | ||
1133 | 1139 | ||
1134 | err = vgpu_comm_sendrecv(msg, size_in, size_out); | 1140 | err = vgpu_comm_sendrecv(&msg, sizeof(msg), sizeof(msg)); |
1135 | if (err || msg->ret) { | 1141 | if (err || msg.ret) { |
1136 | err = -ENOMEM; | 1142 | err = -ENOMEM; |
1137 | goto fail; | 1143 | goto done; |
1138 | } | 1144 | } |
1139 | 1145 | ||
1140 | if (p->resident_chid != (u16)~0) { | 1146 | if (p->resident_chid != (u16)~0) { |
@@ -1146,13 +1152,12 @@ static int vgpu_gr_suspend_resume_contexts(struct gk20a *g, | |||
1146 | } | 1152 | } |
1147 | } | 1153 | } |
1148 | 1154 | ||
1149 | fail: | 1155 | done: |
1156 | if (handle) | ||
1157 | tegra_gr_comm_oob_put_ptr(handle); | ||
1150 | nvgpu_mutex_release(&dbg_s->ch_list_lock); | 1158 | nvgpu_mutex_release(&dbg_s->ch_list_lock); |
1151 | nvgpu_mutex_release(&g->dbg_sessions_lock); | 1159 | nvgpu_mutex_release(&g->dbg_sessions_lock); |
1152 | |||
1153 | *ctx_resident_ch_fd = channel_fd; | 1160 | *ctx_resident_ch_fd = channel_fd; |
1154 | nvgpu_kfree(g, msg); | ||
1155 | |||
1156 | return err; | 1161 | return err; |
1157 | } | 1162 | } |
1158 | 1163 | ||