#include "mali_kbase_js_defs.h"
#include "mali_kbase_js_policy.h"
+#include "mali_kbase_context.h"
#include "mali_kbase_defs.h"
#include "mali_kbase_debug.h"
*
* The following locking conditions are made on the caller:
* - it must \em not hold kbasep_js_kctx_info::ctx::jsctx_mutex.
- * - it must \em not hold kbasep_js_device_data::runpool_irq::lock (as this will be
- * obtained internally)
+ * - it must \em not hold hwaccess_lock (as this will be obtained internally)
* - it must \em not hold kbasep_js_device_data::runpool_mutex (as this will be
* obtained internally)
* - it must \em not hold kbasep_jd_device_data::queue_mutex (again, it's used internally).
*
* The following locking conditions are made on the caller:
* - it must hold kbasep_js_kctx_info::ctx::jsctx_mutex.
- * - it must \em not hold the kbasep_js_device_data::runpool_irq::lock, (as this will be
- * obtained internally)
+ * - it must \em not hold the hwaccess_lock, (as this will be obtained
+ * internally)
* - it must \em not hold kbasep_js_device_data::runpool_mutex (as this could be
* obtained internally)
*
* @note This function can safely be called from IRQ context.
*
* The following locking conditions are made on the caller:
- * - it must \em not hold the kbasep_js_device_data::runpool_irq::lock, because
- * it will be used internally.
+ * - it must \em not hold the hwaccess_lock, because it will be used internally.
*
* @return value != false if the retain succeeded, and the context will not be scheduled out.
* @return false if the retain failed (because the context is being/has been scheduled out).
* @note This function can safely be called from IRQ context.
*
* The following locks must be held by the caller:
- * - kbasep_js_device_data::runpool_irq::lock
+ * - hwaccess_lock
*
* @return value != false if the retain succeeded, and the context will not be scheduled out.
* @return false if the retain failed (because the context is being/has been scheduled out).
* @note This function can safely be called from IRQ context.
*
* The following locking conditions are made on the caller:
- * - it must \em not hold the kbasep_js_device_data::runpoool_irq::lock, because
- * it will be used internally. If the runpool_irq::lock is already held, then
- * the caller should use kbasep_js_runpool_lookup_ctx_nolock() instead.
+ * - it must \em not hold the hwaccess_lock, because it will be used internally.
+ * If the hwaccess_lock is already held, then the caller should use
+ * kbasep_js_runpool_lookup_ctx_nolock() instead.
*
* @return a valid struct kbase_context on success, which has been refcounted as being busy.
* @return NULL on failure, indicating that no context was found in \a as_nr
* Note: This function can safely be called from IRQ context.
*
* The following locking conditions are made on the caller:
- * - it must the kbasep_js_device_data::runpoool_irq::lock.
+ * - it must the hold the hwaccess_lock
*
* Return: a valid struct kbase_context on success, which has been refcounted as
* being busy.
* scheduled, or that already has a zero refcount.
*
* The following locking conditions are made on the caller:
- * - it must \em not hold the kbasep_js_device_data::runpool_irq::lock, because
- * it will be used internally.
+ * - it must \em not hold the hwaccess_lock, because it will be used internally.
* - it must \em not hold kbasep_js_kctx_info::ctx::jsctx_mutex.
* - it must \em not hold kbasep_js_device_data::runpool_mutex (as this will be
* obtained internally)
- * - it must \em not hold the kbase_device::as[n].transaction_mutex (as this will be obtained internally)
+ * - it must \em not hold the kbase_device::mmu_hw_mutex (as this will be
+ * obtained internally)
* - it must \em not hold kbasep_jd_device_data::queue_mutex (as this will be
* obtained internally)
*
* kbasep_js_release_privileged_ctx is called).
*
* The following locking conditions are made on the caller:
- * - it must \em not hold the kbasep_js_device_data::runpool_irq::lock, because
- * it will be used internally.
+ * - it must \em not hold the hwaccess_lock, because it will be used internally.
* - it must \em not hold kbasep_js_device_data::runpool_mutex (as this will be
* obtained internally)
- * - it must \em not hold the kbase_device::as[n].transaction_mutex (as this will be obtained internally)
+ * - it must \em not hold the kbase_device::mmu_hw_mutex (as this will be
+ * obtained internally)
* - it must \em not hold kbasep_jd_device_data::queue_mutex (again, it's used internally).
* - it must \em not hold kbasep_js_kctx_info::ctx::jsctx_mutex, because it will
* be used internally.
* See kbasep_js_runpool_release_ctx for potential side effects.
*
* The following locking conditions are made on the caller:
- * - it must \em not hold the kbasep_js_device_data::runpool_irq::lock, because
- * it will be used internally.
+ * - it must \em not hold the hwaccess_lock, because it will be used internally.
* - it must \em not hold kbasep_js_kctx_info::ctx::jsctx_mutex.
* - it must \em not hold kbasep_js_device_data::runpool_mutex (as this will be
* obtained internally)
- * - it must \em not hold the kbase_device::as[n].transaction_mutex (as this will be obtained internally)
+ * - it must \em not hold the kbase_device::mmu_hw_mutex (as this will be
+ * obtained internally)
*
*/
void kbasep_js_release_privileged_ctx(struct kbase_device *kbdev, struct kbase_context *kctx);
*
* The following locks may be used:
* - kbasep_js_device_data::runpool_mutex
- * - kbasep_js_device_data::runpool_irq::lock
+ * - hwaccess_lock
*/
void kbase_js_try_run_jobs(struct kbase_device *kbdev);
*
* @param[in] katom Pointer to the atom to complete
* @param[in] end_timestamp The time that the atom completed (may be NULL)
+ *
+ * Return: Atom that has now been unblocked and can now be run, or NULL if none
*/
-void kbase_js_complete_atom(struct kbase_jd_atom *katom,
+struct kbase_jd_atom *kbase_js_complete_atom(struct kbase_jd_atom *katom,
ktime_t *end_timestamp);
/**
*
* As with any bool, never test the return value with true.
*
- * The caller must hold kbasep_js_device_data::runpool_irq::lock.
+ * The caller must hold hwaccess_lock.
*/
static inline bool kbasep_js_is_submit_allowed(struct kbasep_js_device_data *js_devdata, struct kbase_context *kctx)
{
/* Ensure context really is scheduled in */
KBASE_DEBUG_ASSERT(kctx->as_nr != KBASEP_AS_NR_INVALID);
- KBASE_DEBUG_ASSERT(kctx->jctx.sched_info.ctx.is_scheduled);
+ KBASE_DEBUG_ASSERT(kbase_ctx_flag(kctx, KCTX_SCHEDULED));
test_bit = (u16) (1u << kctx->as_nr);
* The purpose of this abstraction is to hide the underlying data size, and wrap up
* the long repeated line of code.
*
- * The caller must hold kbasep_js_device_data::runpool_irq::lock.
+ * The caller must hold hwaccess_lock.
*/
static inline void kbasep_js_set_submit_allowed(struct kbasep_js_device_data *js_devdata, struct kbase_context *kctx)
{
/* Ensure context really is scheduled in */
KBASE_DEBUG_ASSERT(kctx->as_nr != KBASEP_AS_NR_INVALID);
- KBASE_DEBUG_ASSERT(kctx->jctx.sched_info.ctx.is_scheduled);
+ KBASE_DEBUG_ASSERT(kbase_ctx_flag(kctx, KCTX_SCHEDULED));
set_bit = (u16) (1u << kctx->as_nr);
* The purpose of this abstraction is to hide the underlying data size, and wrap up
* the long repeated line of code.
*
- * The caller must hold kbasep_js_device_data::runpool_irq::lock.
+ * The caller must hold hwaccess_lock.
*/
static inline void kbasep_js_clear_submit_allowed(struct kbasep_js_device_data *js_devdata, struct kbase_context *kctx)
{
/* Ensure context really is scheduled in */
KBASE_DEBUG_ASSERT(kctx->as_nr != KBASEP_AS_NR_INVALID);
- KBASE_DEBUG_ASSERT(kctx->jctx.sched_info.ctx.is_scheduled);
+ KBASE_DEBUG_ASSERT(kbase_ctx_flag(kctx, KCTX_SCHEDULED));
clear_bit = (u16) (1u << kctx->as_nr);
clear_mask = ~clear_bit;
/**
* Debug Check the refcount of a context. Only use within ASSERTs
*
- * Obtains kbasep_js_device_data::runpool_irq::lock
+ * Obtains hwaccess_lock
*
* @return negative value if the context is not scheduled in
* @return current refcount of the context if it is scheduled in. The refcount
KBASE_DEBUG_ASSERT(kctx != NULL);
js_devdata = &kbdev->js_data;
- spin_lock_irqsave(&js_devdata->runpool_irq.lock, flags);
+ spin_lock_irqsave(&kbdev->hwaccess_lock, flags);
as_nr = kctx->as_nr;
if (as_nr != KBASEP_AS_NR_INVALID)
result = js_devdata->runpool_irq.per_as_data[as_nr].as_busy_refcount;
- spin_unlock_irqrestore(&js_devdata->runpool_irq.lock, flags);
+ spin_unlock_irqrestore(&kbdev->hwaccess_lock, flags);
return result;
}
* when there is no ctx in \a as_nr (NULL returned).
*
* The following locking conditions are made on the caller:
- * - it must \em not hold the kbasep_js_device_data::runpoool_irq::lock, because
- * it will be used internally.
+ * - it must \em not hold the hwaccess_lock, because it will be used internally.
*
* @return a valid struct kbase_context on success, with a refcount that is guarenteed
* to be non-zero and unmodified by this function.
js_devdata = &kbdev->js_data;
js_per_as_data = &js_devdata->runpool_irq.per_as_data[as_nr];
- spin_lock_irqsave(&js_devdata->runpool_irq.lock, flags);
+ spin_lock_irqsave(&kbdev->hwaccess_lock, flags);
found_kctx = js_per_as_data->kctx;
KBASE_DEBUG_ASSERT(found_kctx == NULL || js_per_as_data->as_busy_refcount > 0);
- spin_unlock_irqrestore(&js_devdata->runpool_irq.lock, flags);
+ spin_unlock_irqrestore(&kbdev->hwaccess_lock, flags);
return found_kctx;
}
KBASE_DEBUG_ASSERT(js_devdata->nr_all_contexts_running < S8_MAX);
++(js_devdata->nr_all_contexts_running);
- if ((js_kctx_info->ctx.flags & KBASE_CTX_FLAG_SUBMIT_DISABLED) == 0) {
+ if (!kbase_ctx_flag(kctx, KCTX_SUBMIT_DISABLED)) {
/* Track contexts that can submit jobs */
KBASE_DEBUG_ASSERT(js_devdata->nr_user_contexts_running <
S8_MAX);
--(js_devdata->nr_all_contexts_running);
KBASE_DEBUG_ASSERT(js_devdata->nr_all_contexts_running >= 0);
- if ((js_kctx_info->ctx.flags & KBASE_CTX_FLAG_SUBMIT_DISABLED) == 0) {
+ if (!kbase_ctx_flag(kctx, KCTX_SUBMIT_DISABLED)) {
/* Track contexts that can submit jobs */
--(js_devdata->nr_user_contexts_running);
KBASE_DEBUG_ASSERT(js_devdata->nr_user_contexts_running >= 0);