entity->context_id = context_id;
atomic64_set(&entity->last_emitted_v_seq, seq_ring);
atomic64_set(&entity->last_queued_v_seq, seq_ring);
- atomic64_set(&entity->last_signaled_v_seq, seq_ring);
/* Add the entity to the run queue */
mutex_lock(&rq->lock);
}
/**
- * Check the virtual sequence number for specified context
- *
- * @seq The virtual sequence number to check
- * @c_entity The pointer to a valid amd_context_entity
- *
- * return 0 if signaled, -1 else.
-*/
-int amd_sched_check_ts(struct amd_context_entity *c_entity, uint64_t seq)
-{
- return (seq <= atomic64_read(&c_entity->last_signaled_v_seq)) ? 0 : -1;
-}
-
-/**
- * Wait for a virtual sequence number to be signaled or timeout
+ * Wait for a virtual sequence number to be emitted.
*
* @c_entity The pointer to a valid context entity
* @seq The virtual sequence number to wait
*
* return =0 signaled , <0 failed
*/
-static int amd_sched_wait(struct amd_context_entity *c_entity,
- uint64_t seq,
- bool intr,
- long timeout,
- bool emit)
+int amd_sched_wait_emit(struct amd_context_entity *c_entity,
+ uint64_t seq,
+ bool intr,
+ long timeout)
{
- atomic64_t *v_seq = emit ? &c_entity->last_emitted_v_seq :
- &c_entity->last_signaled_v_seq;
- wait_queue_head_t *wait_queue = emit ? &c_entity->wait_emit :
- &c_entity->wait_queue;
+ atomic64_t *v_seq = &c_entity->last_emitted_v_seq;
+ wait_queue_head_t *wait_queue = &c_entity->wait_emit;
if (intr && (timeout < 0)) {
wait_event_interruptible(
return 0;
}
-int amd_sched_wait_signal(struct amd_context_entity *c_entity,
- uint64_t seq,
- bool intr,
- long timeout)
-{
- return amd_sched_wait(c_entity, seq, intr, timeout, false);
-}
-
-int amd_sched_wait_emit(struct amd_context_entity *c_entity,
- uint64_t seq,
- bool intr,
- long timeout)
-{
- return amd_sched_wait(c_entity, seq, intr, timeout, true);
-}
-
static int amd_sched_main(void *param)
{
int r;
/* the virtual_seq is unique per context per ring */
atomic64_t last_queued_v_seq;
atomic64_t last_emitted_v_seq;
- atomic64_t last_signaled_v_seq;
pid_t tgid;
uint32_t context_id;
/* the job_queue maintains the jobs submitted by clients */
struct amd_context_entity *c_entity,
void *job);
-int amd_sched_check_ts(struct amd_context_entity *c_entity, uint64_t seq);
-
-int amd_sched_wait_signal(struct amd_context_entity *c_entity,
- uint64_t seq, bool intr, long timeout);
int amd_sched_wait_emit(struct amd_context_entity *c_entity,
uint64_t seq,
bool intr,