diff --git a/drivers/gpu/nvgpu/common/debugger.c b/drivers/gpu/nvgpu/common/debugger.c index f71ced7f3..f5e5046a3 100644 --- a/drivers/gpu/nvgpu/common/debugger.c +++ b/drivers/gpu/nvgpu/common/debugger.c @@ -33,6 +33,7 @@ #include #include #include +#include #include #include diff --git a/drivers/gpu/nvgpu/common/fifo/channel.c b/drivers/gpu/nvgpu/common/fifo/channel.c index dde65acf2..bcfa3109a 100644 --- a/drivers/gpu/nvgpu/common/fifo/channel.c +++ b/drivers/gpu/nvgpu/common/fifo/channel.c @@ -46,6 +46,7 @@ #include #include #include +#include #include #include #include diff --git a/drivers/gpu/nvgpu/common/fifo/submit.c b/drivers/gpu/nvgpu/common/fifo/submit.c index 24583af8a..ebb541f03 100644 --- a/drivers/gpu/nvgpu/common/fifo/submit.c +++ b/drivers/gpu/nvgpu/common/fifo/submit.c @@ -21,6 +21,7 @@ */ #include +#include #include #include #include diff --git a/drivers/gpu/nvgpu/common/gr/fecs_trace.c b/drivers/gpu/nvgpu/common/gr/fecs_trace.c index b27f22b8f..5f99c16bc 100644 --- a/drivers/gpu/nvgpu/common/gr/fecs_trace.c +++ b/drivers/gpu/nvgpu/common/gr/fecs_trace.c @@ -21,6 +21,7 @@ */ #include +#include #include #include #include diff --git a/drivers/gpu/nvgpu/common/perf/perfbuf.c b/drivers/gpu/nvgpu/common/perf/perfbuf.c index 8c2e0b2f3..e33448b23 100644 --- a/drivers/gpu/nvgpu/common/perf/perfbuf.c +++ b/drivers/gpu/nvgpu/common/perf/perfbuf.c @@ -24,6 +24,7 @@ #include #include #include +#include int nvgpu_perfbuf_enable_locked(struct gk20a *g, u64 offset, u32 size) { diff --git a/drivers/gpu/nvgpu/common/pmu/perfmon/pmu_perfmon.c b/drivers/gpu/nvgpu/common/pmu/perfmon/pmu_perfmon.c index 29b07b958..3c363d602 100644 --- a/drivers/gpu/nvgpu/common/pmu/perfmon/pmu_perfmon.c +++ b/drivers/gpu/nvgpu/common/pmu/perfmon/pmu_perfmon.c @@ -22,6 +22,7 @@ #include #include +#include #include #include #include diff --git a/drivers/gpu/nvgpu/common/ptimer/ptimer.c b/drivers/gpu/nvgpu/common/ptimer/ptimer.c index e1078eeb8..fa0af217a 100644 --- a/drivers/gpu/nvgpu/common/ptimer/ptimer.c +++ b/drivers/gpu/nvgpu/common/ptimer/ptimer.c @@ -24,6 +24,7 @@ #include #include #include +#include int nvgpu_get_timestamps_zipper(struct gk20a *g, u32 source_id, u32 count, diff --git a/drivers/gpu/nvgpu/hal/clk/clk_gm20b.c b/drivers/gpu/nvgpu/hal/clk/clk_gm20b.c index a4e51b303..5bf84a120 100644 --- a/drivers/gpu/nvgpu/hal/clk/clk_gm20b.c +++ b/drivers/gpu/nvgpu/hal/clk/clk_gm20b.c @@ -31,6 +31,7 @@ #include #include #include +#include #include #include diff --git a/drivers/gpu/nvgpu/hal/mm/cache/flush_gk20a.c b/drivers/gpu/nvgpu/hal/mm/cache/flush_gk20a.c index 7b1bb0c1c..b9aabb4ff 100644 --- a/drivers/gpu/nvgpu/hal/mm/cache/flush_gk20a.c +++ b/drivers/gpu/nvgpu/hal/mm/cache/flush_gk20a.c @@ -27,6 +27,7 @@ #include #include #include +#include #include #include diff --git a/drivers/gpu/nvgpu/hal/mm/cache/flush_gk20a_fusa.c b/drivers/gpu/nvgpu/hal/mm/cache/flush_gk20a_fusa.c index 107749d6b..fd4338a05 100644 --- a/drivers/gpu/nvgpu/hal/mm/cache/flush_gk20a_fusa.c +++ b/drivers/gpu/nvgpu/hal/mm/cache/flush_gk20a_fusa.c @@ -27,6 +27,7 @@ #include #include #include +#include #include #include diff --git a/drivers/gpu/nvgpu/include/nvgpu/gk20a.h b/drivers/gpu/nvgpu/include/nvgpu/gk20a.h index 87b8ba1f4..4d406d276 100644 --- a/drivers/gpu/nvgpu/include/nvgpu/gk20a.h +++ b/drivers/gpu/nvgpu/include/nvgpu/gk20a.h @@ -39,6 +39,7 @@ * - @ref unit-devctl * - @ref unit-sdl * - @ref unit-init + * - @ref unit-qnx_init * - @ref unit-falcon * - @ref unit-os_utils * - @ref unit-acr @@ -2329,10 +2330,6 @@ bool is_nvgpu_gpu_state_valid(struct gk20a *g); #define GK20A_BAR1_IORESOURCE_MEM 1U #define GK20A_SIM_IORESOURCE_MEM 2U -void gk20a_busy_noresume(struct gk20a *g); -void gk20a_idle_nosuspend(struct gk20a *g); -int __must_check gk20a_busy(struct gk20a *g); -void gk20a_idle(struct gk20a *g); #ifdef CONFIG_PM int gk20a_do_idle_impl(struct gk20a *g, bool force_reset); int gk20a_do_unidle_impl(struct gk20a *g); diff --git a/drivers/gpu/nvgpu/include/nvgpu/nvgpu_init.h b/drivers/gpu/nvgpu/include/nvgpu/nvgpu_init.h index ca20af9fa..a015d1061 100644 --- a/drivers/gpu/nvgpu/include/nvgpu/nvgpu_init.h +++ b/drivers/gpu/nvgpu/include/nvgpu/nvgpu_init.h @@ -163,7 +163,7 @@ int nvgpu_can_busy(struct gk20a *g); * * @return pointer to g if successful, otherwise 0. */ -struct gk20a * __must_check nvgpu_get(struct gk20a *g); +struct gk20a * nvgpu_get(struct gk20a *g); /** * @brief Decrement ref count on driver. @@ -192,4 +192,41 @@ void nvgpu_check_gpu_state(struct gk20a *g); */ void nvgpu_init_gpu_characteristics(struct gk20a *g); +/** + * @brief Takes a reference for keeping gpu busy but not try to initialize it. + * Does nothing for safety. + * + * @param g [in] The GPU + */ +void gk20a_busy_noresume(struct gk20a *g); + +/** + * @brief Drops a reference for gpu. Does nothing for safety. + * + * @param g [in] The GPU + */ +void gk20a_idle_nosuspend(struct gk20a *g); + +/** + * @brief Takes a reference for keeping gpu busy and initialize it if this is + * first reference. Also, takes a power ref if power saving is supported. On + * safety it just checks if GPU is in usable state. + * + * @param g [in] The GPU + * + * @return 0 in case of success, -ENODEV in case of failure. + * + * This is called mostly by the devctl path to check if proceeding further is + * allowed or not. + */ +int gk20a_busy(struct gk20a *g); + +/** + * @brief Drops a reference for gpu, put on idle if power saving is supported + * and power ref goes to 0. Does nothing for safety. + * + * @param g [in] The GPU + */ +void gk20a_idle(struct gk20a *g); + #endif /* NVGPU_INIT_H */ diff --git a/drivers/gpu/nvgpu/os/linux/cde.c b/drivers/gpu/nvgpu/os/linux/cde.c index 11b07dad9..d80cac12c 100644 --- a/drivers/gpu/nvgpu/os/linux/cde.c +++ b/drivers/gpu/nvgpu/os/linux/cde.c @@ -40,6 +40,7 @@ #include #include #include +#include #include #include diff --git a/drivers/gpu/nvgpu/os/linux/debug_bios.c b/drivers/gpu/nvgpu/os/linux/debug_bios.c index b6d4771e8..44c4e267a 100644 --- a/drivers/gpu/nvgpu/os/linux/debug_bios.c +++ b/drivers/gpu/nvgpu/os/linux/debug_bios.c @@ -13,6 +13,7 @@ */ #include +#include #include "debug_bios.h" #include "os_linux.h" diff --git a/drivers/gpu/nvgpu/os/linux/debug_fecs_trace.c b/drivers/gpu/nvgpu/os/linux/debug_fecs_trace.c index 05e1da9de..3af32bb23 100644 --- a/drivers/gpu/nvgpu/os/linux/debug_fecs_trace.c +++ b/drivers/gpu/nvgpu/os/linux/debug_fecs_trace.c @@ -17,6 +17,7 @@ #include #include +#include #include "os_linux.h" diff --git a/drivers/gpu/nvgpu/os/linux/debug_ltc.c b/drivers/gpu/nvgpu/os/linux/debug_ltc.c index 0608adbda..5cbb3490f 100644 --- a/drivers/gpu/nvgpu/os/linux/debug_ltc.c +++ b/drivers/gpu/nvgpu/os/linux/debug_ltc.c @@ -16,6 +16,7 @@ #include "os_linux.h" #include +#include #include #include diff --git a/drivers/gpu/nvgpu/os/linux/debug_pmu.c b/drivers/gpu/nvgpu/os/linux/debug_pmu.c index ae98f6f5e..948da8bfa 100644 --- a/drivers/gpu/nvgpu/os/linux/debug_pmu.c +++ b/drivers/gpu/nvgpu/os/linux/debug_pmu.c @@ -17,6 +17,7 @@ #include #include #include +#include #include "debug_pmu.h" #include "os_linux.h" diff --git a/drivers/gpu/nvgpu/os/linux/debug_sched.c b/drivers/gpu/nvgpu/os/linux/debug_sched.c index 5b7cbddfd..2b6669cb3 100644 --- a/drivers/gpu/nvgpu/os/linux/debug_sched.c +++ b/drivers/gpu/nvgpu/os/linux/debug_sched.c @@ -14,6 +14,7 @@ #include "debug_sched.h" #include "os_linux.h" +#include #include #include diff --git a/drivers/gpu/nvgpu/os/linux/ioctl_as.c b/drivers/gpu/nvgpu/os/linux/ioctl_as.c index fd904267c..15a683aa9 100644 --- a/drivers/gpu/nvgpu/os/linux/ioctl_as.c +++ b/drivers/gpu/nvgpu/os/linux/ioctl_as.c @@ -27,6 +27,7 @@ #include #include #include +#include #include #include diff --git a/drivers/gpu/nvgpu/os/linux/sysfs.c b/drivers/gpu/nvgpu/os/linux/sysfs.c index 98c86f9c9..25c4d8d28 100644 --- a/drivers/gpu/nvgpu/os/linux/sysfs.c +++ b/drivers/gpu/nvgpu/os/linux/sysfs.c @@ -33,6 +33,7 @@ #include #include #include +#include #include "os_linux.h" #include "sysfs.h"