mirror of
git://nv-tegra.nvidia.com/linux-nvgpu.git
synced 2025-12-25 11:04:51 +03:00
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:
committed by
Alex Waterman
parent
b813adbf49
commit
4f80c6b8a9
@@ -357,6 +357,8 @@ struct nvgpu_channel_ref_action {
|
||||
};
|
||||
#endif
|
||||
|
||||
struct nvgpu_channel_user_syncpt;
|
||||
|
||||
/** Channel context */
|
||||
struct nvgpu_channel {
|
||||
/** Pointer to GPU context. Set only when channel is active. */
|
||||
@@ -481,8 +483,10 @@ struct nvgpu_channel {
|
||||
|
||||
/** Syncpoint lock to allocate fences. */
|
||||
struct nvgpu_mutex sync_lock;
|
||||
#ifdef CONFIG_TEGRA_GK20A_NVHOST
|
||||
/** Syncpoint for usermode submit case. */
|
||||
struct nvgpu_channel_sync *user_sync;
|
||||
struct nvgpu_channel_user_syncpt *user_sync;
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_NVGPU_GR_VIRTUALIZATION
|
||||
/** Channel handle for vgpu case. */
|
||||
|
||||
@@ -111,7 +111,6 @@ void nvgpu_channel_sync_destroy(struct nvgpu_channel_sync *sync,
|
||||
* @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
|
||||
@@ -121,8 +120,7 @@ void nvgpu_channel_sync_destroy(struct nvgpu_channel_sync *sync,
|
||||
* @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);
|
||||
struct nvgpu_channel_sync *nvgpu_channel_sync_create(struct nvgpu_channel *c);
|
||||
|
||||
/**
|
||||
* @brief Check if OS fence framwework is needed
|
||||
|
||||
@@ -45,8 +45,7 @@ nvgpu_channel_sync_to_semaphore(struct nvgpu_channel_sync *sync);
|
||||
* returns a pointer to the struct nvgpu_channel_sync associated with it.
|
||||
*/
|
||||
struct nvgpu_channel_sync *
|
||||
nvgpu_channel_sync_semaphore_create(
|
||||
struct nvgpu_channel *c, bool user_managed);
|
||||
nvgpu_channel_sync_semaphore_create(struct nvgpu_channel *c);
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -87,15 +87,13 @@ nvgpu_channel_sync_to_syncpt(struct nvgpu_channel_sync *sync);
|
||||
* @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,
|
||||
bool user_managed);
|
||||
nvgpu_channel_sync_syncpt_create(struct nvgpu_channel *c);
|
||||
|
||||
#else
|
||||
|
||||
@@ -124,7 +122,7 @@ nvgpu_channel_sync_to_syncpt(struct nvgpu_channel_sync *sync)
|
||||
}
|
||||
|
||||
static inline struct nvgpu_channel_sync *
|
||||
nvgpu_channel_sync_syncpt_create(struct nvgpu_channel *c, bool user_managed)
|
||||
nvgpu_channel_sync_syncpt_create(struct nvgpu_channel *c)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
89
drivers/gpu/nvgpu/include/nvgpu/channel_user_syncpt.h
Normal file
89
drivers/gpu/nvgpu/include/nvgpu/channel_user_syncpt.h
Normal file
@@ -0,0 +1,89 @@
|
||||
/*
|
||||
* Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef NVGPU_USER_SYNC_H
|
||||
#define NVGPU_USER_SYNC_H
|
||||
|
||||
#ifdef CONFIG_TEGRA_GK20A_NVHOST
|
||||
|
||||
#include <nvgpu/types.h>
|
||||
|
||||
struct nvgpu_channel;
|
||||
struct nvgpu_channel_user_syncpt;
|
||||
|
||||
/**
|
||||
* @brief Create user syncpoint for a channel.
|
||||
*
|
||||
* @param c [in] Pointer to Channel.
|
||||
*
|
||||
* Construct a nvgpu_channel_user_syncpt that represents a syncpoint allocation
|
||||
* to be managed by userspace in conjunction with usermode submits.
|
||||
*
|
||||
* @return Pointer to nvgpu_channel_user_syncpt in case of success, or NULL in
|
||||
* case of failure.
|
||||
*/
|
||||
struct nvgpu_channel_user_syncpt *
|
||||
nvgpu_channel_user_syncpt_create(struct nvgpu_channel *ch);
|
||||
|
||||
/**
|
||||
* @brief Get user syncpoint id
|
||||
*
|
||||
* @param s [in] User syncpoint pointer.
|
||||
*
|
||||
* @return Syncpoint id of \a s.
|
||||
*/
|
||||
u32 nvgpu_channel_user_syncpt_get_id(struct nvgpu_channel_user_syncpt *s);
|
||||
|
||||
/**
|
||||
* @brief Get user syncpoint address
|
||||
*
|
||||
* @param s [in] User 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_user_syncpt_get_address(struct nvgpu_channel_user_syncpt *s);
|
||||
|
||||
/**
|
||||
* @brief Set the user syncpoint to safe state
|
||||
*
|
||||
* @param s [in] User syncpoint pointer.
|
||||
*
|
||||
* This should be used to reset user managed syncpoint since we don't track
|
||||
* threshold values for those syncpoints
|
||||
*/
|
||||
void nvgpu_channel_user_syncpt_set_safe_state(struct nvgpu_channel_user_syncpt *s);
|
||||
|
||||
/**
|
||||
* @brief Free user syncpoint
|
||||
*
|
||||
* @param s [in] User syncpoint pointer.
|
||||
*
|
||||
* Free the resources allocated by nvgpu_channel_user_syncpt_create.
|
||||
*/
|
||||
void nvgpu_channel_user_syncpt_destroy(struct nvgpu_channel_user_syncpt *s);
|
||||
|
||||
#endif /* CONFIG_TEGRA_GK20A_NVHOST */
|
||||
|
||||
#endif /* NVGPU_USER_SYNC_H */
|
||||
Reference in New Issue
Block a user