gpu: nvgpu: enforce priv usage of fence

Add a "priv" fence struct type and use that in the fence type to
emphasize that the inner data is not meant to be seen.

The fence unit needs to have an outside-visible fence type so that
fences can be allocated directly as a struct field in job metadata for
performance and simplicity, so hiding the type entirely wouldn't work.

A couple of places need to touch the priv data directly in channel code.
Those can be thought to be technically fence unit's code scattered
outside the fence files, but they mean that the architecture is not
perfect yet.

Jira NVGPU-5773

Change-Id: Ifa3c95757ae31eef0e32f2605293e23e210b065f
Signed-off-by: Konsta Hölttä <kholtta@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2395071
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Konsta Hölttä
2020-08-04 16:17:52 +03:00
committed by Alex Waterman
parent be6b37ba50
commit 27a64f2e23
6 changed files with 83 additions and 38 deletions

View File

@@ -358,7 +358,11 @@ static void nvgpu_channel_signal_os_fence_framework(struct nvgpu_channel *ch,
#if defined(CONFIG_NVGPU_SYNCFD_ANDROID)
gk20a_sync_timeline_signal(fence_framework->timeline);
#elif defined(CONFIG_NVGPU_SYNCFD_STABLE)
f = nvgpu_get_dma_fence(&fence->os_fence);
/*
* This is not a good example on how to use the fence type. Don't touch
* the priv data. This is os-specific code for the fence unit.
*/
f = nvgpu_get_dma_fence(&fence->priv.os_fence);
/*
* Sometimes the post fence of a job isn't a file. It can be a raw
* semaphore for kernel-internal tracking, or a raw syncpoint for