diff options
author | Alex Waterman <alexw@nvidia.com> | 2018-08-21 13:35:06 -0400 |
---|---|---|
committer | mobile promotions <svcmobile_promotions@nvidia.com> | 2018-09-27 18:04:38 -0400 |
commit | 8789cafcfb0d1e16ad0b2c61b047d275f2d684b4 (patch) | |
tree | 34092ee2fcedbfbe719c9984c5f5f06807632158 /drivers/gpu/nvgpu/common | |
parent | c6eae929fd74f11ab13d469a38bffd4e8ba50fb5 (diff) |
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>
Diffstat (limited to 'drivers/gpu/nvgpu/common')
-rw-r--r-- | drivers/gpu/nvgpu/common/mm/vm.c | 4 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/common/sync/channel_sync.c | 14 |
2 files changed, 14 insertions, 4 deletions
diff --git a/drivers/gpu/nvgpu/common/mm/vm.c b/drivers/gpu/nvgpu/common/mm/vm.c index 1e6c4601..7f0b3d10 100644 --- a/drivers/gpu/nvgpu/common/mm/vm.c +++ b/drivers/gpu/nvgpu/common/mm/vm.c | |||
@@ -225,7 +225,7 @@ static int nvgpu_init_sema_pool(struct vm_gk20a *vm) | |||
225 | /* | 225 | /* |
226 | * Don't waste the memory on semaphores if we don't need them. | 226 | * Don't waste the memory on semaphores if we don't need them. |
227 | */ | 227 | */ |
228 | if (nvgpu_is_enabled(g, NVGPU_HAS_SYNCPOINTS)) { | 228 | if (nvgpu_has_syncpoints(g)) { |
229 | return 0; | 229 | return 0; |
230 | } | 230 | } |
231 | 231 | ||
@@ -609,7 +609,7 @@ static void __nvgpu_vm_remove(struct vm_gk20a *vm) | |||
609 | * pool involves unmapping a GMMU mapping which means aquiring the | 609 | * pool involves unmapping a GMMU mapping which means aquiring the |
610 | * update_gmmu_lock. | 610 | * update_gmmu_lock. |
611 | */ | 611 | */ |
612 | if (!nvgpu_is_enabled(g, NVGPU_HAS_SYNCPOINTS)) { | 612 | if (!nvgpu_has_syncpoints(g)) { |
613 | if (vm->sema_pool) { | 613 | if (vm->sema_pool) { |
614 | nvgpu_semaphore_pool_unmap(vm->sema_pool, vm); | 614 | nvgpu_semaphore_pool_unmap(vm->sema_pool, vm); |
615 | nvgpu_semaphore_pool_put(vm->sema_pool); | 615 | nvgpu_semaphore_pool_put(vm->sema_pool); |
diff --git a/drivers/gpu/nvgpu/common/sync/channel_sync.c b/drivers/gpu/nvgpu/common/sync/channel_sync.c index 116e5701..b40de834 100644 --- a/drivers/gpu/nvgpu/common/sync/channel_sync.c +++ b/drivers/gpu/nvgpu/common/sync/channel_sync.c | |||
@@ -658,7 +658,7 @@ struct nvgpu_channel_sync *nvgpu_channel_sync_create(struct channel_gk20a *c, | |||
658 | bool user_managed) | 658 | bool user_managed) |
659 | { | 659 | { |
660 | #ifdef CONFIG_TEGRA_GK20A_NVHOST | 660 | #ifdef CONFIG_TEGRA_GK20A_NVHOST |
661 | if (gk20a_platform_has_syncpoints(c->g)) | 661 | if (nvgpu_has_syncpoints(c->g)) |
662 | return channel_sync_syncpt_create(c, user_managed); | 662 | return channel_sync_syncpt_create(c, user_managed); |
663 | #endif | 663 | #endif |
664 | return channel_sync_semaphore_create(c, user_managed); | 664 | return channel_sync_semaphore_create(c, user_managed); |
@@ -666,5 +666,15 @@ struct nvgpu_channel_sync *nvgpu_channel_sync_create(struct channel_gk20a *c, | |||
666 | 666 | ||
667 | bool nvgpu_channel_sync_needs_os_fence_framework(struct gk20a *g) | 667 | bool nvgpu_channel_sync_needs_os_fence_framework(struct gk20a *g) |
668 | { | 668 | { |
669 | return !gk20a_platform_has_syncpoints(g); | 669 | return !nvgpu_has_syncpoints(g); |
670 | } | ||
671 | |||
672 | bool nvgpu_has_syncpoints(struct gk20a *g) | ||
673 | { | ||
674 | #ifdef CONFIG_TEGRA_GK20A_NVHOST | ||
675 | return nvgpu_is_enabled(g, NVGPU_HAS_SYNCPOINTS) && | ||
676 | !g->disable_syncpoints; | ||
677 | #else | ||
678 | return false; | ||
679 | #endif | ||
670 | } | 680 | } |