gpu: nvgpu: Standardize HAS_SYNCPOINTs check

Nvgpu uses many ways to check if sync points are enabled. The four
ways used to be:

  platform->has_syncpoints
  g->has_syncpoints
  nvgpu_is_enabled(g, NVPGU_HAS_SYNCPOINTS)
  gk20a_platform_has_syncpoints()

This patch standardizes all usage to now be nvgpu_has_syncpoints()
which is based on gk20a_platform_has_syncpoints() - just renamed to
be general to nvgpu.

All usage of the other forms have now been consolidated. However,
under the hood nvgpu_has_syncpoints() does check the is_enabled
flag. This flag is now set where g->has_syncpoints used to be set
based on the platform data.

The basic dependency chain is this:

  nvgpu_has_syncpoints -> NVGPU_HAS_SYNCPOINTS ->
    platform->has_syncpoints

However, note: there are several places where syncpoints can be
disabled if some other driver initialization fails (for ex. host1x).
Also note that nvgpu_has_syncpoints() also considers a disable
variable set by debugfs.

Bug 2327574

Change-Id: Ia2375a80f5f2e27285e6175568dd13e6bb25fd33
Signed-off-by: Alex Waterman <alexw@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1803975
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Alex Waterman
2018-08-21 10:35:06 -07:00
committed by Abdul Salam
parent ac87a707b3
commit 966d1a08be
11 changed files with 29 additions and 29 deletions

View File

@@ -21,6 +21,7 @@
#include <nvgpu/gk20a.h>
#include <nvgpu/nvhost.h>
#include <nvgpu/enabled.h>
#include "nvhost_priv.h"
@@ -45,9 +46,9 @@ int nvgpu_get_nvhost_dev(struct gk20a *g)
}
} else {
if (g->has_syncpoints) {
if (nvgpu_has_syncpoints(g)) {
nvgpu_warn(g, "host1x reference not found. assuming no syncpoints support");
g->has_syncpoints = false;
__nvgpu_set_enabled(g, NVGPU_HAS_SYNCPOINTS, false);
}
return 0;
}
@@ -263,13 +264,13 @@ int nvgpu_nvhost_syncpt_init(struct gk20a *g)
{
int err = 0;
if (!g->has_syncpoints)
if (!nvgpu_has_syncpoints(g))
return -ENOSYS;
err = nvgpu_get_nvhost_dev(g);
if (err) {
nvgpu_err(g, "host1x device not available");
g->has_syncpoints = false;
__nvgpu_set_enabled(g, NVGPU_HAS_SYNCPOINTS, false);
return -ENOSYS;
}
@@ -279,7 +280,7 @@ int nvgpu_nvhost_syncpt_init(struct gk20a *g)
&g->syncpt_unit_size);
if (err) {
nvgpu_err(g, "Failed to get syncpt interface");
g->has_syncpoints = false;
__nvgpu_set_enabled(g, NVGPU_HAS_SYNCPOINTS, false);
return -ENOSYS;
}