summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTerje Bergstrom <tbergstrom@nvidia.com>2017-04-14 18:40:47 -0400
committermobile promotions <svcmobile_promotions@nvidia.com>2017-04-26 12:14:26 -0400
commit71af78d2c22c6519b1ae2cbe3826f05e178d86f6 (patch)
treed5b1b51c9fe318caebea65b872153d2da977e278
parent388113aa19c202edd261e49f8c169f0b31ade784 (diff)
gpu: nvgpu: Move has_syncpts to gk20a
Copy has_syncpts to struct gk20a at probe time, and access it from gk20a instead of platform_gk20a. JIRA NVGPU-16 Change-Id: I50329e3a5141a62e6e9828e97ea0747abc1ce1ee Signed-off-by: Terje Bergstrom <tbergstrom@nvidia.com> Reviewed-on: http://git-master/r/1463545 Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
-rw-r--r--drivers/gpu/nvgpu/common/linux/driver_common.c1
-rw-r--r--drivers/gpu/nvgpu/gk20a/channel_sync_gk20a.c4
-rw-r--r--drivers/gpu/nvgpu/gk20a/debug_gk20a.c4
-rw-r--r--drivers/gpu/nvgpu/gk20a/gk20a.c2
-rw-r--r--drivers/gpu/nvgpu/gk20a/gk20a.h13
-rw-r--r--drivers/gpu/nvgpu/gk20a/platform_gk20a.h16
-rw-r--r--drivers/gpu/nvgpu/vgpu/vgpu.c1
7 files changed, 20 insertions, 21 deletions
diff --git a/drivers/gpu/nvgpu/common/linux/driver_common.c b/drivers/gpu/nvgpu/common/linux/driver_common.c
index 31cc879c..b4d88b08 100644
--- a/drivers/gpu/nvgpu/common/linux/driver_common.c
+++ b/drivers/gpu/nvgpu/common/linux/driver_common.c
@@ -107,6 +107,7 @@ static void nvgpu_init_pm_vars(struct gk20a *g)
107 g->default_pri_timeout = platform->default_pri_timeout; 107 g->default_pri_timeout = platform->default_pri_timeout;
108 g->aggressive_sync_destroy = platform->aggressive_sync_destroy; 108 g->aggressive_sync_destroy = platform->aggressive_sync_destroy;
109 g->aggressive_sync_destroy_thresh = platform->aggressive_sync_destroy_thresh; 109 g->aggressive_sync_destroy_thresh = platform->aggressive_sync_destroy_thresh;
110 g->has_syncpoints = platform->has_syncpoints;
110 111
111 /* set default values to aelpg parameters */ 112 /* set default values to aelpg parameters */
112 g->pmu.aelpg_param[0] = APCTRL_SAMPLING_PERIOD_PG_DEFAULT_US; 113 g->pmu.aelpg_param[0] = APCTRL_SAMPLING_PERIOD_PG_DEFAULT_US;
diff --git a/drivers/gpu/nvgpu/gk20a/channel_sync_gk20a.c b/drivers/gpu/nvgpu/gk20a/channel_sync_gk20a.c
index 3fb35e94..ddd94a2d 100644
--- a/drivers/gpu/nvgpu/gk20a/channel_sync_gk20a.c
+++ b/drivers/gpu/nvgpu/gk20a/channel_sync_gk20a.c
@@ -966,7 +966,7 @@ void gk20a_channel_sync_destroy(struct gk20a_channel_sync *sync)
966struct gk20a_channel_sync *gk20a_channel_sync_create(struct channel_gk20a *c) 966struct gk20a_channel_sync *gk20a_channel_sync_create(struct channel_gk20a *c)
967{ 967{
968#ifdef CONFIG_TEGRA_GK20A_NVHOST 968#ifdef CONFIG_TEGRA_GK20A_NVHOST
969 if (gk20a_platform_has_syncpoints(c->g->dev)) 969 if (gk20a_platform_has_syncpoints(c->g))
970 return gk20a_channel_syncpt_create(c); 970 return gk20a_channel_syncpt_create(c);
971#endif 971#endif
972 return gk20a_channel_semaphore_create(c); 972 return gk20a_channel_semaphore_create(c);
@@ -974,7 +974,7 @@ struct gk20a_channel_sync *gk20a_channel_sync_create(struct channel_gk20a *c)
974 974
975bool gk20a_channel_sync_needs_sync_framework(struct channel_gk20a *c) 975bool gk20a_channel_sync_needs_sync_framework(struct channel_gk20a *c)
976{ 976{
977 if (gk20a_platform_has_syncpoints(c->g->dev)) 977 if (gk20a_platform_has_syncpoints(c->g))
978 return false; 978 return false;
979 return true; 979 return true;
980} 980}
diff --git a/drivers/gpu/nvgpu/gk20a/debug_gk20a.c b/drivers/gpu/nvgpu/gk20a/debug_gk20a.c
index d577c625..885f0a83 100644
--- a/drivers/gpu/nvgpu/gk20a/debug_gk20a.c
+++ b/drivers/gpu/nvgpu/gk20a/debug_gk20a.c
@@ -324,8 +324,8 @@ void gk20a_debug_init(struct device *dev, const char *debugfs_symlink)
324 debugfs_create_u32("ch_wdt_timeout_ms", S_IRUGO|S_IWUSR, 324 debugfs_create_u32("ch_wdt_timeout_ms", S_IRUGO|S_IWUSR,
325 platform->debugfs, &platform->ch_wdt_timeout_ms); 325 platform->debugfs, &platform->ch_wdt_timeout_ms);
326 326
327 debugfs_create_bool("disable_syncpoints", S_IRUGO|S_IWUSR, 327 debugfs_create_u32("disable_syncpoints", S_IRUGO|S_IWUSR,
328 platform->debugfs, &platform->disable_syncpoints); 328 platform->debugfs, &g->disable_syncpoints);
329 329
330 /* Legacy debugging API. */ 330 /* Legacy debugging API. */
331 debugfs_create_u32("dbg_mask", S_IRUGO|S_IWUSR, 331 debugfs_create_u32("dbg_mask", S_IRUGO|S_IWUSR,
diff --git a/drivers/gpu/nvgpu/gk20a/gk20a.c b/drivers/gpu/nvgpu/gk20a/gk20a.c
index b3f4e5fe..9dca86fb 100644
--- a/drivers/gpu/nvgpu/gk20a/gk20a.c
+++ b/drivers/gpu/nvgpu/gk20a/gk20a.c
@@ -455,7 +455,7 @@ int gk20a_init_gpu_characteristics(struct gk20a *g)
455 if (g->ops.mm.support_sparse && g->ops.mm.support_sparse(g)) 455 if (g->ops.mm.support_sparse && g->ops.mm.support_sparse(g))
456 gpu->flags |= NVGPU_GPU_FLAGS_SUPPORT_SPARSE_ALLOCS; 456 gpu->flags |= NVGPU_GPU_FLAGS_SUPPORT_SPARSE_ALLOCS;
457 457
458 if (gk20a_platform_has_syncpoints(g->dev)) 458 if (gk20a_platform_has_syncpoints(g))
459 gpu->flags |= NVGPU_GPU_FLAGS_HAS_SYNCPOINTS; 459 gpu->flags |= NVGPU_GPU_FLAGS_HAS_SYNCPOINTS;
460 460
461 gpu->flags |= NVGPU_GPU_FLAGS_SUPPORT_USERSPACE_MANAGED_AS; 461 gpu->flags |= NVGPU_GPU_FLAGS_SUPPORT_USERSPACE_MANAGED_AS;
diff --git a/drivers/gpu/nvgpu/gk20a/gk20a.h b/drivers/gpu/nvgpu/gk20a/gk20a.h
index 0d1ae9d7..616c25ee 100644
--- a/drivers/gpu/nvgpu/gk20a/gk20a.h
+++ b/drivers/gpu/nvgpu/gk20a/gk20a.h
@@ -999,6 +999,10 @@ struct gk20a {
999 unsigned int aggressive_sync_destroy_thresh; 999 unsigned int aggressive_sync_destroy_thresh;
1000 bool aggressive_sync_destroy; 1000 bool aggressive_sync_destroy;
1001 1001
1002 bool has_syncpoints;
1003 /* Debugfs knob for forcing syncpt support off in runtime. */
1004 u32 disable_syncpoints;
1005
1002 u32 emc3d_ratio; 1006 u32 emc3d_ratio;
1003 1007
1004#ifdef CONFIG_DEBUG_FS 1008#ifdef CONFIG_DEBUG_FS
@@ -1497,4 +1501,13 @@ void gk20a_put(struct gk20a *g);
1497int gk20a_railgating_debugfs_init(struct device *dev); 1501int gk20a_railgating_debugfs_init(struct device *dev);
1498#endif 1502#endif
1499 1503
1504static inline bool gk20a_platform_has_syncpoints(struct gk20a *g)
1505{
1506#ifdef CONFIG_TEGRA_GK20A_NVHOST
1507 return g->has_syncpoints && !g->disable_syncpoints;
1508#else
1509 return false;
1510#endif
1511}
1512
1500#endif /* GK20A_H */ 1513#endif /* GK20A_H */
diff --git a/drivers/gpu/nvgpu/gk20a/platform_gk20a.h b/drivers/gpu/nvgpu/gk20a/platform_gk20a.h
index 1115a5fb..8c93249a 100644
--- a/drivers/gpu/nvgpu/gk20a/platform_gk20a.h
+++ b/drivers/gpu/nvgpu/gk20a/platform_gk20a.h
@@ -49,12 +49,6 @@ struct gk20a_platform {
49 49
50 /* Should be populated at probe. */ 50 /* Should be populated at probe. */
51 bool has_syncpoints; 51 bool has_syncpoints;
52 /* Debugfs knob for forcing syncpt support off in runtime. */
53#if LINUX_VERSION_CODE < KERNEL_VERSION(4,4,0)
54 u32 disable_syncpoints;
55#else
56 bool disable_syncpoints;
57#endif
58 52
59 /* channel limit after which to start aggressive sync destroy */ 53 /* channel limit after which to start aggressive sync destroy */
60 unsigned int aggressive_sync_destroy_thresh; 54 unsigned int aggressive_sync_destroy_thresh;
@@ -271,16 +265,6 @@ extern struct gk20a_platform vgpu_tegra_platform;
271#endif 265#endif
272#endif 266#endif
273 267
274static inline bool gk20a_platform_has_syncpoints(struct device *dev)
275{
276#ifdef CONFIG_TEGRA_GK20A_NVHOST
277 struct gk20a_platform *p = dev_get_drvdata(dev);
278 return p->has_syncpoints && !p->disable_syncpoints;
279#else
280 return false;
281#endif
282}
283
284int gk20a_tegra_busy(struct device *dev); 268int gk20a_tegra_busy(struct device *dev);
285void gk20a_tegra_idle(struct device *dev); 269void gk20a_tegra_idle(struct device *dev);
286void gk20a_tegra_debug_dump(struct device *pdev); 270void gk20a_tegra_debug_dump(struct device *pdev);
diff --git a/drivers/gpu/nvgpu/vgpu/vgpu.c b/drivers/gpu/nvgpu/vgpu/vgpu.c
index 480d80d7..a98006f2 100644
--- a/drivers/gpu/nvgpu/vgpu/vgpu.c
+++ b/drivers/gpu/nvgpu/vgpu/vgpu.c
@@ -240,6 +240,7 @@ static void vgpu_init_vars(struct gk20a *g, struct gk20a_platform *platform)
240 240
241 g->aggressive_sync_destroy = platform->aggressive_sync_destroy; 241 g->aggressive_sync_destroy = platform->aggressive_sync_destroy;
242 g->aggressive_sync_destroy_thresh = platform->aggressive_sync_destroy_thresh; 242 g->aggressive_sync_destroy_thresh = platform->aggressive_sync_destroy_thresh;
243 g->has_syncpoints = platform->has_syncpoints;
243} 244}
244 245
245static int vgpu_init_support(struct platform_device *pdev) 246static int vgpu_init_support(struct platform_device *pdev)