Skip to content

Commit 14e85fa

Browse files
committed
Merge tag 'drm-xe-fixes-2025-07-11' of https://gitlab.freedesktop.org/drm/xe/kernel into drm-fixes
Driver Changes: - Clear LMTT page to avoid leaking data from one VF to another - Align PF queue size to power of 2 - Disable Indirect Ring State to avoid intermittent issues on context switch: feature is not currently needed, so can be disabled for now. - Fix compression handling when the BO pages are very fragmented - Restore display pm on error path - Fix runtime pm handling in xe devcoredump - Fix xe_pm_set_vram_threshold() doc - Recommend new minor versions of GuC firmware - Drop some workarounds on VF - Do not use verbose GuC logging by default: it should be only for debugging Signed-off-by: Simona Vetter <[email protected]> From: Lucas De Marchi <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/s6jyd24mimbzb4vxtgc5vupvbyqplfep2c6eupue7znnlbhuxy@lmvzexfzhrnn
2 parents 3638e6a + 74806f6 commit 14e85fa

File tree

9 files changed

+53
-23
lines changed

9 files changed

+53
-23
lines changed

drivers/gpu/drm/xe/xe_devcoredump.c

Lines changed: 28 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -171,14 +171,32 @@ static void xe_devcoredump_snapshot_free(struct xe_devcoredump_snapshot *ss)
171171

172172
#define XE_DEVCOREDUMP_CHUNK_MAX (SZ_512M + SZ_1G)
173173

174+
/**
175+
* xe_devcoredump_read() - Read data from the Xe device coredump snapshot
176+
* @buffer: Destination buffer to copy the coredump data into
177+
* @offset: Offset in the coredump data to start reading from
178+
* @count: Number of bytes to read
179+
* @data: Pointer to the xe_devcoredump structure
180+
* @datalen: Length of the data (unused)
181+
*
182+
* Reads a chunk of the coredump snapshot data into the provided buffer.
183+
* If the devcoredump is smaller than 1.5 GB (XE_DEVCOREDUMP_CHUNK_MAX),
184+
* it is read directly from a pre-written buffer. For larger devcoredumps,
185+
* the pre-written buffer must be periodically repopulated from the snapshot
186+
* state due to kmalloc size limitations.
187+
*
188+
* Return: Number of bytes copied on success, or a negative error code on failure.
189+
*/
174190
static ssize_t xe_devcoredump_read(char *buffer, loff_t offset,
175191
size_t count, void *data, size_t datalen)
176192
{
177193
struct xe_devcoredump *coredump = data;
178194
struct xe_devcoredump_snapshot *ss;
179-
ssize_t byte_copied;
195+
ssize_t byte_copied = 0;
180196
u32 chunk_offset;
181197
ssize_t new_chunk_position;
198+
bool pm_needed = false;
199+
int ret = 0;
182200

183201
if (!coredump)
184202
return -ENODEV;
@@ -188,20 +206,19 @@ static ssize_t xe_devcoredump_read(char *buffer, loff_t offset,
188206
/* Ensure delayed work is captured before continuing */
189207
flush_work(&ss->work);
190208

191-
if (ss->read.size > XE_DEVCOREDUMP_CHUNK_MAX)
209+
pm_needed = ss->read.size > XE_DEVCOREDUMP_CHUNK_MAX;
210+
if (pm_needed)
192211
xe_pm_runtime_get(gt_to_xe(ss->gt));
193212

194213
mutex_lock(&coredump->lock);
195214

196215
if (!ss->read.buffer) {
197-
mutex_unlock(&coredump->lock);
198-
return -ENODEV;
216+
ret = -ENODEV;
217+
goto unlock;
199218
}
200219

201-
if (offset >= ss->read.size) {
202-
mutex_unlock(&coredump->lock);
203-
return 0;
204-
}
220+
if (offset >= ss->read.size)
221+
goto unlock;
205222

206223
new_chunk_position = div_u64_rem(offset,
207224
XE_DEVCOREDUMP_CHUNK_MAX,
@@ -221,12 +238,13 @@ static ssize_t xe_devcoredump_read(char *buffer, loff_t offset,
221238
ss->read.size - offset;
222239
memcpy(buffer, ss->read.buffer + chunk_offset, byte_copied);
223240

241+
unlock:
224242
mutex_unlock(&coredump->lock);
225243

226-
if (ss->read.size > XE_DEVCOREDUMP_CHUNK_MAX)
244+
if (pm_needed)
227245
xe_pm_runtime_put(gt_to_xe(ss->gt));
228246

229-
return byte_copied;
247+
return byte_copied ? byte_copied : ret;
230248
}
231249

232250
static void xe_devcoredump_free(void *data)

drivers/gpu/drm/xe/xe_gt_pagefault.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -444,6 +444,7 @@ static int xe_alloc_pf_queue(struct xe_gt *gt, struct pf_queue *pf_queue)
444444
#define PF_MULTIPLIER 8
445445
pf_queue->num_dw =
446446
(num_eus + XE_NUM_HW_ENGINES) * PF_MSG_LEN_DW * PF_MULTIPLIER;
447+
pf_queue->num_dw = roundup_pow_of_two(pf_queue->num_dw);
447448
#undef PF_MULTIPLIER
448449

449450
pf_queue->gt = gt;

drivers/gpu/drm/xe/xe_lmtt.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,9 @@ static struct xe_lmtt_pt *lmtt_pt_alloc(struct xe_lmtt *lmtt, unsigned int level
7878
}
7979

8080
lmtt_assert(lmtt, xe_bo_is_vram(bo));
81+
lmtt_debug(lmtt, "level=%u addr=%#llx\n", level, (u64)xe_bo_main_addr(bo, XE_PAGE_SIZE));
82+
83+
xe_map_memset(lmtt_to_xe(lmtt), &bo->vmap, 0, 0, bo->size);
8184

8285
pt->level = level;
8386
pt->bo = bo;
@@ -91,6 +94,9 @@ static struct xe_lmtt_pt *lmtt_pt_alloc(struct xe_lmtt *lmtt, unsigned int level
9194

9295
static void lmtt_pt_free(struct xe_lmtt_pt *pt)
9396
{
97+
lmtt_debug(&pt->bo->tile->sriov.pf.lmtt, "level=%u addr=%llx\n",
98+
pt->level, (u64)xe_bo_main_addr(pt->bo, XE_PAGE_SIZE));
99+
94100
xe_bo_unpin_map_no_vm(pt->bo);
95101
kfree(pt);
96102
}
@@ -226,9 +232,14 @@ static void lmtt_write_pte(struct xe_lmtt *lmtt, struct xe_lmtt_pt *pt,
226232

227233
switch (lmtt->ops->lmtt_pte_size(level)) {
228234
case sizeof(u32):
235+
lmtt_assert(lmtt, !overflows_type(pte, u32));
236+
lmtt_assert(lmtt, !pte || !iosys_map_rd(&pt->bo->vmap, idx * sizeof(u32), u32));
237+
229238
xe_map_wr(lmtt_to_xe(lmtt), &pt->bo->vmap, idx * sizeof(u32), u32, pte);
230239
break;
231240
case sizeof(u64):
241+
lmtt_assert(lmtt, !pte || !iosys_map_rd(&pt->bo->vmap, idx * sizeof(u64), u64));
242+
232243
xe_map_wr(lmtt_to_xe(lmtt), &pt->bo->vmap, idx * sizeof(u64), u64, pte);
233244
break;
234245
default:

drivers/gpu/drm/xe/xe_migrate.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -863,7 +863,7 @@ struct dma_fence *xe_migrate_copy(struct xe_migrate *m,
863863
if (src_is_vram && xe_migrate_allow_identity(src_L0, &src_it))
864864
xe_res_next(&src_it, src_L0);
865865
else
866-
emit_pte(m, bb, src_L0_pt, src_is_vram, copy_system_ccs,
866+
emit_pte(m, bb, src_L0_pt, src_is_vram, copy_system_ccs || use_comp_pat,
867867
&src_it, src_L0, src);
868868

869869
if (dst_is_vram && xe_migrate_allow_identity(src_L0, &dst_it))

drivers/gpu/drm/xe/xe_module.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
struct xe_modparam xe_modparam = {
2222
.probe_display = true,
23-
.guc_log_level = 3,
23+
.guc_log_level = IS_ENABLED(CONFIG_DRM_XE_DEBUG) ? 3 : 1,
2424
.force_probe = CONFIG_DRM_XE_FORCE_PROBE,
2525
.wedged_mode = 1,
2626
.svm_notifier_size = 512,

drivers/gpu/drm/xe/xe_pci.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,6 @@ static const struct xe_graphics_desc graphics_xelpg = {
140140
.has_asid = 1, \
141141
.has_atomic_enable_pte_bit = 1, \
142142
.has_flat_ccs = 1, \
143-
.has_indirect_ring_state = 1, \
144143
.has_range_tlb_invalidation = 1, \
145144
.has_usm = 1, \
146145
.has_64bit_timestamp = 1, \

drivers/gpu/drm/xe/xe_pm.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ int xe_pm_suspend(struct xe_device *xe)
134134
/* FIXME: Super racey... */
135135
err = xe_bo_evict_all(xe);
136136
if (err)
137-
goto err_pxp;
137+
goto err_display;
138138

139139
for_each_gt(gt, xe, id) {
140140
err = xe_gt_suspend(gt);
@@ -151,7 +151,6 @@ int xe_pm_suspend(struct xe_device *xe)
151151

152152
err_display:
153153
xe_display_pm_resume(xe);
154-
err_pxp:
155154
xe_pxp_pm_resume(xe->pxp);
156155
err:
157156
drm_dbg(&xe->drm, "Device suspend failed %d\n", err);
@@ -753,11 +752,13 @@ void xe_pm_assert_unbounded_bridge(struct xe_device *xe)
753752
}
754753

755754
/**
756-
* xe_pm_set_vram_threshold - Set a vram threshold for allowing/blocking D3Cold
755+
* xe_pm_set_vram_threshold - Set a VRAM threshold for allowing/blocking D3Cold
757756
* @xe: xe device instance
758-
* @threshold: VRAM size in bites for the D3cold threshold
757+
* @threshold: VRAM size in MiB for the D3cold threshold
759758
*
760-
* Returns 0 for success, negative error code otherwise.
759+
* Return:
760+
* * 0 - success
761+
* * -EINVAL - invalid argument
761762
*/
762763
int xe_pm_set_vram_threshold(struct xe_device *xe, u32 threshold)
763764
{

drivers/gpu/drm/xe/xe_uc_fw.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,10 +114,10 @@ struct fw_blobs_by_type {
114114
#define XE_GT_TYPE_ANY XE_GT_TYPE_UNINITIALIZED
115115

116116
#define XE_GUC_FIRMWARE_DEFS(fw_def, mmp_ver, major_ver) \
117-
fw_def(BATTLEMAGE, GT_TYPE_ANY, major_ver(xe, guc, bmg, 70, 44, 1)) \
118-
fw_def(LUNARLAKE, GT_TYPE_ANY, major_ver(xe, guc, lnl, 70, 44, 1)) \
117+
fw_def(BATTLEMAGE, GT_TYPE_ANY, major_ver(xe, guc, bmg, 70, 45, 2)) \
118+
fw_def(LUNARLAKE, GT_TYPE_ANY, major_ver(xe, guc, lnl, 70, 45, 2)) \
119119
fw_def(METEORLAKE, GT_TYPE_ANY, major_ver(i915, guc, mtl, 70, 44, 1)) \
120-
fw_def(DG2, GT_TYPE_ANY, major_ver(i915, guc, dg2, 70, 44, 1)) \
120+
fw_def(DG2, GT_TYPE_ANY, major_ver(i915, guc, dg2, 70, 45, 2)) \
121121
fw_def(DG1, GT_TYPE_ANY, major_ver(i915, guc, dg1, 70, 44, 1)) \
122122
fw_def(ALDERLAKE_N, GT_TYPE_ANY, major_ver(i915, guc, tgl, 70, 44, 1)) \
123123
fw_def(ALDERLAKE_P, GT_TYPE_ANY, major_ver(i915, guc, adlp, 70, 44, 1)) \

drivers/gpu/drm/xe/xe_wa_oob.rules

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,10 @@
3838
GRAPHICS_VERSION(2004)
3939
GRAPHICS_VERSION_RANGE(3000, 3001)
4040
22019338487 MEDIA_VERSION(2000)
41-
GRAPHICS_VERSION(2001)
41+
GRAPHICS_VERSION(2001), FUNC(xe_rtp_match_not_sriov_vf)
4242
MEDIA_VERSION(3000), MEDIA_STEP(A0, B0), FUNC(xe_rtp_match_not_sriov_vf)
4343
22019338487_display PLATFORM(LUNARLAKE)
44-
16023588340 GRAPHICS_VERSION(2001)
44+
16023588340 GRAPHICS_VERSION(2001), FUNC(xe_rtp_match_not_sriov_vf)
4545
14019789679 GRAPHICS_VERSION(1255)
4646
GRAPHICS_VERSION_RANGE(1270, 2004)
4747
no_media_l3 MEDIA_VERSION(3000)

0 commit comments

Comments
 (0)