1 // SPDX-License-Identifier: MIT 2 /* 3 * Copyright © 2014 Intel Corporation 4 */ 5 6 #include <linux/circ_buf.h> 7 8 #include "gem/i915_gem_context.h" 9 #include "gt/gen8_engine_cs.h" 10 #include "gt/intel_breadcrumbs.h" 11 #include "gt/intel_context.h" 12 #include "gt/intel_engine_pm.h" 13 #include "gt/intel_gt.h" 14 #include "gt/intel_gt_irq.h" 15 #include "gt/intel_gt_pm.h" 16 #include "gt/intel_lrc.h" 17 #include "gt/intel_mocs.h" 18 #include "gt/intel_ring.h" 19 20 #include "intel_guc_submission.h" 21 22 #include "i915_drv.h" 23 #include "i915_trace.h" 24 25 /** 26 * DOC: GuC-based command submission 27 * 28 * IMPORTANT NOTE: GuC submission is currently not supported in i915. The GuC 29 * firmware is moving to an updated submission interface and we plan to 30 * turn submission back on when that lands. The below documentation (and related 31 * code) matches the old submission model and will be updated as part of the 32 * upgrade to the new flow. 33 * 34 * GuC stage descriptor: 35 * During initialization, the driver allocates a static pool of 1024 such 36 * descriptors, and shares them with the GuC. Currently, we only use one 37 * descriptor. This stage descriptor lets the GuC know about the workqueue and 38 * process descriptor. Theoretically, it also lets the GuC know about our HW 39 * contexts (context ID, etc...), but we actually employ a kind of submission 40 * where the GuC uses the LRCA sent via the work item instead. This is called 41 * a "proxy" submission. 42 * 43 * The Scratch registers: 44 * There are 16 MMIO-based registers start from 0xC180. The kernel driver writes 45 * a value to the action register (SOFT_SCRATCH_0) along with any data. It then 46 * triggers an interrupt on the GuC via another register write (0xC4C8). 47 * Firmware writes a success/fail code back to the action register after 48 * processes the request. The kernel driver polls waiting for this update and 49 * then proceeds. 50 * 51 * Work Items: 52 * There are several types of work items that the host may place into a 53 * workqueue, each with its own requirements and limitations. Currently only 54 * WQ_TYPE_INORDER is needed to support legacy submission via GuC, which 55 * represents in-order queue. The kernel driver packs ring tail pointer and an 56 * ELSP context descriptor dword into Work Item. 57 * See guc_add_request() 58 * 59 */ 60 61 #define GUC_REQUEST_SIZE 64 /* bytes */ 62 63 static inline struct i915_priolist *to_priolist(struct rb_node *rb) 64 { 65 return rb_entry(rb, struct i915_priolist, node); 66 } 67 68 static struct guc_stage_desc *__get_stage_desc(struct intel_guc *guc, u32 id) 69 { 70 struct guc_stage_desc *base = guc->stage_desc_pool_vaddr; 71 72 return &base[id]; 73 } 74 75 static int guc_stage_desc_pool_create(struct intel_guc *guc) 76 { 77 u32 size = PAGE_ALIGN(sizeof(struct guc_stage_desc) * 78 GUC_MAX_STAGE_DESCRIPTORS); 79 80 return intel_guc_allocate_and_map_vma(guc, size, &guc->stage_desc_pool, 81 &guc->stage_desc_pool_vaddr); 82 } 83 84 static void guc_stage_desc_pool_destroy(struct intel_guc *guc) 85 { 86 i915_vma_unpin_and_release(&guc->stage_desc_pool, I915_VMA_RELEASE_MAP); 87 } 88 89 /* 90 * Initialise/clear the stage descriptor shared with the GuC firmware. 91 * 92 * This descriptor tells the GuC where (in GGTT space) to find the important 93 * data structures related to work submission (process descriptor, write queue, 94 * etc). 95 */ 96 static void guc_stage_desc_init(struct intel_guc *guc) 97 { 98 struct guc_stage_desc *desc; 99 100 /* we only use 1 stage desc, so hardcode it to 0 */ 101 desc = __get_stage_desc(guc, 0); 102 memset(desc, 0, sizeof(*desc)); 103 104 desc->attribute = GUC_STAGE_DESC_ATTR_ACTIVE | 105 GUC_STAGE_DESC_ATTR_KERNEL; 106 107 desc->stage_id = 0; 108 desc->priority = GUC_CLIENT_PRIORITY_KMD_NORMAL; 109 110 desc->wq_size = GUC_WQ_SIZE; 111 } 112 113 static void guc_stage_desc_fini(struct intel_guc *guc) 114 { 115 struct guc_stage_desc *desc; 116 117 desc = __get_stage_desc(guc, 0); 118 memset(desc, 0, sizeof(*desc)); 119 } 120 121 static void guc_add_request(struct intel_guc *guc, struct i915_request *rq) 122 { 123 /* Leaving stub as this function will be used in future patches */ 124 } 125 126 /* 127 * When we're doing submissions using regular execlists backend, writing to 128 * ELSP from CPU side is enough to make sure that writes to ringbuffer pages 129 * pinned in mappable aperture portion of GGTT are visible to command streamer. 130 * Writes done by GuC on our behalf are not guaranteeing such ordering, 131 * therefore, to ensure the flush, we're issuing a POSTING READ. 132 */ 133 static void flush_ggtt_writes(struct i915_vma *vma) 134 { 135 if (i915_vma_is_map_and_fenceable(vma)) 136 intel_uncore_posting_read_fw(vma->vm->gt->uncore, 137 GUC_STATUS); 138 } 139 140 static void guc_submit(struct intel_engine_cs *engine, 141 struct i915_request **out, 142 struct i915_request **end) 143 { 144 struct intel_guc *guc = &engine->gt->uc.guc; 145 146 do { 147 struct i915_request *rq = *out++; 148 149 flush_ggtt_writes(rq->ring->vma); 150 guc_add_request(guc, rq); 151 } while (out != end); 152 } 153 154 static inline int rq_prio(const struct i915_request *rq) 155 { 156 return rq->sched.attr.priority; 157 } 158 159 static struct i915_request *schedule_in(struct i915_request *rq, int idx) 160 { 161 trace_i915_request_in(rq, idx); 162 163 /* 164 * Currently we are not tracking the rq->context being inflight 165 * (ce->inflight = rq->engine). It is only used by the execlists 166 * backend at the moment, a similar counting strategy would be 167 * required if we generalise the inflight tracking. 168 */ 169 170 __intel_gt_pm_get(rq->engine->gt); 171 return i915_request_get(rq); 172 } 173 174 static void schedule_out(struct i915_request *rq) 175 { 176 trace_i915_request_out(rq); 177 178 intel_gt_pm_put_async(rq->engine->gt); 179 i915_request_put(rq); 180 } 181 182 static void __guc_dequeue(struct intel_engine_cs *engine) 183 { 184 struct intel_engine_execlists * const execlists = &engine->execlists; 185 struct i915_request **first = execlists->inflight; 186 struct i915_request ** const last_port = first + execlists->port_mask; 187 struct i915_request *last = first[0]; 188 struct i915_request **port; 189 bool submit = false; 190 struct rb_node *rb; 191 192 lockdep_assert_held(&engine->active.lock); 193 194 if (last) { 195 if (*++first) 196 return; 197 198 last = NULL; 199 } 200 201 /* 202 * We write directly into the execlists->inflight queue and don't use 203 * the execlists->pending queue, as we don't have a distinct switch 204 * event. 205 */ 206 port = first; 207 while ((rb = rb_first_cached(&execlists->queue))) { 208 struct i915_priolist *p = to_priolist(rb); 209 struct i915_request *rq, *rn; 210 211 priolist_for_each_request_consume(rq, rn, p) { 212 if (last && rq->context != last->context) { 213 if (port == last_port) 214 goto done; 215 216 *port = schedule_in(last, 217 port - execlists->inflight); 218 port++; 219 } 220 221 list_del_init(&rq->sched.link); 222 __i915_request_submit(rq); 223 submit = true; 224 last = rq; 225 } 226 227 rb_erase_cached(&p->node, &execlists->queue); 228 i915_priolist_free(p); 229 } 230 done: 231 execlists->queue_priority_hint = 232 rb ? to_priolist(rb)->priority : INT_MIN; 233 if (submit) { 234 *port = schedule_in(last, port - execlists->inflight); 235 *++port = NULL; 236 guc_submit(engine, first, port); 237 } 238 execlists->active = execlists->inflight; 239 } 240 241 static void guc_submission_tasklet(struct tasklet_struct *t) 242 { 243 struct intel_engine_cs * const engine = 244 from_tasklet(engine, t, execlists.tasklet); 245 struct intel_engine_execlists * const execlists = &engine->execlists; 246 struct i915_request **port, *rq; 247 unsigned long flags; 248 249 spin_lock_irqsave(&engine->active.lock, flags); 250 251 for (port = execlists->inflight; (rq = *port); port++) { 252 if (!i915_request_completed(rq)) 253 break; 254 255 schedule_out(rq); 256 } 257 if (port != execlists->inflight) { 258 int idx = port - execlists->inflight; 259 int rem = ARRAY_SIZE(execlists->inflight) - idx; 260 memmove(execlists->inflight, port, rem * sizeof(*port)); 261 } 262 263 __guc_dequeue(engine); 264 265 spin_unlock_irqrestore(&engine->active.lock, flags); 266 } 267 268 static void cs_irq_handler(struct intel_engine_cs *engine, u16 iir) 269 { 270 if (iir & GT_RENDER_USER_INTERRUPT) { 271 intel_engine_signal_breadcrumbs(engine); 272 tasklet_hi_schedule(&engine->execlists.tasklet); 273 } 274 } 275 276 static void guc_reset_prepare(struct intel_engine_cs *engine) 277 { 278 struct intel_engine_execlists * const execlists = &engine->execlists; 279 280 ENGINE_TRACE(engine, "\n"); 281 282 /* 283 * Prevent request submission to the hardware until we have 284 * completed the reset in i915_gem_reset_finish(). If a request 285 * is completed by one engine, it may then queue a request 286 * to a second via its execlists->tasklet *just* as we are 287 * calling engine->init_hw() and also writing the ELSP. 288 * Turning off the execlists->tasklet until the reset is over 289 * prevents the race. 290 */ 291 __tasklet_disable_sync_once(&execlists->tasklet); 292 } 293 294 static void guc_reset_state(struct intel_context *ce, 295 struct intel_engine_cs *engine, 296 u32 head, 297 bool scrub) 298 { 299 GEM_BUG_ON(!intel_context_is_pinned(ce)); 300 301 /* 302 * We want a simple context + ring to execute the breadcrumb update. 303 * We cannot rely on the context being intact across the GPU hang, 304 * so clear it and rebuild just what we need for the breadcrumb. 305 * All pending requests for this context will be zapped, and any 306 * future request will be after userspace has had the opportunity 307 * to recreate its own state. 308 */ 309 if (scrub) 310 lrc_init_regs(ce, engine, true); 311 312 /* Rerun the request; its payload has been neutered (if guilty). */ 313 lrc_update_regs(ce, engine, head); 314 } 315 316 static void guc_reset_rewind(struct intel_engine_cs *engine, bool stalled) 317 { 318 struct intel_engine_execlists * const execlists = &engine->execlists; 319 struct i915_request *rq; 320 unsigned long flags; 321 322 spin_lock_irqsave(&engine->active.lock, flags); 323 324 /* Push back any incomplete requests for replay after the reset. */ 325 rq = execlists_unwind_incomplete_requests(execlists); 326 if (!rq) 327 goto out_unlock; 328 329 if (!i915_request_started(rq)) 330 stalled = false; 331 332 __i915_request_reset(rq, stalled); 333 guc_reset_state(rq->context, engine, rq->head, stalled); 334 335 out_unlock: 336 spin_unlock_irqrestore(&engine->active.lock, flags); 337 } 338 339 static void guc_reset_cancel(struct intel_engine_cs *engine) 340 { 341 struct intel_engine_execlists * const execlists = &engine->execlists; 342 struct i915_request *rq, *rn; 343 struct rb_node *rb; 344 unsigned long flags; 345 346 ENGINE_TRACE(engine, "\n"); 347 348 /* 349 * Before we call engine->cancel_requests(), we should have exclusive 350 * access to the submission state. This is arranged for us by the 351 * caller disabling the interrupt generation, the tasklet and other 352 * threads that may then access the same state, giving us a free hand 353 * to reset state. However, we still need to let lockdep be aware that 354 * we know this state may be accessed in hardirq context, so we 355 * disable the irq around this manipulation and we want to keep 356 * the spinlock focused on its duties and not accidentally conflate 357 * coverage to the submission's irq state. (Similarly, although we 358 * shouldn't need to disable irq around the manipulation of the 359 * submission's irq state, we also wish to remind ourselves that 360 * it is irq state.) 361 */ 362 spin_lock_irqsave(&engine->active.lock, flags); 363 364 /* Mark all executing requests as skipped. */ 365 list_for_each_entry(rq, &engine->active.requests, sched.link) { 366 i915_request_set_error_once(rq, -EIO); 367 i915_request_mark_complete(rq); 368 } 369 370 /* Flush the queued requests to the timeline list (for retiring). */ 371 while ((rb = rb_first_cached(&execlists->queue))) { 372 struct i915_priolist *p = to_priolist(rb); 373 374 priolist_for_each_request_consume(rq, rn, p) { 375 list_del_init(&rq->sched.link); 376 __i915_request_submit(rq); 377 dma_fence_set_error(&rq->fence, -EIO); 378 i915_request_mark_complete(rq); 379 } 380 381 rb_erase_cached(&p->node, &execlists->queue); 382 i915_priolist_free(p); 383 } 384 385 /* Remaining _unready_ requests will be nop'ed when submitted */ 386 387 execlists->queue_priority_hint = INT_MIN; 388 execlists->queue = RB_ROOT_CACHED; 389 390 spin_unlock_irqrestore(&engine->active.lock, flags); 391 } 392 393 static void guc_reset_finish(struct intel_engine_cs *engine) 394 { 395 struct intel_engine_execlists * const execlists = &engine->execlists; 396 397 if (__tasklet_enable(&execlists->tasklet)) 398 /* And kick in case we missed a new request submission. */ 399 tasklet_hi_schedule(&execlists->tasklet); 400 401 ENGINE_TRACE(engine, "depth->%d\n", 402 atomic_read(&execlists->tasklet.count)); 403 } 404 405 /* 406 * Set up the memory resources to be shared with the GuC (via the GGTT) 407 * at firmware loading time. 408 */ 409 int intel_guc_submission_init(struct intel_guc *guc) 410 { 411 int ret; 412 413 if (guc->stage_desc_pool) 414 return 0; 415 416 ret = guc_stage_desc_pool_create(guc); 417 if (ret) 418 return ret; 419 /* 420 * Keep static analysers happy, let them know that we allocated the 421 * vma after testing that it didn't exist earlier. 422 */ 423 GEM_BUG_ON(!guc->stage_desc_pool); 424 425 return 0; 426 } 427 428 void intel_guc_submission_fini(struct intel_guc *guc) 429 { 430 if (guc->stage_desc_pool) { 431 guc_stage_desc_pool_destroy(guc); 432 } 433 } 434 435 static int guc_context_alloc(struct intel_context *ce) 436 { 437 return lrc_alloc(ce, ce->engine); 438 } 439 440 static int guc_context_pre_pin(struct intel_context *ce, 441 struct i915_gem_ww_ctx *ww, 442 void **vaddr) 443 { 444 return lrc_pre_pin(ce, ce->engine, ww, vaddr); 445 } 446 447 static int guc_context_pin(struct intel_context *ce, void *vaddr) 448 { 449 return lrc_pin(ce, ce->engine, vaddr); 450 } 451 452 static const struct intel_context_ops guc_context_ops = { 453 .alloc = guc_context_alloc, 454 455 .pre_pin = guc_context_pre_pin, 456 .pin = guc_context_pin, 457 .unpin = lrc_unpin, 458 .post_unpin = lrc_post_unpin, 459 460 .enter = intel_context_enter_engine, 461 .exit = intel_context_exit_engine, 462 463 .reset = lrc_reset, 464 .destroy = lrc_destroy, 465 }; 466 467 static int guc_request_alloc(struct i915_request *request) 468 { 469 int ret; 470 471 GEM_BUG_ON(!intel_context_is_pinned(request->context)); 472 473 /* 474 * Flush enough space to reduce the likelihood of waiting after 475 * we start building the request - in which case we will just 476 * have to repeat work. 477 */ 478 request->reserved_space += GUC_REQUEST_SIZE; 479 480 /* 481 * Note that after this point, we have committed to using 482 * this request as it is being used to both track the 483 * state of engine initialisation and liveness of the 484 * golden renderstate above. Think twice before you try 485 * to cancel/unwind this request now. 486 */ 487 488 /* Unconditionally invalidate GPU caches and TLBs. */ 489 ret = request->engine->emit_flush(request, EMIT_INVALIDATE); 490 if (ret) 491 return ret; 492 493 request->reserved_space -= GUC_REQUEST_SIZE; 494 return 0; 495 } 496 497 static inline void queue_request(struct intel_engine_cs *engine, 498 struct i915_request *rq, 499 int prio) 500 { 501 GEM_BUG_ON(!list_empty(&rq->sched.link)); 502 list_add_tail(&rq->sched.link, 503 i915_sched_lookup_priolist(engine, prio)); 504 set_bit(I915_FENCE_FLAG_PQUEUE, &rq->fence.flags); 505 } 506 507 static void guc_submit_request(struct i915_request *rq) 508 { 509 struct intel_engine_cs *engine = rq->engine; 510 unsigned long flags; 511 512 /* Will be called from irq-context when using foreign fences. */ 513 spin_lock_irqsave(&engine->active.lock, flags); 514 515 queue_request(engine, rq, rq_prio(rq)); 516 517 GEM_BUG_ON(RB_EMPTY_ROOT(&engine->execlists.queue.rb_root)); 518 GEM_BUG_ON(list_empty(&rq->sched.link)); 519 520 tasklet_hi_schedule(&engine->execlists.tasklet); 521 522 spin_unlock_irqrestore(&engine->active.lock, flags); 523 } 524 525 static void sanitize_hwsp(struct intel_engine_cs *engine) 526 { 527 struct intel_timeline *tl; 528 529 list_for_each_entry(tl, &engine->status_page.timelines, engine_link) 530 intel_timeline_reset_seqno(tl); 531 } 532 533 static void guc_sanitize(struct intel_engine_cs *engine) 534 { 535 /* 536 * Poison residual state on resume, in case the suspend didn't! 537 * 538 * We have to assume that across suspend/resume (or other loss 539 * of control) that the contents of our pinned buffers has been 540 * lost, replaced by garbage. Since this doesn't always happen, 541 * let's poison such state so that we more quickly spot when 542 * we falsely assume it has been preserved. 543 */ 544 if (IS_ENABLED(CONFIG_DRM_I915_DEBUG_GEM)) 545 memset(engine->status_page.addr, POISON_INUSE, PAGE_SIZE); 546 547 /* 548 * The kernel_context HWSP is stored in the status_page. As above, 549 * that may be lost on resume/initialisation, and so we need to 550 * reset the value in the HWSP. 551 */ 552 sanitize_hwsp(engine); 553 554 /* And scrub the dirty cachelines for the HWSP */ 555 clflush_cache_range(engine->status_page.addr, PAGE_SIZE); 556 } 557 558 static void setup_hwsp(struct intel_engine_cs *engine) 559 { 560 intel_engine_set_hwsp_writemask(engine, ~0u); /* HWSTAM */ 561 562 ENGINE_WRITE_FW(engine, 563 RING_HWS_PGA, 564 i915_ggtt_offset(engine->status_page.vma)); 565 } 566 567 static void start_engine(struct intel_engine_cs *engine) 568 { 569 ENGINE_WRITE_FW(engine, 570 RING_MODE_GEN7, 571 _MASKED_BIT_ENABLE(GEN11_GFX_DISABLE_LEGACY_MODE)); 572 573 ENGINE_WRITE_FW(engine, RING_MI_MODE, _MASKED_BIT_DISABLE(STOP_RING)); 574 ENGINE_POSTING_READ(engine, RING_MI_MODE); 575 } 576 577 static int guc_resume(struct intel_engine_cs *engine) 578 { 579 assert_forcewakes_active(engine->uncore, FORCEWAKE_ALL); 580 581 intel_mocs_init_engine(engine); 582 583 intel_breadcrumbs_reset(engine->breadcrumbs); 584 585 setup_hwsp(engine); 586 start_engine(engine); 587 588 return 0; 589 } 590 591 static void guc_set_default_submission(struct intel_engine_cs *engine) 592 { 593 engine->submit_request = guc_submit_request; 594 } 595 596 static void guc_release(struct intel_engine_cs *engine) 597 { 598 engine->sanitize = NULL; /* no longer in control, nothing to sanitize */ 599 600 tasklet_kill(&engine->execlists.tasklet); 601 602 intel_engine_cleanup_common(engine); 603 lrc_fini_wa_ctx(engine); 604 } 605 606 static void guc_default_vfuncs(struct intel_engine_cs *engine) 607 { 608 /* Default vfuncs which can be overridden by each engine. */ 609 610 engine->resume = guc_resume; 611 612 engine->cops = &guc_context_ops; 613 engine->request_alloc = guc_request_alloc; 614 615 engine->schedule = i915_schedule; 616 617 engine->reset.prepare = guc_reset_prepare; 618 engine->reset.rewind = guc_reset_rewind; 619 engine->reset.cancel = guc_reset_cancel; 620 engine->reset.finish = guc_reset_finish; 621 622 engine->emit_flush = gen8_emit_flush_xcs; 623 engine->emit_init_breadcrumb = gen8_emit_init_breadcrumb; 624 engine->emit_fini_breadcrumb = gen8_emit_fini_breadcrumb_xcs; 625 if (GRAPHICS_VER(engine->i915) >= 12) { 626 engine->emit_fini_breadcrumb = gen12_emit_fini_breadcrumb_xcs; 627 engine->emit_flush = gen12_emit_flush_xcs; 628 } 629 engine->set_default_submission = guc_set_default_submission; 630 631 engine->flags |= I915_ENGINE_HAS_PREEMPTION; 632 633 /* 634 * TODO: GuC supports timeslicing and semaphores as well, but they're 635 * handled by the firmware so some minor tweaks are required before 636 * enabling. 637 * 638 * engine->flags |= I915_ENGINE_HAS_TIMESLICES; 639 * engine->flags |= I915_ENGINE_HAS_SEMAPHORES; 640 */ 641 642 engine->emit_bb_start = gen8_emit_bb_start; 643 } 644 645 static void rcs_submission_override(struct intel_engine_cs *engine) 646 { 647 switch (GRAPHICS_VER(engine->i915)) { 648 case 12: 649 engine->emit_flush = gen12_emit_flush_rcs; 650 engine->emit_fini_breadcrumb = gen12_emit_fini_breadcrumb_rcs; 651 break; 652 case 11: 653 engine->emit_flush = gen11_emit_flush_rcs; 654 engine->emit_fini_breadcrumb = gen11_emit_fini_breadcrumb_rcs; 655 break; 656 default: 657 engine->emit_flush = gen8_emit_flush_rcs; 658 engine->emit_fini_breadcrumb = gen8_emit_fini_breadcrumb_rcs; 659 break; 660 } 661 } 662 663 static inline void guc_default_irqs(struct intel_engine_cs *engine) 664 { 665 engine->irq_keep_mask = GT_RENDER_USER_INTERRUPT; 666 intel_engine_set_irq_handler(engine, cs_irq_handler); 667 } 668 669 int intel_guc_submission_setup(struct intel_engine_cs *engine) 670 { 671 struct drm_i915_private *i915 = engine->i915; 672 673 /* 674 * The setup relies on several assumptions (e.g. irqs always enabled) 675 * that are only valid on gen11+ 676 */ 677 GEM_BUG_ON(GRAPHICS_VER(i915) < 11); 678 679 tasklet_setup(&engine->execlists.tasklet, guc_submission_tasklet); 680 681 guc_default_vfuncs(engine); 682 guc_default_irqs(engine); 683 684 if (engine->class == RENDER_CLASS) 685 rcs_submission_override(engine); 686 687 lrc_init_wa_ctx(engine); 688 689 /* Finally, take ownership and responsibility for cleanup! */ 690 engine->sanitize = guc_sanitize; 691 engine->release = guc_release; 692 693 return 0; 694 } 695 696 void intel_guc_submission_enable(struct intel_guc *guc) 697 { 698 guc_stage_desc_init(guc); 699 } 700 701 void intel_guc_submission_disable(struct intel_guc *guc) 702 { 703 struct intel_gt *gt = guc_to_gt(guc); 704 705 GEM_BUG_ON(gt->awake); /* GT should be parked first */ 706 707 /* Note: By the time we're here, GuC may have already been reset */ 708 709 guc_stage_desc_fini(guc); 710 } 711 712 static bool __guc_submission_selected(struct intel_guc *guc) 713 { 714 struct drm_i915_private *i915 = guc_to_gt(guc)->i915; 715 716 if (!intel_guc_submission_is_supported(guc)) 717 return false; 718 719 return i915->params.enable_guc & ENABLE_GUC_SUBMISSION; 720 } 721 722 void intel_guc_submission_init_early(struct intel_guc *guc) 723 { 724 guc->submission_selected = __guc_submission_selected(guc); 725 } 726