From fa1b18c171aba0f8bb674ccc8c60ae81213a16f6 Mon Sep 17 00:00:00 2001 From: Richard Zhao Date: Tue, 5 Dec 2017 15:48:22 -0800 Subject: gpu: nvgpu: vgpu: add tsg release command gv11b needs tsg release callback to release CE method buffer. Bug 2022929 Change-Id: I32e27a5fa49eb61b9c2fc72ea32034191a9be48e Signed-off-by: Richard Zhao Reviewed-on: https://git-master.nvidia.com/r/1611631 Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Thomas Fleury GVS: Gerrit_Virtual_Submit Reviewed-by: Aparna Das Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/common/linux/vgpu/fifo_vgpu.h | 1 + .../nvgpu/common/linux/vgpu/gv11b/vgpu_hal_gv11b.c | 1 + drivers/gpu/nvgpu/common/linux/vgpu/tsg_vgpu.c | 22 +++++++++++++++++++++- drivers/gpu/nvgpu/gk20a/gk20a.h | 1 + drivers/gpu/nvgpu/gk20a/tsg_gk20a.c | 3 +++ 5 files changed, 27 insertions(+), 1 deletion(-) (limited to 'drivers/gpu') diff --git a/drivers/gpu/nvgpu/common/linux/vgpu/fifo_vgpu.h b/drivers/gpu/nvgpu/common/linux/vgpu/fifo_vgpu.h index 62a3a256..5aefb356 100644 --- a/drivers/gpu/nvgpu/common/linux/vgpu/fifo_vgpu.h +++ b/drivers/gpu/nvgpu/common/linux/vgpu/fifo_vgpu.h @@ -50,6 +50,7 @@ int vgpu_fifo_force_reset_ch(struct channel_gk20a *ch, u32 err_code, bool verbose); u32 vgpu_fifo_default_timeslice_us(struct gk20a *g); int vgpu_tsg_open(struct tsg_gk20a *tsg); +void vgpu_tsg_release(struct tsg_gk20a *tsg); int vgpu_tsg_bind_channel(struct tsg_gk20a *tsg, struct channel_gk20a *ch); int vgpu_tsg_unbind_channel(struct channel_gk20a *ch); diff --git a/drivers/gpu/nvgpu/common/linux/vgpu/gv11b/vgpu_hal_gv11b.c b/drivers/gpu/nvgpu/common/linux/vgpu/gv11b/vgpu_hal_gv11b.c index 7d60bfb2..079b4cb9 100644 --- a/drivers/gpu/nvgpu/common/linux/vgpu/gv11b/vgpu_hal_gv11b.c +++ b/drivers/gpu/nvgpu/common/linux/vgpu/gv11b/vgpu_hal_gv11b.c @@ -355,6 +355,7 @@ static const struct gpu_ops vgpu_gv11b_ops = { .set_runlist_interleave = vgpu_fifo_set_runlist_interleave, .tsg_set_timeslice = vgpu_tsg_set_timeslice, .tsg_open = vgpu_tsg_open, + .tsg_release = vgpu_tsg_release, .force_reset_ch = vgpu_fifo_force_reset_ch, .engine_enum_from_type = gp10b_fifo_engine_enum_from_type, .device_info_data_parse = gp10b_device_info_data_parse, diff --git a/drivers/gpu/nvgpu/common/linux/vgpu/tsg_vgpu.c b/drivers/gpu/nvgpu/common/linux/vgpu/tsg_vgpu.c index c40e6f90..06f52177 100644 --- a/drivers/gpu/nvgpu/common/linux/vgpu/tsg_vgpu.c +++ b/drivers/gpu/nvgpu/common/linux/vgpu/tsg_vgpu.c @@ -28,7 +28,7 @@ int vgpu_tsg_open(struct tsg_gk20a *tsg) { struct tegra_vgpu_cmd_msg msg = {}; - struct tegra_vgpu_tsg_open_params *p = + struct tegra_vgpu_tsg_open_rel_params *p = &msg.params.tsg_open; int err; @@ -47,6 +47,26 @@ int vgpu_tsg_open(struct tsg_gk20a *tsg) return err; } +void vgpu_tsg_release(struct tsg_gk20a *tsg) +{ + struct tegra_vgpu_cmd_msg msg = {}; + struct tegra_vgpu_tsg_open_rel_params *p = + &msg.params.tsg_release; + int err; + + gk20a_dbg_fn(""); + + msg.cmd = TEGRA_VGPU_CMD_TSG_RELEASE; + msg.handle = vgpu_get_handle(tsg->g); + p->tsg_id = tsg->tsgid; + err = vgpu_comm_sendrecv(&msg, sizeof(msg), sizeof(msg)); + err = err ? err : msg.ret; + if (err) { + nvgpu_err(tsg->g, + "vgpu_tsg_release failed, tsgid %d", tsg->tsgid); + } +} + int vgpu_enable_tsg(struct tsg_gk20a *tsg) { struct gk20a *g = tsg->g; diff --git a/drivers/gpu/nvgpu/gk20a/gk20a.h b/drivers/gpu/nvgpu/gk20a/gk20a.h index c6bc129f..f577f93c 100644 --- a/drivers/gpu/nvgpu/gk20a/gk20a.h +++ b/drivers/gpu/nvgpu/gk20a/gk20a.h @@ -552,6 +552,7 @@ struct gpu_ops { struct channel_gk20a *ch); int (*tsg_unbind_channel)(struct channel_gk20a *ch); int (*tsg_open)(struct tsg_gk20a *tsg); + void (*tsg_release)(struct tsg_gk20a *tsg); u32 (*eng_runlist_base_size)(void); int (*init_engine_info)(struct fifo_gk20a *f); u32 (*runlist_entry_size)(void); diff --git a/drivers/gpu/nvgpu/gk20a/tsg_gk20a.c b/drivers/gpu/nvgpu/gk20a/tsg_gk20a.c index 8906257f..4efcfda8 100644 --- a/drivers/gpu/nvgpu/gk20a/tsg_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/tsg_gk20a.c @@ -315,6 +315,9 @@ void gk20a_tsg_release(struct nvgpu_ref *ref) struct gk20a *g = tsg->g; struct gk20a_event_id_data *event_id_data, *event_id_data_temp; + if (g->ops.fifo.tsg_release) + g->ops.fifo.tsg_release(tsg); + if (tsg->tsg_gr_ctx) { gr_gk20a_free_tsg_gr_ctx(tsg); tsg->tsg_gr_ctx = NULL; -- cgit v1.2.2