Commit 8656ea9a authored by Balasubramani Vivekanandan's avatar Balasubramani Vivekanandan Committed by Rodrigo Vivi

drm/xe: Add event tracing for CTB

Event tracing enabled for CTB submissions.

Additional minor refactor - Removed a unnecessary ct_to_xe() call.

v2: Remove a unwanted comment (Hari)
    Add missing change to commit message
Signed-off-by: default avatarBalasubramani Vivekanandan <balasubramani.vivekanandan@intel.com>
Reviewed-by: default avatarHaridhar Kalvala <haridhar.kalvala@intel.com>
Link: https://lore.kernel.org/intel-xe/20231019093140.1901665-2-balasubramani.vivekanandan@intel.com/Signed-off-by: default avatarRodrigo Vivi <rodrigo.vivi@intel.com>
parent f6c39fee
...@@ -460,7 +460,7 @@ static int h2g_write(struct xe_guc_ct *ct, const u32 *action, u32 len, ...@@ -460,7 +460,7 @@ static int h2g_write(struct xe_guc_ct *ct, const u32 *action, u32 len,
/* Write H2G ensuring visable before descriptor update */ /* Write H2G ensuring visable before descriptor update */
xe_map_memcpy_to(xe, &map, 0, cmd, H2G_CT_HEADERS * sizeof(u32)); xe_map_memcpy_to(xe, &map, 0, cmd, H2G_CT_HEADERS * sizeof(u32));
xe_map_memcpy_to(xe, &map, H2G_CT_HEADERS * sizeof(u32), action, len * sizeof(u32)); xe_map_memcpy_to(xe, &map, H2G_CT_HEADERS * sizeof(u32), action, len * sizeof(u32));
xe_device_wmb(ct_to_xe(ct)); xe_device_wmb(xe);
/* Update local copies */ /* Update local copies */
h2g->info.tail = (tail + full_len) % h2g->info.size; h2g->info.tail = (tail + full_len) % h2g->info.size;
...@@ -469,6 +469,9 @@ static int h2g_write(struct xe_guc_ct *ct, const u32 *action, u32 len, ...@@ -469,6 +469,9 @@ static int h2g_write(struct xe_guc_ct *ct, const u32 *action, u32 len,
/* Update descriptor */ /* Update descriptor */
desc_write(xe, h2g, tail, h2g->info.tail); desc_write(xe, h2g, tail, h2g->info.tail);
trace_xe_guc_ctb_h2g(ct_to_gt(ct)->info.id, *(action - 1), full_len,
desc_read(xe, h2g, head), h2g->info.tail);
return 0; return 0;
} }
...@@ -934,6 +937,7 @@ static int g2h_read(struct xe_guc_ct *ct, u32 *msg, bool fast_path) ...@@ -934,6 +937,7 @@ static int g2h_read(struct xe_guc_ct *ct, u32 *msg, bool fast_path)
struct guc_ctb *g2h = &ct->ctbs.g2h; struct guc_ctb *g2h = &ct->ctbs.g2h;
u32 tail, head, len; u32 tail, head, len;
s32 avail; s32 avail;
u32 action;
lockdep_assert_held(&ct->fast_lock); lockdep_assert_held(&ct->fast_lock);
...@@ -984,11 +988,13 @@ static int g2h_read(struct xe_guc_ct *ct, u32 *msg, bool fast_path) ...@@ -984,11 +988,13 @@ static int g2h_read(struct xe_guc_ct *ct, u32 *msg, bool fast_path)
avail * sizeof(u32)); avail * sizeof(u32));
} }
action = FIELD_GET(GUC_HXG_EVENT_MSG_0_ACTION, msg[1]);
if (fast_path) { if (fast_path) {
if (FIELD_GET(GUC_HXG_MSG_0_TYPE, msg[1]) != GUC_HXG_TYPE_EVENT) if (FIELD_GET(GUC_HXG_MSG_0_TYPE, msg[1]) != GUC_HXG_TYPE_EVENT)
return 0; return 0;
switch (FIELD_GET(GUC_HXG_EVENT_MSG_0_ACTION, msg[1])) { switch (action) {
case XE_GUC_ACTION_REPORT_PAGE_FAULT_REQ_DESC: case XE_GUC_ACTION_REPORT_PAGE_FAULT_REQ_DESC:
case XE_GUC_ACTION_TLB_INVALIDATION_DONE: case XE_GUC_ACTION_TLB_INVALIDATION_DONE:
break; /* Process these in fast-path */ break; /* Process these in fast-path */
...@@ -1001,6 +1007,9 @@ static int g2h_read(struct xe_guc_ct *ct, u32 *msg, bool fast_path) ...@@ -1001,6 +1007,9 @@ static int g2h_read(struct xe_guc_ct *ct, u32 *msg, bool fast_path)
g2h->info.head = (head + avail) % g2h->info.size; g2h->info.head = (head + avail) % g2h->info.size;
desc_write(xe, g2h, head, g2h->info.head); desc_write(xe, g2h, head, g2h->info.head);
trace_xe_guc_ctb_g2h(ct_to_gt(ct)->info.id, action, len,
g2h->info.head, tail);
return len; return len;
} }
......
...@@ -521,6 +521,7 @@ DEFINE_EVENT(xe_vm, xe_vm_rebind_worker_exit, ...@@ -521,6 +521,7 @@ DEFINE_EVENT(xe_vm, xe_vm_rebind_worker_exit,
TRACE_EVENT(xe_guc_ct_h2g_flow_control, TRACE_EVENT(xe_guc_ct_h2g_flow_control,
TP_PROTO(u32 _head, u32 _tail, u32 size, u32 space, u32 len), TP_PROTO(u32 _head, u32 _tail, u32 size, u32 space, u32 len),
TP_ARGS(_head, _tail, size, space, len), TP_ARGS(_head, _tail, size, space, len),
/* GuC */
TP_STRUCT__entry( TP_STRUCT__entry(
__field(u32, _head) __field(u32, _head)
...@@ -568,6 +569,46 @@ TRACE_EVENT(xe_guc_ct_g2h_flow_control, ...@@ -568,6 +569,46 @@ TRACE_EVENT(xe_guc_ct_g2h_flow_control,
__entry->space, __entry->len) __entry->space, __entry->len)
); );
DECLARE_EVENT_CLASS(xe_guc_ctb,
TP_PROTO(u8 gt_id, u32 action, u32 len, u32 _head, u32 tail),
TP_ARGS(gt_id, action, len, _head, tail),
TP_STRUCT__entry(
__field(u8, gt_id)
__field(u32, action)
__field(u32, len)
__field(u32, tail)
__field(u32, _head)
),
TP_fast_assign(
__entry->gt_id = gt_id;
__entry->action = action;
__entry->len = len;
__entry->tail = tail;
__entry->_head = _head;
),
TP_printk("gt%d: H2G CTB: action=0x%x, len=%d, tail=%d, head=%d\n",
__entry->gt_id, __entry->action, __entry->len,
__entry->tail, __entry->_head)
);
DEFINE_EVENT(xe_guc_ctb, xe_guc_ctb_h2g,
TP_PROTO(u8 gt_id, u32 action, u32 len, u32 _head, u32 tail),
TP_ARGS(gt_id, action, len, _head, tail)
);
DEFINE_EVENT_PRINT(xe_guc_ctb, xe_guc_ctb_g2h,
TP_PROTO(u8 gt_id, u32 action, u32 len, u32 _head, u32 tail),
TP_ARGS(gt_id, action, len, _head, tail),
TP_printk("gt%d: G2H CTB: action=0x%x, len=%d, tail=%d, head=%d\n",
__entry->gt_id, __entry->action, __entry->len,
__entry->tail, __entry->_head)
);
#endif #endif
/* This part must be outside protection */ /* This part must be outside protection */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment