From 71af78d2c22c6519b1ae2cbe3826f05e178d86f6 Mon Sep 17 00:00:00 2001 From: Terje Bergstrom Date: Fri, 14 Apr 2017 15:40:47 -0700 Subject: 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 Reviewed-on: http://git-master/r/1463545 Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/gk20a/channel_sync_gk20a.c | 4 ++-- drivers/gpu/nvgpu/gk20a/debug_gk20a.c | 4 ++-- drivers/gpu/nvgpu/gk20a/gk20a.c | 2 +- drivers/gpu/nvgpu/gk20a/gk20a.h | 13 +++++++++++++ drivers/gpu/nvgpu/gk20a/platform_gk20a.h | 16 ---------------- 5 files changed, 18 insertions(+), 21 deletions(-) (limited to 'drivers/gpu/nvgpu/gk20a') 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) struct gk20a_channel_sync *gk20a_channel_sync_create(struct channel_gk20a *c) { #ifdef CONFIG_TEGRA_GK20A_NVHOST - if (gk20a_platform_has_syncpoints(c->g->dev)) + if (gk20a_platform_has_syncpoints(c->g)) return gk20a_channel_syncpt_create(c); #endif return gk20a_channel_semaphore_create(c); @@ -974,7 +974,7 @@ struct gk20a_channel_sync *gk20a_channel_sync_create(struct channel_gk20a *c) bool gk20a_channel_sync_needs_sync_framework(struct channel_gk20a *c) { - if (gk20a_platform_has_syncpoints(c->g->dev)) + if (gk20a_platform_has_syncpoints(c->g)) return false; return true; } 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) debugfs_create_u32("ch_wdt_timeout_ms", S_IRUGO|S_IWUSR, platform->debugfs, &platform->ch_wdt_timeout_ms); - debugfs_create_bool("disable_syncpoints", S_IRUGO|S_IWUSR, - platform->debugfs, &platform->disable_syncpoints); + debugfs_create_u32("disable_syncpoints", S_IRUGO|S_IWUSR, + platform->debugfs, &g->disable_syncpoints); /* Legacy debugging API. */ 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) if (g->ops.mm.support_sparse && g->ops.mm.support_sparse(g)) gpu->flags |= NVGPU_GPU_FLAGS_SUPPORT_SPARSE_ALLOCS; - if (gk20a_platform_has_syncpoints(g->dev)) + if (gk20a_platform_has_syncpoints(g)) gpu->flags |= NVGPU_GPU_FLAGS_HAS_SYNCPOINTS; 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 { unsigned int aggressive_sync_destroy_thresh; bool aggressive_sync_destroy; + bool has_syncpoints; + /* Debugfs knob for forcing syncpt support off in runtime. */ + u32 disable_syncpoints; + u32 emc3d_ratio; #ifdef CONFIG_DEBUG_FS @@ -1497,4 +1501,13 @@ void gk20a_put(struct gk20a *g); int gk20a_railgating_debugfs_init(struct device *dev); #endif +static inline bool gk20a_platform_has_syncpoints(struct gk20a *g) +{ +#ifdef CONFIG_TEGRA_GK20A_NVHOST + return g->has_syncpoints && !g->disable_syncpoints; +#else + return false; +#endif +} + #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 { /* Should be populated at probe. */ bool has_syncpoints; - /* Debugfs knob for forcing syncpt support off in runtime. */ -#if LINUX_VERSION_CODE < KERNEL_VERSION(4,4,0) - u32 disable_syncpoints; -#else - bool disable_syncpoints; -#endif /* channel limit after which to start aggressive sync destroy */ unsigned int aggressive_sync_destroy_thresh; @@ -271,16 +265,6 @@ extern struct gk20a_platform vgpu_tegra_platform; #endif #endif -static inline bool gk20a_platform_has_syncpoints(struct device *dev) -{ -#ifdef CONFIG_TEGRA_GK20A_NVHOST - struct gk20a_platform *p = dev_get_drvdata(dev); - return p->has_syncpoints && !p->disable_syncpoints; -#else - return false; -#endif -} - int gk20a_tegra_busy(struct device *dev); void gk20a_tegra_idle(struct device *dev); void gk20a_tegra_debug_dump(struct device *pdev); -- cgit v1.2.2