gpu: nvgpu: add channel_user_syncpt

Refactor user managed syncpoints out of the channel sync infrastructure
that deals with jobs submitted via the kernel api. The user syncpt only
needs to expose the id and gpu address of the reserved syncpoint. None
of the rest (fences, priv cmdbufs) is needed for that, so it hasn't been
ideal to couple with the user-allocated syncpts.

With user syncpts now provided by channel_user_syncpt, remove the
user_managed flag from the kernel sync api.

This allows moving all the kernel submit sync code to be conditionally
compiled in only when needed, and separates the user sync functionality
in a more clear way from the rest with a minimal API.

[this is squashed with commit 5111caea601a (gpu: nvgpu: guard user
syncpt with nvhost config) from
https://git-master.nvidia.com/r/c/linux-nvgpu/+/2325009]

Jira NVGPU-4548

Change-Id: I99259fc9cbd30bbd478ed86acffcce12768502d3
Signed-off-by: Konsta Hölttä <kholtta@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2321768
(cherry picked from commit 1095ad353f5f1cf7ca180d0701bc02a607404f5e)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2319629
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-03-26 11:53:59 +02:00
committed by Alex Waterman
parent b813adbf49
commit 4f80c6b8a9
21 changed files with 380 additions and 191 deletions

View File

@@ -39,6 +39,7 @@
#include <nvgpu/channel.h>
#include <nvgpu/channel_sync.h>
#include <nvgpu/channel_sync_syncpt.h>
#include <nvgpu/channel_user_syncpt.h>
#include <nvgpu/runlist.h>
#include <nvgpu/gr/ctx.h>
#include <nvgpu/gr/obj_ctx.h>
@@ -1047,7 +1048,6 @@ static int nvgpu_ioctl_channel_get_user_syncpoint(struct nvgpu_channel *ch,
{
#ifdef CONFIG_TEGRA_GK20A_NVHOST
struct gk20a *g = ch->g;
struct nvgpu_channel_sync_syncpt *user_sync_syncpt = NULL;
if (!nvgpu_is_enabled(g, NVGPU_SUPPORT_USER_SYNCPOINT)) {
nvgpu_err(g, "user syncpoints not supported");
@@ -1068,24 +1068,20 @@ static int nvgpu_ioctl_channel_get_user_syncpoint(struct nvgpu_channel *ch,
if (ch->user_sync) {
nvgpu_mutex_release(&ch->sync_lock);
} else {
ch->user_sync = nvgpu_channel_sync_create(ch, true);
ch->user_sync = nvgpu_channel_user_syncpt_create(ch);
if (!ch->user_sync) {
nvgpu_mutex_release(&ch->sync_lock);
return -ENOMEM;
}
nvgpu_mutex_release(&ch->sync_lock);
}
user_sync_syncpt = nvgpu_channel_sync_to_syncpt(ch->user_sync);
if (user_sync_syncpt == NULL) {
return -EINVAL;
}
args->syncpoint_id = nvgpu_channel_sync_get_syncpt_id(user_sync_syncpt);
args->syncpoint_id = nvgpu_channel_user_syncpt_get_id(ch->user_sync);
args->syncpoint_max = nvgpu_nvhost_syncpt_read_maxval(g->nvhost,
args->syncpoint_id);
if (nvgpu_is_enabled(g, NVGPU_SUPPORT_SYNCPOINT_ADDRESS)) {
args->gpu_va =
nvgpu_channel_sync_get_syncpt_address(user_sync_syncpt);
nvgpu_channel_user_syncpt_get_address(ch->user_sync);
} else {
args->gpu_va = 0;
}