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>
This commit is contained in:
Terje Bergstrom
2017-04-14 15:40:47 -07:00
committed by mobile promotions
parent 388113aa19
commit 71af78d2c2
7 changed files with 20 additions and 21 deletions

View File

@@ -107,6 +107,7 @@ static void nvgpu_init_pm_vars(struct gk20a *g)
g->default_pri_timeout = platform->default_pri_timeout; g->default_pri_timeout = platform->default_pri_timeout;
g->aggressive_sync_destroy = platform->aggressive_sync_destroy; g->aggressive_sync_destroy = platform->aggressive_sync_destroy;
g->aggressive_sync_destroy_thresh = platform->aggressive_sync_destroy_thresh; g->aggressive_sync_destroy_thresh = platform->aggressive_sync_destroy_thresh;
g->has_syncpoints = platform->has_syncpoints;
/* set default values to aelpg parameters */ /* set default values to aelpg parameters */
g->pmu.aelpg_param[0] = APCTRL_SAMPLING_PERIOD_PG_DEFAULT_US; g->pmu.aelpg_param[0] = APCTRL_SAMPLING_PERIOD_PG_DEFAULT_US;

View File

@@ -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) struct gk20a_channel_sync *gk20a_channel_sync_create(struct channel_gk20a *c)
{ {
#ifdef CONFIG_TEGRA_GK20A_NVHOST #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); return gk20a_channel_syncpt_create(c);
#endif #endif
return gk20a_channel_semaphore_create(c); 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) 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 false;
return true; return true;
} }

View File

@@ -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, debugfs_create_u32("ch_wdt_timeout_ms", S_IRUGO|S_IWUSR,
platform->debugfs, &platform->ch_wdt_timeout_ms); platform->debugfs, &platform->ch_wdt_timeout_ms);
debugfs_create_bool("disable_syncpoints", S_IRUGO|S_IWUSR, debugfs_create_u32("disable_syncpoints", S_IRUGO|S_IWUSR,
platform->debugfs, &platform->disable_syncpoints); platform->debugfs, &g->disable_syncpoints);
/* Legacy debugging API. */ /* Legacy debugging API. */
debugfs_create_u32("dbg_mask", S_IRUGO|S_IWUSR, debugfs_create_u32("dbg_mask", S_IRUGO|S_IWUSR,

View File

@@ -455,7 +455,7 @@ int gk20a_init_gpu_characteristics(struct gk20a *g)
if (g->ops.mm.support_sparse && g->ops.mm.support_sparse(g)) if (g->ops.mm.support_sparse && g->ops.mm.support_sparse(g))
gpu->flags |= NVGPU_GPU_FLAGS_SUPPORT_SPARSE_ALLOCS; 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_HAS_SYNCPOINTS;
gpu->flags |= NVGPU_GPU_FLAGS_SUPPORT_USERSPACE_MANAGED_AS; gpu->flags |= NVGPU_GPU_FLAGS_SUPPORT_USERSPACE_MANAGED_AS;

View File

@@ -999,6 +999,10 @@ struct gk20a {
unsigned int aggressive_sync_destroy_thresh; unsigned int aggressive_sync_destroy_thresh;
bool aggressive_sync_destroy; bool aggressive_sync_destroy;
bool has_syncpoints;
/* Debugfs knob for forcing syncpt support off in runtime. */
u32 disable_syncpoints;
u32 emc3d_ratio; u32 emc3d_ratio;
#ifdef CONFIG_DEBUG_FS #ifdef CONFIG_DEBUG_FS
@@ -1497,4 +1501,13 @@ void gk20a_put(struct gk20a *g);
int gk20a_railgating_debugfs_init(struct device *dev); int gk20a_railgating_debugfs_init(struct device *dev);
#endif #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 */ #endif /* GK20A_H */

View File

@@ -49,12 +49,6 @@ struct gk20a_platform {
/* Should be populated at probe. */ /* Should be populated at probe. */
bool has_syncpoints; 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 */ /* channel limit after which to start aggressive sync destroy */
unsigned int aggressive_sync_destroy_thresh; unsigned int aggressive_sync_destroy_thresh;
@@ -271,16 +265,6 @@ extern struct gk20a_platform vgpu_tegra_platform;
#endif #endif
#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); int gk20a_tegra_busy(struct device *dev);
void gk20a_tegra_idle(struct device *dev); void gk20a_tegra_idle(struct device *dev);
void gk20a_tegra_debug_dump(struct device *pdev); void gk20a_tegra_debug_dump(struct device *pdev);

View File

@@ -240,6 +240,7 @@ static void vgpu_init_vars(struct gk20a *g, struct gk20a_platform *platform)
g->aggressive_sync_destroy = platform->aggressive_sync_destroy; g->aggressive_sync_destroy = platform->aggressive_sync_destroy;
g->aggressive_sync_destroy_thresh = platform->aggressive_sync_destroy_thresh; g->aggressive_sync_destroy_thresh = platform->aggressive_sync_destroy_thresh;
g->has_syncpoints = platform->has_syncpoints;
} }
static int vgpu_init_support(struct platform_device *pdev) static int vgpu_init_support(struct platform_device *pdev)