For an LRC belonging to the secondary queue, in order to check if its
context group is active, we need to check the LRC of the primary queue.
In addition to that we want to compare the secondary queue position to
CSMQDEBUG register to check if the queue itself is active.
To do so, store primary LRC and position information in the LRC.
A note on references involved:
- In general the Queue takes a ref on its LRC.
- In addition, for multi-queue,
a. Primary Queue takes a ref for each Secondary LRC.
b. Each Secondary Queue takes a ref to the Primary Queue
In the current patch, each LRC in the queue group is storing a pointer
to primary LRC. Both primary and secondary LRCs are freed only when
primary queue is destroyed. At this time, all secondary queues are
already destroyed, so there is no one using secondary LRCs. We should be
good without taking any additional references.
Signed-off-by: Umesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com>
Reviewed-by: Niranjana Vishwanathapura <niranjana.vishwanathapura@intel.com>
Link: https://patch.msgid.link/20260507162016.3888309-18-umesh.nerlige.ramappa@intel.com
{
xe_assert(gt_to_xe(q->gt), idx < q->width);
- scoped_guard(spinlock, &q->lrc_lookup_lock)
+ scoped_guard(spinlock, &q->lrc_lookup_lock) {
q->lrc[idx] = lrc;
+ if (xe_exec_queue_is_multi_queue(q))
+ q->lrc[idx]->multi_queue.primary_lrc =
+ q->multi_queue.group->primary->lrc[0];
+ }
}
/**
}
q->multi_queue.pos = pos;
+ q->lrc[0]->multi_queue.pos = pos;
return 0;
}
return SZ_16K;
}
+static inline bool xe_lrc_is_multi_queue(struct xe_lrc *lrc)
+{
+ return lrc->multi_queue.primary_lrc;
+}
+
size_t xe_gt_lrc_hang_replay_size(struct xe_gt *gt, enum xe_engine_class class);
size_t xe_gt_lrc_size(struct xe_gt *gt, enum xe_engine_class class);
u32 xe_lrc_pphwsp_offset(struct xe_lrc *lrc);
/** @ctx_timestamp: readout value of CTX_TIMESTAMP on last update */
u64 ctx_timestamp;
+
+ /** @multi_queue: Multi queue LRC related information */
+ struct {
+ /** @multi_queue.primary_lrc: Primary lrc of this multi-queue group*/
+ struct xe_lrc *primary_lrc;
+ /** @multi_queue.pos: Position of LRC within the multi-queue group */
+ u8 pos;
+ } multi_queue;
};
struct xe_lrc_snapshot;