Skip to content

Commit

Permalink
Merge tag 'drm-xe-next-2024-10-31' of https://gitlab.freedesktop.org/…
Browse files Browse the repository at this point in the history
…drm/xe/kernel into drm-next

UAPI Changes:
- Define and parse OA sync properties (Ashutosh)

Driver Changes:
- Add caller info to xe_gt_reset_async (Nirmoy)
- A large forcewake rework / cleanup (Himal)
- A g2h response timeout fix (Badal)
- A PTL workaround (Vinay)
- Handle unreliable MMIO reads during forcewake (Shuicheng)
- Ufence user-space access fixes (Nirmoy)
- Annotate flexible arrays (Matthew Brost)
- Enable GuC lite restore (Fei)
- Prevent GuC register capture on VF (Zhanjun)
- Show VFs VRAM / LMEM provisioning summary over debugfs (Michal)
- Parallel queues fix on GT reset (Nirmoy)
- Move reference grabbing to a job's dma-fence (Matt Brost)
- Mark a number of local workqueues WQ_MEM_RECLAIM (Matt Brost)
- OA synchronization support (Ashutosh)
- Capture all available bits of GuC timestamp to GuC log (John)
- Increase readability of guc_info debugfs (John)
- Add a mmio barrier before GGTT invalidate (Matt Brost)
- Don't short-circuit TDR on jobs not started (Matt Brost)

Signed-off-by: Dave Airlie <[email protected]>

From: Thomas Hellstrom <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/ZyNvA_vZZYR-1eWE@fedora
  • Loading branch information
airlied committed Nov 5, 2024
2 parents ffd9939 + 35d25a4 commit fb6c5b1
Show file tree
Hide file tree
Showing 47 changed files with 1,012 additions and 518 deletions.
1 change: 1 addition & 0 deletions drivers/gpu/drm/xe/abi/guc_klvs_abi.h
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,7 @@ enum xe_guc_klv_ids {
GUC_WORKAROUND_KLV_ID_DISABLE_MTP_DURING_ASYNC_COMPUTE = 0x9007,
GUC_WA_KLV_NP_RD_WRITE_TO_CLEAR_RCSM_AT_CGP_LATE_RESTORE = 0x9008,
GUC_WORKAROUND_KLV_ID_BACK_TO_BACK_RCS_ENGINE_RESET = 0x9009,
GUC_WA_KLV_WAKE_POWER_DOMAINS_FOR_OUTBOUND_MMIO = 0x900a,
};

#endif
6 changes: 4 additions & 2 deletions drivers/gpu/drm/xe/display/xe_hdcp_gsc.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ bool intel_hdcp_gsc_check_status(struct intel_display *display)
struct xe_gt *gt = tile->media_gt;
struct xe_gsc *gsc = &gt->uc.gsc;
bool ret = true;
unsigned int fw_ref;

if (!gsc && !xe_uc_fw_is_enabled(&gsc->fw)) {
drm_dbg_kms(&xe->drm,
Expand All @@ -50,7 +51,8 @@ bool intel_hdcp_gsc_check_status(struct intel_display *display)
}

xe_pm_runtime_get(xe);
if (xe_force_wake_get(gt_to_fw(gt), XE_FW_GSC)) {
fw_ref = xe_force_wake_get(gt_to_fw(gt), XE_FW_GSC);
if (!fw_ref) {
drm_dbg_kms(&xe->drm,
"failed to get forcewake to check proxy status\n");
ret = false;
Expand All @@ -60,7 +62,7 @@ bool intel_hdcp_gsc_check_status(struct intel_display *display)
if (!xe_gsc_proxy_init_done(gsc))
ret = false;

xe_force_wake_put(gt_to_fw(gt), XE_FW_GSC);
xe_force_wake_put(gt_to_fw(gt), fw_ref);
out:
xe_pm_runtime_put(xe);
return ret;
Expand Down
3 changes: 2 additions & 1 deletion drivers/gpu/drm/xe/regs/xe_guc_regs.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,8 @@
#define HUC_LOADING_AGENT_GUC REG_BIT(1)
#define GUC_WOPCM_OFFSET_VALID REG_BIT(0)
#define GUC_MAX_IDLE_COUNT XE_REG(0xc3e4)
#define GUC_PMTIMESTAMP XE_REG(0xc3e8)
#define GUC_PMTIMESTAMP_LO XE_REG(0xc3e8)
#define GUC_PMTIMESTAMP_HI XE_REG(0xc3ec)

#define GUC_SEND_INTERRUPT XE_REG(0xc4c8)
#define GUC_SEND_TRIGGER REG_BIT(0)
Expand Down
18 changes: 8 additions & 10 deletions drivers/gpu/drm/xe/tests/xe_mocs.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,11 @@ static void read_l3cc_table(struct xe_gt *gt,
{
struct kunit *test = kunit_get_current_test();
u32 l3cc, l3cc_expected;
unsigned int i;
unsigned int fw_ref, i;
u32 reg_val;
u32 ret;

ret = xe_force_wake_get(gt_to_fw(gt), XE_FW_GT);
KUNIT_ASSERT_EQ_MSG(test, ret, 0, "Forcewake Failed.\n");
fw_ref = xe_force_wake_get(gt_to_fw(gt), XE_FW_GT);
KUNIT_ASSERT_NE_MSG(test, fw_ref, 0, "Forcewake Failed.\n");

for (i = 0; i < info->num_mocs_regs; i++) {
if (!(i & 1)) {
Expand All @@ -72,23 +71,22 @@ static void read_l3cc_table(struct xe_gt *gt,
KUNIT_EXPECT_EQ_MSG(test, l3cc_expected, l3cc,
"l3cc idx=%u has incorrect val.\n", i);
}
xe_force_wake_put(gt_to_fw(gt), XE_FW_GT);
xe_force_wake_put(gt_to_fw(gt), fw_ref);
}

static void read_mocs_table(struct xe_gt *gt,
const struct xe_mocs_info *info)
{
struct kunit *test = kunit_get_current_test();
u32 mocs, mocs_expected;
unsigned int i;
unsigned int fw_ref, i;
u32 reg_val;
u32 ret;

KUNIT_EXPECT_TRUE_MSG(test, info->unused_entries_index,
"Unused entries index should have been defined\n");

ret = xe_force_wake_get(gt_to_fw(gt), XE_FW_GT);
KUNIT_ASSERT_EQ_MSG(test, ret, 0, "Forcewake Failed.\n");
fw_ref = xe_force_wake_get(gt_to_fw(gt), XE_FW_GT);
KUNIT_ASSERT_NE_MSG(test, fw_ref, 0, "Forcewake Failed.\n");

for (i = 0; i < info->num_mocs_regs; i++) {
if (regs_are_mcr(gt))
Expand All @@ -106,7 +104,7 @@ static void read_mocs_table(struct xe_gt *gt,
"mocs reg 0x%x has incorrect val.\n", i);
}

xe_force_wake_put(gt_to_fw(gt), XE_FW_GT);
xe_force_wake_put(gt_to_fw(gt), fw_ref);
}

static int mocs_kernel_test_run_device(struct xe_device *xe)
Expand Down
27 changes: 23 additions & 4 deletions drivers/gpu/drm/xe/xe_debugfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -90,13 +90,32 @@ static int forcewake_open(struct inode *inode, struct file *file)
{
struct xe_device *xe = inode->i_private;
struct xe_gt *gt;
u8 id;
u8 id, last_gt;
unsigned int fw_ref;

xe_pm_runtime_get(xe);
for_each_gt(gt, xe, id)
XE_WARN_ON(xe_force_wake_get(gt_to_fw(gt), XE_FORCEWAKE_ALL));
for_each_gt(gt, xe, id) {
last_gt = id;

fw_ref = xe_force_wake_get(gt_to_fw(gt), XE_FORCEWAKE_ALL);
if (!xe_force_wake_ref_has_domain(fw_ref, XE_FORCEWAKE_ALL))
goto err_fw_get;
}

return 0;

err_fw_get:
for_each_gt(gt, xe, id) {
if (id < last_gt)
xe_force_wake_put(gt_to_fw(gt), XE_FORCEWAKE_ALL);
else if (id == last_gt)
xe_force_wake_put(gt_to_fw(gt), fw_ref);
else
break;
}

xe_pm_runtime_put(xe);
return -ETIMEDOUT;
}

static int forcewake_release(struct inode *inode, struct file *file)
Expand All @@ -106,7 +125,7 @@ static int forcewake_release(struct inode *inode, struct file *file)
u8 id;

for_each_gt(gt, xe, id)
XE_WARN_ON(xe_force_wake_put(gt_to_fw(gt), XE_FORCEWAKE_ALL));
xe_force_wake_put(gt_to_fw(gt), XE_FORCEWAKE_ALL);
xe_pm_runtime_put(xe);

return 0;
Expand Down
16 changes: 9 additions & 7 deletions drivers/gpu/drm/xe/xe_devcoredump.c
Original file line number Diff line number Diff line change
Expand Up @@ -158,13 +158,15 @@ static void xe_devcoredump_deferred_snap_work(struct work_struct *work)
{
struct xe_devcoredump_snapshot *ss = container_of(work, typeof(*ss), work);
struct xe_devcoredump *coredump = container_of(ss, typeof(*coredump), snapshot);
unsigned int fw_ref;

/* keep going if fw fails as we still want to save the memory and SW data */
if (xe_force_wake_get(gt_to_fw(ss->gt), XE_FORCEWAKE_ALL))
fw_ref = xe_force_wake_get(gt_to_fw(ss->gt), XE_FORCEWAKE_ALL);
if (!xe_force_wake_ref_has_domain(fw_ref, XE_FORCEWAKE_ALL))
xe_gt_info(ss->gt, "failed to get forcewake for coredump capture\n");
xe_vm_snapshot_capture_delayed(ss->vm);
xe_guc_exec_queue_snapshot_capture_delayed(ss->ge);
xe_force_wake_put(gt_to_fw(ss->gt), XE_FORCEWAKE_ALL);
xe_force_wake_put(gt_to_fw(ss->gt), fw_ref);

/* Calculate devcoredump size */
ss->read.size = __xe_devcoredump_read(NULL, INT_MAX, coredump);
Expand Down Expand Up @@ -236,8 +238,9 @@ static void devcoredump_snapshot(struct xe_devcoredump *coredump,
u32 width_mask = (0x1 << q->width) - 1;
const char *process_name = "no process";

int i;
unsigned int fw_ref;
bool cookie;
int i;

ss->snapshot_time = ktime_get_real();
ss->boot_time = ktime_get_boottime();
Expand All @@ -261,11 +264,10 @@ static void devcoredump_snapshot(struct xe_devcoredump *coredump,
}

/* keep going if fw fails as we still want to save the memory and SW data */
if (xe_force_wake_get(gt_to_fw(q->gt), XE_FORCEWAKE_ALL))
xe_gt_info(ss->gt, "failed to get forcewake for coredump capture\n");
fw_ref = xe_force_wake_get(gt_to_fw(q->gt), XE_FORCEWAKE_ALL);

ss->guc.log = xe_guc_log_snapshot_capture(&guc->log, true);
ss->guc.ct = xe_guc_ct_snapshot_capture(&guc->ct, true);
ss->guc.ct = xe_guc_ct_snapshot_capture(&guc->ct);
ss->ge = xe_guc_exec_queue_snapshot_capture(q);
ss->job = xe_sched_job_snapshot_capture(job);
ss->vm = xe_vm_snapshot_capture(q->vm);
Expand All @@ -274,7 +276,7 @@ static void devcoredump_snapshot(struct xe_devcoredump *coredump,

queue_work(system_unbound_wq, &ss->work);

xe_force_wake_put(gt_to_fw(q->gt), XE_FORCEWAKE_ALL);
xe_force_wake_put(gt_to_fw(q->gt), fw_ref);
dma_fence_end_signalling(cookie);
}

Expand Down
25 changes: 14 additions & 11 deletions drivers/gpu/drm/xe/xe_device.c
Original file line number Diff line number Diff line change
Expand Up @@ -604,18 +604,18 @@ int xe_device_probe_early(struct xe_device *xe)
static int probe_has_flat_ccs(struct xe_device *xe)
{
struct xe_gt *gt;
unsigned int fw_ref;
u32 reg;
int err;

/* Always enabled/disabled, no runtime check to do */
if (GRAPHICS_VER(xe) < 20 || !xe->info.has_flat_ccs)
return 0;

gt = xe_root_mmio_gt(xe);

err = xe_force_wake_get(gt_to_fw(gt), XE_FW_GT);
if (err)
return err;
fw_ref = xe_force_wake_get(gt_to_fw(gt), XE_FW_GT);
if (!fw_ref)
return -ETIMEDOUT;

reg = xe_gt_mcr_unicast_read_any(gt, XE2_FLAT_CCS_BASE_RANGE_LOWER);
xe->info.has_flat_ccs = (reg & XE2_FLAT_CCS_ENABLE);
Expand All @@ -624,7 +624,8 @@ static int probe_has_flat_ccs(struct xe_device *xe)
drm_dbg(&xe->drm,
"Flat CCS has been disabled in bios, May lead to performance impact");

return xe_force_wake_put(gt_to_fw(gt), XE_FW_GT);
xe_force_wake_put(gt_to_fw(gt), fw_ref);
return 0;
}

int xe_device_probe(struct xe_device *xe)
Expand Down Expand Up @@ -875,6 +876,7 @@ void xe_device_wmb(struct xe_device *xe)
void xe_device_td_flush(struct xe_device *xe)
{
struct xe_gt *gt;
unsigned int fw_ref;
u8 id;

if (!IS_DGFX(xe) || GRAPHICS_VER(xe) < 20)
Expand All @@ -889,7 +891,8 @@ void xe_device_td_flush(struct xe_device *xe)
if (xe_gt_is_media_type(gt))
continue;

if (xe_force_wake_get(gt_to_fw(gt), XE_FW_GT))
fw_ref = xe_force_wake_get(gt_to_fw(gt), XE_FW_GT);
if (!fw_ref)
return;

xe_mmio_write32(&gt->mmio, XE2_TDF_CTRL, TRANSIENT_FLUSH_REQUEST);
Expand All @@ -904,22 +907,22 @@ void xe_device_td_flush(struct xe_device *xe)
150, NULL, false))
xe_gt_err_once(gt, "TD flush timeout\n");

xe_force_wake_put(gt_to_fw(gt), XE_FW_GT);
xe_force_wake_put(gt_to_fw(gt), fw_ref);
}
}

void xe_device_l2_flush(struct xe_device *xe)
{
struct xe_gt *gt;
int err;
unsigned int fw_ref;

gt = xe_root_mmio_gt(xe);

if (!XE_WA(gt, 16023588340))
return;

err = xe_force_wake_get(gt_to_fw(gt), XE_FW_GT);
if (err)
fw_ref = xe_force_wake_get(gt_to_fw(gt), XE_FW_GT);
if (!fw_ref)
return;

spin_lock(&gt->global_invl_lock);
Expand All @@ -929,7 +932,7 @@ void xe_device_l2_flush(struct xe_device *xe)
xe_gt_err_once(gt, "Global invalidation timeout\n");
spin_unlock(&gt->global_invl_lock);

xe_force_wake_put(gt_to_fw(gt), XE_FW_GT);
xe_force_wake_put(gt_to_fw(gt), fw_ref);
}

u32 xe_device_ccs_bytes(struct xe_device *xe, u64 size)
Expand Down
8 changes: 6 additions & 2 deletions drivers/gpu/drm/xe/xe_drm_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,7 @@ static void show_run_ticks(struct drm_printer *p, struct drm_file *file)
struct xe_hw_engine *hwe;
struct xe_exec_queue *q;
u64 gpu_timestamp;
unsigned int fw_ref;

xe_pm_runtime_get(xe);

Expand All @@ -303,13 +304,16 @@ static void show_run_ticks(struct drm_printer *p, struct drm_file *file)
continue;

fw = xe_hw_engine_to_fw_domain(hwe);
if (xe_force_wake_get(gt_to_fw(gt), fw)) {

fw_ref = xe_force_wake_get(gt_to_fw(gt), fw);
if (!xe_force_wake_ref_has_domain(fw_ref, fw)) {
hwe = NULL;
xe_force_wake_put(gt_to_fw(gt), fw_ref);
break;
}

gpu_timestamp = xe_hw_engine_read_timestamp(hwe);
XE_WARN_ON(xe_force_wake_put(gt_to_fw(gt), fw));
xe_force_wake_put(gt_to_fw(gt), fw_ref);
break;
}

Expand Down
2 changes: 1 addition & 1 deletion drivers/gpu/drm/xe/xe_exec_queue_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ struct xe_exec_queue {
/** @hw_engine_group_link: link into exec queues in the same hw engine group */
struct list_head hw_engine_group_link;
/** @lrc: logical ring context for this exec queue */
struct xe_lrc *lrc[];
struct xe_lrc *lrc[] __counted_by(width);
};

/**
Expand Down
2 changes: 1 addition & 1 deletion drivers/gpu/drm/xe/xe_execlist.c
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ execlist_run_job(struct drm_sched_job *drm_job)
q->ring_ops->emit_job(job);
xe_execlist_make_active(exl);

return dma_fence_get(job->fence);
return job->fence;
}

static void execlist_job_free(struct drm_sched_job *drm_job)
Expand Down
Loading

0 comments on commit fb6c5b1

Please sign in to comment.