Files
linux-nvgpu/drivers/gpu/nvgpu/os/linux/os_fence_syncpt.c
Jon Hunter 261d4bed13 gpu: nvgpu: Enable -Wmissing-prototypes
The compiler option -Wmissing-prototypes is being enabled globally in
the upstream Linux kernel and this causes build failures for nvgpu. The
build failures occur because either the driver is missing an include
file which has the prototype or because the function is not declared
statically when it should be (ie. there are no external users).

Fix the various build failures and enable -Wmissing-prototypes to
prevent any new instances from occurring.

Bug 4404965

Change-Id: I551922836e37b0c94c158232d6277f4053e9d2d3
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/3027483
(cherry picked from commit e8cbf90db2d0db7277db9e3eec9fb88d69c7fcc7)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/3035518
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-12-15 14:09:44 -08:00

109 lines
2.6 KiB
C

// SPDX-License-Identifier: GPL-2.0-only
// SPDX-FileCopyrightText: Copyright (c) 2018-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#if !defined(CONFIG_TEGRA_GK20A_NVHOST_HOST1X)
#include <uapi/linux/nvhost_ioctl.h>
#endif
#include <linux/err.h>
#include <nvgpu/errno.h>
#include <nvgpu/types.h>
#include <nvgpu/os_fence.h>
#include <nvgpu/os_fence_syncpts.h>
#include <nvgpu/nvhost.h>
#include <nvgpu/atomic.h>
#include <nvgpu/gk20a.h>
#include <nvgpu/channel.h>
#include <nvgpu/channel_sync.h>
#include <nvgpu/linux/os_fence_dma.h>
#include "os_fence_priv.h"
#include "nvhost_priv.h"
static int nvgpu_os_fence_syncpt_install_fd(struct nvgpu_os_fence *s,
int fd)
{
return nvgpu_nvhost_fence_install(s->priv, fd);
}
static void nvgpu_os_fence_syncpt_drop_ref(struct nvgpu_os_fence *s)
{
nvgpu_nvhost_fence_put(s->priv);
nvgpu_os_fence_clear(s);
}
static void nvgpu_os_fence_syncpt_dup(struct nvgpu_os_fence *s)
{
nvgpu_nvhost_fence_dup(s->priv);
}
static const struct nvgpu_os_fence_ops syncpt_ops = {
.drop_ref = nvgpu_os_fence_syncpt_drop_ref,
.install_fence = nvgpu_os_fence_syncpt_install_fd,
.dup = nvgpu_os_fence_syncpt_dup,
};
int nvgpu_os_fence_syncpt_create(struct nvgpu_os_fence *fence_out,
struct nvgpu_channel *c, struct nvgpu_nvhost_dev *nvhost_device,
u32 id, u32 thresh)
{
struct nvhost_ctrl_sync_fence_info pt = {
.id = id,
.thresh = thresh,
};
struct nvhost_fence *fence;
fence = nvgpu_nvhost_fence_create(nvhost_device->host1x_pdev, &pt, 1,
"fence");
if (IS_ERR(fence)) {
nvgpu_err(c->g, "error %d during construction of fence.",
(int)PTR_ERR(fence));
return PTR_ERR(fence);
}
nvgpu_os_fence_init(fence_out, c->g, &syncpt_ops, fence);
return 0;
}
int nvgpu_os_fence_syncpt_fdget(struct nvgpu_os_fence *fence_out,
struct nvgpu_channel *c, int fd)
{
struct nvhost_fence *fence = nvgpu_nvhost_fence_get(fd);
if (fence == NULL) {
return -ENOMEM;
}
nvgpu_os_fence_init(fence_out, c->g, &syncpt_ops, fence);
return 0;
}
int nvgpu_os_fence_get_syncpts(
struct nvgpu_os_fence_syncpt *fence_syncpt_out,
struct nvgpu_os_fence *fence_in)
{
if (fence_in->ops != &syncpt_ops) {
return -EINVAL;
}
fence_syncpt_out->fence = fence_in;
return 0;
}
u32 nvgpu_os_fence_syncpt_get_num_syncpoints(
struct nvgpu_os_fence_syncpt *fence)
{
return nvgpu_nvhost_fence_num_pts(fence->fence->priv);
}
int nvgpu_os_fence_syncpt_foreach_pt(struct nvgpu_os_fence_syncpt *fence,
int (*iter)(struct nvhost_ctrl_sync_fence_info, void *),
void *data)
{
return nvgpu_nvhost_fence_foreach_pt(fence->fence->priv, iter, data);
}