diff --git a/drivers/gpu/nvgpu/include/nvgpu/channel_sync.h b/drivers/gpu/nvgpu/include/nvgpu/channel_sync.h index 68e676057..bb8714eb5 100644 --- a/drivers/gpu/nvgpu/include/nvgpu/channel_sync.h +++ b/drivers/gpu/nvgpu/include/nvgpu/channel_sync.h @@ -87,27 +87,53 @@ void nvgpu_channel_sync_get_ref(struct nvgpu_channel_sync *s); bool nvgpu_channel_sync_put_ref_and_check(struct nvgpu_channel_sync *s); #endif /* CONFIG_NVGPU_KERNEL_MODE_SUBMIT */ -/* - * Set the channel syncpoint/semaphore to safe state +/** + * @brief Set the channel syncpoint/semaphore to safe state + * + * @param sync [in] Pointer to syncpoint/semaphore. + * * This should be used to reset User managed syncpoint since we don't * track threshold values for those syncpoints */ void nvgpu_channel_sync_set_safe_state(struct nvgpu_channel_sync *s); -/* +/** + * @brief Free channel syncpoint/semaphore + * + * @param sync [in] Pointer to syncpoint/semaphore. + * * Free the resources allocated by nvgpu_channel_sync_create. */ void nvgpu_channel_sync_destroy(struct nvgpu_channel_sync *sync, bool set_safe_state); -/* +/** + * @brief Create channel syncpoint/semaphore + * + * @param c [in] Pointer to Channel. + * @param user_managed [in] True is syncpoint is user managed. + * * Construct a channel_sync backed by either a syncpoint or a semaphore. * A channel_sync is by default constructed as backed by a syncpoint * if CONFIG_TEGRA_GK20A_NVHOST is defined, otherwise the channel_sync * is constructed as backed by a semaphore. + * + * @return Pointer to nvgpu_channel_sync in case of success, or NULL + * in case of failure. */ struct nvgpu_channel_sync *nvgpu_channel_sync_create(struct nvgpu_channel *c, bool user_managed); + +/** + * @brief Check if OS fence framwework is needed + * + * @param g [in] Pointer to GPU + * + * Sync framework requires deferred job cleanup, wrapping syncs in FDs, + * and other heavy stuff, which prevents deterministic submits. + * + * @return True is OS fence framework is needed. + */ bool nvgpu_channel_sync_needs_os_fence_framework(struct gk20a *g); #endif /* NVGPU_CHANNEL_SYNC_H */ diff --git a/drivers/gpu/nvgpu/include/nvgpu/channel_sync_syncpt.h b/drivers/gpu/nvgpu/include/nvgpu/channel_sync_syncpt.h index d5ea30209..5aa3eb185 100644 --- a/drivers/gpu/nvgpu/include/nvgpu/channel_sync_syncpt.h +++ b/drivers/gpu/nvgpu/include/nvgpu/channel_sync_syncpt.h @@ -39,13 +39,24 @@ struct priv_cmd_entry; #ifdef CONFIG_TEGRA_GK20A_NVHOST -/* - * Returns the sync point id or negative number if no syncpt +/** + * @brief Get syncpoint id + * + * @param s [in] Syncpoint pointer. + * + * @return Syncpoint id of \a s. */ u32 nvgpu_channel_sync_get_syncpt_id(struct nvgpu_channel_sync_syncpt *s); -/* - * Returns the sync point address of sync point or 0 if not supported +/** + * @brief Get syncpoint address + * + * @param s [in] Syncpoint pointer. + * + * Get syncpoint GPU VA. This address can be used in push buffer entries + * for acquire/release operations. + * + * @return Syncpoint address (GPU VA) of syncpoint or 0 if not supported */ u64 nvgpu_channel_sync_get_syncpt_address(struct nvgpu_channel_sync_syncpt *s); @@ -58,16 +69,29 @@ int nvgpu_channel_sync_wait_syncpt(struct nvgpu_channel_sync_syncpt *s, u32 id, u32 thresh, struct priv_cmd_entry *entry); #endif -/* - * Converts a valid struct nvgpu_channel_sync ptr to - * struct nvgpu_channel_sync_syncpt ptr else return NULL. +/** + * @brief Get syncpoint from sync operations + * + * @param sync [in] Pointer to sync operations. + * + * Converts a valid struct nvgpu_channel_sync pointer \a sync to + * struct nvgpu_channel_sync_syncpt pointer else return NULL + * + * @return Pointer to syncpoint, if sync is backed by a syncpoint. + * @retval NULL if sync is backed by a sempahore. */ struct nvgpu_channel_sync_syncpt * nvgpu_channel_sync_to_syncpt(struct nvgpu_channel_sync *sync); -/* - * Constructs a struct nvgpu_channel_sync_syncpt and returns a - * pointer to the struct nvgpu_channel_sync associated with it. +/** + * @brief Create syncpoint. + * + * @param c [in] Pointer to channel. + * @param user_managed [in] True is syncpoint is managed by client. + * + * Constructs a struct nvgpu_channel_sync_syncpt. + * + * @return Pointer to nvgpu_channel_sync associated with created syncpoint. */ struct nvgpu_channel_sync * nvgpu_channel_sync_syncpt_create(struct nvgpu_channel *c, diff --git a/drivers/gpu/nvgpu/include/nvgpu/fifo.h b/drivers/gpu/nvgpu/include/nvgpu/fifo.h index 285d63b8e..a37e859fa 100644 --- a/drivers/gpu/nvgpu/include/nvgpu/fifo.h +++ b/drivers/gpu/nvgpu/include/nvgpu/fifo.h @@ -108,6 +108,8 @@ * Sync * ---- * + * + include/nvgpu/channel_sync.h + * + include/nvgpu/channel_sync_syncpt.h * + include/nvgpu/gops_sync.h * * Usermode