@@ -1607,15 +1607,16 @@ static void g2h_worker_func(struct work_struct *w)
1607
1607
receive_g2h (ct );
1608
1608
}
1609
1609
1610
- struct xe_guc_ct_snapshot * xe_guc_ct_snapshot_alloc (struct xe_guc_ct * ct , bool atomic )
1610
+ static struct xe_guc_ct_snapshot * guc_ct_snapshot_alloc (struct xe_guc_ct * ct , bool atomic ,
1611
+ bool want_ctb )
1611
1612
{
1612
1613
struct xe_guc_ct_snapshot * snapshot ;
1613
1614
1614
1615
snapshot = kzalloc (sizeof (* snapshot ), atomic ? GFP_ATOMIC : GFP_KERNEL );
1615
1616
if (!snapshot )
1616
1617
return NULL ;
1617
1618
1618
- if (ct -> bo ) {
1619
+ if (ct -> bo && want_ctb ) {
1619
1620
snapshot -> ctb_size = ct -> bo -> size ;
1620
1621
snapshot -> ctb = kmalloc (snapshot -> ctb_size , atomic ? GFP_ATOMIC : GFP_KERNEL );
1621
1622
}
@@ -1645,25 +1646,13 @@ static void guc_ctb_snapshot_print(struct guc_ctb_snapshot *snapshot,
1645
1646
drm_printf (p , "\tstatus (memory): 0x%x\n" , snapshot -> desc .status );
1646
1647
}
1647
1648
1648
- /**
1649
- * xe_guc_ct_snapshot_capture - Take a quick snapshot of the CT state.
1650
- * @ct: GuC CT object.
1651
- * @atomic: Boolean to indicate if this is called from atomic context like
1652
- * reset or CTB handler or from some regular path like debugfs.
1653
- *
1654
- * This can be printed out in a later stage like during dev_coredump
1655
- * analysis.
1656
- *
1657
- * Returns: a GuC CT snapshot object that must be freed by the caller
1658
- * by using `xe_guc_ct_snapshot_free`.
1659
- */
1660
- struct xe_guc_ct_snapshot * xe_guc_ct_snapshot_capture (struct xe_guc_ct * ct ,
1661
- bool atomic )
1649
+ static struct xe_guc_ct_snapshot * guc_ct_snapshot_capture (struct xe_guc_ct * ct , bool atomic ,
1650
+ bool want_ctb )
1662
1651
{
1663
1652
struct xe_device * xe = ct_to_xe (ct );
1664
1653
struct xe_guc_ct_snapshot * snapshot ;
1665
1654
1666
- snapshot = xe_guc_ct_snapshot_alloc (ct , atomic );
1655
+ snapshot = guc_ct_snapshot_alloc (ct , atomic , want_ctb );
1667
1656
if (!snapshot ) {
1668
1657
xe_gt_err (ct_to_gt (ct ), "Skipping CTB snapshot entirely.\n" );
1669
1658
return NULL ;
@@ -1682,6 +1671,21 @@ struct xe_guc_ct_snapshot *xe_guc_ct_snapshot_capture(struct xe_guc_ct *ct,
1682
1671
return snapshot ;
1683
1672
}
1684
1673
1674
+ /**
1675
+ * xe_guc_ct_snapshot_capture - Take a quick snapshot of the CT state.
1676
+ * @ct: GuC CT object.
1677
+ *
1678
+ * This can be printed out in a later stage like during dev_coredump
1679
+ * analysis. This is safe to be called during atomic context.
1680
+ *
1681
+ * Returns: a GuC CT snapshot object that must be freed by the caller
1682
+ * by using `xe_guc_ct_snapshot_free`.
1683
+ */
1684
+ struct xe_guc_ct_snapshot * xe_guc_ct_snapshot_capture (struct xe_guc_ct * ct )
1685
+ {
1686
+ return guc_ct_snapshot_capture (ct , true, true);
1687
+ }
1688
+
1685
1689
/**
1686
1690
* xe_guc_ct_snapshot_print - Print out a given GuC CT snapshot.
1687
1691
* @snapshot: GuC CT snapshot object.
@@ -1704,12 +1708,8 @@ void xe_guc_ct_snapshot_print(struct xe_guc_ct_snapshot *snapshot,
1704
1708
drm_printf (p , "\tg2h outstanding: %d\n" ,
1705
1709
snapshot -> g2h_outstanding );
1706
1710
1707
- if (snapshot -> ctb ) {
1711
+ if (snapshot -> ctb )
1708
1712
xe_print_blob_ascii85 (p , "CTB data" , snapshot -> ctb , 0 , snapshot -> ctb_size );
1709
- } else {
1710
- drm_printf (p , "CTB snapshot missing!\n" );
1711
- return ;
1712
- }
1713
1713
} else {
1714
1714
drm_puts (p , "CT disabled\n" );
1715
1715
}
@@ -1735,14 +1735,16 @@ void xe_guc_ct_snapshot_free(struct xe_guc_ct_snapshot *snapshot)
1735
1735
* xe_guc_ct_print - GuC CT Print.
1736
1736
* @ct: GuC CT.
1737
1737
* @p: drm_printer where it will be printed out.
1738
+ * @want_ctb: Should the full CTB content be dumped (vs just the headers)
1738
1739
*
1739
- * This function quickly capture a snapshot and immediately print it out.
1740
+ * This function will quickly capture a snapshot of the CT state
1741
+ * and immediately print it out.
1740
1742
*/
1741
- void xe_guc_ct_print (struct xe_guc_ct * ct , struct drm_printer * p )
1743
+ void xe_guc_ct_print (struct xe_guc_ct * ct , struct drm_printer * p , bool want_ctb )
1742
1744
{
1743
1745
struct xe_guc_ct_snapshot * snapshot ;
1744
1746
1745
- snapshot = xe_guc_ct_snapshot_capture (ct , false);
1747
+ snapshot = guc_ct_snapshot_capture (ct , false, want_ctb );
1746
1748
xe_guc_ct_snapshot_print (snapshot , p );
1747
1749
xe_guc_ct_snapshot_free (snapshot );
1748
1750
}
@@ -1776,7 +1778,7 @@ static void ct_dead_capture(struct xe_guc_ct *ct, struct guc_ctb *ctb, u32 reaso
1776
1778
return ;
1777
1779
1778
1780
snapshot_log = xe_guc_log_snapshot_capture (& guc -> log , true);
1779
- snapshot_ct = xe_guc_ct_snapshot_capture ((ct ), true );
1781
+ snapshot_ct = xe_guc_ct_snapshot_capture ((ct ));
1780
1782
1781
1783
spin_lock_irqsave (& ct -> dead .lock , flags );
1782
1784
0 commit comments