15ca02815Sjsg // SPDX-License-Identifier: MIT
2c349dbc7Sjsg /*
3c349dbc7Sjsg * Copyright © 2019 Intel Corporation
4c349dbc7Sjsg */
5c349dbc7Sjsg
6c349dbc7Sjsg #include "gt/intel_engine_pm.h"
75ca02815Sjsg #include "gt/intel_gpu_commands.h"
8c349dbc7Sjsg #include "i915_selftest.h"
9c349dbc7Sjsg
10*f005ef32Sjsg #include "gem/selftests/igt_gem_utils.h"
11c349dbc7Sjsg #include "gem/selftests/mock_context.h"
12c349dbc7Sjsg #include "selftests/igt_reset.h"
13c349dbc7Sjsg #include "selftests/igt_spinner.h"
145ca02815Sjsg #include "selftests/intel_scheduler_helpers.h"
15c349dbc7Sjsg
16c349dbc7Sjsg struct live_mocs {
175ca02815Sjsg struct drm_i915_mocs_table table;
185ca02815Sjsg struct drm_i915_mocs_table *mocs;
195ca02815Sjsg struct drm_i915_mocs_table *l3cc;
20c349dbc7Sjsg struct i915_vma *scratch;
21c349dbc7Sjsg void *vaddr;
22c349dbc7Sjsg };
23c349dbc7Sjsg
mocs_context_create(struct intel_engine_cs * engine)242fdb5a15Sjsg static struct intel_context *mocs_context_create(struct intel_engine_cs *engine)
252fdb5a15Sjsg {
262fdb5a15Sjsg struct intel_context *ce;
272fdb5a15Sjsg
282fdb5a15Sjsg ce = intel_context_create(engine);
292fdb5a15Sjsg if (IS_ERR(ce))
302fdb5a15Sjsg return ce;
312fdb5a15Sjsg
322fdb5a15Sjsg /* We build large requests to read the registers from the ring */
335ca02815Sjsg ce->ring_size = SZ_16K;
342fdb5a15Sjsg
352fdb5a15Sjsg return ce;
362fdb5a15Sjsg }
372fdb5a15Sjsg
request_add_sync(struct i915_request * rq,int err)38c349dbc7Sjsg static int request_add_sync(struct i915_request *rq, int err)
39c349dbc7Sjsg {
40c349dbc7Sjsg i915_request_get(rq);
41c349dbc7Sjsg i915_request_add(rq);
42c349dbc7Sjsg if (i915_request_wait(rq, 0, HZ / 5) < 0)
43c349dbc7Sjsg err = -ETIME;
44c349dbc7Sjsg i915_request_put(rq);
45c349dbc7Sjsg
46c349dbc7Sjsg return err;
47c349dbc7Sjsg }
48c349dbc7Sjsg
request_add_spin(struct i915_request * rq,struct igt_spinner * spin)49c349dbc7Sjsg static int request_add_spin(struct i915_request *rq, struct igt_spinner *spin)
50c349dbc7Sjsg {
51c349dbc7Sjsg int err = 0;
52c349dbc7Sjsg
53c349dbc7Sjsg i915_request_get(rq);
54c349dbc7Sjsg i915_request_add(rq);
55c349dbc7Sjsg if (spin && !igt_wait_for_spinner(spin, rq))
56c349dbc7Sjsg err = -ETIME;
57c349dbc7Sjsg i915_request_put(rq);
58c349dbc7Sjsg
59c349dbc7Sjsg return err;
60c349dbc7Sjsg }
61c349dbc7Sjsg
live_mocs_init(struct live_mocs * arg,struct intel_gt * gt)62c349dbc7Sjsg static int live_mocs_init(struct live_mocs *arg, struct intel_gt *gt)
63c349dbc7Sjsg {
64c349dbc7Sjsg unsigned int flags;
65c349dbc7Sjsg int err;
66c349dbc7Sjsg
67c349dbc7Sjsg memset(arg, 0, sizeof(*arg));
68c349dbc7Sjsg
695ca02815Sjsg flags = get_mocs_settings(gt->i915, &arg->table);
70c349dbc7Sjsg if (!flags)
71c349dbc7Sjsg return -EINVAL;
72c349dbc7Sjsg
73c349dbc7Sjsg if (flags & HAS_RENDER_L3CC)
745ca02815Sjsg arg->l3cc = &arg->table;
75c349dbc7Sjsg
76c349dbc7Sjsg if (flags & (HAS_GLOBAL_MOCS | HAS_ENGINE_MOCS))
775ca02815Sjsg arg->mocs = &arg->table;
78c349dbc7Sjsg
795ca02815Sjsg arg->scratch =
805ca02815Sjsg __vm_create_scratch_for_read_pinned(>->ggtt->vm, PAGE_SIZE);
81c349dbc7Sjsg if (IS_ERR(arg->scratch))
82c349dbc7Sjsg return PTR_ERR(arg->scratch);
83c349dbc7Sjsg
845ca02815Sjsg arg->vaddr = i915_gem_object_pin_map_unlocked(arg->scratch->obj, I915_MAP_WB);
85c349dbc7Sjsg if (IS_ERR(arg->vaddr)) {
86c349dbc7Sjsg err = PTR_ERR(arg->vaddr);
87c349dbc7Sjsg goto err_scratch;
88c349dbc7Sjsg }
89c349dbc7Sjsg
90c349dbc7Sjsg return 0;
91c349dbc7Sjsg
92c349dbc7Sjsg err_scratch:
93c349dbc7Sjsg i915_vma_unpin_and_release(&arg->scratch, 0);
94c349dbc7Sjsg return err;
95c349dbc7Sjsg }
96c349dbc7Sjsg
live_mocs_fini(struct live_mocs * arg)97c349dbc7Sjsg static void live_mocs_fini(struct live_mocs *arg)
98c349dbc7Sjsg {
99c349dbc7Sjsg i915_vma_unpin_and_release(&arg->scratch, I915_VMA_RELEASE_MAP);
100c349dbc7Sjsg }
101c349dbc7Sjsg
read_regs(struct i915_request * rq,u32 addr,unsigned int count,u32 * offset)102c349dbc7Sjsg static int read_regs(struct i915_request *rq,
103c349dbc7Sjsg u32 addr, unsigned int count,
1045ca02815Sjsg u32 *offset)
105c349dbc7Sjsg {
106c349dbc7Sjsg unsigned int i;
107c349dbc7Sjsg u32 *cs;
108c349dbc7Sjsg
109c349dbc7Sjsg GEM_BUG_ON(!IS_ALIGNED(*offset, sizeof(u32)));
110c349dbc7Sjsg
111c349dbc7Sjsg cs = intel_ring_begin(rq, 4 * count);
112c349dbc7Sjsg if (IS_ERR(cs))
113c349dbc7Sjsg return PTR_ERR(cs);
114c349dbc7Sjsg
115c349dbc7Sjsg for (i = 0; i < count; i++) {
116c349dbc7Sjsg *cs++ = MI_STORE_REGISTER_MEM_GEN8 | MI_USE_GGTT;
117c349dbc7Sjsg *cs++ = addr;
118c349dbc7Sjsg *cs++ = *offset;
119c349dbc7Sjsg *cs++ = 0;
120c349dbc7Sjsg
121c349dbc7Sjsg addr += sizeof(u32);
122c349dbc7Sjsg *offset += sizeof(u32);
123c349dbc7Sjsg }
124c349dbc7Sjsg
125c349dbc7Sjsg intel_ring_advance(rq, cs);
126c349dbc7Sjsg
127c349dbc7Sjsg return 0;
128c349dbc7Sjsg }
129c349dbc7Sjsg
read_mocs_table(struct i915_request * rq,const struct drm_i915_mocs_table * table,u32 * offset)130c349dbc7Sjsg static int read_mocs_table(struct i915_request *rq,
131c349dbc7Sjsg const struct drm_i915_mocs_table *table,
1325ca02815Sjsg u32 *offset)
133c349dbc7Sjsg {
134*f005ef32Sjsg struct intel_gt *gt = rq->engine->gt;
135c349dbc7Sjsg u32 addr;
136c349dbc7Sjsg
1375ca02815Sjsg if (!table)
1385ca02815Sjsg return 0;
1395ca02815Sjsg
140*f005ef32Sjsg if (HAS_GLOBAL_MOCS_REGISTERS(rq->i915))
141*f005ef32Sjsg addr = global_mocs_offset() + gt->uncore->gsi_offset;
142c349dbc7Sjsg else
143c349dbc7Sjsg addr = mocs_offset(rq->engine);
144c349dbc7Sjsg
145c349dbc7Sjsg return read_regs(rq, addr, table->n_entries, offset);
146c349dbc7Sjsg }
147c349dbc7Sjsg
read_l3cc_table(struct i915_request * rq,const struct drm_i915_mocs_table * table,u32 * offset)148c349dbc7Sjsg static int read_l3cc_table(struct i915_request *rq,
149c349dbc7Sjsg const struct drm_i915_mocs_table *table,
1505ca02815Sjsg u32 *offset)
151c349dbc7Sjsg {
152c349dbc7Sjsg u32 addr = i915_mmio_reg_offset(GEN9_LNCFCMOCS(0));
153c349dbc7Sjsg
1545ca02815Sjsg if (!table)
1555ca02815Sjsg return 0;
1565ca02815Sjsg
157c349dbc7Sjsg return read_regs(rq, addr, (table->n_entries + 1) / 2, offset);
158c349dbc7Sjsg }
159c349dbc7Sjsg
check_mocs_table(struct intel_engine_cs * engine,const struct drm_i915_mocs_table * table,u32 ** vaddr)160c349dbc7Sjsg static int check_mocs_table(struct intel_engine_cs *engine,
161c349dbc7Sjsg const struct drm_i915_mocs_table *table,
1625ca02815Sjsg u32 **vaddr)
163c349dbc7Sjsg {
164c349dbc7Sjsg unsigned int i;
165c349dbc7Sjsg u32 expect;
166c349dbc7Sjsg
1675ca02815Sjsg if (!table)
1685ca02815Sjsg return 0;
1695ca02815Sjsg
170c349dbc7Sjsg for_each_mocs(expect, table, i) {
171c349dbc7Sjsg if (**vaddr != expect) {
172c349dbc7Sjsg pr_err("%s: Invalid MOCS[%d] entry, found %08x, expected %08x\n",
173c349dbc7Sjsg engine->name, i, **vaddr, expect);
174c349dbc7Sjsg return -EINVAL;
175c349dbc7Sjsg }
176c349dbc7Sjsg ++*vaddr;
177c349dbc7Sjsg }
178c349dbc7Sjsg
179c349dbc7Sjsg return 0;
180c349dbc7Sjsg }
181c349dbc7Sjsg
mcr_range(struct drm_i915_private * i915,u32 offset)182c349dbc7Sjsg static bool mcr_range(struct drm_i915_private *i915, u32 offset)
183c349dbc7Sjsg {
184c349dbc7Sjsg /*
185c349dbc7Sjsg * Registers in this range are affected by the MCR selector
186c349dbc7Sjsg * which only controls CPU initiated MMIO. Routing does not
187c349dbc7Sjsg * work for CS access so we cannot verify them on this path.
188c349dbc7Sjsg */
1895ca02815Sjsg return GRAPHICS_VER(i915) >= 8 && offset >= 0xb000 && offset <= 0xb4ff;
190c349dbc7Sjsg }
191c349dbc7Sjsg
check_l3cc_table(struct intel_engine_cs * engine,const struct drm_i915_mocs_table * table,u32 ** vaddr)192c349dbc7Sjsg static int check_l3cc_table(struct intel_engine_cs *engine,
193c349dbc7Sjsg const struct drm_i915_mocs_table *table,
1945ca02815Sjsg u32 **vaddr)
195c349dbc7Sjsg {
196c349dbc7Sjsg /* Can we read the MCR range 0xb00 directly? See intel_workarounds! */
197c349dbc7Sjsg u32 reg = i915_mmio_reg_offset(GEN9_LNCFCMOCS(0));
198c349dbc7Sjsg unsigned int i;
199c349dbc7Sjsg u32 expect;
200c349dbc7Sjsg
2015ca02815Sjsg if (!table)
2025ca02815Sjsg return 0;
2035ca02815Sjsg
204c349dbc7Sjsg for_each_l3cc(expect, table, i) {
205c349dbc7Sjsg if (!mcr_range(engine->i915, reg) && **vaddr != expect) {
206c349dbc7Sjsg pr_err("%s: Invalid L3CC[%d] entry, found %08x, expected %08x\n",
207c349dbc7Sjsg engine->name, i, **vaddr, expect);
208c349dbc7Sjsg return -EINVAL;
209c349dbc7Sjsg }
210c349dbc7Sjsg ++*vaddr;
211c349dbc7Sjsg reg += 4;
212c349dbc7Sjsg }
213c349dbc7Sjsg
214c349dbc7Sjsg return 0;
215c349dbc7Sjsg }
216c349dbc7Sjsg
check_mocs_engine(struct live_mocs * arg,struct intel_context * ce)217c349dbc7Sjsg static int check_mocs_engine(struct live_mocs *arg,
218c349dbc7Sjsg struct intel_context *ce)
219c349dbc7Sjsg {
220c349dbc7Sjsg struct i915_vma *vma = arg->scratch;
221c349dbc7Sjsg struct i915_request *rq;
222c349dbc7Sjsg u32 offset;
223c349dbc7Sjsg u32 *vaddr;
224c349dbc7Sjsg int err;
225c349dbc7Sjsg
226c349dbc7Sjsg memset32(arg->vaddr, STACK_MAGIC, PAGE_SIZE / sizeof(u32));
227c349dbc7Sjsg
228c349dbc7Sjsg rq = intel_context_create_request(ce);
229c349dbc7Sjsg if (IS_ERR(rq))
230c349dbc7Sjsg return PTR_ERR(rq);
231c349dbc7Sjsg
232*f005ef32Sjsg err = igt_vma_move_to_active_unlocked(vma, rq, EXEC_OBJECT_WRITE);
233c349dbc7Sjsg
234c349dbc7Sjsg /* Read the mocs tables back using SRM */
235c349dbc7Sjsg offset = i915_ggtt_offset(vma);
236c349dbc7Sjsg if (!err)
2375ca02815Sjsg err = read_mocs_table(rq, arg->mocs, &offset);
238c349dbc7Sjsg if (!err && ce->engine->class == RENDER_CLASS)
2395ca02815Sjsg err = read_l3cc_table(rq, arg->l3cc, &offset);
240c349dbc7Sjsg offset -= i915_ggtt_offset(vma);
241c349dbc7Sjsg GEM_BUG_ON(offset > PAGE_SIZE);
242c349dbc7Sjsg
243c349dbc7Sjsg err = request_add_sync(rq, err);
244c349dbc7Sjsg if (err)
245c349dbc7Sjsg return err;
246c349dbc7Sjsg
247c349dbc7Sjsg /* Compare the results against the expected tables */
248c349dbc7Sjsg vaddr = arg->vaddr;
249c349dbc7Sjsg if (!err)
2505ca02815Sjsg err = check_mocs_table(ce->engine, arg->mocs, &vaddr);
251c349dbc7Sjsg if (!err && ce->engine->class == RENDER_CLASS)
2525ca02815Sjsg err = check_l3cc_table(ce->engine, arg->l3cc, &vaddr);
253c349dbc7Sjsg if (err)
254c349dbc7Sjsg return err;
255c349dbc7Sjsg
256c349dbc7Sjsg GEM_BUG_ON(arg->vaddr + offset != vaddr);
257c349dbc7Sjsg return 0;
258c349dbc7Sjsg }
259c349dbc7Sjsg
live_mocs_kernel(void * arg)260c349dbc7Sjsg static int live_mocs_kernel(void *arg)
261c349dbc7Sjsg {
262c349dbc7Sjsg struct intel_gt *gt = arg;
263c349dbc7Sjsg struct intel_engine_cs *engine;
264c349dbc7Sjsg enum intel_engine_id id;
265c349dbc7Sjsg struct live_mocs mocs;
266c349dbc7Sjsg int err;
267c349dbc7Sjsg
268c349dbc7Sjsg /* Basic check the system is configured with the expected mocs table */
269c349dbc7Sjsg
270c349dbc7Sjsg err = live_mocs_init(&mocs, gt);
271c349dbc7Sjsg if (err)
272c349dbc7Sjsg return err;
273c349dbc7Sjsg
274c349dbc7Sjsg for_each_engine(engine, gt, id) {
275c349dbc7Sjsg intel_engine_pm_get(engine);
276c349dbc7Sjsg err = check_mocs_engine(&mocs, engine->kernel_context);
277c349dbc7Sjsg intel_engine_pm_put(engine);
278c349dbc7Sjsg if (err)
279c349dbc7Sjsg break;
280c349dbc7Sjsg }
281c349dbc7Sjsg
282c349dbc7Sjsg live_mocs_fini(&mocs);
283c349dbc7Sjsg return err;
284c349dbc7Sjsg }
285c349dbc7Sjsg
live_mocs_clean(void * arg)286c349dbc7Sjsg static int live_mocs_clean(void *arg)
287c349dbc7Sjsg {
288c349dbc7Sjsg struct intel_gt *gt = arg;
289c349dbc7Sjsg struct intel_engine_cs *engine;
290c349dbc7Sjsg enum intel_engine_id id;
291c349dbc7Sjsg struct live_mocs mocs;
292c349dbc7Sjsg int err;
293c349dbc7Sjsg
294c349dbc7Sjsg /* Every new context should see the same mocs table */
295c349dbc7Sjsg
296c349dbc7Sjsg err = live_mocs_init(&mocs, gt);
297c349dbc7Sjsg if (err)
298c349dbc7Sjsg return err;
299c349dbc7Sjsg
300c349dbc7Sjsg for_each_engine(engine, gt, id) {
301c349dbc7Sjsg struct intel_context *ce;
302c349dbc7Sjsg
3032fdb5a15Sjsg ce = mocs_context_create(engine);
304c349dbc7Sjsg if (IS_ERR(ce)) {
305c349dbc7Sjsg err = PTR_ERR(ce);
306c349dbc7Sjsg break;
307c349dbc7Sjsg }
308c349dbc7Sjsg
309c349dbc7Sjsg err = check_mocs_engine(&mocs, ce);
310c349dbc7Sjsg intel_context_put(ce);
311c349dbc7Sjsg if (err)
312c349dbc7Sjsg break;
313c349dbc7Sjsg }
314c349dbc7Sjsg
315c349dbc7Sjsg live_mocs_fini(&mocs);
316c349dbc7Sjsg return err;
317c349dbc7Sjsg }
318c349dbc7Sjsg
active_engine_reset(struct intel_context * ce,const char * reason,bool using_guc)319c349dbc7Sjsg static int active_engine_reset(struct intel_context *ce,
3205ca02815Sjsg const char *reason,
3215ca02815Sjsg bool using_guc)
322c349dbc7Sjsg {
323c349dbc7Sjsg struct igt_spinner spin;
324c349dbc7Sjsg struct i915_request *rq;
325c349dbc7Sjsg int err;
326c349dbc7Sjsg
327c349dbc7Sjsg err = igt_spinner_init(&spin, ce->engine->gt);
328c349dbc7Sjsg if (err)
329c349dbc7Sjsg return err;
330c349dbc7Sjsg
331c349dbc7Sjsg rq = igt_spinner_create_request(&spin, ce, MI_NOOP);
332c349dbc7Sjsg if (IS_ERR(rq)) {
333c349dbc7Sjsg igt_spinner_fini(&spin);
334c349dbc7Sjsg return PTR_ERR(rq);
335c349dbc7Sjsg }
336c349dbc7Sjsg
337c349dbc7Sjsg err = request_add_spin(rq, &spin);
3385ca02815Sjsg if (err == 0 && !using_guc)
339c349dbc7Sjsg err = intel_engine_reset(ce->engine, reason);
340c349dbc7Sjsg
3415ca02815Sjsg /* Ensure the reset happens and kills the engine */
3425ca02815Sjsg if (err == 0)
3435ca02815Sjsg err = intel_selftest_wait_for_rq(rq);
3445ca02815Sjsg
345c349dbc7Sjsg igt_spinner_end(&spin);
346c349dbc7Sjsg igt_spinner_fini(&spin);
347c349dbc7Sjsg
348c349dbc7Sjsg return err;
349c349dbc7Sjsg }
350c349dbc7Sjsg
__live_mocs_reset(struct live_mocs * mocs,struct intel_context * ce,bool using_guc)351c349dbc7Sjsg static int __live_mocs_reset(struct live_mocs *mocs,
3525ca02815Sjsg struct intel_context *ce, bool using_guc)
353c349dbc7Sjsg {
3545ca02815Sjsg struct intel_gt *gt = ce->engine->gt;
355c349dbc7Sjsg int err;
356c349dbc7Sjsg
3575ca02815Sjsg if (intel_has_reset_engine(gt)) {
3585ca02815Sjsg if (!using_guc) {
359c349dbc7Sjsg err = intel_engine_reset(ce->engine, "mocs");
360c349dbc7Sjsg if (err)
361c349dbc7Sjsg return err;
362c349dbc7Sjsg
363c349dbc7Sjsg err = check_mocs_engine(mocs, ce);
364c349dbc7Sjsg if (err)
365c349dbc7Sjsg return err;
3665ca02815Sjsg }
367c349dbc7Sjsg
3685ca02815Sjsg err = active_engine_reset(ce, "mocs", using_guc);
369c349dbc7Sjsg if (err)
370c349dbc7Sjsg return err;
371c349dbc7Sjsg
372c349dbc7Sjsg err = check_mocs_engine(mocs, ce);
373c349dbc7Sjsg if (err)
374c349dbc7Sjsg return err;
3755ca02815Sjsg }
376c349dbc7Sjsg
3775ca02815Sjsg if (intel_has_gpu_reset(gt)) {
3785ca02815Sjsg intel_gt_reset(gt, ce->engine->mask, "mocs");
379c349dbc7Sjsg
380c349dbc7Sjsg err = check_mocs_engine(mocs, ce);
381c349dbc7Sjsg if (err)
382c349dbc7Sjsg return err;
3835ca02815Sjsg }
384c349dbc7Sjsg
385c349dbc7Sjsg return 0;
386c349dbc7Sjsg }
387c349dbc7Sjsg
live_mocs_reset(void * arg)388c349dbc7Sjsg static int live_mocs_reset(void *arg)
389c349dbc7Sjsg {
390c349dbc7Sjsg struct intel_gt *gt = arg;
391c349dbc7Sjsg struct intel_engine_cs *engine;
392c349dbc7Sjsg enum intel_engine_id id;
393c349dbc7Sjsg struct live_mocs mocs;
394c349dbc7Sjsg int err = 0;
395c349dbc7Sjsg
396c349dbc7Sjsg /* Check the mocs setup is retained over per-engine and global resets */
397c349dbc7Sjsg
398c349dbc7Sjsg err = live_mocs_init(&mocs, gt);
399c349dbc7Sjsg if (err)
400c349dbc7Sjsg return err;
401c349dbc7Sjsg
402c349dbc7Sjsg igt_global_reset_lock(gt);
403c349dbc7Sjsg for_each_engine(engine, gt, id) {
4045ca02815Sjsg bool using_guc = intel_engine_uses_guc(engine);
4055ca02815Sjsg struct intel_selftest_saved_policy saved;
406c349dbc7Sjsg struct intel_context *ce;
4075ca02815Sjsg int err2;
4085ca02815Sjsg
4095ca02815Sjsg err = intel_selftest_modify_policy(engine, &saved,
4105ca02815Sjsg SELFTEST_SCHEDULER_MODIFY_FAST_RESET);
4115ca02815Sjsg if (err)
4125ca02815Sjsg break;
413c349dbc7Sjsg
4142fdb5a15Sjsg ce = mocs_context_create(engine);
415c349dbc7Sjsg if (IS_ERR(ce)) {
416c349dbc7Sjsg err = PTR_ERR(ce);
4175ca02815Sjsg goto restore;
418c349dbc7Sjsg }
419c349dbc7Sjsg
420c349dbc7Sjsg intel_engine_pm_get(engine);
421c349dbc7Sjsg
4225ca02815Sjsg err = __live_mocs_reset(&mocs, ce, using_guc);
4235ca02815Sjsg
4245ca02815Sjsg intel_engine_pm_put(engine);
425c349dbc7Sjsg intel_context_put(ce);
4265ca02815Sjsg
4275ca02815Sjsg restore:
4285ca02815Sjsg err2 = intel_selftest_restore_policy(engine, &saved);
4295ca02815Sjsg if (err == 0)
4305ca02815Sjsg err = err2;
431c349dbc7Sjsg if (err)
432c349dbc7Sjsg break;
433c349dbc7Sjsg }
434c349dbc7Sjsg igt_global_reset_unlock(gt);
435c349dbc7Sjsg
436c349dbc7Sjsg live_mocs_fini(&mocs);
437c349dbc7Sjsg return err;
438c349dbc7Sjsg }
439c349dbc7Sjsg
intel_mocs_live_selftests(struct drm_i915_private * i915)440c349dbc7Sjsg int intel_mocs_live_selftests(struct drm_i915_private *i915)
441c349dbc7Sjsg {
442c349dbc7Sjsg static const struct i915_subtest tests[] = {
443c349dbc7Sjsg SUBTEST(live_mocs_kernel),
444c349dbc7Sjsg SUBTEST(live_mocs_clean),
445c349dbc7Sjsg SUBTEST(live_mocs_reset),
446c349dbc7Sjsg };
447c349dbc7Sjsg struct drm_i915_mocs_table table;
448c349dbc7Sjsg
449c349dbc7Sjsg if (!get_mocs_settings(i915, &table))
450c349dbc7Sjsg return 0;
451c349dbc7Sjsg
4521bb76ff1Sjsg return intel_gt_live_subtests(tests, to_gt(i915));
453c349dbc7Sjsg }
454