diff options
Diffstat (limited to 'drivers/gpu/nvgpu/common/linux/module.c')
-rw-r--r-- | drivers/gpu/nvgpu/common/linux/module.c | 39 |
1 files changed, 20 insertions, 19 deletions
diff --git a/drivers/gpu/nvgpu/common/linux/module.c b/drivers/gpu/nvgpu/common/linux/module.c index 67dfeff3..5dfd8ff7 100644 --- a/drivers/gpu/nvgpu/common/linux/module.c +++ b/drivers/gpu/nvgpu/common/linux/module.c | |||
@@ -48,17 +48,18 @@ | |||
48 | #include "module.h" | 48 | #include "module.h" |
49 | #include "module_usermode.h" | 49 | #include "module_usermode.h" |
50 | #include "intr.h" | 50 | #include "intr.h" |
51 | #include "cde.h" | ||
52 | #include "ioctl.h" | 51 | #include "ioctl.h" |
53 | #include "sim.h" | 52 | #include "sim.h" |
54 | 53 | ||
55 | #include "os_linux.h" | 54 | #include "os_linux.h" |
56 | #include "cde_gm20b.h" | ||
57 | #include "cde_gp10b.h" | ||
58 | #include "ctxsw_trace.h" | 55 | #include "ctxsw_trace.h" |
59 | #include "driver_common.h" | 56 | #include "driver_common.h" |
60 | #include "channel.h" | 57 | #include "channel.h" |
61 | 58 | ||
59 | #ifdef CONFIG_NVGPU_SUPPORT_CDE | ||
60 | #include "cde.h" | ||
61 | #endif | ||
62 | |||
62 | #define CLASS_NAME "nvidia-gpu" | 63 | #define CLASS_NAME "nvidia-gpu" |
63 | /* TODO: Change to e.g. "nvidia-gpu%s" once we have symlinks in place. */ | 64 | /* TODO: Change to e.g. "nvidia-gpu%s" once we have symlinks in place. */ |
64 | 65 | ||
@@ -180,23 +181,13 @@ static int gk20a_restore_registers(struct gk20a *g) | |||
180 | 181 | ||
181 | static int nvgpu_init_os_linux_ops(struct nvgpu_os_linux *l) | 182 | static int nvgpu_init_os_linux_ops(struct nvgpu_os_linux *l) |
182 | { | 183 | { |
183 | struct gk20a *g = &l->g; | 184 | int err = 0; |
184 | u32 ver = g->params.gpu_arch + g->params.gpu_impl; | ||
185 | |||
186 | switch (ver) { | ||
187 | case GK20A_GPUID_GM20B: | ||
188 | case GK20A_GPUID_GM20B_B: | ||
189 | l->ops.cde = gm20b_cde_ops.cde; | ||
190 | break; | ||
191 | case NVGPU_GPUID_GP10B: | ||
192 | l->ops.cde = gp10b_cde_ops.cde; | ||
193 | break; | ||
194 | default: | ||
195 | /* CDE is optional, so today ignoring unknown chip is fine */ | ||
196 | break; | ||
197 | } | ||
198 | 185 | ||
199 | return 0; | 186 | #ifdef CONFIG_NVGPU_SUPPORT_CDE |
187 | err = nvgpu_cde_init_ops(l); | ||
188 | #endif | ||
189 | |||
190 | return err; | ||
200 | } | 191 | } |
201 | 192 | ||
202 | int nvgpu_finalize_poweron_linux(struct nvgpu_os_linux *l) | 193 | int nvgpu_finalize_poweron_linux(struct nvgpu_os_linux *l) |
@@ -285,8 +276,10 @@ int gk20a_pm_finalize_poweron(struct device *dev) | |||
285 | 276 | ||
286 | gk20a_scale_resume(dev_from_gk20a(g)); | 277 | gk20a_scale_resume(dev_from_gk20a(g)); |
287 | 278 | ||
279 | #ifdef CONFIG_NVGPU_SUPPORT_CDE | ||
288 | if (platform->has_cde) | 280 | if (platform->has_cde) |
289 | gk20a_init_cde_support(l); | 281 | gk20a_init_cde_support(l); |
282 | #endif | ||
290 | 283 | ||
291 | err = gk20a_sched_ctrl_init(g); | 284 | err = gk20a_sched_ctrl_init(g); |
292 | if (err) { | 285 | if (err) { |
@@ -325,7 +318,9 @@ static int gk20a_lockout_registers(struct gk20a *g) | |||
325 | static int gk20a_pm_prepare_poweroff(struct device *dev) | 318 | static int gk20a_pm_prepare_poweroff(struct device *dev) |
326 | { | 319 | { |
327 | struct gk20a *g = get_gk20a(dev); | 320 | struct gk20a *g = get_gk20a(dev); |
321 | #ifdef CONFIG_NVGPU_SUPPORT_CDE | ||
328 | struct nvgpu_os_linux *l = nvgpu_os_linux_from_gk20a(g); | 322 | struct nvgpu_os_linux *l = nvgpu_os_linux_from_gk20a(g); |
323 | #endif | ||
329 | int ret = 0; | 324 | int ret = 0; |
330 | struct gk20a_platform *platform = gk20a_get_platform(dev); | 325 | struct gk20a_platform *platform = gk20a_get_platform(dev); |
331 | bool irqs_enabled; | 326 | bool irqs_enabled; |
@@ -348,7 +343,9 @@ static int gk20a_pm_prepare_poweroff(struct device *dev) | |||
348 | 343 | ||
349 | gk20a_scale_suspend(dev); | 344 | gk20a_scale_suspend(dev); |
350 | 345 | ||
346 | #ifdef CONFIG_NVGPU_SUPPORT_CDE | ||
351 | gk20a_cde_suspend(l); | 347 | gk20a_cde_suspend(l); |
348 | #endif | ||
352 | 349 | ||
353 | ret = gk20a_prepare_poweroff(g); | 350 | ret = gk20a_prepare_poweroff(g); |
354 | if (ret) | 351 | if (ret) |
@@ -1239,7 +1236,9 @@ return_err: | |||
1239 | int nvgpu_remove(struct device *dev, struct class *class) | 1236 | int nvgpu_remove(struct device *dev, struct class *class) |
1240 | { | 1237 | { |
1241 | struct gk20a *g = get_gk20a(dev); | 1238 | struct gk20a *g = get_gk20a(dev); |
1239 | #ifdef CONFIG_NVGPU_SUPPORT_CDE | ||
1242 | struct nvgpu_os_linux *l = nvgpu_os_linux_from_gk20a(g); | 1240 | struct nvgpu_os_linux *l = nvgpu_os_linux_from_gk20a(g); |
1241 | #endif | ||
1243 | struct gk20a_platform *platform = gk20a_get_platform(dev); | 1242 | struct gk20a_platform *platform = gk20a_get_platform(dev); |
1244 | int err; | 1243 | int err; |
1245 | 1244 | ||
@@ -1251,8 +1250,10 @@ int nvgpu_remove(struct device *dev, struct class *class) | |||
1251 | if (nvgpu_mem_is_valid(&g->syncpt_mem)) | 1250 | if (nvgpu_mem_is_valid(&g->syncpt_mem)) |
1252 | nvgpu_dma_free(g, &g->syncpt_mem); | 1251 | nvgpu_dma_free(g, &g->syncpt_mem); |
1253 | 1252 | ||
1253 | #ifdef CONFIG_NVGPU_SUPPORT_CDE | ||
1254 | if (platform->has_cde) | 1254 | if (platform->has_cde) |
1255 | gk20a_cde_destroy(l); | 1255 | gk20a_cde_destroy(l); |
1256 | #endif | ||
1256 | 1257 | ||
1257 | #ifdef CONFIG_GK20A_CTXSW_TRACE | 1258 | #ifdef CONFIG_GK20A_CTXSW_TRACE |
1258 | gk20a_ctxsw_trace_cleanup(g); | 1259 | gk20a_ctxsw_trace_cleanup(g); |