summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/vgpu/fecs_trace_vgpu.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/nvgpu/vgpu/fecs_trace_vgpu.c')
-rw-r--r--drivers/gpu/nvgpu/vgpu/fecs_trace_vgpu.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/drivers/gpu/nvgpu/vgpu/fecs_trace_vgpu.c b/drivers/gpu/nvgpu/vgpu/fecs_trace_vgpu.c
index 634932b7..c80da26d 100644
--- a/drivers/gpu/nvgpu/vgpu/fecs_trace_vgpu.c
+++ b/drivers/gpu/nvgpu/vgpu/fecs_trace_vgpu.c
@@ -26,6 +26,7 @@ struct vgpu_fecs_trace {
26 struct nvgpu_ctxsw_ring_header *header; 26 struct nvgpu_ctxsw_ring_header *header;
27 struct nvgpu_ctxsw_trace_entry *entries; 27 struct nvgpu_ctxsw_trace_entry *entries;
28 int num_entries; 28 int num_entries;
29 bool enabled;
29 void *buf; 30 void *buf;
30}; 31};
31 32
@@ -104,6 +105,7 @@ static int vgpu_fecs_trace_deinit(struct gk20a *g)
104 105
105static int vgpu_fecs_trace_enable(struct gk20a *g) 106static int vgpu_fecs_trace_enable(struct gk20a *g)
106{ 107{
108 struct vgpu_fecs_trace *vcst = (struct vgpu_fecs_trace *)g->fecs_trace;
107 struct tegra_vgpu_cmd_msg msg = { 109 struct tegra_vgpu_cmd_msg msg = {
108 .cmd = TEGRA_VGPU_CMD_FECS_TRACE_ENABLE, 110 .cmd = TEGRA_VGPU_CMD_FECS_TRACE_ENABLE,
109 .handle = vgpu_get_handle(g), 111 .handle = vgpu_get_handle(g),
@@ -113,23 +115,33 @@ static int vgpu_fecs_trace_enable(struct gk20a *g)
113 err = vgpu_comm_sendrecv(&msg, sizeof(msg), sizeof(msg)); 115 err = vgpu_comm_sendrecv(&msg, sizeof(msg), sizeof(msg));
114 err = err ? err : msg.ret; 116 err = err ? err : msg.ret;
115 WARN_ON(err); 117 WARN_ON(err);
118 vcst->enabled = !err;
116 return err; 119 return err;
117} 120}
118 121
119static int vgpu_fecs_trace_disable(struct gk20a *g) 122static int vgpu_fecs_trace_disable(struct gk20a *g)
120{ 123{
124 struct vgpu_fecs_trace *vcst = (struct vgpu_fecs_trace *)g->fecs_trace;
121 struct tegra_vgpu_cmd_msg msg = { 125 struct tegra_vgpu_cmd_msg msg = {
122 .cmd = TEGRA_VGPU_CMD_FECS_TRACE_DISABLE, 126 .cmd = TEGRA_VGPU_CMD_FECS_TRACE_DISABLE,
123 .handle = vgpu_get_handle(g), 127 .handle = vgpu_get_handle(g),
124 }; 128 };
125 int err; 129 int err;
126 130
131 vcst->enabled = false;
127 err = vgpu_comm_sendrecv(&msg, sizeof(msg), sizeof(msg)); 132 err = vgpu_comm_sendrecv(&msg, sizeof(msg), sizeof(msg));
128 err = err ? err : msg.ret; 133 err = err ? err : msg.ret;
129 WARN_ON(err); 134 WARN_ON(err);
130 return err; 135 return err;
131} 136}
132 137
138static bool vpgpu_fecs_trace_is_enabled(struct gk20a *g)
139{
140 struct vgpu_fecs_trace *vcst = (struct vgpu_fecs_trace *)g->fecs_trace;
141
142 return (vcst && vcst->enabled);
143}
144
133static int vgpu_fecs_trace_poll(struct gk20a *g) 145static int vgpu_fecs_trace_poll(struct gk20a *g)
134{ 146{
135 struct tegra_vgpu_cmd_msg msg = { 147 struct tegra_vgpu_cmd_msg msg = {
@@ -208,6 +220,7 @@ void vgpu_init_fecs_trace_ops(struct gpu_ops *ops)
208 ops->fecs_trace.deinit = vgpu_fecs_trace_deinit; 220 ops->fecs_trace.deinit = vgpu_fecs_trace_deinit;
209 ops->fecs_trace.enable = vgpu_fecs_trace_enable; 221 ops->fecs_trace.enable = vgpu_fecs_trace_enable;
210 ops->fecs_trace.disable = vgpu_fecs_trace_disable; 222 ops->fecs_trace.disable = vgpu_fecs_trace_disable;
223 ops->fecs_trace.is_enabled = vpgpu_fecs_trace_is_enabled;
211 ops->fecs_trace.reset = NULL; 224 ops->fecs_trace.reset = NULL;
212 ops->fecs_trace.flush = NULL; 225 ops->fecs_trace.flush = NULL;
213 ops->fecs_trace.poll = vgpu_fecs_trace_poll; 226 ops->fecs_trace.poll = vgpu_fecs_trace_poll;