mirror of
git://nv-tegra.nvidia.com/linux-nvgpu.git
synced 2025-12-24 18:42:29 +03:00
gpu: nvgpu: make os fence headers consistent
Move the sema-specific APIs to the sema-specific os fence header. Do the same for syncpts. Stub out the os fence type and the initialized check if os fence support is not enabled in build time. Guard the sema header with CONFIG_NVGPU_SW_SEMAPHORE. Jira NVGPU-5773 Change-Id: I838debd66a800b00cde76e65458b13eee367b55f Signed-off-by: Konsta Hölttä <kholtta@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2395070 Reviewed-by: automaticguardword <automaticguardword@nvidia.com> Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Deepak Nibade <dnibade@nvidia.com> Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> GVS: Gerrit_Virtual_Submit Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
committed by
Alex Waterman
parent
7aa852b31c
commit
4f85b2b1d4
@@ -25,14 +25,8 @@
|
||||
#ifndef NVGPU_OS_FENCE_H
|
||||
#define NVGPU_OS_FENCE_H
|
||||
|
||||
#include <nvgpu/errno.h>
|
||||
#include <nvgpu/types.h>
|
||||
|
||||
struct nvgpu_semaphore;
|
||||
struct nvgpu_channel;
|
||||
struct priv_cmd_entry;
|
||||
struct nvgpu_nvhost_dev;
|
||||
|
||||
/*
|
||||
* struct nvgpu_os_fence adds an abstraction to the earlier Android Sync
|
||||
* Framework, specifically the sync-fence mechanism and the newer DMA sync
|
||||
@@ -68,6 +62,11 @@ struct nvgpu_os_fence_ops {
|
||||
void (*dup)(struct nvgpu_os_fence *s);
|
||||
};
|
||||
|
||||
#if !defined(CONFIG_NVGPU_SYNCFD_NONE)
|
||||
|
||||
struct gk20a;
|
||||
struct nvgpu_channel;
|
||||
|
||||
/*
|
||||
* The priv field contains the actual backend:
|
||||
* - struct sync_fence for semas on LINUX_VERSION <= 4.14
|
||||
@@ -89,51 +88,21 @@ static inline bool nvgpu_os_fence_is_initialized(struct nvgpu_os_fence *fence)
|
||||
return (fence->ops != NULL);
|
||||
}
|
||||
|
||||
#ifndef CONFIG_NVGPU_SYNCFD_NONE
|
||||
|
||||
int nvgpu_os_fence_sema_create(
|
||||
struct nvgpu_os_fence *fence_out,
|
||||
struct nvgpu_channel *c,
|
||||
struct nvgpu_semaphore *sema);
|
||||
|
||||
int nvgpu_os_fence_fdget(
|
||||
struct nvgpu_os_fence *fence_out,
|
||||
struct nvgpu_channel *c, int fd);
|
||||
|
||||
#else
|
||||
#else /* CONFIG_NVGPU_SYNCFD_NONE */
|
||||
|
||||
static inline int nvgpu_os_fence_sema_create(
|
||||
struct nvgpu_os_fence *fence_out,
|
||||
struct nvgpu_channel *c,
|
||||
struct nvgpu_semaphore *sema)
|
||||
struct nvgpu_os_fence {
|
||||
const struct nvgpu_os_fence_ops *ops;
|
||||
};
|
||||
|
||||
static inline bool nvgpu_os_fence_is_initialized(struct nvgpu_os_fence *fence)
|
||||
{
|
||||
return -ENOSYS;
|
||||
}
|
||||
static inline int nvgpu_os_fence_fdget(
|
||||
struct nvgpu_os_fence *fence_out,
|
||||
struct nvgpu_channel *c, int fd)
|
||||
{
|
||||
return -ENOSYS;
|
||||
return false;
|
||||
}
|
||||
|
||||
#endif /* !CONFIG_NVGPU_SYNCFD_NONE */
|
||||
|
||||
#if defined(CONFIG_TEGRA_GK20A_NVHOST) && !defined(CONFIG_NVGPU_SYNCFD_NONE)
|
||||
|
||||
int nvgpu_os_fence_syncpt_create(struct nvgpu_os_fence *fence_out,
|
||||
struct nvgpu_channel *c, struct nvgpu_nvhost_dev *nvhost_dev,
|
||||
u32 id, u32 thresh);
|
||||
|
||||
#else
|
||||
|
||||
static inline int nvgpu_os_fence_syncpt_create(
|
||||
struct nvgpu_os_fence *fence_out, struct nvgpu_channel *c,
|
||||
struct nvgpu_nvhost_dev *nvhost_dev,
|
||||
u32 id, u32 thresh)
|
||||
{
|
||||
return -ENOSYS;
|
||||
}
|
||||
|
||||
#endif /* CONFIG_TEGRA_GK20A_NVHOST && !CONFIG_NVGPU_SYNCFD_NONE */
|
||||
#endif /* CONFIG_NVGPU_SYNCFD_NONE */
|
||||
|
||||
#endif /* NVGPU_OS_FENCE_H */
|
||||
|
||||
@@ -25,6 +25,8 @@
|
||||
#ifndef NVGPU_OS_FENCE_SEMA_H
|
||||
#define NVGPU_OS_FENCE_SEMA_H
|
||||
|
||||
#include <nvgpu/errno.h>
|
||||
|
||||
struct nvgpu_os_fence;
|
||||
struct nvgpu_semaphore;
|
||||
|
||||
@@ -32,7 +34,13 @@ struct nvgpu_os_fence_sema {
|
||||
struct nvgpu_os_fence *fence;
|
||||
};
|
||||
|
||||
#if !defined(CONFIG_NVGPU_SYNCFD_NONE)
|
||||
#if defined(CONFIG_NVGPU_SW_SEMAPHORE) && !defined(CONFIG_NVGPU_SYNCFD_NONE)
|
||||
|
||||
int nvgpu_os_fence_sema_create(
|
||||
struct nvgpu_os_fence *fence_out,
|
||||
struct nvgpu_channel *c,
|
||||
struct nvgpu_semaphore *sema);
|
||||
|
||||
/*
|
||||
* Return a struct of nvgpu_os_fence_sema only if the underlying os_fence
|
||||
* object is backed by semaphore, else return empty object.
|
||||
@@ -58,7 +66,15 @@ void nvgpu_os_fence_sema_extract_nth_semaphore(
|
||||
u32 nvgpu_os_fence_sema_get_num_semaphores(
|
||||
struct nvgpu_os_fence_sema *fence);
|
||||
|
||||
#else
|
||||
#else /* CONFIG_NVGPU_SW_SEMAPHORE && !CONFIG_NVGPU_SYNCFD_NONE */
|
||||
|
||||
static inline int nvgpu_os_fence_sema_create(
|
||||
struct nvgpu_os_fence *fence_out,
|
||||
struct nvgpu_channel *c,
|
||||
struct nvgpu_semaphore *sema)
|
||||
{
|
||||
return -ENOSYS;
|
||||
}
|
||||
|
||||
static inline int nvgpu_os_fence_get_semas(
|
||||
struct nvgpu_os_fence_sema *fence_sema_out,
|
||||
@@ -79,6 +95,6 @@ static inline u32 nvgpu_os_fence_sema_get_num_semaphores(
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif /* !CONFIG_NVGPU_SYNCFD_NONE */
|
||||
#endif /* CONFIG_NVGPU_SW_SEMAPHORE && !CONFIG_NVGPU_SYNCFD_NONE */
|
||||
|
||||
#endif /* NVGPU_OS_FENCE_SEMAS_H */
|
||||
|
||||
@@ -25,14 +25,22 @@
|
||||
#ifndef NVGPU_OS_FENCE_SYNCPT_H
|
||||
#define NVGPU_OS_FENCE_SYNCPT_H
|
||||
|
||||
#include <nvgpu/errno.h>
|
||||
|
||||
struct nvgpu_os_fence;
|
||||
struct nvhost_ctrl_sync_fence_info;
|
||||
struct nvgpu_nvhost_dev;
|
||||
|
||||
struct nvgpu_os_fence_syncpt {
|
||||
struct nvgpu_os_fence *fence;
|
||||
};
|
||||
|
||||
#if defined(CONFIG_TEGRA_GK20A_NVHOST) && !defined(CONFIG_NVGPU_SYNCFD_NONE)
|
||||
|
||||
int nvgpu_os_fence_syncpt_create(struct nvgpu_os_fence *fence_out,
|
||||
struct nvgpu_channel *c, struct nvgpu_nvhost_dev *nvhost_dev,
|
||||
u32 id, u32 thresh);
|
||||
|
||||
/*
|
||||
* Return a struct of nvgpu_os_fence_syncpt only if the underlying os_fence
|
||||
* object is backed by syncpoints, else return empty object.
|
||||
@@ -59,7 +67,15 @@ int nvgpu_os_fence_syncpt_foreach_pt(
|
||||
u32 nvgpu_os_fence_syncpt_get_num_syncpoints(
|
||||
struct nvgpu_os_fence_syncpt *fence);
|
||||
|
||||
#else
|
||||
#else /* CONFIG_TEGRA_GK20A_NVHOST && !CONFIG_NVGPU_SYNCFD_NONE */
|
||||
|
||||
static inline int nvgpu_os_fence_syncpt_create(
|
||||
struct nvgpu_os_fence *fence_out, struct nvgpu_channel *c,
|
||||
struct nvgpu_nvhost_dev *nvhost_dev,
|
||||
u32 id, u32 thresh)
|
||||
{
|
||||
return -ENOSYS;
|
||||
}
|
||||
|
||||
static inline int nvgpu_os_fence_get_syncpts(
|
||||
struct nvgpu_os_fence_syncpt *fence_syncpt_out,
|
||||
@@ -74,6 +90,6 @@ static inline u32 nvgpu_os_fence_syncpt_get_num_syncpoints(
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif /* CONFIG_TEGRA_GK20A_NVHOST && !CONFIG_NVGPU_SYNCFD_NONE */
|
||||
|
||||
#endif /* NVGPU_OS_FENCE_SYNPT_H */
|
||||
|
||||
Reference in New Issue
Block a user