summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTerje Bergstrom <tbergstrom@nvidia.com>2018-01-24 15:42:57 -0500
committermobile promotions <svcmobile_promotions@nvidia.com>2018-02-15 17:11:46 -0500
commit662c441467c4f251d65840f2097ac4e58ec234ff (patch)
tree6d28a87ee4805bd51ab41fbdb158ee596f9e9fe8
parentb6ab47d39683f607de166fef1111b20d8eda097e (diff)
gpu: nvgpu: Allow disabling CDE functionality
CDE is a Tegra SoC specific feature. Add new config option CONFIG_NVGPU_SUPPORT_CDE and #ifdef all CDE specific code with it. JIRA NVGPU-4 Change-Id: I6f0b0047d6ba2b5c36c2eb9b8a1514776741f5b5 Signed-off-by: Terje Bergstrom <tbergstrom@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/1648002 Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
-rw-r--r--drivers/gpu/nvgpu/Kconfig7
-rw-r--r--drivers/gpu/nvgpu/Makefile14
-rw-r--r--drivers/gpu/nvgpu/common/linux/cde.c23
-rw-r--r--drivers/gpu/nvgpu/common/linux/cde.h1
-rw-r--r--drivers/gpu/nvgpu/common/linux/debug.c4
-rw-r--r--drivers/gpu/nvgpu/common/linux/driver_common.c2
-rw-r--r--drivers/gpu/nvgpu/common/linux/ioctl_ctrl.c11
-rw-r--r--drivers/gpu/nvgpu/common/linux/module.c39
-rw-r--r--drivers/gpu/nvgpu/common/linux/platform_gk20a.h2
-rw-r--r--drivers/gpu/nvgpu/common/linux/platform_gk20a_tegra.c2
-rw-r--r--drivers/gpu/nvgpu/common/linux/platform_gp10b_tegra.c2
-rw-r--r--drivers/gpu/nvgpu/common/linux/platform_gv11b_tegra.c3
12 files changed, 80 insertions, 30 deletions
diff --git a/drivers/gpu/nvgpu/Kconfig b/drivers/gpu/nvgpu/Kconfig
index 9e75339f..13b27813 100644
--- a/drivers/gpu/nvgpu/Kconfig
+++ b/drivers/gpu/nvgpu/Kconfig
@@ -128,3 +128,10 @@ config GK20A_VIDMEM
128 Enable support for using and allocating buffers in a distinct video 128 Enable support for using and allocating buffers in a distinct video
129 memory aperture (in contrast to general system memory), available on 129 memory aperture (in contrast to general system memory), available on
130 GPUs that have their own banks. PCIe GPUs have this, for example. 130 GPUs that have their own banks. PCIe GPUs have this, for example.
131
132config NVGPU_SUPPORT_CDE
133 bool "Support extraction of comptags for CDE"
134 depends on GK20A
135 default y
136 help
137 Enable support for extraction of comptags for CDE.
diff --git a/drivers/gpu/nvgpu/Makefile b/drivers/gpu/nvgpu/Makefile
index c99a48dc..4169bc9b 100644
--- a/drivers/gpu/nvgpu/Makefile
+++ b/drivers/gpu/nvgpu/Makefile
@@ -38,12 +38,9 @@ nvgpu-y := \
38 common/linux/vm.o \ 38 common/linux/vm.o \
39 common/linux/intr.o \ 39 common/linux/intr.o \
40 common/linux/sysfs.o \ 40 common/linux/sysfs.o \
41 common/linux/cde.o \
42 common/linux/io.o \ 41 common/linux/io.o \
43 common/linux/io_usermode.o \ 42 common/linux/io_usermode.o \
44 common/linux/rwsem.o \ 43 common/linux/rwsem.o \
45 common/linux/cde_gm20b.o \
46 common/linux/cde_gp10b.o \
47 common/linux/comptags.o \ 44 common/linux/comptags.o \
48 common/linux/dmabuf.o \ 45 common/linux/dmabuf.o \
49 common/linux/sched.o \ 46 common/linux/sched.o \
@@ -132,7 +129,6 @@ nvgpu-$(CONFIG_DEBUG_FS) += \
132 common/linux/debug.o \ 129 common/linux/debug.o \
133 common/linux/debug_gr.o \ 130 common/linux/debug_gr.o \
134 common/linux/debug_fifo.o \ 131 common/linux/debug_fifo.o \
135 common/linux/debug_cde.o \
136 common/linux/debug_ce.o \ 132 common/linux/debug_ce.o \
137 common/linux/debug_pmu.o \ 133 common/linux/debug_pmu.o \
138 common/linux/debug_sched.o \ 134 common/linux/debug_sched.o \
@@ -301,3 +297,13 @@ nvgpu-$(CONFIG_TEGRA_GR_VIRTUALIZATION) += \
301 common/linux/vgpu/gv11b/vgpu_fifo_gv11b.o \ 297 common/linux/vgpu/gv11b/vgpu_fifo_gv11b.o \
302 common/linux/vgpu/gv11b/vgpu_subctx_gv11b.o \ 298 common/linux/vgpu/gv11b/vgpu_subctx_gv11b.o \
303 common/linux/vgpu/gv11b/vgpu_tsg_gv11b.o 299 common/linux/vgpu/gv11b/vgpu_tsg_gv11b.o
300
301nvgpu-$(CONFIG_NVGPU_SUPPORT_CDE) += \
302 common/linux/cde.o \
303 common/linux/cde_gm20b.o \
304 common/linux/cde_gp10b.o
305
306ifeq ($(CONFIG_DEBUG_FS),y)
307nvgpu-$(CONFIG_NVGPU_SUPPORT_CDE) += \
308 common/linux/debug_cde.o
309endif
diff --git a/drivers/gpu/nvgpu/common/linux/cde.c b/drivers/gpu/nvgpu/common/linux/cde.c
index 894e776d..b366acc4 100644
--- a/drivers/gpu/nvgpu/common/linux/cde.c
+++ b/drivers/gpu/nvgpu/common/linux/cde.c
@@ -44,6 +44,8 @@
44#include "os_linux.h" 44#include "os_linux.h"
45#include "dmabuf.h" 45#include "dmabuf.h"
46#include "channel.h" 46#include "channel.h"
47#include "cde_gm20b.h"
48#include "cde_gp10b.h"
47 49
48#include <nvgpu/hw/gk20a/hw_ccsr_gk20a.h> 50#include <nvgpu/hw/gk20a/hw_ccsr_gk20a.h>
49#include <nvgpu/hw/gk20a/hw_pbdma_gk20a.h> 51#include <nvgpu/hw/gk20a/hw_pbdma_gk20a.h>
@@ -1749,3 +1751,24 @@ int gk20a_mark_compressible_write(struct gk20a *g, u32 buffer_fd,
1749 dma_buf_put(dmabuf); 1751 dma_buf_put(dmabuf);
1750 return 0; 1752 return 0;
1751} 1753}
1754
1755int nvgpu_cde_init_ops(struct nvgpu_os_linux *l)
1756{
1757 struct gk20a *g = &l->g;
1758 u32 ver = g->params.gpu_arch + g->params.gpu_impl;
1759
1760 switch (ver) {
1761 case GK20A_GPUID_GM20B:
1762 case GK20A_GPUID_GM20B_B:
1763 l->ops.cde = gm20b_cde_ops.cde;
1764 break;
1765 case NVGPU_GPUID_GP10B:
1766 l->ops.cde = gp10b_cde_ops.cde;
1767 break;
1768 default:
1769 /* CDE is optional, so today ignoring unknown chip is fine */
1770 break;
1771 }
1772
1773 return 0;
1774}
diff --git a/drivers/gpu/nvgpu/common/linux/cde.h b/drivers/gpu/nvgpu/common/linux/cde.h
index 91ea9b88..115558dc 100644
--- a/drivers/gpu/nvgpu/common/linux/cde.h
+++ b/drivers/gpu/nvgpu/common/linux/cde.h
@@ -321,5 +321,6 @@ int gk20a_prepare_compressible_read(
321int gk20a_mark_compressible_write( 321int gk20a_mark_compressible_write(
322 struct gk20a *g, u32 buffer_fd, u32 valid_compbits, u64 offset, 322 struct gk20a *g, u32 buffer_fd, u32 valid_compbits, u64 offset,
323 u32 zbc_color); 323 u32 zbc_color);
324int nvgpu_cde_init_ops(struct nvgpu_os_linux *l);
324 325
325#endif 326#endif
diff --git a/drivers/gpu/nvgpu/common/linux/debug.c b/drivers/gpu/nvgpu/common/linux/debug.c
index af3b9964..80a1f7db 100644
--- a/drivers/gpu/nvgpu/common/linux/debug.c
+++ b/drivers/gpu/nvgpu/common/linux/debug.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (C) 2017 NVIDIA Corporation. All rights reserved. 2 * Copyright (C) 2017-2018 NVIDIA Corporation. All rights reserved.
3 * 3 *
4 * This software is licensed under the terms of the GNU General Public 4 * This software is licensed under the terms of the GNU General Public
5 * License version 2, as published by the Free Software Foundation, and 5 * License version 2, as published by the Free Software Foundation, and
@@ -377,7 +377,9 @@ void gk20a_debug_init(struct gk20a *g, const char *debugfs_symlink)
377 gr_gk20a_debugfs_init(g); 377 gr_gk20a_debugfs_init(g);
378 gk20a_pmu_debugfs_init(g); 378 gk20a_pmu_debugfs_init(g);
379 gk20a_railgating_debugfs_init(g); 379 gk20a_railgating_debugfs_init(g);
380#ifdef CONFIG_NVGPU_SUPPORT_CDE
380 gk20a_cde_debugfs_init(g); 381 gk20a_cde_debugfs_init(g);
382#endif
381 gk20a_ce_debugfs_init(g); 383 gk20a_ce_debugfs_init(g);
382 nvgpu_alloc_debugfs_init(g); 384 nvgpu_alloc_debugfs_init(g);
383 nvgpu_hal_debugfs_init(g); 385 nvgpu_hal_debugfs_init(g);
diff --git a/drivers/gpu/nvgpu/common/linux/driver_common.c b/drivers/gpu/nvgpu/common/linux/driver_common.c
index 66078a85..b3333e37 100644
--- a/drivers/gpu/nvgpu/common/linux/driver_common.c
+++ b/drivers/gpu/nvgpu/common/linux/driver_common.c
@@ -148,7 +148,9 @@ static void nvgpu_init_pm_vars(struct gk20a *g)
148 g->aggressive_sync_destroy = platform->aggressive_sync_destroy; 148 g->aggressive_sync_destroy = platform->aggressive_sync_destroy;
149 g->aggressive_sync_destroy_thresh = platform->aggressive_sync_destroy_thresh; 149 g->aggressive_sync_destroy_thresh = platform->aggressive_sync_destroy_thresh;
150 g->has_syncpoints = platform->has_syncpoints; 150 g->has_syncpoints = platform->has_syncpoints;
151#ifdef CONFIG_NVGPU_SUPPORT_CDE
151 g->has_cde = platform->has_cde; 152 g->has_cde = platform->has_cde;
153#endif
152 g->ptimer_src_freq = platform->ptimer_src_freq; 154 g->ptimer_src_freq = platform->ptimer_src_freq;
153 g->support_pmu = support_gk20a_pmu(dev_from_gk20a(g)); 155 g->support_pmu = support_gk20a_pmu(dev_from_gk20a(g));
154 g->can_railgate = platform->can_railgate_init; 156 g->can_railgate = platform->can_railgate_init;
diff --git a/drivers/gpu/nvgpu/common/linux/ioctl_ctrl.c b/drivers/gpu/nvgpu/common/linux/ioctl_ctrl.c
index 0b449692..71a9bee6 100644
--- a/drivers/gpu/nvgpu/common/linux/ioctl_ctrl.c
+++ b/drivers/gpu/nvgpu/common/linux/ioctl_ctrl.c
@@ -333,10 +333,12 @@ static int gk20a_ctrl_prepare_compressible_read(
333 struct gk20a *g, 333 struct gk20a *g,
334 struct nvgpu_gpu_prepare_compressible_read_args *args) 334 struct nvgpu_gpu_prepare_compressible_read_args *args)
335{ 335{
336 int ret = -ENOSYS;
337
338#ifdef CONFIG_NVGPU_SUPPORT_CDE
336 struct nvgpu_os_linux *l = nvgpu_os_linux_from_gk20a(g); 339 struct nvgpu_os_linux *l = nvgpu_os_linux_from_gk20a(g);
337 struct nvgpu_fence fence; 340 struct nvgpu_fence fence;
338 struct gk20a_fence *fence_out = NULL; 341 struct gk20a_fence *fence_out = NULL;
339 int ret = 0;
340 int flags = args->submit_flags; 342 int flags = args->submit_flags;
341 343
342 fence.id = args->fence.syncpt_id; 344 fence.id = args->fence.syncpt_id;
@@ -377,18 +379,21 @@ static int gk20a_ctrl_prepare_compressible_read(
377 } 379 }
378 } 380 }
379 gk20a_fence_put(fence_out); 381 gk20a_fence_put(fence_out);
382#endif
380 383
381 return 0; 384 return ret;
382} 385}
383 386
384static int gk20a_ctrl_mark_compressible_write( 387static int gk20a_ctrl_mark_compressible_write(
385 struct gk20a *g, 388 struct gk20a *g,
386 struct nvgpu_gpu_mark_compressible_write_args *args) 389 struct nvgpu_gpu_mark_compressible_write_args *args)
387{ 390{
388 int ret; 391 int ret = -ENOSYS;
389 392
393#ifdef CONFIG_NVGPU_SUPPORT_CDE
390 ret = gk20a_mark_compressible_write(g, args->handle, 394 ret = gk20a_mark_compressible_write(g, args->handle,
391 args->valid_compbits, args->offset, args->zbc_color); 395 args->valid_compbits, args->offset, args->zbc_color);
396#endif
392 397
393 return ret; 398 return ret;
394} 399}
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
181static int nvgpu_init_os_linux_ops(struct nvgpu_os_linux *l) 182static 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
202int nvgpu_finalize_poweron_linux(struct nvgpu_os_linux *l) 193int 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)
325static int gk20a_pm_prepare_poweroff(struct device *dev) 318static 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:
1239int nvgpu_remove(struct device *dev, struct class *class) 1236int 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);
diff --git a/drivers/gpu/nvgpu/common/linux/platform_gk20a.h b/drivers/gpu/nvgpu/common/linux/platform_gk20a.h
index ba4880af..927a2cee 100644
--- a/drivers/gpu/nvgpu/common/linux/platform_gk20a.h
+++ b/drivers/gpu/nvgpu/common/linux/platform_gk20a.h
@@ -217,7 +217,9 @@ struct gk20a_platform {
217 /* source frequency for ptimer in hz */ 217 /* source frequency for ptimer in hz */
218 u32 ptimer_src_freq; 218 u32 ptimer_src_freq;
219 219
220#ifdef CONFIG_NVGPU_SUPPORT_CDE
220 bool has_cde; 221 bool has_cde;
222#endif
221 223
222 /* soc name for finding firmware files */ 224 /* soc name for finding firmware files */
223 const char *soc_name; 225 const char *soc_name;
diff --git a/drivers/gpu/nvgpu/common/linux/platform_gk20a_tegra.c b/drivers/gpu/nvgpu/common/linux/platform_gk20a_tegra.c
index 219dcd40..952a7ed1 100644
--- a/drivers/gpu/nvgpu/common/linux/platform_gk20a_tegra.c
+++ b/drivers/gpu/nvgpu/common/linux/platform_gk20a_tegra.c
@@ -948,7 +948,9 @@ struct gk20a_platform gm20b_tegra_platform = {
948 948
949 .dump_platform_dependencies = gk20a_tegra_debug_dump, 949 .dump_platform_dependencies = gk20a_tegra_debug_dump,
950 950
951#ifdef CONFIG_NVGPU_SUPPORT_CDE
951 .has_cde = true, 952 .has_cde = true,
953#endif
952 954
953 .soc_name = "tegra21x", 955 .soc_name = "tegra21x",
954 956
diff --git a/drivers/gpu/nvgpu/common/linux/platform_gp10b_tegra.c b/drivers/gpu/nvgpu/common/linux/platform_gp10b_tegra.c
index fd3c3e2c..c90277e7 100644
--- a/drivers/gpu/nvgpu/common/linux/platform_gp10b_tegra.c
+++ b/drivers/gpu/nvgpu/common/linux/platform_gp10b_tegra.c
@@ -409,7 +409,9 @@ struct gk20a_platform gp10b_tegra_platform = {
409 409
410 .dump_platform_dependencies = gk20a_tegra_debug_dump, 410 .dump_platform_dependencies = gk20a_tegra_debug_dump,
411 411
412#ifdef CONFIG_NVGPU_SUPPORT_CDE
412 .has_cde = true, 413 .has_cde = true,
414#endif
413 415
414 .clk_round_rate = gp10b_round_clk_rate, 416 .clk_round_rate = gp10b_round_clk_rate,
415 .get_clk_freqs = gp10b_clk_get_freqs, 417 .get_clk_freqs = gp10b_clk_get_freqs,
diff --git a/drivers/gpu/nvgpu/common/linux/platform_gv11b_tegra.c b/drivers/gpu/nvgpu/common/linux/platform_gv11b_tegra.c
index ad56167a..407cd27f 100644
--- a/drivers/gpu/nvgpu/common/linux/platform_gv11b_tegra.c
+++ b/drivers/gpu/nvgpu/common/linux/platform_gv11b_tegra.c
@@ -211,9 +211,6 @@ static int gv11b_tegra_suspend(struct device *dev)
211struct gk20a_platform gv11b_tegra_platform = { 211struct gk20a_platform gv11b_tegra_platform = {
212 .has_syncpoints = true, 212 .has_syncpoints = true,
213 213
214 /* no cde. use sysmem compression */
215 .has_cde = false,
216
217 /* ptimer src frequency in hz*/ 214 /* ptimer src frequency in hz*/
218 .ptimer_src_freq = 31250000, 215 .ptimer_src_freq = 31250000,
219 216