Skip to content

Commit 255e094

Browse files
committed
Merge tag 'drm-intel-gt-next-2025-01-10' of https://gitlab.freedesktop.org/drm/i915/kernel into drm-next
Driver Changes: - More robust engine resets on Haswell and older (Nitin) - Dead code removal (David) - Selftest, logging and tracing improvements (Sk, Nitin, Sebastian, Apoorva) Signed-off-by: Dave Airlie <[email protected]> From: Joonas Lahtinen <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
2 parents 39388d5 + 6f0572f commit 255e094

13 files changed

+39
-101
lines changed

drivers/gpu/drm/i915/gem/i915_gem_lmem.c

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -52,29 +52,6 @@ bool i915_gem_object_is_lmem(struct drm_i915_gem_object *obj)
5252
mr->type == INTEL_MEMORY_STOLEN_LOCAL);
5353
}
5454

55-
/**
56-
* __i915_gem_object_is_lmem - Whether the object is resident in
57-
* lmem while in the fence signaling critical path.
58-
* @obj: The object to check.
59-
*
60-
* This function is intended to be called from within the fence signaling
61-
* path where the fence, or a pin, keeps the object from being migrated. For
62-
* example during gpu reset or similar.
63-
*
64-
* Return: Whether the object is resident in lmem.
65-
*/
66-
bool __i915_gem_object_is_lmem(struct drm_i915_gem_object *obj)
67-
{
68-
struct intel_memory_region *mr = READ_ONCE(obj->mm.region);
69-
70-
#ifdef CONFIG_LOCKDEP
71-
GEM_WARN_ON(dma_resv_test_signaled(obj->base.resv, DMA_RESV_USAGE_BOOKKEEP) &&
72-
i915_gem_object_evictable(obj));
73-
#endif
74-
return mr && (mr->type == INTEL_MEMORY_LOCAL ||
75-
mr->type == INTEL_MEMORY_STOLEN_LOCAL);
76-
}
77-
7855
/**
7956
* __i915_gem_object_create_lmem_with_ps - Create lmem object and force the
8057
* minimum page size for the backing pages.

drivers/gpu/drm/i915/gem/i915_gem_lmem.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@ i915_gem_object_lmem_io_map(struct drm_i915_gem_object *obj,
1919

2020
bool i915_gem_object_is_lmem(struct drm_i915_gem_object *obj);
2121

22-
bool __i915_gem_object_is_lmem(struct drm_i915_gem_object *obj);
23-
2422
struct drm_i915_gem_object *
2523
i915_gem_object_create_lmem_from_data(struct drm_i915_private *i915,
2624
const void *data, size_t size);

drivers/gpu/drm/i915/gt/intel_reset.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1113,6 +1113,7 @@ static bool __intel_gt_unset_wedged(struct intel_gt *gt)
11131113
* Warn CI about the unrecoverable wedged condition.
11141114
* Time for a reboot.
11151115
*/
1116+
gt_err(gt, "Unrecoverable wedged condition\n");
11161117
add_taint_for_CI(gt->i915, TAINT_WARN);
11171118
return false;
11181119
}
@@ -1264,8 +1265,10 @@ void intel_gt_reset(struct intel_gt *gt,
12641265
}
12651266

12661267
ret = resume(gt);
1267-
if (ret)
1268+
if (ret) {
1269+
gt_err(gt, "Failed to resume (%d)\n", ret);
12681270
goto taint;
1271+
}
12691272

12701273
finish:
12711274
reset_finish(gt, awake);
@@ -1608,6 +1611,7 @@ void intel_gt_set_wedged_on_init(struct intel_gt *gt)
16081611
set_bit(I915_WEDGED_ON_INIT, &gt->reset.flags);
16091612

16101613
/* Wedged on init is non-recoverable */
1614+
gt_err(gt, "Non-recoverable wedged on init\n");
16111615
add_taint_for_CI(gt->i915, TAINT_WARN);
16121616
}
16131617

drivers/gpu/drm/i915/gt/intel_ring.c

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -308,30 +308,6 @@ u32 *intel_ring_begin(struct i915_request *rq, unsigned int num_dwords)
308308
return cs;
309309
}
310310

311-
/* Align the ring tail to a cacheline boundary */
312-
int intel_ring_cacheline_align(struct i915_request *rq)
313-
{
314-
int num_dwords;
315-
void *cs;
316-
317-
num_dwords = (rq->ring->emit & (CACHELINE_BYTES - 1)) / sizeof(u32);
318-
if (num_dwords == 0)
319-
return 0;
320-
321-
num_dwords = CACHELINE_DWORDS - num_dwords;
322-
GEM_BUG_ON(num_dwords & 1);
323-
324-
cs = intel_ring_begin(rq, num_dwords);
325-
if (IS_ERR(cs))
326-
return PTR_ERR(cs);
327-
328-
memset64(cs, (u64)MI_NOOP << 32 | MI_NOOP, num_dwords / 2);
329-
intel_ring_advance(rq, cs + num_dwords);
330-
331-
GEM_BUG_ON(rq->ring->emit & (CACHELINE_BYTES - 1));
332-
return 0;
333-
}
334-
335311
#if IS_ENABLED(CONFIG_DRM_I915_SELFTEST)
336312
#include "selftest_ring.c"
337313
#endif

drivers/gpu/drm/i915/gt/intel_ring.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ struct intel_ring *
1616
intel_engine_create_ring(struct intel_engine_cs *engine, int size);
1717

1818
u32 *intel_ring_begin(struct i915_request *rq, unsigned int num_dwords);
19-
int intel_ring_cacheline_align(struct i915_request *rq);
2019

2120
unsigned int intel_ring_update_space(struct intel_ring *ring);
2221

drivers/gpu/drm/i915/gt/intel_ring_submission.c

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
#include "shmem_utils.h"
2727
#include "intel_engine_heartbeat.h"
2828
#include "intel_engine_pm.h"
29+
#include "intel_gt_print.h"
2930

3031
/* Rough estimate of the typical request size, performing a flush,
3132
* set-context and then emitting the batch.
@@ -230,8 +231,13 @@ static int xcs_resume(struct intel_engine_cs *engine)
230231

231232
set_pp_dir(engine);
232233

233-
/* First wake the ring up to an empty/idle ring */
234-
for ((kt) = ktime_get() + (2 * NSEC_PER_MSEC);
234+
/*
235+
* First wake the ring up to an empty/idle ring.
236+
* Use 50ms of delay to let the engine write successfully
237+
* for all platforms. Experimented with different values and
238+
* determined that 50ms works best based on testing.
239+
*/
240+
for ((kt) = ktime_get() + (50 * NSEC_PER_MSEC);
235241
ktime_before(ktime_get(), (kt)); cpu_relax()) {
236242
/*
237243
* In case of resets fails because engine resumes from
@@ -282,16 +288,16 @@ static int xcs_resume(struct intel_engine_cs *engine)
282288
return 0;
283289

284290
err:
285-
drm_err(&engine->i915->drm,
286-
"%s initialization failed; "
287-
"ctl %08x (valid? %d) head %08x [%08x] tail %08x [%08x] start %08x [expected %08x]\n",
288-
engine->name,
289-
ENGINE_READ(engine, RING_CTL),
290-
ENGINE_READ(engine, RING_CTL) & RING_VALID,
291-
ENGINE_READ(engine, RING_HEAD), ring->head,
292-
ENGINE_READ(engine, RING_TAIL), ring->tail,
293-
ENGINE_READ(engine, RING_START),
294-
i915_ggtt_offset(ring->vma));
291+
gt_err(engine->gt, "%s initialization failed\n", engine->name);
292+
ENGINE_TRACE(engine,
293+
"ctl %08x (valid? %d) head %08x [%08x] tail %08x [%08x] start %08x [expected %08x]\n",
294+
ENGINE_READ(engine, RING_CTL),
295+
ENGINE_READ(engine, RING_CTL) & RING_VALID,
296+
ENGINE_READ(engine, RING_HEAD), ring->head,
297+
ENGINE_READ(engine, RING_TAIL), ring->tail,
298+
ENGINE_READ(engine, RING_START),
299+
i915_ggtt_offset(ring->vma));
300+
GEM_TRACE_DUMP();
295301
return -EIO;
296302
}
297303

drivers/gpu/drm/i915/gt/selftest_migrate.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ static int clear(struct intel_migrate *migrate,
262262
{
263263
struct drm_i915_private *i915 = migrate->context->engine->i915;
264264
struct drm_i915_gem_object *obj;
265-
struct i915_request *rq;
265+
struct i915_request *rq = NULL;
266266
struct i915_gem_ww_ctx ww;
267267
u32 *vaddr, val = 0;
268268
bool ccs_cap = false;

drivers/gpu/drm/i915/gt/selftest_rc6.c

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#include "intel_gpu_commands.h"
99
#include "intel_gt_requests.h"
1010
#include "intel_ring.h"
11+
#include "intel_rps.h"
1112
#include "selftest_rc6.h"
1213

1314
#include "selftests/i915_random.h"
@@ -38,6 +39,9 @@ int live_rc6_manual(void *arg)
3839
ktime_t dt;
3940
u64 res[2];
4041
int err = 0;
42+
u32 rc0_freq = 0;
43+
u32 rc6_freq = 0;
44+
struct intel_rps *rps = &gt->rps;
4145

4246
/*
4347
* Our claim is that we can "encourage" the GPU to enter rc6 at will.
@@ -66,6 +70,7 @@ int live_rc6_manual(void *arg)
6670
rc0_power = librapl_energy_uJ() - rc0_power;
6771
dt = ktime_sub(ktime_get(), dt);
6872
res[1] = rc6_residency(rc6);
73+
rc0_freq = intel_rps_read_actual_frequency_fw(rps);
6974
if ((res[1] - res[0]) >> 10) {
7075
pr_err("RC6 residency increased by %lldus while disabled for 1000ms!\n",
7176
(res[1] - res[0]) >> 10);
@@ -77,7 +82,11 @@ int live_rc6_manual(void *arg)
7782
rc0_power = div64_u64(NSEC_PER_SEC * rc0_power,
7883
ktime_to_ns(dt));
7984
if (!rc0_power) {
80-
pr_err("No power measured while in RC0\n");
85+
if (rc0_freq)
86+
pr_debug("No power measured while in RC0! GPU Freq: %u in RC0\n",
87+
rc0_freq);
88+
else
89+
pr_err("No power and freq measured while in RC0\n");
8190
err = -EINVAL;
8291
goto out_unlock;
8392
}
@@ -90,7 +99,8 @@ int live_rc6_manual(void *arg)
9099
intel_uncore_forcewake_flush(rc6_to_uncore(rc6), FORCEWAKE_ALL);
91100
dt = ktime_get();
92101
rc6_power = librapl_energy_uJ();
93-
msleep(100);
102+
msleep(1000);
103+
rc6_freq = intel_rps_read_actual_frequency_fw(rps);
94104
rc6_power = librapl_energy_uJ() - rc6_power;
95105
dt = ktime_sub(ktime_get(), dt);
96106
res[1] = rc6_residency(rc6);
@@ -108,7 +118,8 @@ int live_rc6_manual(void *arg)
108118
pr_info("GPU consumed %llduW in RC0 and %llduW in RC6\n",
109119
rc0_power, rc6_power);
110120
if (2 * rc6_power > rc0_power) {
111-
pr_err("GPU leaked energy while in RC6!\n");
121+
pr_err("GPU leaked energy while in RC6! GPU Freq: %u in RC6 and %u in RC0\n",
122+
rc6_freq, rc0_freq);
112123
err = -EINVAL;
113124
goto out_unlock;
114125
}

drivers/gpu/drm/i915/gt/uc/intel_guc_log.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
#define GUC_LOG_DEFAULT_CRASH_BUFFER_SIZE SZ_2M
1919
#define GUC_LOG_DEFAULT_DEBUG_BUFFER_SIZE SZ_16M
2020
#define GUC_LOG_DEFAULT_CAPTURE_BUFFER_SIZE SZ_1M
21-
#elif defined(CONFIG_DRM_I915_DEBUG_GEM)
21+
#elif IS_ENABLED(CONFIG_DRM_I915_DEBUG_GEM)
2222
#define GUC_LOG_DEFAULT_CRASH_BUFFER_SIZE SZ_1M
2323
#define GUC_LOG_DEFAULT_DEBUG_BUFFER_SIZE SZ_2M
2424
#define GUC_LOG_DEFAULT_CAPTURE_BUFFER_SIZE SZ_1M

drivers/gpu/drm/i915/gt/uc/intel_huc.c

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -427,19 +427,6 @@ void intel_huc_fini(struct intel_huc *huc)
427427
intel_uc_fw_fini(&huc->fw);
428428
}
429429

430-
void intel_huc_suspend(struct intel_huc *huc)
431-
{
432-
if (!intel_uc_fw_is_loadable(&huc->fw))
433-
return;
434-
435-
/*
436-
* in the unlikely case that we're suspending before the GSC has
437-
* completed its loading sequence, just stop waiting. We'll restart
438-
* on resume.
439-
*/
440-
delayed_huc_load_complete(huc);
441-
}
442-
443430
static const char *auth_mode_string(struct intel_huc *huc,
444431
enum intel_huc_authentication_type type)
445432
{

drivers/gpu/drm/i915/gt/uc/intel_huc.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ int intel_huc_sanitize(struct intel_huc *huc);
5757
void intel_huc_init_early(struct intel_huc *huc);
5858
int intel_huc_init(struct intel_huc *huc);
5959
void intel_huc_fini(struct intel_huc *huc);
60-
void intel_huc_suspend(struct intel_huc *huc);
6160
int intel_huc_auth(struct intel_huc *huc, enum intel_huc_authentication_type type);
6261
int intel_huc_wait_for_auth_complete(struct intel_huc *huc,
6362
enum intel_huc_authentication_type type);

drivers/gpu/drm/i915/i915_active.c

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -527,24 +527,6 @@ int i915_active_acquire(struct i915_active *ref)
527527
return err;
528528
}
529529

530-
int i915_active_acquire_for_context(struct i915_active *ref, u64 idx)
531-
{
532-
struct i915_active_fence *active;
533-
int err;
534-
535-
err = i915_active_acquire(ref);
536-
if (err)
537-
return err;
538-
539-
active = active_instance(ref, idx);
540-
if (!active) {
541-
i915_active_release(ref);
542-
return -ENOMEM;
543-
}
544-
545-
return 0; /* return with active ref */
546-
}
547-
548530
void i915_active_release(struct i915_active *ref)
549531
{
550532
debug_active_assert(ref);

drivers/gpu/drm/i915/i915_active.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,6 @@ int i915_request_await_active(struct i915_request *rq,
186186
#define I915_ACTIVE_AWAIT_BARRIER BIT(2)
187187

188188
int i915_active_acquire(struct i915_active *ref);
189-
int i915_active_acquire_for_context(struct i915_active *ref, u64 idx);
190189
bool i915_active_acquire_if_busy(struct i915_active *ref);
191190

192191
void i915_active_release(struct i915_active *ref);

0 commit comments

Comments
 (0)