mirror of
git://nv-tegra.nvidia.com/linux-nvgpu.git
synced 2025-12-22 17:36:20 +03:00
gpu: nvgpu: init: move out linux-specific APIs
The functions nvgpu_warn_on_no_regs() and nvgpu_wait_for_idle() are only used by linux, so move them out of nvgpu.common.init into linux-specific driver code. JIRA NVGPU-2385 Change-Id: Iea38cdb16f9e513d8242c1b07b80171b8b68db5b Signed-off-by: Philip Elcan <pelcan@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/2156459 Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com> Reviewed-by: svc-mobile-misra <svc-mobile-misra@nvidia.com> Reviewed-by: Sagar Kamble <skamble@nvidia.com> GVS: Gerrit_Virtual_Submit Reviewed-by: Alex Waterman <alexw@nvidia.com> Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
committed by
mobile promotions
parent
91187b6db2
commit
b0ad7c0ad2
@@ -74,11 +74,6 @@ void nvgpu_check_gpu_state(struct gk20a *g)
|
||||
}
|
||||
}
|
||||
|
||||
void nvgpu_warn_on_no_regs(void)
|
||||
{
|
||||
WARN_ONCE(true, "Attempted access to GPU regs after unmapping!");
|
||||
}
|
||||
|
||||
static void gk20a_mask_interrupts(struct gk20a *g)
|
||||
{
|
||||
if (g->ops.mc.intr_mask != NULL) {
|
||||
@@ -583,35 +578,6 @@ int nvgpu_can_busy(struct gk20a *g)
|
||||
}
|
||||
}
|
||||
|
||||
int nvgpu_wait_for_idle(struct gk20a *g)
|
||||
{
|
||||
int wait_length = 150; /* 3 second overall max wait. */
|
||||
int target_usage_count = 0;
|
||||
bool done = false;
|
||||
|
||||
if (g == NULL) {
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
do {
|
||||
if (nvgpu_atomic_read(&g->usage_count) == target_usage_count) {
|
||||
done = true;
|
||||
} else if (wait_length-- < 0) {
|
||||
done = true;
|
||||
} else {
|
||||
nvgpu_msleep(20);
|
||||
}
|
||||
} while (!done);
|
||||
|
||||
if (wait_length < 0) {
|
||||
nvgpu_warn(g, "Timed out waiting for idle (%d)!\n",
|
||||
nvgpu_atomic_read(&g->usage_count));
|
||||
return -ETIMEDOUT;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void nvgpu_init_gpu_characteristics(struct gk20a *g)
|
||||
{
|
||||
#ifdef NV_BUILD_CONFIGURATION_IS_SAFETY
|
||||
|
||||
@@ -27,14 +27,12 @@ int nvgpu_finalize_poweron(struct gk20a *g);
|
||||
int nvgpu_prepare_poweroff(struct gk20a *g);
|
||||
|
||||
int nvgpu_can_busy(struct gk20a *g);
|
||||
int nvgpu_wait_for_idle(struct gk20a *g);
|
||||
|
||||
struct gk20a * __must_check nvgpu_get(struct gk20a *g);
|
||||
void nvgpu_put(struct gk20a *g);
|
||||
|
||||
/* register accessors */
|
||||
void nvgpu_check_gpu_state(struct gk20a *g);
|
||||
void nvgpu_warn_on_no_regs(void);
|
||||
|
||||
void nvgpu_init_gpu_characteristics(struct gk20a *g);
|
||||
|
||||
|
||||
@@ -18,6 +18,11 @@
|
||||
|
||||
#include "os_linux.h"
|
||||
|
||||
static void nvgpu_warn_on_no_regs(void)
|
||||
{
|
||||
WARN_ONCE(true, "Attempted access to GPU regs after unmapping!");
|
||||
}
|
||||
|
||||
void nvgpu_writel(struct gk20a *g, u32 r, u32 v)
|
||||
{
|
||||
struct nvgpu_os_linux *l = nvgpu_os_linux_from_gk20a(g);
|
||||
|
||||
@@ -90,6 +90,35 @@
|
||||
#include <trace/events/gk20a.h>
|
||||
#endif
|
||||
|
||||
static int nvgpu_wait_for_idle(struct gk20a *g)
|
||||
{
|
||||
int wait_length = 150; /* 3 second overall max wait. */
|
||||
int target_usage_count = 0;
|
||||
bool done = false;
|
||||
|
||||
if (g == NULL) {
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
do {
|
||||
if (nvgpu_atomic_read(&g->usage_count) == target_usage_count) {
|
||||
done = true;
|
||||
} else if (wait_length-- < 0) {
|
||||
done = true;
|
||||
} else {
|
||||
nvgpu_msleep(20);
|
||||
}
|
||||
} while (!done);
|
||||
|
||||
if (wait_length < 0) {
|
||||
nvgpu_warn(g, "Timed out waiting for idle (%d)!\n",
|
||||
nvgpu_atomic_read(&g->usage_count));
|
||||
return -ETIMEDOUT;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int nvgpu_kernel_shutdown_notification(struct notifier_block *nb,
|
||||
unsigned long event, void *unused)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user