diff --git a/drivers/gpu/nvgpu/include/nvgpu/preempt.h b/drivers/gpu/nvgpu/include/nvgpu/preempt.h index 863d6ca44..2cfa7cd38 100644 --- a/drivers/gpu/nvgpu/include/nvgpu/preempt.h +++ b/drivers/gpu/nvgpu/include/nvgpu/preempt.h @@ -24,13 +24,52 @@ #include +/** + * @file + * + * Preemption interface. + */ struct gk20a; struct nvgpu_channel; struct nvgpu_tsg; +/** + * @brief Get preemption timeout (ms). This timeout is defined by s/w. + * + * @param g[in] The GPU driver struct to query preempt timeout for. + * + * @return Maximum amount of time in ms to wait for preemption completion, + * i.e. context non resident on PBDMAs and engines. + */ u32 nvgpu_preempt_get_timeout(struct gk20a *g); + +/** + * @brief Preempts TSG if channel is bound to TSG. + * + * @param g[in] The GPU driver struct which owns this channel. + * @param ch[in] Pointer to channel to be preempted. + * + * Preempts TSG if channel is bound to TSG. Preemption implies that the + * context's state is saved out and also that the context cannot remain parked + * either in Host or in any engine. + * + * After triggering a preempt request for channel's TSG, pbdmas and engines + * are polled to make sure preemption completed, i.e. context is not loaded + * on any pbdma or engine. + * + * @return 0 in case of success, <0 in case of failure + * @retval 0 if channel was not bound to TSG. + * @retval 0 if TSG was not loaded on pbdma or engine. + * @retval 0 if TSG was loaded (pbdma or engine) and could be preempted. + * @retval non-zero value if preemption did not complete within s/w defined + * timeout. + */ int nvgpu_preempt_channel(struct gk20a *g, struct nvgpu_channel *ch); +/** + * Called from recovery handling for volta onwards. This will + * not be part of safety build after recovery is not supported in safety build. + */ void nvgpu_preempt_poll_tsg_on_pbdma(struct gk20a *g, struct nvgpu_tsg *tsg); #endif /* NVGPU_PREEMPT_H */