mirror of
git://nv-tegra.nvidia.com/linux-nvgpu.git
synced 2025-12-24 10:34:43 +03:00
gpu: nvgpu: add safety build flag CONFIG_NVGPU_SW_SEMAPHORE
Added the safety build flag CONFIG_NVGPU_SW_SEMAPHORE to compile out sw semaphore implementation in NVGPU. sw semaphore is only used for presilicon bringup of GPU and hence is not needed for safety build. Jira NVGPU-3172 Change-Id: I6a46ef22f1e2059437f710198f4ea49a47656fef Signed-off-by: Debarshi Dutta <ddutta@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/2164216 Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com> Reviewed-by: svc-mobile-misra <svc-mobile-misra@nvidia.com> Reviewed-by: Sagar Kamble <skamble@nvidia.com> GVS: Gerrit_Virtual_Submit Reviewed-by: Vijayakumar Subbu <vsubbu@nvidia.com> Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
committed by
mobile promotions
parent
feb3ba3d59
commit
92d009e796
@@ -45,10 +45,11 @@ static void nvgpu_fence_free(struct nvgpu_ref *ref)
|
||||
if (nvgpu_os_fence_is_initialized(&f->os_fence)) {
|
||||
f->os_fence.ops->drop_ref(&f->os_fence);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_NVGPU_SW_SEMAPHPORE
|
||||
if (f->semaphore != NULL) {
|
||||
nvgpu_semaphore_put(f->semaphore);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (f->allocator != NULL) {
|
||||
if (nvgpu_alloc_initialized(f->allocator)) {
|
||||
@@ -195,10 +196,13 @@ void nvgpu_fence_init(struct nvgpu_fence_type *f,
|
||||
}
|
||||
f->ops = ops;
|
||||
f->syncpt_id = NVGPU_INVALID_SYNCPT_ID;
|
||||
#ifdef CONFIG_NVGPU_SW_SEMAPHPORE
|
||||
f->semaphore = NULL;
|
||||
#endif
|
||||
f->os_fence = os_fence;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_NVGPU_SW_SEMAPHORE
|
||||
/* Fences that are backed by GPU semaphores: */
|
||||
|
||||
static int nvgpu_semaphore_fence_wait(struct nvgpu_fence_type *f, u32 timeout)
|
||||
@@ -248,6 +252,8 @@ int nvgpu_fence_from_semaphore(
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_TEGRA_GK20A_NVHOST
|
||||
/* Fences that are backed by host1x syncpoints: */
|
||||
|
||||
|
||||
@@ -1718,6 +1718,7 @@ static void gk20a_free_channel(struct nvgpu_channel *ch, bool force)
|
||||
}
|
||||
nvgpu_mutex_release(&ch->sync_lock);
|
||||
|
||||
#ifdef CONFIG_NVGPU_SW_SEMAPHORE
|
||||
/*
|
||||
* free the channel used semaphore index.
|
||||
* we need to do this before releasing the address space,
|
||||
@@ -1726,6 +1727,7 @@ static void gk20a_free_channel(struct nvgpu_channel *ch, bool force)
|
||||
if (ch->hw_sema != NULL) {
|
||||
nvgpu_hw_semaphore_free(ch);
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* When releasing the channel we unbind the VM - so release the ref.
|
||||
@@ -2739,7 +2741,9 @@ void nvgpu_channel_debug_dump_all(struct gk20a *g,
|
||||
for (chid = 0U; chid < f->num_channels; chid++) {
|
||||
struct nvgpu_channel *ch = &f->channel[chid];
|
||||
struct nvgpu_channel_dump_info *info = infos[chid];
|
||||
#ifdef CONFIG_NVGPU_SW_SEMAPHORE
|
||||
struct nvgpu_hw_semaphore *hw_sema = ch->hw_sema;
|
||||
#endif
|
||||
|
||||
/* if this info exists, the above loop took a channel ref */
|
||||
if (info == NULL) {
|
||||
@@ -2752,12 +2756,14 @@ void nvgpu_channel_debug_dump_all(struct gk20a *g,
|
||||
info->refs = nvgpu_atomic_read(&ch->ref_count);
|
||||
info->deterministic = ch->deterministic;
|
||||
|
||||
#ifdef CONFIG_NVGPU_SW_SEMAPHORE
|
||||
if (hw_sema != NULL) {
|
||||
info->sema.value = nvgpu_hw_semaphore_read(hw_sema);
|
||||
info->sema.next =
|
||||
(u32)nvgpu_hw_semaphore_read_next(hw_sema);
|
||||
info->sema.addr = nvgpu_hw_semaphore_addr(hw_sema);
|
||||
}
|
||||
#endif
|
||||
|
||||
g->ops.channel.read_state(g, ch, &info->hw_state);
|
||||
g->ops.ramfc.capture_ram_dump(g, ch, info);
|
||||
|
||||
@@ -166,7 +166,9 @@ static void nvgpu_remove_mm_support(struct mm_gk20a *mm)
|
||||
nvgpu_vm_put(mm->cde.vm);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_NVGPU_SW_SEMAPHORE
|
||||
nvgpu_semaphore_sea_destroy(g);
|
||||
#endif
|
||||
#ifdef CONFIG_NVGPU_DGPU
|
||||
nvgpu_vidmem_destroy(g);
|
||||
#endif
|
||||
|
||||
@@ -314,6 +314,7 @@ bool nvgpu_big_pages_possible(struct vm_gk20a *vm, u64 base, u64 size)
|
||||
return true;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_NVGPU_SW_SEMAPHORE
|
||||
/*
|
||||
* Initialize a semaphore pool. Just return successfully if we do not need
|
||||
* semaphores (i.e when sync-pts are active).
|
||||
@@ -375,6 +376,7 @@ static int nvgpu_init_sema_pool(struct vm_gk20a *vm)
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Initialize a preallocated vm
|
||||
@@ -619,6 +621,7 @@ int nvgpu_vm_do_init(struct mm_gk20a *mm,
|
||||
nvgpu_ref_init(&vm->ref);
|
||||
nvgpu_init_list_node(&vm->vm_area_list);
|
||||
|
||||
#ifdef CONFIG_NVGPU_SW_SEMAPHORE
|
||||
/*
|
||||
* This is only necessary for channel address spaces. The best way to
|
||||
* distinguish channel address spaces from other address spaces is by
|
||||
@@ -630,12 +633,15 @@ int nvgpu_vm_do_init(struct mm_gk20a *mm,
|
||||
goto clean_up_gmmu_lock;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
|
||||
#ifdef CONFIG_NVGPU_SW_SEMAPHORE
|
||||
clean_up_gmmu_lock:
|
||||
nvgpu_mutex_destroy(&vm->update_gmmu_lock);
|
||||
nvgpu_mutex_destroy(&vm->syncpt_ro_map_lock);
|
||||
#endif
|
||||
clean_up_allocators:
|
||||
if (nvgpu_alloc_initialized(&vm->kernel)) {
|
||||
nvgpu_alloc_destroy(&vm->kernel);
|
||||
@@ -732,6 +738,7 @@ static void nvgpu_vm_remove(struct vm_gk20a *vm)
|
||||
struct gk20a *g = vm->mm->g;
|
||||
bool done;
|
||||
|
||||
#ifdef CONFIG_NVGPU_SW_SEMAPHORE
|
||||
/*
|
||||
* Do this outside of the update_gmmu_lock since unmapping the semaphore
|
||||
* pool involves unmapping a GMMU mapping which means aquiring the
|
||||
@@ -743,6 +750,7 @@ static void nvgpu_vm_remove(struct vm_gk20a *vm)
|
||||
nvgpu_semaphore_pool_put(vm->sema_pool);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if (nvgpu_mem_is_valid(&g->syncpt_mem) &&
|
||||
vm->syncpt_ro_map_gpu_va != 0ULL) {
|
||||
|
||||
@@ -45,7 +45,7 @@ struct nvgpu_channel_sync *nvgpu_channel_sync_create(struct nvgpu_channel *c,
|
||||
if (nvgpu_has_syncpoints(c->g)) {
|
||||
return nvgpu_channel_sync_syncpt_create(c, user_managed);
|
||||
} else {
|
||||
#ifdef CONFIG_NVGPU_KERNEL_MODE_SUBMIT
|
||||
#ifdef CONFIG_NVGPU_SW_SEMAPHORE
|
||||
return nvgpu_channel_sync_semaphore_create(c, user_managed);
|
||||
#else
|
||||
return NULL;
|
||||
|
||||
Reference in New Issue
Block a user