Basic GuC submission support in the i915
Subsystems (3)
cover Basic GuC submission support in the i915
Basic GuC submission support. This is the first bullet point in the upstreaming plan covered in the following RFC [1].
At a very high level the GuC is a piece of firmware which sits between the i915 and the GPU. It offloads some of the scheduling of contexts from the i915 and programs the GPU to submit contexts. The i915 communicates with the GuC and the GuC communicates with the GPU.
GuC submission will be disabled by default on all current upstream platforms behind a module parameter - enable_guc. A value of 3 will enable submission and HuC loading via the GuC. GuC submission should work on all gen11+ platforms assuming the GuC firmware is present.
This is a huge series and it is completely unrealistic to merge all of these patches at once. Fortunately I believe we can break down the series into different merges:
1. Merge Chris Wilson's patches. These have already been reviewed upstream and I fully agree with these patches as a precursor to GuC submission.
2. Update to GuC 60.1.2. These are largely Michal's patches.
3. Turn on GuC/HuC auto mode by default.
4. Additional patches needed to support GuC submission. This is any patch not covered by 1-3 in the first 34 patches. e.g. 'Engine relative MMIO'
5. GuC submission support. Patches number 35+. These all don't have to merge at once though as we don't actually allow GuC submission until the last patch of this series.
[1] https://patchwork.freedesktop.org/patch/432206/?series=89840&rev=1
Chris Wilson (3):
drm/i915/gt: Move engine setup out of set_default_submission drm/i915/gt: Move submission_method into intel_gt drm/i915/gt: Move CS interrupt handler to the backend
Daniele Ceraolo Spurio (6):
drm/i915/guc: skip disabling CTBs before sanitizing the GuC drm/i915/guc: use probe_error log for CT enablement failure drm/i915/guc: enable only the user interrupt when using GuC submission drm/i915/uc: turn on GuC/HuC auto mode by default drm/i915/guc: Use guc_class instead of engine_class in fw interface drm/i915/guc: Unblock GuC submission on Gen11+
John Harrison (13):
drm/i915/guc: Support per context scheduling policies drm/i915/guc: Update firmware to v60.1.2
drm/i915: Engine relative MMIO
drm/i915/guc: Module load failure test for CT buffer creation drm/i915: Track 'serial' counts for virtual engines drm/i915/guc: Provide mmio list to be saved/restored on engine reset drm/i915/guc: Don't complain about reset races drm/i915/guc: Enable GuC engine reset
drm/i915/guc: Fix for error capture after full GPU reset with GuC drm/i915/guc: Hook GuC scheduling policies up drm/i915/guc: Connect reset modparam updates to GuC policy flags drm/i915/guc: Include scheduling policies in the debugfs state dump drm/i915/guc: Add golden context to GuC ADS
Matthew Brost (53):
drm/i915: Introduce i915_sched_engine object
drm/i915/guc: Improve error message for unsolicited CT response drm/i915/guc: Add non blocking CTB send function drm/i915/guc: Add stall timer to non blocking CTB send function drm/i915/guc: Optimize CTB writes and reads
drm/i915/guc: Increase size of CTB buffers
drm/i915/guc: Add new GuC interface defines and structures drm/i915/guc: Remove GuC stage descriptor, add lrc descriptor drm/i915/guc: Add lrc descriptor context lookup array drm/i915/guc: Implement GuC submission tasklet drm/i915/guc: Add bypass tasklet submission path to GuC drm/i915/guc: Implement GuC context operations for new inteface drm/i915/guc: Insert fence on context when deregistering drm/i915/guc: Defer context unpin until scheduling is disabled drm/i915/guc: Disable engine barriers with GuC during unpin drm/i915/guc: Extend deregistration fence to schedule disable drm/i915: Disable preempt busywait when using GuC scheduling drm/i915/guc: Ensure request ordering via completion fences drm/i915/guc: Disable semaphores when using GuC scheduling drm/i915/guc: Ensure G2H response has space in buffer drm/i915/guc: Update intel_gt_wait_for_idle to work with GuC drm/i915/guc: Update GuC debugfs to support new GuC drm/i915/guc: Add several request trace points
drm/i915: Add intel_context tracing
drm/i915/guc: GuC virtual engines
drm/i915: Hold reference to intel_context over life of i915_request drm/i915/guc: Disable bonding extension with GuC submission drm/i915/guc: Direct all breadcrumbs for a class to single breadcrumbs drm/i915/guc: Reset implementation for new GuC interface drm/i915: Reset GPU immediately if submission is disabled drm/i915/guc: Add disable interrupts to guc sanitize drm/i915/guc: Suspend/resume implementation for new interface drm/i915/guc: Handle context reset notification drm/i915/guc: Handle engine reset failure notification drm/i915/guc: Enable the timer expired interrupt for GuC drm/i915/guc: Capture error state on context reset drm/i915/guc: Don't call ring_is_idle in GuC submission drm/i915/guc: Implement banned contexts for GuC submission drm/i915/guc: Allow flexible number of context ids drm/i915/guc: Connect the number of guc_ids to debugfs drm/i915/guc: Don't return -EAGAIN to user when guc_ids exhausted drm/i915/guc: Don't allow requests not ready to consume all guc_ids drm/i915/guc: Introduce guc_submit_engine object drm/i915/guc: Implement GuC priority management drm/i915/guc: Support request cancellation
drm/i915/guc: Check return of __xa_store when registering a context drm/i915/guc: Non-static lrc descriptor registration buffer drm/i915/guc: Take GT PM ref when deregistering context drm/i915: Add GT PM delayed worker
drm/i915/guc: Take engine PM when a context is pinned with GuC
submission
drm/i915/guc: Don't call switch_to_kernel_context with GuC submission drm/i915/guc: Selftest for GuC flow control
drm/i915/guc: Update GuC documentation
Michal Wajdeczko (21):
drm/i915/guc: Keep strict GuC ABI definitions drm/i915/guc: Stop using fence/status from CTB descriptor drm/i915: Promote ptrdiff() to i915_utils.h drm/i915/guc: Only rely on own CTB size drm/i915/guc: Don't repeat CTB layout calculations drm/i915/guc: Replace CTB array with explicit members drm/i915/guc: Update sizes of CTB buffers drm/i915/guc: Relax CTB response timeout drm/i915/guc: Start protecting access to CTB descriptors drm/i915/guc: Stop using mutex while sending CTB messages drm/i915/guc: Don't receive all G2H messages in irq handler drm/i915/guc: Always copy CT message to new allocation drm/i915/guc: Introduce unified HXG messages drm/i915/guc: Update MMIO based communication drm/i915/guc: Update CTB response status drm/i915/guc: Add flag for mark broken CTB drm/i915/guc: New definition of the CTB descriptor drm/i915/guc: New definition of the CTB registration action drm/i915/guc: New CTB based communication drm/i915/guc: Kill guc_clients.ct_pool drm/i915/guc: Early initialization of GuC send registers
Rodrigo Vivi (1):
drm/i915/guc: Remove sample_forcewake h2g action
drivers/gpu/drm/i915/Makefile | 2 + drivers/gpu/drm/i915/gem/i915_gem_context.c | 39 +- drivers/gpu/drm/i915/gem/i915_gem_context.h | 1 + drivers/gpu/drm/i915/gem/i915_gem_mman.c | 3 +- drivers/gpu/drm/i915/gem/i915_gem_wait.c | 4 +- drivers/gpu/drm/i915/gt/gen8_engine_cs.c | 6 +- drivers/gpu/drm/i915/gt/intel_breadcrumbs.c | 44 +- drivers/gpu/drm/i915/gt/intel_breadcrumbs.h | 14 +- .../gpu/drm/i915/gt/intel_breadcrumbs_types.h | 7 + drivers/gpu/drm/i915/gt/intel_context.c | 50 +- drivers/gpu/drm/i915/gt/intel_context.h | 45 +- drivers/gpu/drm/i915/gt/intel_context_types.h | 76 +- drivers/gpu/drm/i915/gt/intel_engine.h | 96 +- drivers/gpu/drm/i915/gt/intel_engine_cs.c | 320 +- .../gpu/drm/i915/gt/intel_engine_heartbeat.c | 75 +- .../gpu/drm/i915/gt/intel_engine_heartbeat.h | 4 + drivers/gpu/drm/i915/gt/intel_engine_pm.c | 14 +- drivers/gpu/drm/i915/gt/intel_engine_pm.h | 5 + drivers/gpu/drm/i915/gt/intel_engine_types.h | 71 +- drivers/gpu/drm/i915/gt/intel_engine_user.c | 6 +- .../drm/i915/gt/intel_execlists_submission.c | 693 +-- .../drm/i915/gt/intel_execlists_submission.h | 14 - drivers/gpu/drm/i915/gt/intel_gpu_commands.h | 5 + drivers/gpu/drm/i915/gt/intel_gt.c | 23 + drivers/gpu/drm/i915/gt/intel_gt.h | 2 + drivers/gpu/drm/i915/gt/intel_gt_irq.c | 100 +- drivers/gpu/drm/i915/gt/intel_gt_irq.h | 23 + drivers/gpu/drm/i915/gt/intel_gt_pm.c | 14 +- drivers/gpu/drm/i915/gt/intel_gt_pm.h | 13 + .../drm/i915/gt/intel_gt_pm_delayed_work.c | 35 + .../drm/i915/gt/intel_gt_pm_delayed_work.h | 24 + drivers/gpu/drm/i915/gt/intel_gt_requests.c | 23 +- drivers/gpu/drm/i915/gt/intel_gt_requests.h | 7 +- drivers/gpu/drm/i915/gt/intel_gt_types.h | 10 + drivers/gpu/drm/i915/gt/intel_lrc_reg.h | 1 - drivers/gpu/drm/i915/gt/intel_reset.c | 58 +- .../gpu/drm/i915/gt/intel_ring_submission.c | 73 +- drivers/gpu/drm/i915/gt/intel_rps.c | 6 +- drivers/gpu/drm/i915/gt/intel_workarounds.c | 46 +- .../gpu/drm/i915/gt/intel_workarounds_types.h | 1 + drivers/gpu/drm/i915/gt/mock_engine.c | 58 +- drivers/gpu/drm/i915/gt/selftest_context.c | 10 + drivers/gpu/drm/i915/gt/selftest_execlists.c | 58 +- drivers/gpu/drm/i915/gt/selftest_hangcheck.c | 6 +- drivers/gpu/drm/i915/gt/selftest_lrc.c | 6 +- drivers/gpu/drm/i915/gt/selftest_reset.c | 2 +- .../drm/i915/gt/selftest_ring_submission.c | 2 +- .../gpu/drm/i915/gt/uc/abi/guc_actions_abi.h | 177 + .../gt/uc/abi/guc_communication_ctb_abi.h | 192 + .../gt/uc/abi/guc_communication_mmio_abi.h | 35 + .../gpu/drm/i915/gt/uc/abi/guc_errors_abi.h | 13 + .../gpu/drm/i915/gt/uc/abi/guc_messages_abi.h | 247 + drivers/gpu/drm/i915/gt/uc/intel_guc.c | 194 +- drivers/gpu/drm/i915/gt/uc/intel_guc.h | 131 +- drivers/gpu/drm/i915/gt/uc/intel_guc_ads.c | 484 +- drivers/gpu/drm/i915/gt/uc/intel_guc_ads.h | 3 + drivers/gpu/drm/i915/gt/uc/intel_guc_ct.c | 1088 +++-- drivers/gpu/drm/i915/gt/uc/intel_guc_ct.h | 49 +- .../gpu/drm/i915/gt/uc/intel_guc_debugfs.c | 56 +- drivers/gpu/drm/i915/gt/uc/intel_guc_fwif.h | 377 +- .../gpu/drm/i915/gt/uc/intel_guc_submission.c | 4037 +++++++++++++++-- .../gpu/drm/i915/gt/uc/intel_guc_submission.h | 20 +- .../i915/gt/uc/intel_guc_submission_types.h | 55 + drivers/gpu/drm/i915/gt/uc/intel_uc.c | 116 +- drivers/gpu/drm/i915/gt/uc/intel_uc.h | 11 + drivers/gpu/drm/i915/gt/uc/intel_uc_fw.c | 25 +- .../i915/gt/uc/selftest_guc_flow_control.c | 589 +++ drivers/gpu/drm/i915/i915_active.c | 3 + drivers/gpu/drm/i915/i915_debugfs.c | 8 +- drivers/gpu/drm/i915/i915_debugfs_params.c | 31 + drivers/gpu/drm/i915/i915_drv.h | 2 +- drivers/gpu/drm/i915/i915_gem_evict.c | 1 + drivers/gpu/drm/i915/i915_gpu_error.c | 28 +- drivers/gpu/drm/i915/i915_irq.c | 10 +- drivers/gpu/drm/i915/i915_params.h | 2 +- drivers/gpu/drm/i915/i915_perf.c | 16 +- drivers/gpu/drm/i915/i915_reg.h | 2 + drivers/gpu/drm/i915/i915_request.c | 218 +- drivers/gpu/drm/i915/i915_request.h | 37 +- drivers/gpu/drm/i915/i915_scheduler.c | 188 +- drivers/gpu/drm/i915/i915_scheduler.h | 74 +- drivers/gpu/drm/i915/i915_scheduler_types.h | 74 + drivers/gpu/drm/i915/i915_trace.h | 219 +- drivers/gpu/drm/i915/i915_utils.h | 5 + drivers/gpu/drm/i915/i915_vma.h | 5 - drivers/gpu/drm/i915/intel_wakeref.c | 5 + drivers/gpu/drm/i915/intel_wakeref.h | 1 + .../drm/i915/selftests/i915_live_selftests.h | 1 + .../gpu/drm/i915/selftests/igt_live_test.c | 2 +- .../i915/selftests/intel_scheduler_helpers.c | 101 + .../i915/selftests/intel_scheduler_helpers.h | 37 + .../gpu/drm/i915/selftests/mock_gem_device.c | 3 +- include/uapi/drm/i915_drm.h | 9 + 93 files changed, 8954 insertions(+), 2222 deletions(-) create mode 100644 drivers/gpu/drm/i915/gt/intel_gt_pm_delayed_work.c create mode 100644 drivers/gpu/drm/i915/gt/intel_gt_pm_delayed_work.h create mode 100644 drivers/gpu/drm/i915/gt/uc/abi/guc_actions_abi.h create mode 100644 drivers/gpu/drm/i915/gt/uc/abi/guc_communication_ctb_abi.h create mode 100644 drivers/gpu/drm/i915/gt/uc/abi/guc_communication_mmio_abi.h create mode 100644 drivers/gpu/drm/i915/gt/uc/abi/guc_errors_abi.h create mode 100644 drivers/gpu/drm/i915/gt/uc/abi/guc_messages_abi.h create mode 100644 drivers/gpu/drm/i915/gt/uc/intel_guc_submission_types.h create mode 100644 drivers/gpu/drm/i915/gt/uc/selftest_guc_flow_control.c create mode 100644 drivers/gpu/drm/i915/selftests/intel_scheduler_helpers.c create mode 100644 drivers/gpu/drm/i915/selftests/intel_scheduler_helpers.h
Signature · 6 lines
2.28.0 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
RFC PATCH 1/97 drm/i915/gt: Move engine setup out of set_default_submission
From: Chris Wilson <[email protected]>
Now that we no longer switch back and forth between guc and execlists, we no longer need to restore the backend's vfunc and can leave them set after initialisation. The only catch is that we lose the submission on wedging and still need to reset the submit_request vfunc on unwedging.
--- .../drm/i915/gt/intel_execlists_submission.c | 46 ++++++++--------- .../gpu/drm/i915/gt/intel_ring_submission.c | 4 -- .../gpu/drm/i915/gt/uc/intel_guc_submission.c | 50 ++++++++----------- 3 files changed, 44 insertions(+), 56 deletions(-)
drivers/gpu/drm/i915/gt/intel_execlists_submission.c +23 -23
@@ -3076,29 +3076,6 @@ static void execlists_set_default_submission(struct intel_engine_cs *engine) engine->submit_request = execlists_submit_request; engine->schedule = i915_schedule; engine->execlists.tasklet.callback = execlists_submission_tasklet; - - engine->reset.prepare = execlists_reset_prepare; - engine->reset.rewind = execlists_reset_rewind; - engine->reset.cancel = execlists_reset_cancel; - engine->reset.finish = execlists_reset_finish; - - engine->park = execlists_park; - engine->unpark =NULL ; - - engine->flags |=I915_ENGINE_SUPPORTS_STATS ; -if (!intel_vgpu_active (engine->i915)) { - engine->flags |=I915_ENGINE_HAS_SEMAPHORES ; -if (can_preempt (engine)) { - engine->flags |=I915_ENGINE_HAS_PREEMPTION ; -if (IS_ACTIVE (CONFIG_DRM_I915_TIMESLICE_DURATION )) - engine->flags |=I915_ENGINE_HAS_TIMESLICES ; - } - } - -if (intel_engine_has_preemption (engine)) - engine->emit_bb_start = gen8_emit_bb_start; -else - engine->emit_bb_start = gen8_emit_bb_start_noarb; }static void execlists_shutdown (struct intel_engine_cs *engine)
@@ -3129,6 +3106,14 @@ logical_ring_default_vfuncs(struct intel_engine_cs *engine) engine->cops = &execlists_context_ops; engine->request_alloc = execlists_request_alloc; + engine->reset.prepare = execlists_reset_prepare; + engine->reset.rewind = execlists_reset_rewind; + engine->reset.cancel = execlists_reset_cancel; + engine->reset.finish = execlists_reset_finish; + + engine->park = execlists_park; + engine->unpark =NULL ; + engine->emit_flush = gen8_emit_flush_xcs; engine->emit_init_breadcrumb = gen8_emit_init_breadcrumb; engine->emit_fini_breadcrumb = gen8_emit_fini_breadcrumb_xcs;
@@ -3149,6 +3134,21 @@ logical_ring_default_vfuncs(struct intel_engine_cs *engine)* until a more refined solution exists. */ } + + engine->flags |=I915_ENGINE_SUPPORTS_STATS ; +if (!intel_vgpu_active (engine->i915)) { + engine->flags |=I915_ENGINE_HAS_SEMAPHORES ; +if (can_preempt (engine)) { + engine->flags |=I915_ENGINE_HAS_PREEMPTION ; +if (IS_ACTIVE (CONFIG_DRM_I915_TIMESLICE_DURATION )) + engine->flags |=I915_ENGINE_HAS_TIMESLICES ; + } + } + +if (intel_engine_has_preemption (engine)) + engine->emit_bb_start = gen8_emit_bb_start; +else + engine->emit_bb_start = gen8_emit_bb_start_noarb; }static void logical_ring_default_irqs (struct intel_engine_cs *engine)
drivers/gpu/drm/i915/gt/intel_ring_submission.c +0 -4
@@ -989,14 +989,10 @@ static void gen6_bsd_submit_request(struct i915_request *request)static void i9xx_set_default_submission (struct intel_engine_cs *engine) { engine->submit_request = i9xx_submit_request; - - engine->park =NULL ; - engine->unpark =NULL ; }static void gen6_bsd_set_default_submission (struct intel_engine_cs *engine) { -i9xx_set_default_submission (engine); engine->submit_request = gen6_bsd_submit_request; }
drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c +21 -29
68 lines not on this page · raw message
Signature · 6 lines
2.28.0 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [RFC PATCH 01/97] drm/i915/gt: Move engine setup out of set_default_submission
Quoted 10 lines · Matthew Brost
From: Chris Wilson <[email protected]>
Now that we no longer switch back and forth between guc and execlists, we no longer need to restore the backend's vfunc and can leave them set after initialisation. The only catch is that we lose the submission on wedging and still need to reset the
submit_requestvfunc on unwedging.Signed-off-by Matthew Brost <[email protected]>Signed-off-by Chris Wilson <[email protected]>Cc Tvrtko Ursulin <[email protected]>
Quoted 174 lines
--- .../drm/i915/gt/intel_execlists_submission.c | 46 ++++++++--------- .../gpu/drm/i915/gt/intel_ring_submission.c | 4 -- .../gpu/drm/i915/gt/uc/intel_guc_submission.c | 50 ++++++++----------- 3 files changed, 44 insertions(+), 56 deletions(-)drivers/gpu/drm/i915/gt/intel_execlists_submission.c +23
-23@@ -3076,29 +3076,6 @@ static void execlists_set_default_submission(struct intel_engine_cs *engine) engine->submit_request = execlists_submit_request; engine->schedule = i915_schedule; engine->execlists.tasklet.callback = execlists_submission_tasklet; - - engine->reset.prepare = execlists_reset_prepare; - engine->reset.rewind = execlists_reset_rewind; - engine->reset.cancel = execlists_reset_cancel; - engine->reset.finish = execlists_reset_finish; - - engine->park = execlists_park; - engine->unpark =NULL ; - - engine->flags |=I915_ENGINE_SUPPORTS_STATS ; -if (!intel_vgpu_active (engine->i915)) { - engine->flags |=I915_ENGINE_HAS_SEMAPHORES ; -if (can_preempt (engine)) { - engine->flags |=I915_ENGINE_HAS_PREEMPTION ; -if (IS_ACTIVE (CONFIG_DRM_I915_TIMESLICE_DURATION )) - engine->flags |=I915_ENGINE_HAS_TIMESLICES ; - } - } - -if (intel_engine_has_preemption (engine)) - engine->emit_bb_start = gen8_emit_bb_start; -else - engine->emit_bb_start = gen8_emit_bb_start_noarb; }static void execlists_shutdown (struct intel_engine_cs *engine)@@ -3129,6 +3106,14 @@ logical_ring_default_vfuncs(struct intel_engine_cs *engine) engine->cops = &execlists_context_ops; engine->request_alloc = execlists_request_alloc; + engine->reset.prepare = execlists_reset_prepare; + engine->reset.rewind = execlists_reset_rewind; + engine->reset.cancel = execlists_reset_cancel; + engine->reset.finish = execlists_reset_finish; + + engine->park = execlists_park; + engine->unpark =NULL ; + engine->emit_flush = gen8_emit_flush_xcs; engine->emit_init_breadcrumb = gen8_emit_init_breadcrumb; engine->emit_fini_breadcrumb = gen8_emit_fini_breadcrumb_xcs;@@ -3149,6 +3134,21 @@ logical_ring_default_vfuncs(struct intel_engine_cs *engine)* until a more refined solution exists. */ } + + engine->flags |=I915_ENGINE_SUPPORTS_STATS ; +if (!intel_vgpu_active (engine->i915)) { + engine->flags |=I915_ENGINE_HAS_SEMAPHORES ; +if (can_preempt (engine)) { + engine->flags |=I915_ENGINE_HAS_PREEMPTION ; +if (IS_ACTIVE (CONFIG_DRM_I915_TIMESLICE_DURATION )) + engine->flags |=I915_ENGINE_HAS_TIMESLICES ; + } + } + +if (intel_engine_has_preemption (engine)) + engine->emit_bb_start = gen8_emit_bb_start; +else + engine->emit_bb_start = gen8_emit_bb_start_noarb; }static void logical_ring_default_irqs (struct intel_engine_cs *engine)drivers/gpu/drm/i915/gt/intel_ring_submission.c +0
-4@@ -989,14 +989,10 @@ static void gen6_bsd_submit_request(struct i915_request *request)static void i9xx_set_default_submission (struct intel_engine_cs *engine) { engine->submit_request = i9xx_submit_request; - - engine->park =NULL ; - engine->unpark =NULL ; }static void gen6_bsd_set_default_submission (struct intel_engine_cs *engine) { -i9xx_set_default_submission (engine); engine->submit_request = gen6_bsd_submit_request; }drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c +21
-29@@ -608,35 +608,6 @@ static int guc_resume(struct intel_engine_cs *engine)static void guc_set_default_submission (struct intel_engine_cs *engine) { engine->submit_request = guc_submit_request; - engine->schedule = i915_schedule; - engine->execlists.tasklet.callback = guc_submission_tasklet; - - engine->reset.prepare = guc_reset_prepare; - engine->reset.rewind = guc_reset_rewind; - engine->reset.cancel = guc_reset_cancel; - engine->reset.finish = guc_reset_finish; - - engine->flags |=I915_ENGINE_NEEDS_BREADCRUMB_TASKLET ; - engine->flags |=I915_ENGINE_HAS_PREEMPTION ; - -/* -* TODO: GuC supports timeslicing and semaphores as well, but they're -* handled by the firmware so some minor tweaks are required before -* enabling. -* -* engine->flags |= I915_ENGINE_HAS_TIMESLICES; -* engine->flags |= I915_ENGINE_HAS_SEMAPHORES; -*/ - - engine->emit_bb_start = gen8_emit_bb_start; - -/* -* For the breadcrumb irq to work we need the interrupts to stay -* enabled. However, on all platforms on which we'll have support for -* GuC submission we don't allow disabling the interrupts at runtime, so -* we're always safe with the current flow. -*/ -GEM_BUG_ON (engine->irq_enable || engine->irq_disable); }static void guc_release (struct intel_engine_cs *engine)@@ -658,6 +629,13 @@ static void guc_default_vfuncs(struct intel_engine_cs *engine) engine->cops = &guc_context_ops; engine->request_alloc = guc_request_alloc; + engine->schedule = i915_schedule; + + engine->reset.prepare = guc_reset_prepare; + engine->reset.rewind = guc_reset_rewind; + engine->reset.cancel = guc_reset_cancel; + engine->reset.finish = guc_reset_finish; + engine->emit_flush = gen8_emit_flush_xcs; engine->emit_init_breadcrumb = gen8_emit_init_breadcrumb; engine->emit_fini_breadcrumb = gen8_emit_fini_breadcrumb_xcs;@@ -666,6 +644,20 @@ static void guc_default_vfuncs(struct intel_engine_cs *engine) engine->emit_flush = gen12_emit_flush_xcs; } engine->set_default_submission = guc_set_default_submission; + + engine->flags |=I915_ENGINE_NEEDS_BREADCRUMB_TASKLET ; + engine->flags |=I915_ENGINE_HAS_PREEMPTION ; + +/* +* TODO: GuC supports timeslicing and semaphores as well, but they're +* handled by the firmware so some minor tweaks are required before +* enabling. +* +* engine->flags |= I915_ENGINE_HAS_TIMESLICES; +* engine->flags |= I915_ENGINE_HAS_SEMAPHORES; +*/ + + engine->emit_bb_start = gen8_emit_bb_start; }static void rcs_submission_override (struct intel_engine_cs *engine)Signature · 1 line
2.28.0
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [Intel-gfx] [RFC PATCH 01/97] drm/i915/gt: Move engine setup out of set_default_submission
In reply to Matthew BrostQuoted 10 lines · Matthew Brost
From: Chris Wilson <[email protected]>
Now that we no longer switch back and forth between guc and execlists, we no longer need to restore the backend's vfunc and can leave them set after initialisation. The only catch is that we lose the submission on wedging and still need to reset the
submit_requestvfunc on unwedging.Signed-off-by Matthew Brost <[email protected]>Signed-off-by Chris Wilson <[email protected]>Cc Tvrtko Ursulin <[email protected]>
This patch had my r-b already so I'll repeat it:
Regards,
Tvrtko
Quoted 172 lines
--- .../drm/i915/gt/intel_execlists_submission.c | 46 ++++++++--------- .../gpu/drm/i915/gt/intel_ring_submission.c | 4 -- .../gpu/drm/i915/gt/uc/intel_guc_submission.c | 50 ++++++++----------- 3 files changed, 44 insertions(+), 56 deletions(-)drivers/gpu/drm/i915/gt/intel_execlists_submission.c +23
-23@@ -3076,29 +3076,6 @@ static void execlists_set_default_submission(struct intel_engine_cs *engine) engine->submit_request = execlists_submit_request; engine->schedule = i915_schedule; engine->execlists.tasklet.callback = execlists_submission_tasklet; - - engine->reset.prepare = execlists_reset_prepare; - engine->reset.rewind = execlists_reset_rewind; - engine->reset.cancel = execlists_reset_cancel; - engine->reset.finish = execlists_reset_finish; - - engine->park = execlists_park; - engine->unpark =NULL ; - - engine->flags |=I915_ENGINE_SUPPORTS_STATS ; -if (!intel_vgpu_active (engine->i915)) { - engine->flags |=I915_ENGINE_HAS_SEMAPHORES ; -if (can_preempt (engine)) { - engine->flags |=I915_ENGINE_HAS_PREEMPTION ; -if (IS_ACTIVE (CONFIG_DRM_I915_TIMESLICE_DURATION )) - engine->flags |=I915_ENGINE_HAS_TIMESLICES ; - } - } - -if (intel_engine_has_preemption (engine)) - engine->emit_bb_start = gen8_emit_bb_start; -else - engine->emit_bb_start = gen8_emit_bb_start_noarb; }static void execlists_shutdown (struct intel_engine_cs *engine)@@ -3129,6 +3106,14 @@ logical_ring_default_vfuncs(struct intel_engine_cs *engine) engine->cops = &execlists_context_ops; engine->request_alloc = execlists_request_alloc; + engine->reset.prepare = execlists_reset_prepare; + engine->reset.rewind = execlists_reset_rewind; + engine->reset.cancel = execlists_reset_cancel; + engine->reset.finish = execlists_reset_finish; + + engine->park = execlists_park; + engine->unpark =NULL ; + engine->emit_flush = gen8_emit_flush_xcs; engine->emit_init_breadcrumb = gen8_emit_init_breadcrumb; engine->emit_fini_breadcrumb = gen8_emit_fini_breadcrumb_xcs;@@ -3149,6 +3134,21 @@ logical_ring_default_vfuncs(struct intel_engine_cs *engine)* until a more refined solution exists. */ } + + engine->flags |=I915_ENGINE_SUPPORTS_STATS ; +if (!intel_vgpu_active (engine->i915)) { + engine->flags |=I915_ENGINE_HAS_SEMAPHORES ; +if (can_preempt (engine)) { + engine->flags |=I915_ENGINE_HAS_PREEMPTION ; +if (IS_ACTIVE (CONFIG_DRM_I915_TIMESLICE_DURATION )) + engine->flags |=I915_ENGINE_HAS_TIMESLICES ; + } + } + +if (intel_engine_has_preemption (engine)) + engine->emit_bb_start = gen8_emit_bb_start; +else + engine->emit_bb_start = gen8_emit_bb_start_noarb; }static void logical_ring_default_irqs (struct intel_engine_cs *engine)drivers/gpu/drm/i915/gt/intel_ring_submission.c +0
-4@@ -989,14 +989,10 @@ static void gen6_bsd_submit_request(struct i915_request *request)static void i9xx_set_default_submission (struct intel_engine_cs *engine) { engine->submit_request = i9xx_submit_request; - - engine->park =NULL ; - engine->unpark =NULL ; }static void gen6_bsd_set_default_submission (struct intel_engine_cs *engine) { -i9xx_set_default_submission (engine); engine->submit_request = gen6_bsd_submit_request; }drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c +21
-29@@ -608,35 +608,6 @@ static int guc_resume(struct intel_engine_cs *engine)static void guc_set_default_submission (struct intel_engine_cs *engine) { engine->submit_request = guc_submit_request; - engine->schedule = i915_schedule; - engine->execlists.tasklet.callback = guc_submission_tasklet; - - engine->reset.prepare = guc_reset_prepare; - engine->reset.rewind = guc_reset_rewind; - engine->reset.cancel = guc_reset_cancel; - engine->reset.finish = guc_reset_finish; - - engine->flags |=I915_ENGINE_NEEDS_BREADCRUMB_TASKLET ; - engine->flags |=I915_ENGINE_HAS_PREEMPTION ; - -/* -* TODO: GuC supports timeslicing and semaphores as well, but they're -* handled by the firmware so some minor tweaks are required before -* enabling. -* -* engine->flags |= I915_ENGINE_HAS_TIMESLICES; -* engine->flags |= I915_ENGINE_HAS_SEMAPHORES; -*/ - - engine->emit_bb_start = gen8_emit_bb_start; - -/* -* For the breadcrumb irq to work we need the interrupts to stay -* enabled. However, on all platforms on which we'll have support for -* GuC submission we don't allow disabling the interrupts at runtime, so -* we're always safe with the current flow. -*/ -GEM_BUG_ON (engine->irq_enable || engine->irq_disable); }static void guc_release (struct intel_engine_cs *engine)@@ -658,6 +629,13 @@ static void guc_default_vfuncs(struct intel_engine_cs *engine) engine->cops = &guc_context_ops; engine->request_alloc = guc_request_alloc; + engine->schedule = i915_schedule; + + engine->reset.prepare = guc_reset_prepare; + engine->reset.rewind = guc_reset_rewind; + engine->reset.cancel = guc_reset_cancel; + engine->reset.finish = guc_reset_finish; + engine->emit_flush = gen8_emit_flush_xcs; engine->emit_init_breadcrumb = gen8_emit_init_breadcrumb; engine->emit_fini_breadcrumb = gen8_emit_fini_breadcrumb_xcs;@@ -666,6 +644,20 @@ static void guc_default_vfuncs(struct intel_engine_cs *engine) engine->emit_flush = gen12_emit_flush_xcs; } engine->set_default_submission = guc_set_default_submission; + + engine->flags |=I915_ENGINE_NEEDS_BREADCRUMB_TASKLET ; + engine->flags |=I915_ENGINE_HAS_PREEMPTION ; + +/* +* TODO: GuC supports timeslicing and semaphores as well, but they're +* handled by the firmware so some minor tweaks are required before +* enabling. +* +* engine->flags |= I915_ENGINE_HAS_TIMESLICES; +* engine->flags |= I915_ENGINE_HAS_SEMAPHORES; +*/ + + engine->emit_bb_start = gen8_emit_bb_start; }static void rcs_submission_override (struct intel_engine_cs *engine)
RFC PATCH 2/97 drm/i915/gt: Move submission_method into intel_gt
In reply to Matthew BrostFrom: Chris Wilson <[email protected]>
Since we setup the submission method for the engines once, it is easy to assign an enum and use that instead of probing into the backends.
--- drivers/gpu/drm/i915/gt/intel_engine.h | 8 +++++++- drivers/gpu/drm/i915/gt/intel_engine_cs.c | 12 ++++++++---- drivers/gpu/drm/i915/gt/intel_execlists_submission.c | 8 -------- drivers/gpu/drm/i915/gt/intel_execlists_submission.h | 3 --- drivers/gpu/drm/i915/gt/intel_gt_types.h | 7 +++++++ drivers/gpu/drm/i915/gt/intel_reset.c | 7 +++---- drivers/gpu/drm/i915/gt/selftest_execlists.c | 2 +- drivers/gpu/drm/i915/gt/selftest_ring_submission.c | 2 +- drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c | 5 ----- drivers/gpu/drm/i915/gt/uc/intel_guc_submission.h | 1 - drivers/gpu/drm/i915/i915_perf.c | 10 +++++----- 11 files changed, 32 insertions(+), 33 deletions(-)
drivers/gpu/drm/i915/gt/intel_engine.h +7 -1
@@ -13,8 +13,9 @@#include "i915_reg.h" #include "i915_request.h" #include "i915_selftest.h" -#include "gt/intel_timeline.h" #include "intel_engine_types.h" +#include "intel_gt_types.h" +#include "intel_timeline.h" #include "intel_workarounds.h" struct drm_printer ;
@@ -262,6 +263,11 @@ void intel_engine_init_active(struct intel_engine_cs *engine,#define ENGINE_MOCK 1#define ENGINE_VIRTUAL 2 +static inline bool intel_engine_uses_guc (const struct intel_engine_cs *engine) +{ +return engine->gt->submission_method >=INTEL_SUBMISSION_GUC ; +} +static inline bool intel_engine_has_preempt_reset (const struct intel_engine_cs *engine) {
drivers/gpu/drm/i915/gt/intel_engine_cs.c +8 -4
@@ -909,12 +909,16 @@ int intel_engines_init(struct intel_gt *gt)enum intel_engine_id id;int err; -if (intel_uc_uses_guc_submission (>->uc)) +if (intel_uc_uses_guc_submission (>->uc)) { + gt->submission_method =INTEL_SUBMISSION_GUC ; setup = intel_guc_submission_setup; -else if (HAS_EXECLISTS (gt->i915)) + }else if (HAS_EXECLISTS (gt->i915)) { + gt->submission_method =INTEL_SUBMISSION_ELSP ; setup = intel_execlists_submission_setup; -else + }else { + gt->submission_method =INTEL_SUBMISSION_RING ; setup = intel_ring_submission_setup; + }for_each_engine (engine, gt, id) { err =engine_setup_common (engine);
@@ -1479,7 +1483,7 @@ static void intel_engine_print_registers(struct intel_engine_cs *engine,drm_printf (m,"\tIPEHR: 0x%08x\n" ,ENGINE_READ (engine,IPEHR )); } -if (intel_engine_in_guc_submission_mode (engine)) { +if (intel_engine_uses_guc (engine)) {/* nothing to print yet */ }else if (HAS_EXECLISTS (dev_priv)) {struct i915_request *const *port, *rq;
drivers/gpu/drm/i915/gt/intel_execlists_submission.c +0 -8
@@ -1768,7 +1768,6 @@ process_csb(struct intel_engine_cs *engine, struct i915_request **inactive)*/ GEM_BUG_ON (!tasklet_is_locked (&execlists->tasklet) && !reset_in_progress (execlists)); -GEM_BUG_ON (!intel_engine_in_execlists_submission_mode (engine));/* * Note that csb_write, csb_status may be either in HWSP or mmio.
@@ -3884,13 +3883,6 @@ void intel_execlists_show_requests(struct intel_engine_cs *engine,spin_unlock_irqrestore (&engine->active.lock, flags); } -bool -intel_engine_in_execlists_submission_mode (const struct intel_engine_cs *engine) -{ -return engine->set_default_submission == - execlists_set_default_submission; -} -#if IS_ENABLED (CONFIG_DRM_I915_SELFTEST )#include "selftest_execlists.c" #endif
drivers/gpu/drm/i915/gt/intel_execlists_submission.h +0 -3
@@ -43,7 +43,4 @@ int intel_virtual_engine_attach_bond(struct intel_engine_cs *engine,const struct intel_engine_cs *master, const struct intel_engine_cs *sibling); -bool -intel_engine_in_execlists_submission_mode (const struct intel_engine_cs *engine); -#endif /* __INTEL_EXECLISTS_SUBMISSION_H__ */
drivers/gpu/drm/i915/gt/intel_gt_types.h +7 -0
@@ -31,6 +31,12 @@ struct i915_ggtt;struct intel_engine_cs ;struct intel_uncore ; +enum intel_submission_method { +INTEL_SUBMISSION_RING , +INTEL_SUBMISSION_ELSP , +INTEL_SUBMISSION_GUC , +}; +struct intel_gt {struct drm_i915_private *i915;struct intel_uncore *uncore;
@@ -118,6 +124,7 @@ struct intel_gt {struct intel_engine_cs *engine[I915_NUM_ENGINES ];struct intel_engine_cs *engine_class[MAX_ENGINE_CLASS +1 ] [MAX_ENGINE_INSTANCE +1 ]; +enum intel_submission_method submission_method;/* * Default address space (either GGTT or ppGTT depending on arch).
drivers/gpu/drm/i915/gt/intel_reset.c +3 -4
@@ -1118,7 +1118,6 @@ static int intel_gt_reset_engine(struct intel_engine_cs *engine)int __intel_engine_reset_bh (struct intel_engine_cs *engine,const char *msg) {struct intel_gt *gt = engine->gt; -bool uses_guc =intel_engine_in_guc_submission_mode (engine);int ret;ENGINE_TRACE (engine,"flags=%lx\n" , gt->reset.flags);
@@ -1134,10 +1133,10 @@ int __intel_engine_reset_bh(struct intel_engine_cs *engine, const char *msg) "Resetting %s for %s\n", engine->name, msg);atomic_inc (&engine->i915->gpu_error.reset_engine_count[engine->uabi_class]); -if (!uses_guc) - ret =intel_gt_reset_engine (engine); -else +if (intel_engine_uses_guc (engine)) ret =intel_guc_reset_engine (&engine->gt->uc.guc, engine); +else + ret =intel_gt_reset_engine (engine);if (ret) {/* If we fail here, we expect to fallback to a global reset */ ENGINE_TRACE (engine,"Failed to reset, err: %d\n" , ret);
drivers/gpu/drm/i915/gt/selftest_execlists.c +1 -1
@@ -4716,7 +4716,7 @@ int intel_execlists_live_selftests(struct drm_i915_private *i915) SUBTEST(live_virtual_reset), }; -if (!HAS_EXECLISTS (i915)) +if (i915->gt.submission_method !=INTEL_SUBMISSION_ELSP )return 0 ;if (intel_gt_is_wedged (&i915->gt))
drivers/gpu/drm/i915/gt/selftest_ring_submission.c +1 -1
@@ -291,7 +291,7 @@ int intel_ring_submission_live_selftests(struct drm_i915_private *i915) SUBTEST(live_ctx_switch_wa), }; -if (HAS_EXECLISTS (i915)) +if (i915->gt.submission_method >INTEL_SUBMISSION_RING )return 0 ;return intel_gt_live_subtests (tests, &i915->gt);
drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c +0 -5
@@ -745,8 +745,3 @@ void intel_guc_submission_init_early(struct intel_guc *guc) { guc->submission_selected =__guc_submission_selected (guc); } - -bool intel_engine_in_guc_submission_mode (const struct intel_engine_cs *engine) -{ -return engine->set_default_submission == guc_set_default_submission; -}
drivers/gpu/drm/i915/gt/uc/intel_guc_submission.h +0 -1
@@ -20,7 +20,6 @@ void intel_guc_submission_fini(struct intel_guc *guc);int intel_guc_preempt_work_create (struct intel_guc *guc);void intel_guc_preempt_work_destroy (struct intel_guc *guc);int intel_guc_submission_setup (struct intel_engine_cs *engine); -bool intel_engine_in_guc_submission_mode (const struct intel_engine_cs *engine);static inline bool intel_guc_submission_is_supported (struct intel_guc *guc) {
drivers/gpu/drm/i915/i915_perf.c +5 -5
@@ -1257,11 +1257,7 @@ static int oa_get_render_ctx_id(struct i915_perf_stream *stream)case 8 :case 9 :case 10 : -if (intel_engine_in_execlists_submission_mode (ce->engine)) { - stream->specific_ctx_id_mask = - (1U <<GEN8_CTX_ID_WIDTH ) -1 ; - stream->specific_ctx_id = stream->specific_ctx_id_mask; - }else { +if (intel_engine_uses_guc (ce->engine)) {/* * When using GuC, the context descriptor we write in * i915 is read by GuC and rewritten before it's
@@ -1280,6 +1276,10 @@ static int oa_get_render_ctx_id(struct i915_perf_stream *stream)*/ stream->specific_ctx_id_mask = (1U << (GEN8_CTX_ID_WIDTH -1 )) -1 ; + }else { + stream->specific_ctx_id_mask = + (1U <<GEN8_CTX_ID_WIDTH ) -1 ; + stream->specific_ctx_id = stream->specific_ctx_id_mask; }break ;
Signature · 1 line
2.28.0
Re: [RFC PATCH 02/97] drm/i915/gt: Move submission_method into intel_gt
Quoted 8 lines · Matthew Brost
From: Chris Wilson <[email protected]>
Since we setup the submission method for the engines once, it is easy to assign an enum and use that instead of probing into the backends.
Signed-off-by Matthew Brost <[email protected]>Signed-off-by Chris Wilson <[email protected]>Cc Tvrtko Ursulin <[email protected]>
Quoted 245 lines
--- drivers/gpu/drm/i915/gt/intel_engine.h | 8 +++++++- drivers/gpu/drm/i915/gt/intel_engine_cs.c | 12 ++++++++---- drivers/gpu/drm/i915/gt/intel_execlists_submission.c | 8 -------- drivers/gpu/drm/i915/gt/intel_execlists_submission.h | 3 --- drivers/gpu/drm/i915/gt/intel_gt_types.h | 7 +++++++ drivers/gpu/drm/i915/gt/intel_reset.c | 7 +++---- drivers/gpu/drm/i915/gt/selftest_execlists.c | 2 +- drivers/gpu/drm/i915/gt/selftest_ring_submission.c | 2 +- drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c | 5 ----- drivers/gpu/drm/i915/gt/uc/intel_guc_submission.h | 1 - drivers/gpu/drm/i915/i915_perf.c | 10 +++++----- 11 files changed, 32 insertions(+), 33 deletions(-)drivers/gpu/drm/i915/gt/intel_engine.h +7
-1@@ -13,8 +13,9 @@#include "i915_reg.h" #include "i915_request.h" #include "i915_selftest.h" -#include "gt/intel_timeline.h" #include "intel_engine_types.h" +#include "intel_gt_types.h" +#include "intel_timeline.h" #include "intel_workarounds.h" struct drm_printer ;@@ -262,6 +263,11 @@ void intel_engine_init_active(struct intel_engine_cs *engine,#define ENGINE_MOCK 1#define ENGINE_VIRTUAL 2 +static inline bool intel_engine_uses_guc (const struct intel_engine_cs *engine) +{ +return engine->gt->submission_method >=INTEL_SUBMISSION_GUC ; +} +static inline bool intel_engine_has_preempt_reset (const struct intel_engine_cs *engine) {drivers/gpu/drm/i915/gt/intel_engine_cs.c +8
-4@@ -909,12 +909,16 @@ int intel_engines_init(struct intel_gt *gt)enum intel_engine_id id;int err; -if (intel_uc_uses_guc_submission (>->uc)) +if (intel_uc_uses_guc_submission (>->uc)) { + gt->submission_method =INTEL_SUBMISSION_GUC ; setup = intel_guc_submission_setup; -else if (HAS_EXECLISTS (gt->i915)) + }else if (HAS_EXECLISTS (gt->i915)) { + gt->submission_method =INTEL_SUBMISSION_ELSP ; setup = intel_execlists_submission_setup; -else + }else { + gt->submission_method =INTEL_SUBMISSION_RING ; setup = intel_ring_submission_setup; + }for_each_engine (engine, gt, id) { err =engine_setup_common (engine);@@ -1479,7 +1483,7 @@ static void intel_engine_print_registers(struct intel_engine_cs *engine,drm_printf (m,"\tIPEHR: 0x%08x\n" ,ENGINE_READ (engine,IPEHR )); } -if (intel_engine_in_guc_submission_mode (engine)) { +if (intel_engine_uses_guc (engine)) {/* nothing to print yet */ }else if (HAS_EXECLISTS (dev_priv)) {struct i915_request *const *port, *rq;drivers/gpu/drm/i915/gt/intel_execlists_submission.c +0
-8@@ -1768,7 +1768,6 @@ process_csb(struct intel_engine_cs *engine, struct i915_request **inactive)*/ GEM_BUG_ON (!tasklet_is_locked (&execlists->tasklet) && !reset_in_progress (execlists)); -GEM_BUG_ON (!intel_engine_in_execlists_submission_mode (engine));/* * Note that csb_write, csb_status may be either in HWSP or mmio. @@ -3884,13 +3883,6 @@ void intel_execlists_show_requests(struct intel_engine_cs *engine,spin_unlock_irqrestore (&engine->active.lock, flags); } -bool -intel_engine_in_execlists_submission_mode (const struct intel_engine_cs *engine) -{ -return engine->set_default_submission == - execlists_set_default_submission; -} -#if IS_ENABLED (CONFIG_DRM_I915_SELFTEST )#include "selftest_execlists.c" #endif drivers/gpu/drm/i915/gt/intel_execlists_submission.h +0
-3@@ -43,7 +43,4 @@ int intel_virtual_engine_attach_bond(struct intel_engine_cs *engine,const struct intel_engine_cs *master, const struct intel_engine_cs *sibling); -bool -intel_engine_in_execlists_submission_mode (const struct intel_engine_cs *engine); -#endif /* __INTEL_EXECLISTS_SUBMISSION_H__ */ drivers/gpu/drm/i915/gt/intel_gt_types.h +7
-0@@ -31,6 +31,12 @@ struct i915_ggtt;struct intel_engine_cs ;struct intel_uncore ; +enum intel_submission_method { +INTEL_SUBMISSION_RING , +INTEL_SUBMISSION_ELSP , +INTEL_SUBMISSION_GUC , +}; +struct intel_gt {struct drm_i915_private *i915;struct intel_uncore *uncore;@@ -118,6 +124,7 @@ struct intel_gt {struct intel_engine_cs *engine[I915_NUM_ENGINES ];struct intel_engine_cs *engine_class[MAX_ENGINE_CLASS +1 ] [MAX_ENGINE_INSTANCE +1 ]; +enum intel_submission_method submission_method;/* * Default address space (either GGTT or ppGTT depending on arch). drivers/gpu/drm/i915/gt/intel_reset.c +3
-4@@ -1118,7 +1118,6 @@ static int intel_gt_reset_engine(struct intel_engine_cs *engine)int __intel_engine_reset_bh (struct intel_engine_cs *engine,const char *msg) {struct intel_gt *gt = engine->gt; -bool uses_guc =intel_engine_in_guc_submission_mode (engine);int ret;ENGINE_TRACE (engine,"flags=%lx\n" , gt->reset.flags);@@ -1134,10 +1133,10 @@ int __intel_engine_reset_bh(struct intel_engine_cs *engine, const char *msg) "Resetting %s for %s\n", engine->name, msg);atomic_inc (&engine->i915->gpu_error.reset_engine_count[engine->uabi_class]); -if (!uses_guc) - ret =intel_gt_reset_engine (engine); -else +if (intel_engine_uses_guc (engine)) ret =intel_guc_reset_engine (&engine->gt->uc.guc, engine); +else + ret =intel_gt_reset_engine (engine);if (ret) {/* If we fail here, we expect to fallback to a global reset */ ENGINE_TRACE (engine,"Failed to reset, err: %d\n" , ret);drivers/gpu/drm/i915/gt/selftest_execlists.c +1
-1@@ -4716,7 +4716,7 @@ int intel_execlists_live_selftests(struct drm_i915_private *i915) SUBTEST(live_virtual_reset), }; -if (!HAS_EXECLISTS (i915)) +if (i915->gt.submission_method !=INTEL_SUBMISSION_ELSP )return 0 ;if (intel_gt_is_wedged (&i915->gt))drivers/gpu/drm/i915/gt/selftest_ring_submission.c +1
-1@@ -291,7 +291,7 @@ int intel_ring_submission_live_selftests(struct drm_i915_private *i915) SUBTEST(live_ctx_switch_wa), }; -if (HAS_EXECLISTS (i915)) +if (i915->gt.submission_method >INTEL_SUBMISSION_RING )return 0 ;return intel_gt_live_subtests (tests, &i915->gt);drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c +0
-5@@ -745,8 +745,3 @@ void intel_guc_submission_init_early(struct intel_guc *guc) { guc->submission_selected =__guc_submission_selected (guc); } - -bool intel_engine_in_guc_submission_mode (const struct intel_engine_cs *engine) -{ -return engine->set_default_submission == guc_set_default_submission; -}drivers/gpu/drm/i915/gt/uc/intel_guc_submission.h +0
-1@@ -20,7 +20,6 @@ void intel_guc_submission_fini(struct intel_guc *guc);int intel_guc_preempt_work_create (struct intel_guc *guc);void intel_guc_preempt_work_destroy (struct intel_guc *guc);int intel_guc_submission_setup (struct intel_engine_cs *engine); -bool intel_engine_in_guc_submission_mode (const struct intel_engine_cs *engine);static inline bool intel_guc_submission_is_supported (struct intel_guc *guc) {drivers/gpu/drm/i915/i915_perf.c +5
-5@@ -1257,11 +1257,7 @@ static int oa_get_render_ctx_id(struct i915_perf_stream *stream)case 8 :case 9 :case 10 : -if (intel_engine_in_execlists_submission_mode (ce->engine)) { - stream->specific_ctx_id_mask = - (1U <<GEN8_CTX_ID_WIDTH ) -1 ; - stream->specific_ctx_id = stream->specific_ctx_id_mask; - }else { +if (intel_engine_uses_guc (ce->engine)) {/* * When using GuC, the context descriptor we write in * i915 is read by GuC and rewritten before it's @@ -1280,6 +1276,10 @@ static int oa_get_render_ctx_id(struct i915_perf_stream *stream)*/ stream->specific_ctx_id_mask = (1U << (GEN8_CTX_ID_WIDTH -1 )) -1 ; + }else { + stream->specific_ctx_id_mask = + (1U <<GEN8_CTX_ID_WIDTH ) -1 ; + stream->specific_ctx_id = stream->specific_ctx_id_mask; }break ;Signature · 1 line
2.28.0
Re: [Intel-gfx] [RFC PATCH 02/97] drm/i915/gt: Move submission_method into intel_gt
In reply to Matthew BrostQuoted 8 lines · Matthew Brost
From: Chris Wilson <[email protected]>
Since we setup the submission method for the engines once, it is easy to assign an enum and use that instead of probing into the backends.
Signed-off-by Matthew Brost <[email protected]>Signed-off-by Chris Wilson <[email protected]>Cc Tvrtko Ursulin <[email protected]>
Same, this patch had my r-b already so I'll repeat it:
Regards,
Tvrtko
Quoted 233 lines
--- drivers/gpu/drm/i915/gt/intel_engine.h | 8 +++++++- drivers/gpu/drm/i915/gt/intel_engine_cs.c | 12 ++++++++---- drivers/gpu/drm/i915/gt/intel_execlists_submission.c | 8 -------- drivers/gpu/drm/i915/gt/intel_execlists_submission.h | 3 --- drivers/gpu/drm/i915/gt/intel_gt_types.h | 7 +++++++ drivers/gpu/drm/i915/gt/intel_reset.c | 7 +++---- drivers/gpu/drm/i915/gt/selftest_execlists.c | 2 +- drivers/gpu/drm/i915/gt/selftest_ring_submission.c | 2 +- drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c | 5 ----- drivers/gpu/drm/i915/gt/uc/intel_guc_submission.h | 1 - drivers/gpu/drm/i915/i915_perf.c | 10 +++++----- 11 files changed, 32 insertions(+), 33 deletions(-)drivers/gpu/drm/i915/gt/intel_engine.h +7
-1@@ -13,8 +13,9 @@#include "i915_reg.h" #include "i915_request.h" #include "i915_selftest.h" -#include "gt/intel_timeline.h" #include "intel_engine_types.h" +#include "intel_gt_types.h" +#include "intel_timeline.h" #include "intel_workarounds.h" struct drm_printer ;@@ -262,6 +263,11 @@ void intel_engine_init_active(struct intel_engine_cs *engine,#define ENGINE_MOCK 1#define ENGINE_VIRTUAL 2 +static inline bool intel_engine_uses_guc (const struct intel_engine_cs *engine) +{ +return engine->gt->submission_method >=INTEL_SUBMISSION_GUC ; +} +static inline bool intel_engine_has_preempt_reset (const struct intel_engine_cs *engine) {drivers/gpu/drm/i915/gt/intel_engine_cs.c +8
-4@@ -909,12 +909,16 @@ int intel_engines_init(struct intel_gt *gt)enum intel_engine_id id;int err; -if (intel_uc_uses_guc_submission (>->uc)) +if (intel_uc_uses_guc_submission (>->uc)) { + gt->submission_method =INTEL_SUBMISSION_GUC ; setup = intel_guc_submission_setup; -else if (HAS_EXECLISTS (gt->i915)) + }else if (HAS_EXECLISTS (gt->i915)) { + gt->submission_method =INTEL_SUBMISSION_ELSP ; setup = intel_execlists_submission_setup; -else + }else { + gt->submission_method =INTEL_SUBMISSION_RING ; setup = intel_ring_submission_setup; + }for_each_engine (engine, gt, id) { err =engine_setup_common (engine);@@ -1479,7 +1483,7 @@ static void intel_engine_print_registers(struct intel_engine_cs *engine,drm_printf (m,"\tIPEHR: 0x%08x\n" ,ENGINE_READ (engine,IPEHR )); } -if (intel_engine_in_guc_submission_mode (engine)) { +if (intel_engine_uses_guc (engine)) {/* nothing to print yet */ }else if (HAS_EXECLISTS (dev_priv)) {struct i915_request *const *port, *rq;drivers/gpu/drm/i915/gt/intel_execlists_submission.c +0
-8@@ -1768,7 +1768,6 @@ process_csb(struct intel_engine_cs *engine, struct i915_request **inactive)*/ GEM_BUG_ON (!tasklet_is_locked (&execlists->tasklet) && !reset_in_progress (execlists)); -GEM_BUG_ON (!intel_engine_in_execlists_submission_mode (engine));/* * Note that csb_write, csb_status may be either in HWSP or mmio. @@ -3884,13 +3883,6 @@ void intel_execlists_show_requests(struct intel_engine_cs *engine,spin_unlock_irqrestore (&engine->active.lock, flags); } -bool -intel_engine_in_execlists_submission_mode (const struct intel_engine_cs *engine) -{ -return engine->set_default_submission == - execlists_set_default_submission; -} -#if IS_ENABLED (CONFIG_DRM_I915_SELFTEST )#include "selftest_execlists.c" #endif drivers/gpu/drm/i915/gt/intel_execlists_submission.h +0
-3@@ -43,7 +43,4 @@ int intel_virtual_engine_attach_bond(struct intel_engine_cs *engine,const struct intel_engine_cs *master, const struct intel_engine_cs *sibling); -bool -intel_engine_in_execlists_submission_mode (const struct intel_engine_cs *engine); -#endif /* __INTEL_EXECLISTS_SUBMISSION_H__ */ drivers/gpu/drm/i915/gt/intel_gt_types.h +7
-0@@ -31,6 +31,12 @@ struct i915_ggtt;struct intel_engine_cs ;struct intel_uncore ; +enum intel_submission_method { +INTEL_SUBMISSION_RING , +INTEL_SUBMISSION_ELSP , +INTEL_SUBMISSION_GUC , +}; +struct intel_gt {struct drm_i915_private *i915;struct intel_uncore *uncore;@@ -118,6 +124,7 @@ struct intel_gt {struct intel_engine_cs *engine[I915_NUM_ENGINES ];struct intel_engine_cs *engine_class[MAX_ENGINE_CLASS +1 ] [MAX_ENGINE_INSTANCE +1 ]; +enum intel_submission_method submission_method;/* * Default address space (either GGTT or ppGTT depending on arch). drivers/gpu/drm/i915/gt/intel_reset.c +3
-4@@ -1118,7 +1118,6 @@ static int intel_gt_reset_engine(struct intel_engine_cs *engine)int __intel_engine_reset_bh (struct intel_engine_cs *engine,const char *msg) {struct intel_gt *gt = engine->gt; -bool uses_guc =intel_engine_in_guc_submission_mode (engine);int ret;ENGINE_TRACE (engine,"flags=%lx\n" , gt->reset.flags);@@ -1134,10 +1133,10 @@ int __intel_engine_reset_bh(struct intel_engine_cs *engine, const char *msg) "Resetting %s for %s\n", engine->name, msg);atomic_inc (&engine->i915->gpu_error.reset_engine_count[engine->uabi_class]); -if (!uses_guc) - ret =intel_gt_reset_engine (engine); -else +if (intel_engine_uses_guc (engine)) ret =intel_guc_reset_engine (&engine->gt->uc.guc, engine); +else + ret =intel_gt_reset_engine (engine);if (ret) {/* If we fail here, we expect to fallback to a global reset */ ENGINE_TRACE (engine,"Failed to reset, err: %d\n" , ret);drivers/gpu/drm/i915/gt/selftest_execlists.c +1
-1@@ -4716,7 +4716,7 @@ int intel_execlists_live_selftests(struct drm_i915_private *i915) SUBTEST(live_virtual_reset), }; -if (!HAS_EXECLISTS (i915)) +if (i915->gt.submission_method !=INTEL_SUBMISSION_ELSP )return 0 ;if (intel_gt_is_wedged (&i915->gt))drivers/gpu/drm/i915/gt/selftest_ring_submission.c +1
-1@@ -291,7 +291,7 @@ int intel_ring_submission_live_selftests(struct drm_i915_private *i915) SUBTEST(live_ctx_switch_wa), }; -if (HAS_EXECLISTS (i915)) +if (i915->gt.submission_method >INTEL_SUBMISSION_RING )return 0 ;return intel_gt_live_subtests (tests, &i915->gt);drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c +0
-5@@ -745,8 +745,3 @@ void intel_guc_submission_init_early(struct intel_guc *guc) { guc->submission_selected =__guc_submission_selected (guc); } - -bool intel_engine_in_guc_submission_mode (const struct intel_engine_cs *engine) -{ -return engine->set_default_submission == guc_set_default_submission; -}drivers/gpu/drm/i915/gt/uc/intel_guc_submission.h +0
-1@@ -20,7 +20,6 @@ void intel_guc_submission_fini(struct intel_guc *guc);int intel_guc_preempt_work_create (struct intel_guc *guc);void intel_guc_preempt_work_destroy (struct intel_guc *guc);int intel_guc_submission_setup (struct intel_engine_cs *engine); -bool intel_engine_in_guc_submission_mode (const struct intel_engine_cs *engine);static inline bool intel_guc_submission_is_supported (struct intel_guc *guc) {drivers/gpu/drm/i915/i915_perf.c +1
-5@@ -1257,11 +1257,7 @@ static int oa_get_render_ctx_id(struct i915_perf_stream *stream)case 8 :case 9 :case 10 : -if (intel_engine_in_execlists_submission_mode (ce->engine)) { - stream->specific_ctx_id_mask = - (1U <<GEN8_CTX_ID_WIDTH ) -1 ; - stream->specific_ctx_id = stream->specific_ctx_id_mask; - }else { +if (intel_engine_uses_guc (ce->engine)) {/* * When using GuC, the context descriptor we write in * i915 is read by GuC and rewritten before it's
drivers/gpu/drm/i915/i915_perf.c static int oa_get_render_ctx_id(struct i915_perf_stream *stream) · line 1285
Quoted 10 lines
drivers/gpu/drm/i915/i915_perf.c +4
-0@@ -1280,6 +1276,10 @@ static int oa_get_render_ctx_id(struct i915_perf_stream *stream)*/ stream->specific_ctx_id_mask = (1U << (GEN8_CTX_ID_WIDTH -1 )) -1 ; + }else { + stream->specific_ctx_id_mask = + (1U <<GEN8_CTX_ID_WIDTH ) -1 ; + stream->specific_ctx_id = stream->specific_ctx_id_mask; }break ;
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
RFC PATCH 3/97 drm/i915/gt: Move CS interrupt handler to the backend
In reply to Matthew BrostFrom: Chris Wilson <[email protected]>
The different submission backends each have their own preferred behaviour and interrupt setup. Let each handle their own interrupts.
This becomes more useful later as we to extract the use of auxiliary state in the interrupt handler that is backend specific.
--- drivers/gpu/drm/i915/gt/intel_engine_cs.c | 7 ++ drivers/gpu/drm/i915/gt/intel_engine_types.h | 14 +--- .../drm/i915/gt/intel_execlists_submission.c | 41 ++++++++++ drivers/gpu/drm/i915/gt/intel_gt_irq.c | 82 ++++++------------- drivers/gpu/drm/i915/gt/intel_gt_irq.h | 23 ++++++ .../gpu/drm/i915/gt/intel_ring_submission.c | 8 ++ drivers/gpu/drm/i915/gt/intel_rps.c | 2 +- .../gpu/drm/i915/gt/uc/intel_guc_submission.c | 11 ++- drivers/gpu/drm/i915/i915_irq.c | 10 ++- 9 files changed, 124 insertions(+), 74 deletions(-)
drivers/gpu/drm/i915/gt/intel_engine_cs.c +7 -0
@@ -255,6 +255,11 @@ static void intel_engine_sanitize_mmio(struct intel_engine_cs *engine)intel_engine_set_hwsp_writemask (engine, ~0u ); } +static void nop_irq_handler (struct intel_engine_cs *engine,u16 iir) +{ +GEM_DEBUG_WARN_ON (iir); +} +static int intel_engine_setup (struct intel_gt *gt,enum intel_engine_id id) {const struct engine_info *info = &intel_engines[id];
@@ -292,6 +297,8 @@ static int intel_engine_setup(struct intel_gt *gt, enum intel_engine_id id) engine->hw_id = info->hw_id; engine->guc_id =MAKE_GUC_ID (info->class, info->instance); + engine->irq_handler = nop_irq_handler; + engine->class = info->class; engine->instance = info->instance;__sprint_engine_name (engine);
drivers/gpu/drm/i915/gt/intel_engine_types.h +4 -10
@@ -402,6 +402,7 @@ struct intel_engine_cs {u32 irq_enable_mask;/* bitmask to enable ring interrupt */ void (*irq_enable)(struct intel_engine_cs *engine);void (*irq_disable)(struct intel_engine_cs *engine); +void (*irq_handler)(struct intel_engine_cs *engine,u16 iir);void (*sanitize)(struct intel_engine_cs *engine);int (*resume)(struct intel_engine_cs *engine);
@@ -481,10 +482,9 @@ struct intel_engine_cs {#define I915_ENGINE_HAS_PREEMPTION BIT(2)#define I915_ENGINE_HAS_SEMAPHORES BIT(3)#define I915_ENGINE_HAS_TIMESLICES BIT(4) -#define I915_ENGINE_NEEDS_BREADCRUMB_TASKLET BIT(5) -#define I915_ENGINE_IS_VIRTUAL BIT(6) -#define I915_ENGINE_HAS_RELATIVE_MMIO BIT(7) -#define I915_ENGINE_REQUIRES_CMD_PARSER BIT(8) +#define I915_ENGINE_IS_VIRTUAL BIT(5) +#define I915_ENGINE_HAS_RELATIVE_MMIO BIT(6) +#define I915_ENGINE_REQUIRES_CMD_PARSER BIT(7)unsigned int flags;/*
@@ -593,12 +593,6 @@ intel_engine_has_timeslices(const struct intel_engine_cs *engine)return engine->flags &I915_ENGINE_HAS_TIMESLICES ; } -static inline bool -intel_engine_needs_breadcrumb_tasklet (const struct intel_engine_cs *engine) -{ -return engine->flags &I915_ENGINE_NEEDS_BREADCRUMB_TASKLET ; -} -static inline bool intel_engine_is_virtual (const struct intel_engine_cs *engine) {
drivers/gpu/drm/i915/gt/intel_execlists_submission.c +41 -0
59 lines not on this page · raw message
drivers/gpu/drm/i915/gt/intel_gt_irq.c +24 -58
127 lines not on this page · raw message
drivers/gpu/drm/i915/gt/intel_gt_irq.h +23 -0
@@ -8,6 +8,8 @@#include <linux/types.h> +#include "intel_engine_types.h" +struct intel_gt ;#define GEN8_GT_IRQS (GEN8_GT_RCS_IRQ | \
@@ -39,4 +41,25 @@ void gen8_gt_irq_handler(struct intel_gt *gt, u32 master_ctl);void gen8_gt_irq_reset (struct intel_gt *gt);void gen8_gt_irq_postinstall (struct intel_gt *gt); +static inline void intel_engine_cs_irq (struct intel_engine_cs *engine,u16 iir) +{ +if (iir) + engine->irq_handler (engine, iir); +} + +static inline void +intel_engine_set_irq_handler (struct intel_engine_cs *engine, +void (*fn)(struct intel_engine_cs *engine, +u16 iir)) +{ +/* +* As the interrupt is live as allocate and setup the engines, +* err on the side of caution and apply barriers to updating +* the irq handler callback. This assures that when we do use +* the engine, we will receive interrupts only to ourselves, +* and not lose any. +*/ +smp_store_mb (engine->irq_handler, fn); +} +#endif /* INTEL_GT_IRQ_H */
drivers/gpu/drm/i915/gt/intel_ring_submission.c +8 -0
@@ -12,6 +12,7 @@#include "intel_breadcrumbs.h" #include "intel_context.h" #include "intel_gt.h" +#include "intel_gt_irq.h" #include "intel_reset.h" #include "intel_ring.h" #include "shmem_utils.h"
@@ -1017,10 +1018,17 @@ static void ring_release(struct intel_engine_cs *engine)intel_timeline_put (engine->legacy.timeline); } +static void irq_handler (struct intel_engine_cs *engine,u16 iir) +{ +intel_engine_signal_breadcrumbs (engine); +} +static void setup_irq (struct intel_engine_cs *engine) {struct drm_i915_private *i915 = engine->i915; +intel_engine_set_irq_handler (engine, irq_handler); +if (INTEL_GEN (i915) >=6 ) { engine->irq_enable = gen6_irq_enable; engine->irq_disable = gen6_irq_disable;
drivers/gpu/drm/i915/gt/intel_rps.c +1 -1
@@ -1774,7 +1774,7 @@ void gen6_rps_irq_handler(struct intel_rps *rps, u32 pm_iir)return ;if (pm_iir &PM_VEBOX_USER_INTERRUPT ) -intel_engine_signal_breadcrumbs (gt->engine[VECS0 ]); +intel_engine_cs_irq (gt->engine[VECS0 ], pm_iir >>10 );if (pm_iir &PM_VEBOX_CS_ERROR_INTERRUPT )DRM_DEBUG ("Command parser error, pm_iir 0x%08x\n" , pm_iir);
drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c +10 -1
@@ -11,6 +11,7 @@#include "gt/intel_context.h" #include "gt/intel_engine_pm.h" #include "gt/intel_gt.h" +#include "gt/intel_gt_irq.h" #include "gt/intel_gt_pm.h" #include "gt/intel_lrc.h" #include "gt/intel_mocs.h"
@@ -264,6 +265,14 @@ static void guc_submission_tasklet(struct tasklet_struct *t)spin_unlock_irqrestore (&engine->active.lock, flags); } +static void cs_irq_handler (struct intel_engine_cs *engine,u16 iir) +{ +if (iir >_RENDER_USER_INTERRUPT ) { +intel_engine_signal_breadcrumbs (engine); +tasklet_hi_schedule (&engine->execlists.tasklet); + } +} +static void guc_reset_prepare (struct intel_engine_cs *engine) {struct intel_engine_execlists *const execlists = &engine->execlists;
@@ -645,7 +654,6 @@ static void guc_default_vfuncs(struct intel_engine_cs *engine) } engine->set_default_submission = guc_set_default_submission; - engine->flags |=I915_ENGINE_NEEDS_BREADCRUMB_TASKLET ; engine->flags |=I915_ENGINE_HAS_PREEMPTION ;/*
@@ -681,6 +689,7 @@ static void rcs_submission_override(struct intel_engine_cs *engine)static inline void guc_default_irqs (struct intel_engine_cs *engine) { engine->irq_keep_mask =GT_RENDER_USER_INTERRUPT ; +intel_engine_set_irq_handler (engine, cs_irq_handler); }int intel_guc_submission_setup (struct intel_engine_cs *engine)
drivers/gpu/drm/i915/i915_irq.c +6 -4
@@ -4014,7 +4014,7 @@ static irqreturn_t i8xx_irq_handler(int irq, void *arg)intel_uncore_write16 (&dev_priv->uncore,GEN2_IIR , iir);if (iir &I915_USER_INTERRUPT ) -intel_engine_signal_breadcrumbs (dev_priv->gt.engine[RCS0 ]); +intel_engine_cs_irq (dev_priv->gt.engine[RCS0 ], iir);if (iir &I915_MASTER_ERROR_INTERRUPT )i8xx_error_irq_handler (dev_priv, eir, eir_stuck);
@@ -4122,7 +4122,7 @@ static irqreturn_t i915_irq_handler(int irq, void *arg)intel_uncore_write (&dev_priv->uncore,GEN2_IIR , iir);if (iir &I915_USER_INTERRUPT ) -intel_engine_signal_breadcrumbs (dev_priv->gt.engine[RCS0 ]); +intel_engine_cs_irq (dev_priv->gt.engine[RCS0 ], iir);if (iir &I915_MASTER_ERROR_INTERRUPT )i9xx_error_irq_handler (dev_priv, eir, eir_stuck);
@@ -4267,10 +4267,12 @@ static irqreturn_t i965_irq_handler(int irq, void *arg)intel_uncore_write (&dev_priv->uncore,GEN2_IIR , iir);if (iir &I915_USER_INTERRUPT ) -intel_engine_signal_breadcrumbs (dev_priv->gt.engine[RCS0 ]); +intel_engine_cs_irq (dev_priv->gt.engine[RCS0 ], + iir);if (iir &I915_BSD_USER_INTERRUPT ) -intel_engine_signal_breadcrumbs (dev_priv->gt.engine[VCS0 ]); +intel_engine_cs_irq (dev_priv->gt.engine[VCS0 ], + iir >>25 );if (iir &I915_MASTER_ERROR_INTERRUPT )i9xx_error_irq_handler (dev_priv, eir, eir_stuck);
Signature · 1 line
2.28.0
Re: [RFC PATCH 03/97] drm/i915/gt: Move CS interrupt handler to the backend
Quoted 11 lines · Matthew Brost
From: Chris Wilson <[email protected]>
The different submission backends each have their own preferred behaviour and interrupt setup. Let each handle their own interrupts.
This becomes more useful later as we to extract the use of auxiliary state in the interrupt handler that is backend specific.
Signed-off-by Matthew Brost <[email protected]>Signed-off-by Chris Wilson <[email protected]>Cc Tvrtko Ursulin <[email protected]>
Quoted 445 lines
--- drivers/gpu/drm/i915/gt/intel_engine_cs.c | 7 ++ drivers/gpu/drm/i915/gt/intel_engine_types.h | 14 +--- .../drm/i915/gt/intel_execlists_submission.c | 41 ++++++++++ drivers/gpu/drm/i915/gt/intel_gt_irq.c | 82 ++++++------------- drivers/gpu/drm/i915/gt/intel_gt_irq.h | 23 ++++++ .../gpu/drm/i915/gt/intel_ring_submission.c | 8 ++ drivers/gpu/drm/i915/gt/intel_rps.c | 2 +- .../gpu/drm/i915/gt/uc/intel_guc_submission.c | 11 ++- drivers/gpu/drm/i915/i915_irq.c | 10 ++- 9 files changed, 124 insertions(+), 74 deletions(-)drivers/gpu/drm/i915/gt/intel_engine_cs.c +7
-0@@ -255,6 +255,11 @@ static void intel_engine_sanitize_mmio(struct intel_engine_cs *engine)intel_engine_set_hwsp_writemask (engine, ~0u ); } +static void nop_irq_handler (struct intel_engine_cs *engine,u16 iir) +{ +GEM_DEBUG_WARN_ON (iir); +} +static int intel_engine_setup (struct intel_gt *gt,enum intel_engine_id id) {const struct engine_info *info = &intel_engines[id];@@ -292,6 +297,8 @@ static int intel_engine_setup(struct intel_gt *gt, enum intel_engine_id id) engine->hw_id = info->hw_id; engine->guc_id =MAKE_GUC_ID (info->class, info->instance); + engine->irq_handler = nop_irq_handler; + engine->class = info->class; engine->instance = info->instance;__sprint_engine_name (engine);drivers/gpu/drm/i915/gt/intel_engine_types.h +4
-10@@ -402,6 +402,7 @@ struct intel_engine_cs {u32 irq_enable_mask;/* bitmask to enable ring interrupt */ void (*irq_enable)(struct intel_engine_cs *engine);void (*irq_disable)(struct intel_engine_cs *engine); +void (*irq_handler)(struct intel_engine_cs *engine,u16 iir);void (*sanitize)(struct intel_engine_cs *engine);int (*resume)(struct intel_engine_cs *engine);@@ -481,10 +482,9 @@ struct intel_engine_cs {#define I915_ENGINE_HAS_PREEMPTION BIT(2)#define I915_ENGINE_HAS_SEMAPHORES BIT(3)#define I915_ENGINE_HAS_TIMESLICES BIT(4) -#define I915_ENGINE_NEEDS_BREADCRUMB_TASKLET BIT(5) -#define I915_ENGINE_IS_VIRTUAL BIT(6) -#define I915_ENGINE_HAS_RELATIVE_MMIO BIT(7) -#define I915_ENGINE_REQUIRES_CMD_PARSER BIT(8) +#define I915_ENGINE_IS_VIRTUAL BIT(5) +#define I915_ENGINE_HAS_RELATIVE_MMIO BIT(6) +#define I915_ENGINE_REQUIRES_CMD_PARSER BIT(7)unsigned int flags;/* @@ -593,12 +593,6 @@ intel_engine_has_timeslices(const struct intel_engine_cs *engine)return engine->flags &I915_ENGINE_HAS_TIMESLICES ; } -static inline bool -intel_engine_needs_breadcrumb_tasklet (const struct intel_engine_cs *engine) -{ -return engine->flags &I915_ENGINE_NEEDS_BREADCRUMB_TASKLET ; -} -static inline bool intel_engine_is_virtual (const struct intel_engine_cs *engine) {drivers/gpu/drm/i915/gt/intel_execlists_submission.c +41
-0@@ -118,6 +118,7 @@#include "intel_engine_stats.h" #include "intel_execlists_submission.h" #include "intel_gt.h" +#include "intel_gt_irq.h" #include "intel_gt_pm.h" #include "intel_gt_requests.h" #include "intel_lrc.h" @@ -2384,6 +2385,45 @@ static void execlists_submission_tasklet(struct tasklet_struct *t)rcu_read_unlock (); } +static void execlists_irq_handler (struct intel_engine_cs *engine,u16 iir) +{ +bool tasklet = false; + +if (unlikely (iir >_CS_MASTER_ERROR_INTERRUPT )) { +u32 eir; + +/* Upper 16b are the enabling mask, rsvd for internal errors */ + eir =ENGINE_READ (engine,RING_EIR ) &GENMASK (15 ,0 ); +ENGINE_TRACE (engine,"CS error: %x\n" , eir); + +/* Disable the error interrupt until after the reset */ +if (likely (eir)) { +ENGINE_WRITE (engine,RING_EMR , ~0u ); +ENGINE_WRITE (engine,RING_EIR , eir); +WRITE_ONCE (engine->execlists.error_interrupt, eir); + tasklet = true; + } + } + +if (iir >_WAIT_SEMAPHORE_INTERRUPT ) { +WRITE_ONCE (engine->execlists.yield, +ENGINE_READ_FW (engine,RING_EXECLIST_STATUS_HI )); +ENGINE_TRACE (engine,"semaphore yield: %08x\n" , + engine->execlists.yield); +if (del_timer (&engine->execlists.timer)) + tasklet = true; + } + +if (iir >_CONTEXT_SWITCH_INTERRUPT ) + tasklet = true; + +if (iir >_RENDER_USER_INTERRUPT ) +intel_engine_signal_breadcrumbs (engine); + +if (tasklet) +tasklet_hi_schedule (&engine->execlists.tasklet); +} +static void __execlists_kick (struct intel_engine_execlists *execlists) {/* Kick the tasklet for some interrupt coalescing and reset handling */ @@ -3133,6 +3173,7 @@ logical_ring_default_vfuncs(struct intel_engine_cs *engine)* until a more refined solution exists. */ } +intel_engine_set_irq_handler (engine, execlists_irq_handler); engine->flags |=I915_ENGINE_SUPPORTS_STATS ;if (!intel_vgpu_active (engine->i915)) {drivers/gpu/drm/i915/gt/intel_gt_irq.c +24
-58@@ -20,48 +20,6 @@ static void guc_irq_handler(struct intel_guc *guc, u16 iir)intel_guc_to_host_event_handler (guc); } -static void -cs_irq_handler (struct intel_engine_cs *engine,u32 iir) -{ -bool tasklet = false; - -if (unlikely (iir >_CS_MASTER_ERROR_INTERRUPT )) { -u32 eir; - -/* Upper 16b are the enabling mask, rsvd for internal errors */ - eir =ENGINE_READ (engine,RING_EIR ) &GENMASK (15 ,0 ); -ENGINE_TRACE (engine,"CS error: %x\n" , eir); - -/* Disable the error interrupt until after the reset */ -if (likely (eir)) { -ENGINE_WRITE (engine,RING_EMR , ~0u ); -ENGINE_WRITE (engine,RING_EIR , eir); -WRITE_ONCE (engine->execlists.error_interrupt, eir); - tasklet = true; - } - } - -if (iir >_WAIT_SEMAPHORE_INTERRUPT ) { -WRITE_ONCE (engine->execlists.yield, -ENGINE_READ_FW (engine,RING_EXECLIST_STATUS_HI )); -ENGINE_TRACE (engine,"semaphore yield: %08x\n" , - engine->execlists.yield); -if (del_timer (&engine->execlists.timer)) - tasklet = true; - } - -if (iir >_CONTEXT_SWITCH_INTERRUPT ) - tasklet = true; - -if (iir >_RENDER_USER_INTERRUPT ) { -intel_engine_signal_breadcrumbs (engine); - tasklet |=intel_engine_needs_breadcrumb_tasklet (engine); - } - -if (tasklet) -tasklet_hi_schedule (&engine->execlists.tasklet); -} -static u32 gen11_gt_engine_identity (struct intel_gt *gt,const unsigned int bank,const unsigned int bit)@@ -122,7 +80,7 @@ gen11_engine_irq_handler(struct intel_gt *gt, const u8 class, engine =NULL ;if (likely (engine)) -return cs_irq_handler (engine, iir); +return intel_engine_cs_irq (engine, iir);WARN_ONCE (1 ,"unhandled engine interrupt class=0x%x, instance=0x%x\n" , class, instance);@@ -275,9 +233,12 @@ void gen11_gt_irq_postinstall(struct intel_gt *gt)void gen5_gt_irq_handler (struct intel_gt *gt,u32 gt_iir) {if (gt_iir >_RENDER_USER_INTERRUPT ) -intel_engine_signal_breadcrumbs (gt->engine_class[RENDER_CLASS ][0 ]); +intel_engine_cs_irq (gt->engine_class[RENDER_CLASS ][0 ], + gt_iir); +if (gt_iir &ILK_BSD_USER_INTERRUPT ) -intel_engine_signal_breadcrumbs (gt->engine_class[VIDEO_DECODE_CLASS ][0 ]); +intel_engine_cs_irq (gt->engine_class[VIDEO_DECODE_CLASS ][0 ], + gt_iir); }static void gen7_parity_error_irq_handler (struct intel_gt *gt,u32 iir)@@ -301,11 +262,16 @@ static void gen7_parity_error_irq_handler(struct intel_gt *gt, u32 iir)void gen6_gt_irq_handler (struct intel_gt *gt,u32 gt_iir) {if (gt_iir >_RENDER_USER_INTERRUPT ) -intel_engine_signal_breadcrumbs (gt->engine_class[RENDER_CLASS ][0 ]); +intel_engine_cs_irq (gt->engine_class[RENDER_CLASS ][0 ], + gt_iir); +if (gt_iir >_BSD_USER_INTERRUPT ) -intel_engine_signal_breadcrumbs (gt->engine_class[VIDEO_DECODE_CLASS ][0 ]); +intel_engine_cs_irq (gt->engine_class[VIDEO_DECODE_CLASS ][0 ], + gt_iir >>12 ); +if (gt_iir >_BLT_USER_INTERRUPT ) -intel_engine_signal_breadcrumbs (gt->engine_class[COPY_ENGINE_CLASS ][0 ]); +intel_engine_cs_irq (gt->engine_class[COPY_ENGINE_CLASS ][0 ], + gt_iir >>22 ); if (gt_iir & (GT_BLT_CS_ERROR_INTERRUPT | GT_BSD_CS_ERROR_INTERRUPT |@@ -324,10 +290,10 @@ void gen8_gt_irq_handler(struct intel_gt *gt, u32 master_ctl)if (master_ctl & (GEN8_GT_RCS_IRQ |GEN8_GT_BCS_IRQ )) { iir =raw_reg_read (regs,GEN8_GT_IIR (0 ));if (likely (iir)) { -cs_irq_handler (gt->engine_class[RENDER_CLASS ][0 ], - iir >>GEN8_RCS_IRQ_SHIFT ); -cs_irq_handler (gt->engine_class[COPY_ENGINE_CLASS ][0 ], - iir >>GEN8_BCS_IRQ_SHIFT ); +intel_engine_cs_irq (gt->engine_class[RENDER_CLASS ][0 ], + iir >>GEN8_RCS_IRQ_SHIFT ); +intel_engine_cs_irq (gt->engine_class[COPY_ENGINE_CLASS ][0 ], + iir >>GEN8_BCS_IRQ_SHIFT );raw_reg_write (regs,GEN8_GT_IIR (0 ), iir); } }@@ -335,10 +301,10 @@ void gen8_gt_irq_handler(struct intel_gt *gt, u32 master_ctl)if (master_ctl & (GEN8_GT_VCS0_IRQ |GEN8_GT_VCS1_IRQ )) { iir =raw_reg_read (regs,GEN8_GT_IIR (1 ));if (likely (iir)) { -cs_irq_handler (gt->engine_class[VIDEO_DECODE_CLASS ][0 ], - iir >>GEN8_VCS0_IRQ_SHIFT ); -cs_irq_handler (gt->engine_class[VIDEO_DECODE_CLASS ][1 ], - iir >>GEN8_VCS1_IRQ_SHIFT ); +intel_engine_cs_irq (gt->engine_class[VIDEO_DECODE_CLASS ][0 ], + iir >>GEN8_VCS0_IRQ_SHIFT ); +intel_engine_cs_irq (gt->engine_class[VIDEO_DECODE_CLASS ][1 ], + iir >>GEN8_VCS1_IRQ_SHIFT );raw_reg_write (regs,GEN8_GT_IIR (1 ), iir); } }@@ -346,8 +312,8 @@ void gen8_gt_irq_handler(struct intel_gt *gt, u32 master_ctl)if (master_ctl &GEN8_GT_VECS_IRQ ) { iir =raw_reg_read (regs,GEN8_GT_IIR (3 ));if (likely (iir)) { -cs_irq_handler (gt->engine_class[VIDEO_ENHANCEMENT_CLASS ][0 ], - iir >>GEN8_VECS_IRQ_SHIFT ); +intel_engine_cs_irq (gt->engine_class[VIDEO_ENHANCEMENT_CLASS ][0 ], + iir >>GEN8_VECS_IRQ_SHIFT );raw_reg_write (regs,GEN8_GT_IIR (3 ), iir); } }drivers/gpu/drm/i915/gt/intel_gt_irq.h +23
-0@@ -8,6 +8,8 @@#include <linux/types.h> +#include "intel_engine_types.h" +struct intel_gt ;#define GEN8_GT_IRQS (GEN8_GT_RCS_IRQ | \@@ -39,4 +41,25 @@ void gen8_gt_irq_handler(struct intel_gt *gt, u32 master_ctl);void gen8_gt_irq_reset (struct intel_gt *gt);void gen8_gt_irq_postinstall (struct intel_gt *gt); +static inline void intel_engine_cs_irq (struct intel_engine_cs *engine,u16 iir) +{ +if (iir) + engine->irq_handler (engine, iir); +} + +static inline void +intel_engine_set_irq_handler (struct intel_engine_cs *engine, +void (*fn)(struct intel_engine_cs *engine, +u16 iir)) +{ +/* +* As the interrupt is live as allocate and setup the engines, +* err on the side of caution and apply barriers to updating +* the irq handler callback. This assures that when we do use +* the engine, we will receive interrupts only to ourselves, +* and not lose any. +*/ +smp_store_mb (engine->irq_handler, fn); +} +#endif /* INTEL_GT_IRQ_H */ drivers/gpu/drm/i915/gt/intel_ring_submission.c +8
-0@@ -12,6 +12,7 @@#include "intel_breadcrumbs.h" #include "intel_context.h" #include "intel_gt.h" +#include "intel_gt_irq.h" #include "intel_reset.h" #include "intel_ring.h" #include "shmem_utils.h" @@ -1017,10 +1018,17 @@ static void ring_release(struct intel_engine_cs *engine)intel_timeline_put (engine->legacy.timeline); } +static void irq_handler (struct intel_engine_cs *engine,u16 iir) +{ +intel_engine_signal_breadcrumbs (engine); +} +static void setup_irq (struct intel_engine_cs *engine) {struct drm_i915_private *i915 = engine->i915; +intel_engine_set_irq_handler (engine, irq_handler); +if (INTEL_GEN (i915) >=6 ) { engine->irq_enable = gen6_irq_enable; engine->irq_disable = gen6_irq_disable;drivers/gpu/drm/i915/gt/intel_rps.c +1
-1@@ -1774,7 +1774,7 @@ void gen6_rps_irq_handler(struct intel_rps *rps, u32 pm_iir)return ;if (pm_iir &PM_VEBOX_USER_INTERRUPT ) -intel_engine_signal_breadcrumbs (gt->engine[VECS0 ]); +intel_engine_cs_irq (gt->engine[VECS0 ], pm_iir >>10 );if (pm_iir &PM_VEBOX_CS_ERROR_INTERRUPT )DRM_DEBUG ("Command parser error, pm_iir 0x%08x\n" , pm_iir);drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c +10
-1@@ -11,6 +11,7 @@#include "gt/intel_context.h" #include "gt/intel_engine_pm.h" #include "gt/intel_gt.h" +#include "gt/intel_gt_irq.h" #include "gt/intel_gt_pm.h" #include "gt/intel_lrc.h" #include "gt/intel_mocs.h" @@ -264,6 +265,14 @@ static void guc_submission_tasklet(struct tasklet_struct *t)spin_unlock_irqrestore (&engine->active.lock, flags); } +static void cs_irq_handler (struct intel_engine_cs *engine,u16 iir) +{ +if (iir >_RENDER_USER_INTERRUPT ) { +intel_engine_signal_breadcrumbs (engine); +tasklet_hi_schedule (&engine->execlists.tasklet); + } +} +static void guc_reset_prepare (struct intel_engine_cs *engine) {struct intel_engine_execlists *const execlists = &engine->execlists;@@ -645,7 +654,6 @@ static void guc_default_vfuncs(struct intel_engine_cs *engine) } engine->set_default_submission = guc_set_default_submission; - engine->flags |=I915_ENGINE_NEEDS_BREADCRUMB_TASKLET ; engine->flags |=I915_ENGINE_HAS_PREEMPTION ;/* @@ -681,6 +689,7 @@ static void rcs_submission_override(struct intel_engine_cs *engine)static inline void guc_default_irqs (struct intel_engine_cs *engine) { engine->irq_keep_mask =GT_RENDER_USER_INTERRUPT ; +intel_engine_set_irq_handler (engine, cs_irq_handler); }int intel_guc_submission_setup (struct intel_engine_cs *engine)drivers/gpu/drm/i915/i915_irq.c +6
-4@@ -4014,7 +4014,7 @@ static irqreturn_t i8xx_irq_handler(int irq, void *arg)intel_uncore_write16 (&dev_priv->uncore,GEN2_IIR , iir);if (iir &I915_USER_INTERRUPT ) -intel_engine_signal_breadcrumbs (dev_priv->gt.engine[RCS0 ]); +intel_engine_cs_irq (dev_priv->gt.engine[RCS0 ], iir);if (iir &I915_MASTER_ERROR_INTERRUPT )i8xx_error_irq_handler (dev_priv, eir, eir_stuck);@@ -4122,7 +4122,7 @@ static irqreturn_t i915_irq_handler(int irq, void *arg)intel_uncore_write (&dev_priv->uncore,GEN2_IIR , iir);if (iir &I915_USER_INTERRUPT ) -intel_engine_signal_breadcrumbs (dev_priv->gt.engine[RCS0 ]); +intel_engine_cs_irq (dev_priv->gt.engine[RCS0 ], iir);if (iir &I915_MASTER_ERROR_INTERRUPT )i9xx_error_irq_handler (dev_priv, eir, eir_stuck);@@ -4267,10 +4267,12 @@ static irqreturn_t i965_irq_handler(int irq, void *arg)intel_uncore_write (&dev_priv->uncore,GEN2_IIR , iir);if (iir &I915_USER_INTERRUPT ) -intel_engine_signal_breadcrumbs (dev_priv->gt.engine[RCS0 ]); +intel_engine_cs_irq (dev_priv->gt.engine[RCS0 ], + iir);if (iir &I915_BSD_USER_INTERRUPT ) -intel_engine_signal_breadcrumbs (dev_priv->gt.engine[VCS0 ]); +intel_engine_cs_irq (dev_priv->gt.engine[VCS0 ], + iir >>25 );if (iir &I915_MASTER_ERROR_INTERRUPT )i9xx_error_irq_handler (dev_priv, eir, eir_stuck);Signature · 1 line
2.28.0
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [Intel-gfx] [RFC PATCH 03/97] drm/i915/gt: Move CS interrupt handler to the backend
In reply to Matthew BrostQuoted 11 lines · Matthew Brost
From: Chris Wilson <[email protected]>
The different submission backends each have their own preferred behaviour and interrupt setup. Let each handle their own interrupts.
This becomes more useful later as we to extract the use of auxiliary state in the interrupt handler that is backend specific.
Signed-off-by Matthew Brost <[email protected]>Signed-off-by Chris Wilson <[email protected]>Cc Tvrtko Ursulin <[email protected]>
Same, this patch had my r-b already so I'll repeat it:
Regards,
Tvrtko
Quoted 443 lines
--- drivers/gpu/drm/i915/gt/intel_engine_cs.c | 7 ++ drivers/gpu/drm/i915/gt/intel_engine_types.h | 14 +--- .../drm/i915/gt/intel_execlists_submission.c | 41 ++++++++++ drivers/gpu/drm/i915/gt/intel_gt_irq.c | 82 ++++++------------- drivers/gpu/drm/i915/gt/intel_gt_irq.h | 23 ++++++ .../gpu/drm/i915/gt/intel_ring_submission.c | 8 ++ drivers/gpu/drm/i915/gt/intel_rps.c | 2 +- .../gpu/drm/i915/gt/uc/intel_guc_submission.c | 11 ++- drivers/gpu/drm/i915/i915_irq.c | 10 ++- 9 files changed, 124 insertions(+), 74 deletions(-)drivers/gpu/drm/i915/gt/intel_engine_cs.c +7
-0@@ -255,6 +255,11 @@ static void intel_engine_sanitize_mmio(struct intel_engine_cs *engine)intel_engine_set_hwsp_writemask (engine, ~0u ); } +static void nop_irq_handler (struct intel_engine_cs *engine,u16 iir) +{ +GEM_DEBUG_WARN_ON (iir); +} +static int intel_engine_setup (struct intel_gt *gt,enum intel_engine_id id) {const struct engine_info *info = &intel_engines[id];@@ -292,6 +297,8 @@ static int intel_engine_setup(struct intel_gt *gt, enum intel_engine_id id) engine->hw_id = info->hw_id; engine->guc_id =MAKE_GUC_ID (info->class, info->instance); + engine->irq_handler = nop_irq_handler; + engine->class = info->class; engine->instance = info->instance;__sprint_engine_name (engine);drivers/gpu/drm/i915/gt/intel_engine_types.h +4
-10@@ -402,6 +402,7 @@ struct intel_engine_cs {u32 irq_enable_mask;/* bitmask to enable ring interrupt */ void (*irq_enable)(struct intel_engine_cs *engine);void (*irq_disable)(struct intel_engine_cs *engine); +void (*irq_handler)(struct intel_engine_cs *engine,u16 iir);void (*sanitize)(struct intel_engine_cs *engine);int (*resume)(struct intel_engine_cs *engine);@@ -481,10 +482,9 @@ struct intel_engine_cs {#define I915_ENGINE_HAS_PREEMPTION BIT(2)#define I915_ENGINE_HAS_SEMAPHORES BIT(3)#define I915_ENGINE_HAS_TIMESLICES BIT(4) -#define I915_ENGINE_NEEDS_BREADCRUMB_TASKLET BIT(5) -#define I915_ENGINE_IS_VIRTUAL BIT(6) -#define I915_ENGINE_HAS_RELATIVE_MMIO BIT(7) -#define I915_ENGINE_REQUIRES_CMD_PARSER BIT(8) +#define I915_ENGINE_IS_VIRTUAL BIT(5) +#define I915_ENGINE_HAS_RELATIVE_MMIO BIT(6) +#define I915_ENGINE_REQUIRES_CMD_PARSER BIT(7)unsigned int flags;/* @@ -593,12 +593,6 @@ intel_engine_has_timeslices(const struct intel_engine_cs *engine)return engine->flags &I915_ENGINE_HAS_TIMESLICES ; } -static inline bool -intel_engine_needs_breadcrumb_tasklet (const struct intel_engine_cs *engine) -{ -return engine->flags &I915_ENGINE_NEEDS_BREADCRUMB_TASKLET ; -} -static inline bool intel_engine_is_virtual (const struct intel_engine_cs *engine) {drivers/gpu/drm/i915/gt/intel_execlists_submission.c +41
-0@@ -118,6 +118,7 @@#include "intel_engine_stats.h" #include "intel_execlists_submission.h" #include "intel_gt.h" +#include "intel_gt_irq.h" #include "intel_gt_pm.h" #include "intel_gt_requests.h" #include "intel_lrc.h" @@ -2384,6 +2385,45 @@ static void execlists_submission_tasklet(struct tasklet_struct *t)rcu_read_unlock (); } +static void execlists_irq_handler (struct intel_engine_cs *engine,u16 iir) +{ +bool tasklet = false; + +if (unlikely (iir >_CS_MASTER_ERROR_INTERRUPT )) { +u32 eir; + +/* Upper 16b are the enabling mask, rsvd for internal errors */ + eir =ENGINE_READ (engine,RING_EIR ) &GENMASK (15 ,0 ); +ENGINE_TRACE (engine,"CS error: %x\n" , eir); + +/* Disable the error interrupt until after the reset */ +if (likely (eir)) { +ENGINE_WRITE (engine,RING_EMR , ~0u ); +ENGINE_WRITE (engine,RING_EIR , eir); +WRITE_ONCE (engine->execlists.error_interrupt, eir); + tasklet = true; + } + } + +if (iir >_WAIT_SEMAPHORE_INTERRUPT ) { +WRITE_ONCE (engine->execlists.yield, +ENGINE_READ_FW (engine,RING_EXECLIST_STATUS_HI )); +ENGINE_TRACE (engine,"semaphore yield: %08x\n" , + engine->execlists.yield); +if (del_timer (&engine->execlists.timer)) + tasklet = true; + } + +if (iir >_CONTEXT_SWITCH_INTERRUPT ) + tasklet = true; + +if (iir >_RENDER_USER_INTERRUPT ) +intel_engine_signal_breadcrumbs (engine); + +if (tasklet) +tasklet_hi_schedule (&engine->execlists.tasklet); +} +static void __execlists_kick (struct intel_engine_execlists *execlists) {/* Kick the tasklet for some interrupt coalescing and reset handling */ @@ -3133,6 +3173,7 @@ logical_ring_default_vfuncs(struct intel_engine_cs *engine)* until a more refined solution exists. */ } +intel_engine_set_irq_handler (engine, execlists_irq_handler); engine->flags |=I915_ENGINE_SUPPORTS_STATS ;if (!intel_vgpu_active (engine->i915)) {drivers/gpu/drm/i915/gt/intel_gt_irq.c +24
-58@@ -20,48 +20,6 @@ static void guc_irq_handler(struct intel_guc *guc, u16 iir)intel_guc_to_host_event_handler (guc); } -static void -cs_irq_handler (struct intel_engine_cs *engine,u32 iir) -{ -bool tasklet = false; - -if (unlikely (iir >_CS_MASTER_ERROR_INTERRUPT )) { -u32 eir; - -/* Upper 16b are the enabling mask, rsvd for internal errors */ - eir =ENGINE_READ (engine,RING_EIR ) &GENMASK (15 ,0 ); -ENGINE_TRACE (engine,"CS error: %x\n" , eir); - -/* Disable the error interrupt until after the reset */ -if (likely (eir)) { -ENGINE_WRITE (engine,RING_EMR , ~0u ); -ENGINE_WRITE (engine,RING_EIR , eir); -WRITE_ONCE (engine->execlists.error_interrupt, eir); - tasklet = true; - } - } - -if (iir >_WAIT_SEMAPHORE_INTERRUPT ) { -WRITE_ONCE (engine->execlists.yield, -ENGINE_READ_FW (engine,RING_EXECLIST_STATUS_HI )); -ENGINE_TRACE (engine,"semaphore yield: %08x\n" , - engine->execlists.yield); -if (del_timer (&engine->execlists.timer)) - tasklet = true; - } - -if (iir >_CONTEXT_SWITCH_INTERRUPT ) - tasklet = true; - -if (iir >_RENDER_USER_INTERRUPT ) { -intel_engine_signal_breadcrumbs (engine); - tasklet |=intel_engine_needs_breadcrumb_tasklet (engine); - } - -if (tasklet) -tasklet_hi_schedule (&engine->execlists.tasklet); -} -static u32 gen11_gt_engine_identity (struct intel_gt *gt,const unsigned int bank,const unsigned int bit)@@ -122,7 +80,7 @@ gen11_engine_irq_handler(struct intel_gt *gt, const u8 class, engine =NULL ;if (likely (engine)) -return cs_irq_handler (engine, iir); +return intel_engine_cs_irq (engine, iir);WARN_ONCE (1 ,"unhandled engine interrupt class=0x%x, instance=0x%x\n" , class, instance);@@ -275,9 +233,12 @@ void gen11_gt_irq_postinstall(struct intel_gt *gt)void gen5_gt_irq_handler (struct intel_gt *gt,u32 gt_iir) {if (gt_iir >_RENDER_USER_INTERRUPT ) -intel_engine_signal_breadcrumbs (gt->engine_class[RENDER_CLASS ][0 ]); +intel_engine_cs_irq (gt->engine_class[RENDER_CLASS ][0 ], + gt_iir); +if (gt_iir &ILK_BSD_USER_INTERRUPT ) -intel_engine_signal_breadcrumbs (gt->engine_class[VIDEO_DECODE_CLASS ][0 ]); +intel_engine_cs_irq (gt->engine_class[VIDEO_DECODE_CLASS ][0 ], + gt_iir); }static void gen7_parity_error_irq_handler (struct intel_gt *gt,u32 iir)@@ -301,11 +262,16 @@ static void gen7_parity_error_irq_handler(struct intel_gt *gt, u32 iir)void gen6_gt_irq_handler (struct intel_gt *gt,u32 gt_iir) {if (gt_iir >_RENDER_USER_INTERRUPT ) -intel_engine_signal_breadcrumbs (gt->engine_class[RENDER_CLASS ][0 ]); +intel_engine_cs_irq (gt->engine_class[RENDER_CLASS ][0 ], + gt_iir); +if (gt_iir >_BSD_USER_INTERRUPT ) -intel_engine_signal_breadcrumbs (gt->engine_class[VIDEO_DECODE_CLASS ][0 ]); +intel_engine_cs_irq (gt->engine_class[VIDEO_DECODE_CLASS ][0 ], + gt_iir >>12 ); +if (gt_iir >_BLT_USER_INTERRUPT ) -intel_engine_signal_breadcrumbs (gt->engine_class[COPY_ENGINE_CLASS ][0 ]); +intel_engine_cs_irq (gt->engine_class[COPY_ENGINE_CLASS ][0 ], + gt_iir >>22 ); if (gt_iir & (GT_BLT_CS_ERROR_INTERRUPT | GT_BSD_CS_ERROR_INTERRUPT |@@ -324,10 +290,10 @@ void gen8_gt_irq_handler(struct intel_gt *gt, u32 master_ctl)if (master_ctl & (GEN8_GT_RCS_IRQ |GEN8_GT_BCS_IRQ )) { iir =raw_reg_read (regs,GEN8_GT_IIR (0 ));if (likely (iir)) { -cs_irq_handler (gt->engine_class[RENDER_CLASS ][0 ], - iir >>GEN8_RCS_IRQ_SHIFT ); -cs_irq_handler (gt->engine_class[COPY_ENGINE_CLASS ][0 ], - iir >>GEN8_BCS_IRQ_SHIFT ); +intel_engine_cs_irq (gt->engine_class[RENDER_CLASS ][0 ], + iir >>GEN8_RCS_IRQ_SHIFT ); +intel_engine_cs_irq (gt->engine_class[COPY_ENGINE_CLASS ][0 ], + iir >>GEN8_BCS_IRQ_SHIFT );raw_reg_write (regs,GEN8_GT_IIR (0 ), iir); } }@@ -335,10 +301,10 @@ void gen8_gt_irq_handler(struct intel_gt *gt, u32 master_ctl)if (master_ctl & (GEN8_GT_VCS0_IRQ |GEN8_GT_VCS1_IRQ )) { iir =raw_reg_read (regs,GEN8_GT_IIR (1 ));if (likely (iir)) { -cs_irq_handler (gt->engine_class[VIDEO_DECODE_CLASS ][0 ], - iir >>GEN8_VCS0_IRQ_SHIFT ); -cs_irq_handler (gt->engine_class[VIDEO_DECODE_CLASS ][1 ], - iir >>GEN8_VCS1_IRQ_SHIFT ); +intel_engine_cs_irq (gt->engine_class[VIDEO_DECODE_CLASS ][0 ], + iir >>GEN8_VCS0_IRQ_SHIFT ); +intel_engine_cs_irq (gt->engine_class[VIDEO_DECODE_CLASS ][1 ], + iir >>GEN8_VCS1_IRQ_SHIFT );raw_reg_write (regs,GEN8_GT_IIR (1 ), iir); } }@@ -346,8 +312,8 @@ void gen8_gt_irq_handler(struct intel_gt *gt, u32 master_ctl)if (master_ctl &GEN8_GT_VECS_IRQ ) { iir =raw_reg_read (regs,GEN8_GT_IIR (3 ));if (likely (iir)) { -cs_irq_handler (gt->engine_class[VIDEO_ENHANCEMENT_CLASS ][0 ], - iir >>GEN8_VECS_IRQ_SHIFT ); +intel_engine_cs_irq (gt->engine_class[VIDEO_ENHANCEMENT_CLASS ][0 ], + iir >>GEN8_VECS_IRQ_SHIFT );raw_reg_write (regs,GEN8_GT_IIR (3 ), iir); } }drivers/gpu/drm/i915/gt/intel_gt_irq.h +23
-0@@ -8,6 +8,8 @@#include <linux/types.h> +#include "intel_engine_types.h" +struct intel_gt ;#define GEN8_GT_IRQS (GEN8_GT_RCS_IRQ | \@@ -39,4 +41,25 @@ void gen8_gt_irq_handler(struct intel_gt *gt, u32 master_ctl);void gen8_gt_irq_reset (struct intel_gt *gt);void gen8_gt_irq_postinstall (struct intel_gt *gt); +static inline void intel_engine_cs_irq (struct intel_engine_cs *engine,u16 iir) +{ +if (iir) + engine->irq_handler (engine, iir); +} + +static inline void +intel_engine_set_irq_handler (struct intel_engine_cs *engine, +void (*fn)(struct intel_engine_cs *engine, +u16 iir)) +{ +/* +* As the interrupt is live as allocate and setup the engines, +* err on the side of caution and apply barriers to updating +* the irq handler callback. This assures that when we do use +* the engine, we will receive interrupts only to ourselves, +* and not lose any. +*/ +smp_store_mb (engine->irq_handler, fn); +} +#endif /* INTEL_GT_IRQ_H */ drivers/gpu/drm/i915/gt/intel_ring_submission.c +8
-0@@ -12,6 +12,7 @@#include "intel_breadcrumbs.h" #include "intel_context.h" #include "intel_gt.h" +#include "intel_gt_irq.h" #include "intel_reset.h" #include "intel_ring.h" #include "shmem_utils.h" @@ -1017,10 +1018,17 @@ static void ring_release(struct intel_engine_cs *engine)intel_timeline_put (engine->legacy.timeline); } +static void irq_handler (struct intel_engine_cs *engine,u16 iir) +{ +intel_engine_signal_breadcrumbs (engine); +} +static void setup_irq (struct intel_engine_cs *engine) {struct drm_i915_private *i915 = engine->i915; +intel_engine_set_irq_handler (engine, irq_handler); +if (INTEL_GEN (i915) >=6 ) { engine->irq_enable = gen6_irq_enable; engine->irq_disable = gen6_irq_disable;drivers/gpu/drm/i915/gt/intel_rps.c +1
-1@@ -1774,7 +1774,7 @@ void gen6_rps_irq_handler(struct intel_rps *rps, u32 pm_iir)return ;if (pm_iir &PM_VEBOX_USER_INTERRUPT ) -intel_engine_signal_breadcrumbs (gt->engine[VECS0 ]); +intel_engine_cs_irq (gt->engine[VECS0 ], pm_iir >>10 );if (pm_iir &PM_VEBOX_CS_ERROR_INTERRUPT )DRM_DEBUG ("Command parser error, pm_iir 0x%08x\n" , pm_iir);drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c +10
-1@@ -11,6 +11,7 @@#include "gt/intel_context.h" #include "gt/intel_engine_pm.h" #include "gt/intel_gt.h" +#include "gt/intel_gt_irq.h" #include "gt/intel_gt_pm.h" #include "gt/intel_lrc.h" #include "gt/intel_mocs.h" @@ -264,6 +265,14 @@ static void guc_submission_tasklet(struct tasklet_struct *t)spin_unlock_irqrestore (&engine->active.lock, flags); } +static void cs_irq_handler (struct intel_engine_cs *engine,u16 iir) +{ +if (iir >_RENDER_USER_INTERRUPT ) { +intel_engine_signal_breadcrumbs (engine); +tasklet_hi_schedule (&engine->execlists.tasklet); + } +} +static void guc_reset_prepare (struct intel_engine_cs *engine) {struct intel_engine_execlists *const execlists = &engine->execlists;@@ -645,7 +654,6 @@ static void guc_default_vfuncs(struct intel_engine_cs *engine) } engine->set_default_submission = guc_set_default_submission; - engine->flags |=I915_ENGINE_NEEDS_BREADCRUMB_TASKLET ; engine->flags |=I915_ENGINE_HAS_PREEMPTION ;/* @@ -681,6 +689,7 @@ static void rcs_submission_override(struct intel_engine_cs *engine)static inline void guc_default_irqs (struct intel_engine_cs *engine) { engine->irq_keep_mask =GT_RENDER_USER_INTERRUPT ; +intel_engine_set_irq_handler (engine, cs_irq_handler); }int intel_guc_submission_setup (struct intel_engine_cs *engine)drivers/gpu/drm/i915/i915_irq.c +6
-4@@ -4014,7 +4014,7 @@ static irqreturn_t i8xx_irq_handler(int irq, void *arg)intel_uncore_write16 (&dev_priv->uncore,GEN2_IIR , iir);if (iir &I915_USER_INTERRUPT ) -intel_engine_signal_breadcrumbs (dev_priv->gt.engine[RCS0 ]); +intel_engine_cs_irq (dev_priv->gt.engine[RCS0 ], iir);if (iir &I915_MASTER_ERROR_INTERRUPT )i8xx_error_irq_handler (dev_priv, eir, eir_stuck);@@ -4122,7 +4122,7 @@ static irqreturn_t i915_irq_handler(int irq, void *arg)intel_uncore_write (&dev_priv->uncore,GEN2_IIR , iir);if (iir &I915_USER_INTERRUPT ) -intel_engine_signal_breadcrumbs (dev_priv->gt.engine[RCS0 ]); +intel_engine_cs_irq (dev_priv->gt.engine[RCS0 ], iir);if (iir &I915_MASTER_ERROR_INTERRUPT )i9xx_error_irq_handler (dev_priv, eir, eir_stuck);@@ -4267,10 +4267,12 @@ static irqreturn_t i965_irq_handler(int irq, void *arg)intel_uncore_write (&dev_priv->uncore,GEN2_IIR , iir);if (iir &I915_USER_INTERRUPT ) -intel_engine_signal_breadcrumbs (dev_priv->gt.engine[RCS0 ]); +intel_engine_cs_irq (dev_priv->gt.engine[RCS0 ], + iir);if (iir &I915_BSD_USER_INTERRUPT ) -intel_engine_signal_breadcrumbs (dev_priv->gt.engine[VCS0 ]); +intel_engine_cs_irq (dev_priv->gt.engine[VCS0 ], + iir >>25 );if (iir &I915_MASTER_ERROR_INTERRUPT )i9xx_error_irq_handler (dev_priv, eir, eir_stuck);
RFC PATCH 4/97 drm/i915/guc: skip disabling CTBs before sanitizing the GuC
In reply to Matthew BrostFrom: Daniele Ceraolo Spurio <[email protected]>
If we're about to sanitize the GuC, something might have going wrong beforehand, so we should avoid trying to talk to it. Even if GuC is still running fine, the sanitize will reset its internal state and clear the CTB registration, so there is still no need to explicitly do so.
References: https://gitlab.freedesktop.org/drm/intel/-/issues/2469
--- drivers/gpu/drm/i915/gt/uc/intel_uc.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-)
drivers/gpu/drm/i915/gt/uc/intel_uc.c +1 -7
@@ -504,7 +504,7 @@ static int __uc_init_hw(struct intel_uc *uc) ret =intel_guc_sample_forcewake (guc);if (ret) - goto err_communication; + goto err_log_capture;if (intel_uc_uses_guc_submission (uc))intel_guc_submission_enable (guc);
@@ -529,8 +529,6 @@ static int __uc_init_hw(struct intel_uc *uc)/* * We've failed to load the firmware :( */ -err_communication: -guc_disable_communication (guc); err_log_capture:__uc_capture_load_err_log (uc); err_out:
@@ -558,9 +556,6 @@ static void __uc_fini_hw(struct intel_uc *uc)if (intel_uc_uses_guc_submission (uc))intel_guc_submission_disable (guc); -if (guc_communication_enabled (guc)) -guc_disable_communication (guc); -__uc_sanitize (uc); }
@@ -577,7 +572,6 @@ void intel_uc_reset_prepare(struct intel_uc *uc)if (!intel_guc_is_ready (guc))return ; -guc_disable_communication (guc);__uc_sanitize (uc); }
Signature · 6 lines
2.28.0 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [RFC PATCH 04/97] drm/i915/guc: skip disabling CTBs before sanitizing the GuC
Quoted 7 lines · Matthew Brost
From: Daniele Ceraolo Spurio <[email protected]>
If we're about to sanitize the GuC, something might have going wrong beforehand, so we should avoid trying to talk to it. Even if GuC is still running fine, the sanitize will reset its internal state and clear the CTB registration, so there is still no need to explicitly do so.
Quoted 5 lines
References: https://gitlab.freedesktop.org/drm/intel/-/issues/2469
Signed-off-by Daniele Ceraolo Spurio <[email protected]>Signed-off-by Matthew Brost <[email protected]>Cc Michal Wajdeczko <[email protected]>Cc John Harrison <[email protected]>
Quoted 47 lines
--- drivers/gpu/drm/i915/gt/uc/intel_uc.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-)drivers/gpu/drm/i915/gt/uc/intel_uc.c +1
-7@@ -504,7 +504,7 @@ static int __uc_init_hw(struct intel_uc *uc) ret =intel_guc_sample_forcewake (guc);if (ret) - goto err_communication; + goto err_log_capture;if (intel_uc_uses_guc_submission (uc))intel_guc_submission_enable (guc);@@ -529,8 +529,6 @@ static int __uc_init_hw(struct intel_uc *uc)/* * We've failed to load the firmware :( */ -err_communication: -guc_disable_communication (guc); err_log_capture:__uc_capture_load_err_log (uc); err_out:@@ -558,9 +556,6 @@ static void __uc_fini_hw(struct intel_uc *uc)if (intel_uc_uses_guc_submission (uc))intel_guc_submission_disable (guc); -if (guc_communication_enabled (guc)) -guc_disable_communication (guc); -__uc_sanitize (uc); }@@ -577,7 +572,6 @@ void intel_uc_reset_prepare(struct intel_uc *uc)if (!intel_guc_is_ready (guc))return ; -guc_disable_communication (guc);__uc_sanitize (uc); }Signature · 1 line
2.28.0
RFC PATCH 5/97 drm/i915/guc: use probe_error log for CT enablement failure
In reply to Matthew BrostFrom: Daniele Ceraolo Spurio <[email protected]>
We have a couple of failure injection points in the CT enablement path, so we need to use i915_probe_error() to select the appropriate log level. A new macro (CT_PROBE_ERROR) has been added to the set of CT logging macros to be used in this scenario and upcoming ones.
While adding the new macros, fix the underlying logging mechanics used by the existing ones (DRM_DEV_* -> drm_*) and move the inlines to before they're used inside the macros.
--- drivers/gpu/drm/i915/gt/uc/intel_guc_ct.c | 48 ++++++++++++----------- 1 file changed, 25 insertions(+), 23 deletions(-)
drivers/gpu/drm/i915/gt/uc/intel_guc_ct.c +25 -23
@@ -7,14 +7,36 @@#include "intel_guc_ct.h" #include "gt/intel_gt.h" +static inline struct intel_guc *ct_to_guc (struct intel_guc_ct *ct) +{ + return container_of(ct, struct intel_guc, ct); +} + +static inline struct intel_gt *ct_to_gt (struct intel_guc_ct *ct) +{ +return guc_to_gt (ct_to_guc (ct)); +} + +static inline struct drm_i915_private *ct_to_i915 (struct intel_guc_ct *ct) +{ +return ct_to_gt (ct)->i915; +} + +static inline struct drm_device *ct_to_drm (struct intel_guc_ct *ct) +{ +return &ct_to_i915 (ct)->drm; +} +#define CT_ERROR (_ct, _fmt, ...) \ - DRM_DEV_ERROR(ct_to_dev(_ct), "CT: " _fmt, ##__VA_ARGS__) + drm_err(ct_to_drm(_ct), "CT: " _fmt, ##__VA_ARGS__)#ifdef CONFIG_DRM_I915_DEBUG_GUC #define CT_DEBUG (_ct, _fmt, ...) \ - DRM_DEV_DEBUG_DRIVER(ct_to_dev(_ct), "CT: " _fmt, ##__VA_ARGS__) + drm_dbg(ct_to_drm(_ct), "CT: " _fmt, ##__VA_ARGS__)#else #define CT_DEBUG (...) do { } while (0)#endif +#define CT_PROBE_ERROR (_ct, _fmt, ...) \ + i915_probe_error(ct_to_i915(ct), "CT: " _fmt, ##__VA_ARGS__);struct ct_request {struct list_head link;
@@ -47,26 +69,6 @@ void intel_guc_ct_init_early(struct intel_guc_ct *ct)INIT_WORK (&ct->requests.worker, ct_incoming_request_worker_func); } -static inline struct intel_guc *ct_to_guc (struct intel_guc_ct *ct) -{ - return container_of(ct, struct intel_guc, ct); -} - -static inline struct intel_gt *ct_to_gt (struct intel_guc_ct *ct) -{ -return guc_to_gt (ct_to_guc (ct)); -} - -static inline struct drm_i915_private *ct_to_i915 (struct intel_guc_ct *ct) -{ -return ct_to_gt (ct)->i915; -} - -static inline struct device *ct_to_dev (struct intel_guc_ct *ct) -{ -return ct_to_i915 (ct)->drm.dev; -} -static inline const char *guc_ct_buffer_type_to_str (u32 type) {switch (type) {
@@ -264,7 +266,7 @@ int intel_guc_ct_enable(struct intel_guc_ct *ct) err_deregister:ct_deregister_buffer (ct,INTEL_GUC_CT_BUFFER_TYPE_RECV ); err_out: -CT_ERROR (ct,"Failed to open open CT channel (err=%d)\n" , err); +CT_PROBE_ERROR (ct,"Failed to open channel (err=%d)\n" , err);return err; }
Signature · 1 line
2.28.0
Re: [RFC PATCH 05/97] drm/i915/guc: use probe_error log for CT enablement failure
Quoted 88 lines · Matthew Brost
From: Daniele Ceraolo Spurio <[email protected]>
We have a couple of failure injection points in the CT enablement path, so we need to use
i915_probe_error()to select the appropriate log level. A new macro (CT_PROBE_ERROR) has been added to the set of CT logging macros to be used in this scenario and upcoming ones.While adding the new macros, fix the underlying logging mechanics used by the existing ones (DRM_DEV_* -> drm_*) and move the inlines to before they're used inside the macros.
Signed-off-by Matthew Brost <[email protected]>Signed-off-by Daniele Ceraolo Spurio <[email protected]>--- drivers/gpu/drm/i915/gt/uc/intel_guc_ct.c | 48 ++++++++++++----------- 1 file changed, 25 insertions(+), 23 deletions(-)drivers/gpu/drm/i915/gt/uc/intel_guc_ct.c +24
-22@@ -7,14 +7,36 @@#include "intel_guc_ct.h" #include "gt/intel_gt.h" +static inline struct intel_guc *ct_to_guc (struct intel_guc_ct *ct) +{ + return container_of(ct, struct intel_guc, ct); +} + +static inline struct intel_gt *ct_to_gt (struct intel_guc_ct *ct) +{ +return guc_to_gt (ct_to_guc (ct)); +} + +static inline struct drm_i915_private *ct_to_i915 (struct intel_guc_ct *ct) +{ +return ct_to_gt (ct)->i915; +} + +static inline struct drm_device *ct_to_drm (struct intel_guc_ct *ct) +{ +return &ct_to_i915 (ct)->drm; +} +#define CT_ERROR (_ct, _fmt, ...) \ - DRM_DEV_ERROR(ct_to_dev(_ct), "CT: " _fmt, ##__VA_ARGS__) + drm_err(ct_to_drm(_ct), "CT: " _fmt, ##__VA_ARGS__)#ifdef CONFIG_DRM_I915_DEBUG_GUC #define CT_DEBUG (_ct, _fmt, ...) \ - DRM_DEV_DEBUG_DRIVER(ct_to_dev(_ct), "CT: " _fmt, ##__VA_ARGS__) + drm_dbg(ct_to_drm(_ct), "CT: " _fmt, ##__VA_ARGS__)#else #define CT_DEBUG (...) do { } while (0)#endif +#define CT_PROBE_ERROR (_ct, _fmt, ...) \ + i915_probe_error(ct_to_i915(ct), "CT: " _fmt, ##__VA_ARGS__);struct ct_request {struct list_head link;@@ -47,26 +69,6 @@ void intel_guc_ct_init_early(struct intel_guc_ct *ct)INIT_WORK (&ct->requests.worker, ct_incoming_request_worker_func); } -static inline struct intel_guc *ct_to_guc (struct intel_guc_ct *ct) -{ - return container_of(ct, struct intel_guc, ct); -} - -static inline struct intel_gt *ct_to_gt (struct intel_guc_ct *ct) -{ -return guc_to_gt (ct_to_guc (ct)); -} - -static inline struct drm_i915_private *ct_to_i915 (struct intel_guc_ct *ct) -{ -return ct_to_gt (ct)->i915; -} - -static inline struct device *ct_to_dev (struct intel_guc_ct *ct) -{ -return ct_to_i915 (ct)->drm.dev; -} -static inline const char *guc_ct_buffer_type_to_str (u32 type) {switch (type) {
drivers/gpu/drm/i915/gt/uc/intel_guc_ct.c int intel_guc_ct_enable(struct intel_guc_ct *ct) · line 269
Quoted 5 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_ct.c +1
-1@@ -264,7 +266,7 @@ int intel_guc_ct_enable(struct intel_guc_ct *ct) err_deregister:ct_deregister_buffer (ct,INTEL_GUC_CT_BUFFER_TYPE_RECV ); err_out: -CT_ERROR (ct,"Failed to open open CT channel (err=%d)\n" , err); +CT_PROBE_ERROR (ct,"Failed to open channel (err=%d)\n" , err);
nit: while here we can start using %pe to print error
Quoted 4 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_ct.c +0
-0return err; }
RFC PATCH 6/97 drm/i915/guc: enable only the user interrupt when using GuC submission
In reply to Matthew BrostFrom: Daniele Ceraolo Spurio <[email protected]>
In GuC submission mode the CS is owned by the GuC FW, so all CS status interrupts are handled by it. We only need the user interrupt as that signals request completion.
Since we're now starting the engines directly in GuC submission mode when selected, we can stop switching back and forth between the execlists and the GuC programming and select directly the correct interrupt mask.
--- drivers/gpu/drm/i915/gt/intel_gt_irq.c | 18 ++++++----- .../gpu/drm/i915/gt/uc/intel_guc_submission.c | 31 ------------------- 2 files changed, 11 insertions(+), 38 deletions(-)
drivers/gpu/drm/i915/gt/intel_gt_irq.c +11 -7
@@ -194,14 +194,18 @@ void gen11_gt_irq_reset(struct intel_gt *gt)void gen11_gt_irq_postinstall (struct intel_gt *gt) { -const u32 irqs = -GT_CS_MASTER_ERROR_INTERRUPT | -GT_RENDER_USER_INTERRUPT | -GT_CONTEXT_SWITCH_INTERRUPT | -GT_WAIT_SEMAPHORE_INTERRUPT ;struct intel_uncore *uncore = gt->uncore; -const u32 dmask = irqs <<16 | irqs; -const u32 smask = irqs <<16 ; +u32 irqs =GT_RENDER_USER_INTERRUPT ; +u32 dmask; +u32 smask; + +if (!intel_uc_wants_guc_submission (>->uc)) + irqs |=GT_CS_MASTER_ERROR_INTERRUPT | +GT_CONTEXT_SWITCH_INTERRUPT | +GT_WAIT_SEMAPHORE_INTERRUPT ; + + dmask = irqs <<16 | irqs; + smask = irqs <<16 ;BUILD_BUG_ON (irqs &0xffff0000 );
drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c +0 -31
@@ -432,32 +432,6 @@ void intel_guc_submission_fini(struct intel_guc *guc) } } -static void guc_interrupts_capture (struct intel_gt *gt) -{ -struct intel_uncore *uncore = gt->uncore; -u32 irqs =GT_CONTEXT_SWITCH_INTERRUPT ; -u32 dmask = irqs <<16 | irqs; - -GEM_BUG_ON (INTEL_GEN (gt->i915) <11 ); - -/* Don't handle the ctx switch interrupt in GuC submission mode */ -intel_uncore_rmw (uncore,GEN11_RENDER_COPY_INTR_ENABLE , dmask,0 ); -intel_uncore_rmw (uncore,GEN11_VCS_VECS_INTR_ENABLE , dmask,0 ); -} - -static void guc_interrupts_release (struct intel_gt *gt) -{ -struct intel_uncore *uncore = gt->uncore; -u32 irqs =GT_CONTEXT_SWITCH_INTERRUPT ; -u32 dmask = irqs <<16 | irqs; - -GEM_BUG_ON (INTEL_GEN (gt->i915) <11 ); - -/* Handle ctx switch interrupts again */ -intel_uncore_rmw (uncore,GEN11_RENDER_COPY_INTR_ENABLE ,0 , dmask); -intel_uncore_rmw (uncore,GEN11_VCS_VECS_INTR_ENABLE ,0 , dmask); -} -static int guc_context_alloc (struct intel_context *ce) {return lrc_alloc (ce, ce->engine);
@@ -722,9 +696,6 @@ int intel_guc_submission_setup(struct intel_engine_cs *engine)void intel_guc_submission_enable (struct intel_guc *guc) {guc_stage_desc_init (guc); - -/* Take over from manual control of ELSP (execlists) */ -guc_interrupts_capture (guc_to_gt (guc)); }void intel_guc_submission_disable (struct intel_guc *guc)
@@ -735,8 +706,6 @@ void intel_guc_submission_disable(struct intel_guc *guc)/* Note: By the time we're here, GuC may have already been reset */ -guc_interrupts_release (gt); -guc_stage_desc_fini (guc); }
Signature · 1 line
2.28.0
Re: [RFC PATCH 06/97] drm/i915/guc: enable only the user interrupt when using GuC submission
Quoted 6 lines · Matthew Brost
From: Daniele Ceraolo Spurio <[email protected]>
In GuC submission mode the CS is owned by the GuC FW, so all CS status interrupts are handled by it. We only need the user interrupt as that signals request completion.
Quoted 7 lines
Since we're now starting the engines directly in GuC submission mode when selected, we can stop switching back and forth between the execlists and the GuC programming and select directly the correct interrupt mask.
Signed-off-by Daniele Ceraolo Spurio <[email protected]>Signed-off-by Matthew Brost <[email protected]>
Quoted 96 lines
Cc John Harrison <[email protected]>Cc Michal Wajdeczko <[email protected]>--- drivers/gpu/drm/i915/gt/intel_gt_irq.c | 18 ++++++----- .../gpu/drm/i915/gt/uc/intel_guc_submission.c | 31 ------------------- 2 files changed, 11 insertions(+), 38 deletions(-)drivers/gpu/drm/i915/gt/intel_gt_irq.c +11
-7@@ -194,14 +194,18 @@ void gen11_gt_irq_reset(struct intel_gt *gt)void gen11_gt_irq_postinstall (struct intel_gt *gt) { -const u32 irqs = -GT_CS_MASTER_ERROR_INTERRUPT | -GT_RENDER_USER_INTERRUPT | -GT_CONTEXT_SWITCH_INTERRUPT | -GT_WAIT_SEMAPHORE_INTERRUPT ;struct intel_uncore *uncore = gt->uncore; -const u32 dmask = irqs <<16 | irqs; -const u32 smask = irqs <<16 ; +u32 irqs =GT_RENDER_USER_INTERRUPT ; +u32 dmask; +u32 smask; + +if (!intel_uc_wants_guc_submission (>->uc)) + irqs |=GT_CS_MASTER_ERROR_INTERRUPT | +GT_CONTEXT_SWITCH_INTERRUPT | +GT_WAIT_SEMAPHORE_INTERRUPT ; + + dmask = irqs <<16 | irqs; + smask = irqs <<16 ;BUILD_BUG_ON (irqs &0xffff0000 );drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c +0
-31@@ -432,32 +432,6 @@ void intel_guc_submission_fini(struct intel_guc *guc) } } -static void guc_interrupts_capture (struct intel_gt *gt) -{ -struct intel_uncore *uncore = gt->uncore; -u32 irqs =GT_CONTEXT_SWITCH_INTERRUPT ; -u32 dmask = irqs <<16 | irqs; - -GEM_BUG_ON (INTEL_GEN (gt->i915) <11 ); - -/* Don't handle the ctx switch interrupt in GuC submission mode */ -intel_uncore_rmw (uncore,GEN11_RENDER_COPY_INTR_ENABLE , dmask,0 ); -intel_uncore_rmw (uncore,GEN11_VCS_VECS_INTR_ENABLE , dmask,0 ); -} - -static void guc_interrupts_release (struct intel_gt *gt) -{ -struct intel_uncore *uncore = gt->uncore; -u32 irqs =GT_CONTEXT_SWITCH_INTERRUPT ; -u32 dmask = irqs <<16 | irqs; - -GEM_BUG_ON (INTEL_GEN (gt->i915) <11 ); - -/* Handle ctx switch interrupts again */ -intel_uncore_rmw (uncore,GEN11_RENDER_COPY_INTR_ENABLE ,0 , dmask); -intel_uncore_rmw (uncore,GEN11_VCS_VECS_INTR_ENABLE ,0 , dmask); -} -static int guc_context_alloc (struct intel_context *ce) {return lrc_alloc (ce, ce->engine);@@ -722,9 +696,6 @@ int intel_guc_submission_setup(struct intel_engine_cs *engine)void intel_guc_submission_enable (struct intel_guc *guc) {guc_stage_desc_init (guc); - -/* Take over from manual control of ELSP (execlists) */ -guc_interrupts_capture (guc_to_gt (guc)); }void intel_guc_submission_disable (struct intel_guc *guc)@@ -735,8 +706,6 @@ void intel_guc_submission_disable(struct intel_guc *guc)/* Note: By the time we're here, GuC may have already been reset */ -guc_interrupts_release (gt); -guc_stage_desc_fini (guc); }Signature · 1 line
2.28.0
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
RFC PATCH 7/97 drm/i915/guc: Remove sample_forcewake h2g action
In reply to Matthew BrostFrom: Rodrigo Vivi <[email protected]>
This action is no-op in the GuC side for a few versions already and it is getting entirely removed soon, in an upcoming version.
Time to remove before we face communication issues.
--- drivers/gpu/drm/i915/gt/uc/intel_guc.c | 16 ---------------- drivers/gpu/drm/i915/gt/uc/intel_guc.h | 1 - drivers/gpu/drm/i915/gt/uc/intel_guc_fwif.h | 4 ---- drivers/gpu/drm/i915/gt/uc/intel_uc.c | 4 ---- 4 files changed, 25 deletions(-)
drivers/gpu/drm/i915/gt/uc/intel_guc.c +0 -16
@@ -469,22 +469,6 @@ int intel_guc_to_host_process_recv_msg(struct intel_guc *guc,return 0 ; } -int intel_guc_sample_forcewake (struct intel_guc *guc) -{ -struct drm_i915_private *dev_priv =guc_to_gt (guc)->i915; -u32 action[2 ]; - - action[0 ] =INTEL_GUC_ACTION_SAMPLE_FORCEWAKE ; -/* WaRsDisableCoarsePowerGating:skl,cnl */ -if (!HAS_RC6 (dev_priv) ||NEEDS_WaRsDisableCoarsePowerGating (dev_priv)) - action[1 ] =0 ; -else -/* bit 0 and 1 are for Render and Media domain separately */ - action[1 ] =GUC_FORCEWAKE_RENDER |GUC_FORCEWAKE_MEDIA ; - -return intel_guc_send (guc, action,ARRAY_SIZE (action)); -} -/** * intel_guc_auth_huc() - Send action to GuC to authenticate HuC ucode * @guc: intel_guc structure
drivers/gpu/drm/i915/gt/uc/intel_guc.h +0 -1
@@ -128,7 +128,6 @@ int intel_guc_send_mmio(struct intel_guc *guc, const u32 *action, u32 len, u32 *response_buf, u32 response_buf_size);int intel_guc_to_host_process_recv_msg (struct intel_guc *guc,const u32 *payload,u32 len); -int intel_guc_sample_forcewake (struct intel_guc *guc);int intel_guc_auth_huc (struct intel_guc *guc,u32 rsa_offset);int intel_guc_suspend (struct intel_guc *guc);int intel_guc_resume (struct intel_guc *guc);
drivers/gpu/drm/i915/gt/uc/intel_guc_fwif.h +0 -4
@@ -302,9 +302,6 @@ struct guc_ct_buffer_desc {#define GUC_CT_MSG_ACTION_SHIFT 16#define GUC_CT_MSG_ACTION_MASK 0xFFFF -#define GUC_FORCEWAKE_RENDER (1 << 0) -#define GUC_FORCEWAKE_MEDIA (1 << 1) -#define GUC_POWER_UNSPECIFIED 0#define GUC_POWER_D0 1#define GUC_POWER_D1 2
@@ -558,7 +555,6 @@ enum intel_guc_action {INTEL_GUC_ACTION_ENTER_S_STATE =0x501 ,INTEL_GUC_ACTION_EXIT_S_STATE =0x502 ,INTEL_GUC_ACTION_SLPC_REQUEST =0x3003 , -INTEL_GUC_ACTION_SAMPLE_FORCEWAKE =0x3005 ,INTEL_GUC_ACTION_AUTHENTICATE_HUC =0x4000 ,INTEL_GUC_ACTION_REGISTER_COMMAND_TRANSPORT_BUFFER =0x4505 , INTEL_GUC_ACTION_DEREGISTER_COMMAND_TRANSPORT_BUFFER = 0x4506,
drivers/gpu/drm/i915/gt/uc/intel_uc.c +0 -4
@@ -502,10 +502,6 @@ static int __uc_init_hw(struct intel_uc *uc)intel_huc_auth (huc); - ret =intel_guc_sample_forcewake (guc); -if (ret) - goto err_log_capture; -if (intel_uc_uses_guc_submission (uc))intel_guc_submission_enable (guc);
Signature · 1 line
2.28.0
Re: [RFC PATCH 07/97] drm/i915/guc: Remove sample_forcewake h2g action
Quoted 10 lines · Matthew Brost
From: Rodrigo Vivi <[email protected]>
This action is no-op in the GuC side for a few versions already and it is getting entirely removed soon, in an upcoming version.
Time to remove before we face communication issues.
Cc Vinay Belgaumkar <[email protected]>Signed-off-by Rodrigo Vivi <[email protected]>Signed-off-by Matthew Brost <[email protected]>
Quoted 84 lines
--- drivers/gpu/drm/i915/gt/uc/intel_guc.c | 16 ---------------- drivers/gpu/drm/i915/gt/uc/intel_guc.h | 1 - drivers/gpu/drm/i915/gt/uc/intel_guc_fwif.h | 4 ---- drivers/gpu/drm/i915/gt/uc/intel_uc.c | 4 ---- 4 files changed, 25 deletions(-)drivers/gpu/drm/i915/gt/uc/intel_guc.c +0
-16@@ -469,22 +469,6 @@ int intel_guc_to_host_process_recv_msg(struct intel_guc *guc,return 0 ; } -int intel_guc_sample_forcewake (struct intel_guc *guc) -{ -struct drm_i915_private *dev_priv =guc_to_gt (guc)->i915; -u32 action[2 ]; - - action[0 ] =INTEL_GUC_ACTION_SAMPLE_FORCEWAKE ; -/* WaRsDisableCoarsePowerGating:skl,cnl */ -if (!HAS_RC6 (dev_priv) ||NEEDS_WaRsDisableCoarsePowerGating (dev_priv)) - action[1 ] =0 ; -else -/* bit 0 and 1 are for Render and Media domain separately */ - action[1 ] =GUC_FORCEWAKE_RENDER |GUC_FORCEWAKE_MEDIA ; - -return intel_guc_send (guc, action,ARRAY_SIZE (action)); -} -/** * intel_guc_auth_huc() - Send action to GuC to authenticate HuC ucode * @guc: intel_guc structure drivers/gpu/drm/i915/gt/uc/intel_guc.h +0
-1@@ -128,7 +128,6 @@ int intel_guc_send_mmio(struct intel_guc *guc, const u32 *action, u32 len, u32 *response_buf, u32 response_buf_size);int intel_guc_to_host_process_recv_msg (struct intel_guc *guc,const u32 *payload,u32 len); -int intel_guc_sample_forcewake (struct intel_guc *guc);int intel_guc_auth_huc (struct intel_guc *guc,u32 rsa_offset);int intel_guc_suspend (struct intel_guc *guc);int intel_guc_resume (struct intel_guc *guc);drivers/gpu/drm/i915/gt/uc/intel_guc_fwif.h +0
-4@@ -302,9 +302,6 @@ struct guc_ct_buffer_desc {#define GUC_CT_MSG_ACTION_SHIFT 16#define GUC_CT_MSG_ACTION_MASK 0xFFFF -#define GUC_FORCEWAKE_RENDER (1 << 0) -#define GUC_FORCEWAKE_MEDIA (1 << 1) -#define GUC_POWER_UNSPECIFIED 0#define GUC_POWER_D0 1#define GUC_POWER_D1 2@@ -558,7 +555,6 @@ enum intel_guc_action {INTEL_GUC_ACTION_ENTER_S_STATE =0x501 ,INTEL_GUC_ACTION_EXIT_S_STATE =0x502 ,INTEL_GUC_ACTION_SLPC_REQUEST =0x3003 , -INTEL_GUC_ACTION_SAMPLE_FORCEWAKE =0x3005 ,INTEL_GUC_ACTION_AUTHENTICATE_HUC =0x4000 ,INTEL_GUC_ACTION_REGISTER_COMMAND_TRANSPORT_BUFFER =0x4505 , INTEL_GUC_ACTION_DEREGISTER_COMMAND_TRANSPORT_BUFFER = 0x4506,drivers/gpu/drm/i915/gt/uc/intel_uc.c +0
-4@@ -502,10 +502,6 @@ static int __uc_init_hw(struct intel_uc *uc)intel_huc_auth (huc); - ret =intel_guc_sample_forcewake (guc); -if (ret) - goto err_log_capture; -if (intel_uc_uses_guc_submission (uc))intel_guc_submission_enable (guc);
Re: [RFC PATCH 07/97] drm/i915/guc: Remove sample_forcewake h2g action
In reply to Matthew BrostQuoted 10 lines · Matthew Brost
From: Rodrigo Vivi <[email protected]>
This action is no-op in the GuC side for a few versions already and it is getting entirely removed soon, in an upcoming version.
Time to remove before we face communication issues.
Cc Vinay Belgaumkar <[email protected]>Signed-off-by Rodrigo Vivi <[email protected]>Signed-off-by Matthew Brost <[email protected]>
Quoted 86 lines
--- drivers/gpu/drm/i915/gt/uc/intel_guc.c | 16 ---------------- drivers/gpu/drm/i915/gt/uc/intel_guc.h | 1 - drivers/gpu/drm/i915/gt/uc/intel_guc_fwif.h | 4 ---- drivers/gpu/drm/i915/gt/uc/intel_uc.c | 4 ---- 4 files changed, 25 deletions(-)drivers/gpu/drm/i915/gt/uc/intel_guc.c +0
-16@@ -469,22 +469,6 @@ int intel_guc_to_host_process_recv_msg(struct intel_guc *guc,return 0 ; } -int intel_guc_sample_forcewake (struct intel_guc *guc) -{ -struct drm_i915_private *dev_priv =guc_to_gt (guc)->i915; -u32 action[2 ]; - - action[0 ] =INTEL_GUC_ACTION_SAMPLE_FORCEWAKE ; -/* WaRsDisableCoarsePowerGating:skl,cnl */ -if (!HAS_RC6 (dev_priv) ||NEEDS_WaRsDisableCoarsePowerGating (dev_priv)) - action[1 ] =0 ; -else -/* bit 0 and 1 are for Render and Media domain separately */ - action[1 ] =GUC_FORCEWAKE_RENDER |GUC_FORCEWAKE_MEDIA ; - -return intel_guc_send (guc, action,ARRAY_SIZE (action)); -} -/** * intel_guc_auth_huc() - Send action to GuC to authenticate HuC ucode * @guc: intel_guc structure drivers/gpu/drm/i915/gt/uc/intel_guc.h +0
-1@@ -128,7 +128,6 @@ int intel_guc_send_mmio(struct intel_guc *guc, const u32 *action, u32 len, u32 *response_buf, u32 response_buf_size);int intel_guc_to_host_process_recv_msg (struct intel_guc *guc,const u32 *payload,u32 len); -int intel_guc_sample_forcewake (struct intel_guc *guc);int intel_guc_auth_huc (struct intel_guc *guc,u32 rsa_offset);int intel_guc_suspend (struct intel_guc *guc);int intel_guc_resume (struct intel_guc *guc);drivers/gpu/drm/i915/gt/uc/intel_guc_fwif.h +0
-4@@ -302,9 +302,6 @@ struct guc_ct_buffer_desc {#define GUC_CT_MSG_ACTION_SHIFT 16#define GUC_CT_MSG_ACTION_MASK 0xFFFF -#define GUC_FORCEWAKE_RENDER (1 << 0) -#define GUC_FORCEWAKE_MEDIA (1 << 1) -#define GUC_POWER_UNSPECIFIED 0#define GUC_POWER_D0 1#define GUC_POWER_D1 2@@ -558,7 +555,6 @@ enum intel_guc_action {INTEL_GUC_ACTION_ENTER_S_STATE =0x501 ,INTEL_GUC_ACTION_EXIT_S_STATE =0x502 ,INTEL_GUC_ACTION_SLPC_REQUEST =0x3003 , -INTEL_GUC_ACTION_SAMPLE_FORCEWAKE =0x3005 ,INTEL_GUC_ACTION_AUTHENTICATE_HUC =0x4000 ,INTEL_GUC_ACTION_REGISTER_COMMAND_TRANSPORT_BUFFER =0x4505 , INTEL_GUC_ACTION_DEREGISTER_COMMAND_TRANSPORT_BUFFER = 0x4506,drivers/gpu/drm/i915/gt/uc/intel_uc.c +0
-4@@ -502,10 +502,6 @@ static int __uc_init_hw(struct intel_uc *uc)intel_huc_auth (huc); - ret =intel_guc_sample_forcewake (guc); -if (ret) - goto err_log_capture; -if (intel_uc_uses_guc_submission (uc))intel_guc_submission_enable (guc);Signature · 1 line
2.28.0
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
RFC PATCH 8/97 drm/i915/guc: Keep strict GuC ABI definitions
In reply to Matthew BrostFrom: Michal Wajdeczko <[email protected]>
Our fwif.h file is now mix of strict firmware ABI definitions and set of our helpers. In anticipation of upcoming changes to the GuC interface try to keep them separate in smaller maintainable files.
--- .../gpu/drm/i915/gt/uc/abi/guc_actions_abi.h | 51 +++++ .../gt/uc/abi/guc_communication_ctb_abi.h | 106 +++++++++ .../gt/uc/abi/guc_communication_mmio_abi.h | 52 +++++ .../gpu/drm/i915/gt/uc/abi/guc_errors_abi.h | 14 ++ .../gpu/drm/i915/gt/uc/abi/guc_messages_abi.h | 21 ++ drivers/gpu/drm/i915/gt/uc/intel_guc_fwif.h | 203 +----------------- 6 files changed, 250 insertions(+), 197 deletions(-) create mode 100644 drivers/gpu/drm/i915/gt/uc/abi/guc_actions_abi.h create mode 100644 drivers/gpu/drm/i915/gt/uc/abi/guc_communication_ctb_abi.h create mode 100644 drivers/gpu/drm/i915/gt/uc/abi/guc_communication_mmio_abi.h create mode 100644 drivers/gpu/drm/i915/gt/uc/abi/guc_errors_abi.h create mode 100644 drivers/gpu/drm/i915/gt/uc/abi/guc_messages_abi.h
drivers/gpu/drm/i915/gt/uc/abi/guc_actions_abi.h new file +51 -0
@@ -0,0 +1,51 @@ +/* SPDX-License-Identifier: MIT */ +/* +* Copyright © 2014-2021 Intel Corporation +*/ + +#ifndef _ABI_GUC_ACTIONS_ABI_H +#define _ABI_GUC_ACTIONS_ABI_H + +enum intel_guc_action { +INTEL_GUC_ACTION_DEFAULT =0x0 , +INTEL_GUC_ACTION_REQUEST_PREEMPTION =0x2 , +INTEL_GUC_ACTION_REQUEST_ENGINE_RESET =0x3 , +INTEL_GUC_ACTION_ALLOCATE_DOORBELL =0x10 , +INTEL_GUC_ACTION_DEALLOCATE_DOORBELL =0x20 , +INTEL_GUC_ACTION_LOG_BUFFER_FILE_FLUSH_COMPLETE =0x30 , +INTEL_GUC_ACTION_UK_LOG_ENABLE_LOGGING =0x40 , +INTEL_GUC_ACTION_FORCE_LOG_BUFFER_FLUSH =0x302 , +INTEL_GUC_ACTION_ENTER_S_STATE =0x501 , +INTEL_GUC_ACTION_EXIT_S_STATE =0x502 , +INTEL_GUC_ACTION_SLPC_REQUEST =0x3003 , +INTEL_GUC_ACTION_AUTHENTICATE_HUC =0x4000 , +INTEL_GUC_ACTION_REGISTER_COMMAND_TRANSPORT_BUFFER =0x4505 , +INTEL_GUC_ACTION_DEREGISTER_COMMAND_TRANSPORT_BUFFER =0x4506 , +INTEL_GUC_ACTION_LIMIT +}; + +enum intel_guc_preempt_options { +INTEL_GUC_PREEMPT_OPTION_DROP_WORK_Q =0x4 , +INTEL_GUC_PREEMPT_OPTION_DROP_SUBMIT_Q =0x8 , +}; + +enum intel_guc_report_status { +INTEL_GUC_REPORT_STATUS_UNKNOWN =0x0 , +INTEL_GUC_REPORT_STATUS_ACKED =0x1 , +INTEL_GUC_REPORT_STATUS_ERROR =0x2 , +INTEL_GUC_REPORT_STATUS_COMPLETE =0x4 , +}; + +enum intel_guc_sleep_state_status { +INTEL_GUC_SLEEP_STATE_SUCCESS =0x1 , +INTEL_GUC_SLEEP_STATE_PREEMPT_TO_IDLE_FAILED =0x2 , + INTEL_GUC_SLEEP_STATE_ENGINE_RESET_FAILED = 0x3 +#define INTEL_GUC_SLEEP_STATE_INVALID_MASK 0x80000000 +}; + +#define GUC_LOG_CONTROL_LOGGING_ENABLED (1 << 0) +#define GUC_LOG_CONTROL_VERBOSITY_SHIFT 4 +#define GUC_LOG_CONTROL_VERBOSITY_MASK (0xF << GUC_LOG_CONTROL_VERBOSITY_SHIFT) +#define GUC_LOG_CONTROL_DEFAULT_LOGGING (1 << 8) + +#endif /* _ABI_GUC_ACTIONS_ABI_H */
drivers/gpu/drm/i915/gt/uc/abi/guc_communication_ctb_abi.h new file +106 -0
106 lines not on this page · raw message
drivers/gpu/drm/i915/gt/uc/abi/guc_communication_mmio_abi.h new file +52 -0
52 lines not on this page · raw message
drivers/gpu/drm/i915/gt/uc/abi/guc_errors_abi.h new file +14 -0
@@ -0,0 +1,14 @@ +/* SPDX-License-Identifier: MIT */ +/* +* Copyright © 2014-2021 Intel Corporation +*/ + +#ifndef _ABI_GUC_ERRORS_ABI_H +#define _ABI_GUC_ERRORS_ABI_H + +enum intel_guc_response_status { +INTEL_GUC_RESPONSE_STATUS_SUCCESS =0x0 , +INTEL_GUC_RESPONSE_STATUS_GENERIC_FAIL =0xF000 , +}; + +#endif /* _ABI_GUC_ERRORS_ABI_H */
drivers/gpu/drm/i915/gt/uc/abi/guc_messages_abi.h new file +21 -0
@@ -0,0 +1,21 @@ +/* SPDX-License-Identifier: MIT */ +/* +* Copyright © 2014-2021 Intel Corporation +*/ + +#ifndef _ABI_GUC_MESSAGES_ABI_H +#define _ABI_GUC_MESSAGES_ABI_H + +#define INTEL_GUC_MSG_TYPE_SHIFT 28 +#define INTEL_GUC_MSG_TYPE_MASK (0xF << INTEL_GUC_MSG_TYPE_SHIFT) +#define INTEL_GUC_MSG_DATA_SHIFT 16 +#define INTEL_GUC_MSG_DATA_MASK (0xFFF << INTEL_GUC_MSG_DATA_SHIFT) +#define INTEL_GUC_MSG_CODE_SHIFT 0 +#define INTEL_GUC_MSG_CODE_MASK (0xFFFF << INTEL_GUC_MSG_CODE_SHIFT) + +enum intel_guc_msg_type { +INTEL_GUC_MSG_TYPE_REQUEST =0x0 , +INTEL_GUC_MSG_TYPE_RESPONSE =0xF , +}; + +#endif /* _ABI_GUC_MESSAGES_ABI_H */
drivers/gpu/drm/i915/gt/uc/intel_guc_fwif.h +6 -197
232 lines not on this page · raw message
Signature · 1 line
2.28.0
Re: [RFC PATCH 08/97] drm/i915/guc: Keep strict GuC ABI definitions
Quoting Matthew Brost (2021-05-06 21:13:22)
Quoted 9 lines
From: Michal Wajdeczko <[email protected]>
Our
fwif.hfile is now mix of strict firmware ABI definitions and set of our helpers. In anticipation of upcoming changes to the GuC interface try to keep them separate in smaller maintainable files.Signed-off-by Michal Wajdeczko <[email protected]>Signed-off-by Matthew Brost <[email protected]>Cc Michał Winiarski <[email protected]>
-Michał
Quoted 5 lines
--- .../gpu/drm/i915/gt/uc/abi/guc_actions_abi.h | 51 +++++ .../gt/uc/abi/guc_communication_ctb_abi.h | 106 +++++++++ .../gt/uc/abi/guc_communication_mmio_abi.h | 52 +++++ .../gpu/drm/i915/gt/uc/abi/guc_errors_abi.h | 14 ++
Quoted 8 lines
.../gpu/drm/i915/gt/uc/abi/guc_messages_abi.h | 21 ++ drivers/gpu/drm/i915/gt/uc/intel_guc_fwif.h | 203 +----------------- 6 files changed, 250 insertions(+), 197 deletions(-) create mode 100644 drivers/gpu/drm/i915/gt/uc/abi/guc_actions_abi.h create mode 100644 drivers/gpu/drm/i915/gt/uc/abi/guc_communication_ctb_abi.h create mode 100644 drivers/gpu/drm/i915/gt/uc/abi/guc_communication_mmio_abi.h create mode 100644 drivers/gpu/drm/i915/gt/uc/abi/guc_errors_abi.h create mode 100644 drivers/gpu/drm/i915/gt/uc/abi/guc_messages_abi.h
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
RFC PATCH 9/97 drm/i915/guc: Stop using fence/status from CTB descriptor
In reply to Matthew BrostFrom: Michal Wajdeczko <[email protected]>
Stop using fence/status from CTB descriptor as future GuC ABI will no longer support replies over CTB descriptor.
--- .../gt/uc/abi/guc_communication_ctb_abi.h | 4 +- drivers/gpu/drm/i915/gt/uc/intel_guc_ct.c | 72 ++----------------- 2 files changed, 6 insertions(+), 70 deletions(-)
drivers/gpu/drm/i915/gt/uc/abi/guc_communication_ctb_abi.h +2 -2
@@ -71,8 +71,8 @@ struct guc_ct_buffer_desc {u32 head;/* offset updated by GuC*/ u32 tail;/* offset updated by owner */ u32 is_in_error;/* error indicator */ -u32 fence;/* fence updated by GuC */ -u32 status;/* status updated by GuC */ +u32 reserved1; +u32 reserved2;u32 owner;/* id of the channel owner */ u32 owner_sub_id;/* owner-defined field for extra tracking */ u32 reserved[5 ];
drivers/gpu/drm/i915/gt/uc/intel_guc_ct.c +4 -68
113 lines not on this page · raw message
Signature · 6 lines
2.28.0 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [RFC PATCH 09/97] drm/i915/guc: Stop using fence/status from CTB descriptor
Quoted 7 lines · Matthew Brost
From: Michal Wajdeczko <[email protected]>
Stop using fence/status from CTB descriptor as future GuC ABI will no longer support replies over CTB descriptor.
Signed-off-by Michal Wajdeczko <[email protected]>Signed-off-by Matthew Brost <[email protected]>
Quoted 146 lines
--- .../gt/uc/abi/guc_communication_ctb_abi.h | 4 +- drivers/gpu/drm/i915/gt/uc/intel_guc_ct.c | 72 ++----------------- 2 files changed, 6 insertions(+), 70 deletions(-)drivers/gpu/drm/i915/gt/uc/abi/guc_communication_ctb_abi.h +2
-2@@ -71,8 +71,8 @@ struct guc_ct_buffer_desc {u32 head;/* offset updated by GuC*/ u32 tail;/* offset updated by owner */ u32 is_in_error;/* error indicator */ -u32 fence;/* fence updated by GuC */ -u32 status;/* status updated by GuC */ +u32 reserved1; +u32 reserved2;u32 owner;/* id of the channel owner */ u32 owner_sub_id;/* owner-defined field for extra tracking */ u32 reserved[5 ];drivers/gpu/drm/i915/gt/uc/intel_guc_ct.c +4
-68@@ -90,13 +90,6 @@ static void guc_ct_buffer_desc_init(struct guc_ct_buffer_desc *desc, desc->owner =CTB_OWNER_HOST ; } -static void guc_ct_buffer_desc_reset (struct guc_ct_buffer_desc *desc) -{ - desc->head =0 ; - desc->tail =0 ; - desc->is_in_error =0 ; -} -static int guc_action_register_ct_buffer (struct intel_guc *guc,u32 desc_addr,u32 type)@@ -315,8 +308,7 @@ static u32 ct_get_next_fence(struct intel_guc_ct *ct)static int ct_write (struct intel_guc_ct *ct,const u32 *action,u32 len/* in dwords */ , -u32 fence, -bool want_response) +u32 fence) {struct intel_guc_ct_buffer *ctb = &ct->ctbs[CTB_SEND ];struct guc_ct_buffer_desc *desc = ctb->desc;@@ -360,8 +352,7 @@ static int ct_write(struct intel_guc_ct *ct,* DW2+: action data */ header = (len <<GUC_CT_MSG_LEN_SHIFT ) | - (GUC_CT_MSG_WRITE_FENCE_TO_DESC ) | - (want_response ?GUC_CT_MSG_SEND_STATUS :0 ) | +GUC_CT_MSG_SEND_STATUS | (action[0 ] <<GUC_CT_MSG_ACTION_SHIFT ); CT_DEBUG(ct, "writing %*ph %*ph %*ph\n",@@ -390,56 +381,6 @@ static int ct_write(struct intel_guc_ct *ct,return -EPIPE ; } -/** -* wait_for_ctb_desc_update - Wait for the CT buffer descriptor update. -* @desc: buffer descriptor -* @fence: response fence -* @status: placeholder for status -* -* Guc will update CT buffer descriptor with new fence and status -* after processing the command identified by the fence. Wait for -* specified fence and then read from the descriptor status of the -* command. -* -* Return: -* * 0 response received (status is valid) -* * -ETIMEDOUT no response within hardcoded timeout -* * -EPROTO no response, CT buffer is in error -*/ -static int wait_for_ctb_desc_update (struct guc_ct_buffer_desc *desc, -u32 fence, -u32 *status) -{ -int err; - -/* -* Fast commands should complete in less than 10us, so sample quickly -* up to that length of time, then switch to a slower sleep-wait loop. -* No GuC command should ever take longer than 10ms. -*/ -#define done (READ_ONCE(desc->fence) == fence) - err =wait_for_us (done,10 ); -if (err) - err =wait_for (done,10 ); -#undef done - -if (unlikely (err)) { -DRM_ERROR ("CT: fence %u failed; reported fence=%u\n" , - fence, desc->fence); - -if (WARN_ON (desc->is_in_error)) { -/* Something went wrong with the messaging, try to reset -* the buffer and hope for the best -*/ -guc_ct_buffer_desc_reset (desc); - err = -EPROTO ; - } - } - - *status = desc->status; -return err; -} -/** * wait_for_ct_request_update - Wait for CT request state update. * @req: pointer to pending request @@ -483,8 +424,6 @@ static int ct_send(struct intel_guc_ct *ct,u32 response_buf_size, u32 *status) { - struct intel_guc_ct_buffer *ctb = &ct->ctbs[CTB_SEND]; -struct guc_ct_buffer_desc *desc = ctb->desc; struct ct_request request;unsigned long flags;u32 fence;@@ -505,16 +444,13 @@ static int ct_send(struct intel_guc_ct *ct,list_add_tail (&request.link, &ct->requests.pending);spin_unlock_irqrestore (&ct->requests.lock, flags); - err =ct_write (ct, action, len, fence, !!response_buf); + err =ct_write (ct, action, len, fence);if (unlikely (err)) goto unlink;intel_guc_notify (ct_to_guc (ct)); -if (response_buf) - err =wait_for_ct_request_update (&request, status); -else - err =wait_for_ctb_desc_update (desc, fence, status); + err =wait_for_ct_request_update (&request, status);if (unlikely (err)) goto unlink;Signature · 1 line
2.28.0
RFC PATCH 10/97 drm/i915: Promote ptrdiff() to i915_utils.h
In reply to Matthew BrostFrom: Michal Wajdeczko <[email protected]>
Generic helpers should be placed in i915_utils.h.
--- drivers/gpu/drm/i915/i915_utils.h | 5 +++++ drivers/gpu/drm/i915/i915_vma.h | 5 ----- 2 files changed, 5 insertions(+), 5 deletions(-)
drivers/gpu/drm/i915/i915_utils.h +5 -0
@@ -201,6 +201,11 @@ __check_struct_size(size_t base, size_t arr, size_t count, size_t *size) __T; \ }) +static __always_inline ptrdiff_t ptrdiff(const void *a, const void *b) +{ +return a - b; +} +/* * container_of_user: Extract the superclass from a pointer to a member. *
drivers/gpu/drm/i915/i915_vma.h +0 -5
@@ -146,11 +146,6 @@ static inline void i915_vma_put(struct i915_vma *vma)i915_gem_object_put (vma->obj); } -static __always_inline ptrdiff_t ptrdiff(const void *a, const void *b) -{ -return a - b; -} - static inline long i915_vma_compare(struct i915_vma *vma, struct i915_address_space *vm,
Signature · 6 lines
2.28.0 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [RFC PATCH 10/97] drm/i915: Promote ptrdiff() to i915_utils.h
Quoted 6 lines · Matthew Brost
From: Michal Wajdeczko <[email protected]>
Generic helpers should be placed in
i915_utils.h.Signed-off-by Michal Wajdeczko <[email protected]>Signed-off-by Matthew Brost <[email protected]>
Quoted 40 lines
--- drivers/gpu/drm/i915/i915_utils.h | 5 +++++ drivers/gpu/drm/i915/i915_vma.h | 5 ----- 2 files changed, 5 insertions(+), 5 deletions(-)drivers/gpu/drm/i915/i915_utils.h +5
-0@@ -201,6 +201,11 @@ __check_struct_size(size_t base, size_t arr, size_t count, size_t *size) __T; \ }) +static __always_inline ptrdiff_t ptrdiff(const void *a, const void *b) +{ +return a - b; +} +/* * container_of_user: Extract the superclass from a pointer to a member. * drivers/gpu/drm/i915/i915_vma.h +0
-5@@ -146,11 +146,6 @@ static inline void i915_vma_put(struct i915_vma *vma)i915_gem_object_put (vma->obj); } -static __always_inline ptrdiff_t ptrdiff(const void *a, const void *b) -{ -return a - b; -} - static inline long i915_vma_compare(struct i915_vma *vma, struct i915_address_space *vm,Signature · 1 line
2.28.0
RFC PATCH 11/97 drm/i915/guc: Only rely on own CTB size
In reply to Matthew BrostFrom: Michal Wajdeczko <[email protected]>
In upcoming GuC firmware, CTB size will be removed from the CTB descriptor so we must keep it locally for any calculations.
While around, improve some debug messages and helpers.
--- drivers/gpu/drm/i915/gt/uc/intel_guc_ct.c | 55 +++++++++++++++++------ drivers/gpu/drm/i915/gt/uc/intel_guc_ct.h | 2 + 2 files changed, 43 insertions(+), 14 deletions(-)
drivers/gpu/drm/i915/gt/uc/intel_guc_ct.c +41 -14
@@ -90,6 +90,24 @@ static void guc_ct_buffer_desc_init(struct guc_ct_buffer_desc *desc, desc->owner =CTB_OWNER_HOST ; } +static void guc_ct_buffer_reset (struct intel_guc_ct_buffer *ctb,u32 cmds_addr) +{ +guc_ct_buffer_desc_init (ctb->desc, cmds_addr, ctb->size); +} + +static void guc_ct_buffer_init (struct intel_guc_ct_buffer *ctb, +struct guc_ct_buffer_desc *desc, +u32 *cmds,u32 size) +{ +GEM_BUG_ON (size %4 ); + + ctb->desc = desc; + ctb->cmds = cmds; + ctb->size = size; + +guc_ct_buffer_reset (ctb,0 ); +} +static int guc_action_register_ct_buffer (struct intel_guc *guc,u32 desc_addr,u32 type)
@@ -148,7 +166,10 @@ static int ct_deregister_buffer(struct intel_guc_ct *ct, u32 type)int intel_guc_ct_init (struct intel_guc_ct *ct) {struct intel_guc *guc =ct_to_guc (ct); +struct guc_ct_buffer_desc *desc; +u32 blob_size;void *blob; +u32 *cmds;int err;int i;
@@ -176,19 +197,24 @@ int intel_guc_ct_init(struct intel_guc_ct *ct)* other code will need updating as well. */ - err =intel_guc_allocate_and_map_vma (guc,PAGE_SIZE , &ct->vma, &blob); + blob_size =PAGE_SIZE ; + err =intel_guc_allocate_and_map_vma (guc, blob_size, &ct->vma, &blob);if (unlikely (err)) { -CT_ERROR (ct,"Failed to allocate CT channel (err=%d)\n" , err); +CT_PROBE_ERROR (ct,"Failed to allocate %u for CTB data (%pe)\n" , + blob_size,ERR_PTR (err));return err; } -CT_DEBUG (ct,"vma base=%#x\n" ,intel_guc_ggtt_offset (guc, ct->vma)); +CT_DEBUG (ct,"base=%#x size=%u\n" ,intel_guc_ggtt_offset (guc, ct->vma), blob_size);/* store pointers to desc and cmds */ for (i =0 ; i <ARRAY_SIZE (ct->ctbs); i++) {GEM_BUG_ON ((i !=CTB_SEND ) && (i !=CTB_RECV )); - ct->ctbs[i].desc = blob +PAGE_SIZE /4 * i; - ct->ctbs[i].cmds = blob +PAGE_SIZE /4 * i +PAGE_SIZE /2 ; + + desc = blob +PAGE_SIZE /4 * i; + cmds = blob +PAGE_SIZE /4 * i +PAGE_SIZE /2 ; + +guc_ct_buffer_init (&ct->ctbs[i], desc, cmds,PAGE_SIZE /4 ); }return 0 ;
@@ -217,7 +243,7 @@ void intel_guc_ct_fini(struct intel_guc_ct *ct)int intel_guc_ct_enable (struct intel_guc_ct *ct) {struct intel_guc *guc =ct_to_guc (ct); -u32 base, cmds, size; +u32 base, cmds;int err;int i;
@@ -232,10 +258,11 @@ int intel_guc_ct_enable(struct intel_guc_ct *ct)*/ for (i =0 ; i <ARRAY_SIZE (ct->ctbs); i++) {GEM_BUG_ON ((i !=CTB_SEND ) && (i !=CTB_RECV )); + cmds = base +PAGE_SIZE /4 * i +PAGE_SIZE /2 ; - size =PAGE_SIZE /4 ; -CT_DEBUG (ct,"%d: addr=%#x size=%u\n" , i, cmds, size); -guc_ct_buffer_desc_init (ct->ctbs[i].desc, cmds, size); +CT_DEBUG (ct,"%d: cmds addr=%#x\n" , i, cmds); + +guc_ct_buffer_reset (&ct->ctbs[i], cmds); }/*
@@ -259,7 +286,7 @@ int intel_guc_ct_enable(struct intel_guc_ct *ct) err_deregister:ct_deregister_buffer (ct,INTEL_GUC_CT_BUFFER_TYPE_RECV ); err_out: -CT_PROBE_ERROR (ct,"Failed to open channel (err=%d)\n" , err); +CT_PROBE_ERROR (ct,"Failed to enable CTB (%pe)\n" ,ERR_PTR (err));return err; }
@@ -314,7 +341,7 @@ static int ct_write(struct intel_guc_ct *ct,struct guc_ct_buffer_desc *desc = ctb->desc;u32 head = desc->head;u32 tail = desc->tail; -u32 size = desc->size; +u32 size = ctb->size;u32 used;u32 header;u32 *cmds = ctb->cmds;
@@ -323,7 +350,7 @@ static int ct_write(struct intel_guc_ct *ct,if (unlikely (desc->is_in_error))return -EPIPE ; -if (unlikely (!IS_ALIGNED (head | tail | size,4 ) || +if (unlikely (!IS_ALIGNED (head | tail,4 ) || (tail | head) >= size)) goto corrupted;
@@ -530,7 +557,7 @@ static int ct_read(struct intel_guc_ct *ct, u32 *data)struct guc_ct_buffer_desc *desc = ctb->desc;u32 head = desc->head;u32 tail = desc->tail; -u32 size = desc->size; +u32 size = ctb->size;u32 *cmds = ctb->cmds;s32 available;unsigned int len;
@@ -539,7 +566,7 @@ static int ct_read(struct intel_guc_ct *ct, u32 *data)if (unlikely (desc->is_in_error))return -EPIPE ; -if (unlikely (!IS_ALIGNED (head | tail | size,4 ) || +if (unlikely (!IS_ALIGNED (head | tail,4 ) || (tail | head) >= size)) goto corrupted;
drivers/gpu/drm/i915/gt/uc/intel_guc_ct.h +2 -0
@@ -29,10 +29,12 @@ struct intel_guc;* * @desc: pointer to the buffer descriptor * @cmds: pointer to the commands buffer +* @size: size of the commands buffer */ struct intel_guc_ct_buffer {struct guc_ct_buffer_desc *desc;u32 *cmds; +u32 size; };
Signature · 1 line
2.28.0
Re: [RFC PATCH 11/97] drm/i915/guc: Only rely on own CTB size
Quoted 7 lines · Matthew Brost
From: Michal Wajdeczko <[email protected]>
In upcoming GuC firmware, CTB size will be removed from the CTB descriptor so we must keep it locally for any calculations.
While around, improve some debug messages and helpers.
desc->size is still used in the patch and really shouldn't be per this comment but a patch later in the series drops it. Seeing as this patch and that patch are going to squashed into a single patch upgrading the GuC firmware I think that is ok.
With that:
Quoted 166 lines
Signed-off-by Michal Wajdeczko <[email protected]>Signed-off-by Matthew Brost <[email protected]>--- drivers/gpu/drm/i915/gt/uc/intel_guc_ct.c | 55 +++++++++++++++++------ drivers/gpu/drm/i915/gt/uc/intel_guc_ct.h | 2 + 2 files changed, 43 insertions(+), 14 deletions(-)drivers/gpu/drm/i915/gt/uc/intel_guc_ct.c +41
-14@@ -90,6 +90,24 @@ static void guc_ct_buffer_desc_init(struct guc_ct_buffer_desc *desc, desc->owner =CTB_OWNER_HOST ; } +static void guc_ct_buffer_reset (struct intel_guc_ct_buffer *ctb,u32 cmds_addr) +{ +guc_ct_buffer_desc_init (ctb->desc, cmds_addr, ctb->size); +} + +static void guc_ct_buffer_init (struct intel_guc_ct_buffer *ctb, +struct guc_ct_buffer_desc *desc, +u32 *cmds,u32 size) +{ +GEM_BUG_ON (size %4 ); + + ctb->desc = desc; + ctb->cmds = cmds; + ctb->size = size; + +guc_ct_buffer_reset (ctb,0 ); +} +static int guc_action_register_ct_buffer (struct intel_guc *guc,u32 desc_addr,u32 type)@@ -148,7 +166,10 @@ static int ct_deregister_buffer(struct intel_guc_ct *ct, u32 type)int intel_guc_ct_init (struct intel_guc_ct *ct) {struct intel_guc *guc =ct_to_guc (ct); +struct guc_ct_buffer_desc *desc; +u32 blob_size;void *blob; +u32 *cmds;int err;int i;@@ -176,19 +197,24 @@ int intel_guc_ct_init(struct intel_guc_ct *ct)* other code will need updating as well. */ - err =intel_guc_allocate_and_map_vma (guc,PAGE_SIZE , &ct->vma, &blob); + blob_size =PAGE_SIZE ; + err =intel_guc_allocate_and_map_vma (guc, blob_size, &ct->vma, &blob);if (unlikely (err)) { -CT_ERROR (ct,"Failed to allocate CT channel (err=%d)\n" , err); +CT_PROBE_ERROR (ct,"Failed to allocate %u for CTB data (%pe)\n" , + blob_size,ERR_PTR (err));return err; } -CT_DEBUG (ct,"vma base=%#x\n" ,intel_guc_ggtt_offset (guc, ct->vma)); +CT_DEBUG (ct,"base=%#x size=%u\n" ,intel_guc_ggtt_offset (guc, ct->vma), blob_size);/* store pointers to desc and cmds */ for (i =0 ; i <ARRAY_SIZE (ct->ctbs); i++) {GEM_BUG_ON ((i !=CTB_SEND ) && (i !=CTB_RECV )); - ct->ctbs[i].desc = blob +PAGE_SIZE /4 * i; - ct->ctbs[i].cmds = blob +PAGE_SIZE /4 * i +PAGE_SIZE /2 ; + + desc = blob +PAGE_SIZE /4 * i; + cmds = blob +PAGE_SIZE /4 * i +PAGE_SIZE /2 ; + +guc_ct_buffer_init (&ct->ctbs[i], desc, cmds,PAGE_SIZE /4 ); }return 0 ;@@ -217,7 +243,7 @@ void intel_guc_ct_fini(struct intel_guc_ct *ct)int intel_guc_ct_enable (struct intel_guc_ct *ct) {struct intel_guc *guc =ct_to_guc (ct); -u32 base, cmds, size; +u32 base, cmds;int err;int i;@@ -232,10 +258,11 @@ int intel_guc_ct_enable(struct intel_guc_ct *ct)*/ for (i =0 ; i <ARRAY_SIZE (ct->ctbs); i++) {GEM_BUG_ON ((i !=CTB_SEND ) && (i !=CTB_RECV )); + cmds = base +PAGE_SIZE /4 * i +PAGE_SIZE /2 ; - size =PAGE_SIZE /4 ; -CT_DEBUG (ct,"%d: addr=%#x size=%u\n" , i, cmds, size); -guc_ct_buffer_desc_init (ct->ctbs[i].desc, cmds, size); +CT_DEBUG (ct,"%d: cmds addr=%#x\n" , i, cmds); + +guc_ct_buffer_reset (&ct->ctbs[i], cmds); }/* @@ -259,7 +286,7 @@ int intel_guc_ct_enable(struct intel_guc_ct *ct) err_deregister:ct_deregister_buffer (ct,INTEL_GUC_CT_BUFFER_TYPE_RECV ); err_out: -CT_PROBE_ERROR (ct,"Failed to open channel (err=%d)\n" , err); +CT_PROBE_ERROR (ct,"Failed to enable CTB (%pe)\n" ,ERR_PTR (err));return err; }@@ -314,7 +341,7 @@ static int ct_write(struct intel_guc_ct *ct,struct guc_ct_buffer_desc *desc = ctb->desc;u32 head = desc->head;u32 tail = desc->tail; -u32 size = desc->size; +u32 size = ctb->size;u32 used;u32 header;u32 *cmds = ctb->cmds;@@ -323,7 +350,7 @@ static int ct_write(struct intel_guc_ct *ct,if (unlikely (desc->is_in_error))return -EPIPE ; -if (unlikely (!IS_ALIGNED (head | tail | size,4 ) || +if (unlikely (!IS_ALIGNED (head | tail,4 ) || (tail | head) >= size)) goto corrupted;@@ -530,7 +557,7 @@ static int ct_read(struct intel_guc_ct *ct, u32 *data)struct guc_ct_buffer_desc *desc = ctb->desc;u32 head = desc->head;u32 tail = desc->tail; -u32 size = desc->size; +u32 size = ctb->size;u32 *cmds = ctb->cmds;s32 available;unsigned int len;@@ -539,7 +566,7 @@ static int ct_read(struct intel_guc_ct *ct, u32 *data)if (unlikely (desc->is_in_error))return -EPIPE ; -if (unlikely (!IS_ALIGNED (head | tail | size,4 ) || +if (unlikely (!IS_ALIGNED (head | tail,4 ) || (tail | head) >= size)) goto corrupted;drivers/gpu/drm/i915/gt/uc/intel_guc_ct.h +2
-0@@ -29,10 +29,12 @@ struct intel_guc;* * @desc: pointer to the buffer descriptor * @cmds: pointer to the commands buffer +* @size: size of the commands buffer */ struct intel_guc_ct_buffer {struct guc_ct_buffer_desc *desc;u32 *cmds; +u32 size; };Signature · 1 line
2.28.0
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [Intel-gfx] [RFC PATCH 11/97] drm/i915/guc: Only rely on own CTB size
Quoted 10 lines · Matthew Brost
Quoted 7 lines · Matthew Brost
From: Michal Wajdeczko <[email protected]>
In upcoming GuC firmware, CTB size will be removed from the CTB descriptor so we must keep it locally for any calculations.
While around, improve some debug messages and helpers.
desc->sizeis still used in the patch and really shouldn't be per this
goal of this patch was to start using local ctb->size for any calculations, not to drop it completely, as at this point (GuC 49) desc->size is still part of the CTB protocol
Quoted 3 lines
comment but a patch later in the series drops it. Seeing as this patch and that patch are going to squashed into a single patch upgrading the GuC firmware I think that is ok.
no need to squash this patch
in fact all CTB patches up to and including 20/97 ("drm/i915/guc:
Introduce unified HXG messages") are compatible with current GuC 49.0.1 and IMHO *should* be merged separately
only patches from 21/97 ("drm/i915/guc: Update MMIO based communication") to 29/97 ("drm/i915/guc: Update firmware to v60.1.2") must be squashed during merge, as this is were communication protocol is changing (from GuC 49 to GuC 60) and we may break existing functionality (HuC authentication)
Michal
Quoted 175 lines
With that:
Reviewed-by Matthew Brost <[email protected]>Quoted 166 lines
Signed-off-by Michal Wajdeczko <[email protected]>Signed-off-by Matthew Brost <[email protected]>--- drivers/gpu/drm/i915/gt/uc/intel_guc_ct.c | 55 +++++++++++++++++------ drivers/gpu/drm/i915/gt/uc/intel_guc_ct.h | 2 + 2 files changed, 43 insertions(+), 14 deletions(-)drivers/gpu/drm/i915/gt/uc/intel_guc_ct.c +41
-14@@ -90,6 +90,24 @@ static void guc_ct_buffer_desc_init(struct guc_ct_buffer_desc *desc, desc->owner =CTB_OWNER_HOST ; } +static void guc_ct_buffer_reset (struct intel_guc_ct_buffer *ctb,u32 cmds_addr) +{ +guc_ct_buffer_desc_init (ctb->desc, cmds_addr, ctb->size); +} + +static void guc_ct_buffer_init (struct intel_guc_ct_buffer *ctb, +struct guc_ct_buffer_desc *desc, +u32 *cmds,u32 size) +{ +GEM_BUG_ON (size %4 ); + + ctb->desc = desc; + ctb->cmds = cmds; + ctb->size = size; + +guc_ct_buffer_reset (ctb,0 ); +} +static int guc_action_register_ct_buffer (struct intel_guc *guc,u32 desc_addr,u32 type)@@ -148,7 +166,10 @@ static int ct_deregister_buffer(struct intel_guc_ct *ct, u32 type)int intel_guc_ct_init (struct intel_guc_ct *ct) {struct intel_guc *guc =ct_to_guc (ct); +struct guc_ct_buffer_desc *desc; +u32 blob_size;void *blob; +u32 *cmds;int err;int i;@@ -176,19 +197,24 @@ int intel_guc_ct_init(struct intel_guc_ct *ct)* other code will need updating as well. */ - err =intel_guc_allocate_and_map_vma (guc,PAGE_SIZE , &ct->vma, &blob); + blob_size =PAGE_SIZE ; + err =intel_guc_allocate_and_map_vma (guc, blob_size, &ct->vma, &blob);if (unlikely (err)) { -CT_ERROR (ct,"Failed to allocate CT channel (err=%d)\n" , err); +CT_PROBE_ERROR (ct,"Failed to allocate %u for CTB data (%pe)\n" , + blob_size,ERR_PTR (err));return err; } -CT_DEBUG (ct,"vma base=%#x\n" ,intel_guc_ggtt_offset (guc, ct->vma)); +CT_DEBUG (ct,"base=%#x size=%u\n" ,intel_guc_ggtt_offset (guc, ct->vma), blob_size);/* store pointers to desc and cmds */ for (i =0 ; i <ARRAY_SIZE (ct->ctbs); i++) {GEM_BUG_ON ((i !=CTB_SEND ) && (i !=CTB_RECV )); - ct->ctbs[i].desc = blob +PAGE_SIZE /4 * i; - ct->ctbs[i].cmds = blob +PAGE_SIZE /4 * i +PAGE_SIZE /2 ; + + desc = blob +PAGE_SIZE /4 * i; + cmds = blob +PAGE_SIZE /4 * i +PAGE_SIZE /2 ; + +guc_ct_buffer_init (&ct->ctbs[i], desc, cmds,PAGE_SIZE /4 ); }return 0 ;@@ -217,7 +243,7 @@ void intel_guc_ct_fini(struct intel_guc_ct *ct)int intel_guc_ct_enable (struct intel_guc_ct *ct) {struct intel_guc *guc =ct_to_guc (ct); -u32 base, cmds, size; +u32 base, cmds;int err;int i;@@ -232,10 +258,11 @@ int intel_guc_ct_enable(struct intel_guc_ct *ct)*/ for (i =0 ; i <ARRAY_SIZE (ct->ctbs); i++) {GEM_BUG_ON ((i !=CTB_SEND ) && (i !=CTB_RECV )); + cmds = base +PAGE_SIZE /4 * i +PAGE_SIZE /2 ; - size =PAGE_SIZE /4 ; -CT_DEBUG (ct,"%d: addr=%#x size=%u\n" , i, cmds, size); -guc_ct_buffer_desc_init (ct->ctbs[i].desc, cmds, size); +CT_DEBUG (ct,"%d: cmds addr=%#x\n" , i, cmds); + +guc_ct_buffer_reset (&ct->ctbs[i], cmds); }/* @@ -259,7 +286,7 @@ int intel_guc_ct_enable(struct intel_guc_ct *ct) err_deregister:ct_deregister_buffer (ct,INTEL_GUC_CT_BUFFER_TYPE_RECV ); err_out: -CT_PROBE_ERROR (ct,"Failed to open channel (err=%d)\n" , err); +CT_PROBE_ERROR (ct,"Failed to enable CTB (%pe)\n" ,ERR_PTR (err));return err; }@@ -314,7 +341,7 @@ static int ct_write(struct intel_guc_ct *ct,struct guc_ct_buffer_desc *desc = ctb->desc;u32 head = desc->head;u32 tail = desc->tail; -u32 size = desc->size; +u32 size = ctb->size;u32 used;u32 header;u32 *cmds = ctb->cmds;@@ -323,7 +350,7 @@ static int ct_write(struct intel_guc_ct *ct,if (unlikely (desc->is_in_error))return -EPIPE ; -if (unlikely (!IS_ALIGNED (head | tail | size,4 ) || +if (unlikely (!IS_ALIGNED (head | tail,4 ) || (tail | head) >= size)) goto corrupted;@@ -530,7 +557,7 @@ static int ct_read(struct intel_guc_ct *ct, u32 *data)struct guc_ct_buffer_desc *desc = ctb->desc;u32 head = desc->head;u32 tail = desc->tail; -u32 size = desc->size; +u32 size = ctb->size;u32 *cmds = ctb->cmds;s32 available;unsigned int len;@@ -539,7 +566,7 @@ static int ct_read(struct intel_guc_ct *ct, u32 *data)if (unlikely (desc->is_in_error))return -EPIPE ; -if (unlikely (!IS_ALIGNED (head | tail | size,4 ) || +if (unlikely (!IS_ALIGNED (head | tail,4 ) || (tail | head) >= size)) goto corrupted;drivers/gpu/drm/i915/gt/uc/intel_guc_ct.h +2
-0@@ -29,10 +29,12 @@ struct intel_guc;* * @desc: pointer to the buffer descriptor * @cmds: pointer to the commands buffer +* @size: size of the commands buffer */ struct intel_guc_ct_buffer {struct guc_ct_buffer_desc *desc;u32 *cmds; +u32 size; };Signature · 1 line
2.28.0_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
RFC PATCH 12/97 drm/i915/guc: Don't repeat CTB layout calculations
In reply to Matthew BrostFrom: Michal Wajdeczko <[email protected]>
We can retrieve offsets to cmds buffers and descriptor from actual pointers that we already keep locally.
--- drivers/gpu/drm/i915/gt/uc/intel_guc_ct.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-)
drivers/gpu/drm/i915/gt/uc/intel_guc_ct.c +10 -6
@@ -244,6 +244,7 @@ int intel_guc_ct_enable(struct intel_guc_ct *ct) {struct intel_guc *guc =ct_to_guc (ct);u32 base, cmds; +void *blob;int err;int i;
@@ -251,15 +252,18 @@ int intel_guc_ct_enable(struct intel_guc_ct *ct)/* vma should be already allocated and map'ed */ GEM_BUG_ON (!ct->vma); +GEM_BUG_ON (!i915_gem_object_has_pinned_pages (ct->vma->obj)); base =intel_guc_ggtt_offset (guc, ct->vma); -/* (re)initialize descriptors -* cmds buffers are in the second half of the blob page -*/ +/* blob should start with send descriptor */ + blob =__px_vaddr (ct->vma->obj); +GEM_BUG_ON (blob != ct->ctbs[CTB_SEND ].desc); + +/* (re)initialize descriptors */ for (i =0 ; i <ARRAY_SIZE (ct->ctbs); i++) {GEM_BUG_ON ((i !=CTB_SEND ) && (i !=CTB_RECV )); - cmds = base +PAGE_SIZE /4 * i +PAGE_SIZE /2 ; + cmds = base +ptrdiff (ct->ctbs[i].cmds, blob);CT_DEBUG (ct,"%d: cmds addr=%#x\n" , i, cmds);guc_ct_buffer_reset (&ct->ctbs[i], cmds);
@@ -269,12 +273,12 @@ int intel_guc_ct_enable(struct intel_guc_ct *ct)* Register both CT buffers starting with RECV buffer. * Descriptors are in first half of the blob. */ - err =ct_register_buffer (ct, base +PAGE_SIZE /4 *CTB_RECV , + err =ct_register_buffer (ct, base +ptrdiff (ct->ctbs[CTB_RECV ].desc, blob),INTEL_GUC_CT_BUFFER_TYPE_RECV );if (unlikely (err)) goto err_out; - err =ct_register_buffer (ct, base +PAGE_SIZE /4 *CTB_SEND , + err =ct_register_buffer (ct, base +ptrdiff (ct->ctbs[CTB_SEND ].desc, blob),INTEL_GUC_CT_BUFFER_TYPE_SEND );if (unlikely (err)) goto err_deregister;
Signature · 6 lines
2.28.0 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [RFC PATCH 12/97] drm/i915/guc: Don't repeat CTB layout calculations
Quoted 24 lines · Matthew Brost
From: Michal Wajdeczko <[email protected]>
We can retrieve offsets to cmds buffers and descriptor from actual pointers that we already keep locally.
Signed-off-by Michal Wajdeczko <[email protected]>Signed-off-by Matthew Brost <[email protected]>--- drivers/gpu/drm/i915/gt/uc/intel_guc_ct.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-)drivers/gpu/drm/i915/gt/uc/intel_guc_ct.c +1
-0@@ -244,6 +244,7 @@ int intel_guc_ct_enable(struct intel_guc_ct *ct) {struct intel_guc *guc =ct_to_guc (ct);u32 base, cmds; +void *blob;int err;int i;
drivers/gpu/drm/i915/gt/uc/intel_guc_ct.c int intel_guc_ct_enable(struct intel_guc_ct *ct) · line 255
Quoted 4 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_ct.c +1
-0@@ -251,15 +252,18 @@ int intel_guc_ct_enable(struct intel_guc_ct *ct)/* vma should be already allocated and map'ed */ GEM_BUG_ON (!ct->vma); +GEM_BUG_ON (!i915_gem_object_has_pinned_pages (ct->vma->obj));
This doesn't really have anything to do with this patch, but again this patch will be squashed into a large patch updating the GuC firmware, so I think this is fine.
With that:
Quoted 36 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_ct.c +8
-6base =intel_guc_ggtt_offset (guc, ct->vma); -/* (re)initialize descriptors -* cmds buffers are in the second half of the blob page -*/ +/* blob should start with send descriptor */ + blob =__px_vaddr (ct->vma->obj); +GEM_BUG_ON (blob != ct->ctbs[CTB_SEND ].desc); + +/* (re)initialize descriptors */ for (i =0 ; i <ARRAY_SIZE (ct->ctbs); i++) {GEM_BUG_ON ((i !=CTB_SEND ) && (i !=CTB_RECV )); - cmds = base +PAGE_SIZE /4 * i +PAGE_SIZE /2 ; + cmds = base +ptrdiff (ct->ctbs[i].cmds, blob);CT_DEBUG (ct,"%d: cmds addr=%#x\n" , i, cmds);guc_ct_buffer_reset (&ct->ctbs[i], cmds);@@ -269,12 +273,12 @@ int intel_guc_ct_enable(struct intel_guc_ct *ct)* Register both CT buffers starting with RECV buffer. * Descriptors are in first half of the blob. */ - err =ct_register_buffer (ct, base +PAGE_SIZE /4 *CTB_RECV , + err =ct_register_buffer (ct, base +ptrdiff (ct->ctbs[CTB_RECV ].desc, blob),INTEL_GUC_CT_BUFFER_TYPE_RECV );if (unlikely (err)) goto err_out; - err =ct_register_buffer (ct, base +PAGE_SIZE /4 *CTB_SEND , + err =ct_register_buffer (ct, base +ptrdiff (ct->ctbs[CTB_SEND ].desc, blob),INTEL_GUC_CT_BUFFER_TYPE_SEND );if (unlikely (err)) goto err_deregister;Signature · 1 line
2.28.0
Re: [RFC PATCH 12/97] drm/i915/guc: Don't repeat CTB layout calculations
Quoted 26 lines · Matthew Brost
Quoted 25 lines · Matthew Brost
From: Michal Wajdeczko <[email protected]>
We can retrieve offsets to cmds buffers and descriptor from actual pointers that we already keep locally.
Signed-off-by Michal Wajdeczko <[email protected]>Signed-off-by Matthew Brost <[email protected]>--- drivers/gpu/drm/i915/gt/uc/intel_guc_ct.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-)drivers/gpu/drm/i915/gt/uc/intel_guc_ct.c +1
-0@@ -244,6 +244,7 @@ int intel_guc_ct_enable(struct intel_guc_ct *ct) {struct intel_guc *guc =ct_to_guc (ct);u32 base, cmds; +void *blob;int err;int i;@@ -251,15 +252,18 @@ int intel_guc_ct_enable(struct intel_guc_ct *ct)
Quoted 7 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_ct.c int intel_guc_ct_enable(struct intel_guc_ct *ct) · line 255
Quoted 3 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_ct.c +1
-0/* vma should be already allocated and map'ed */ GEM_BUG_ON (!ct->vma); +GEM_BUG_ON (!i915_gem_object_has_pinned_pages (ct->vma->obj));This doesn't really have anything to do with this patch, but again this patch will be squashed into a large patch updating the GuC firmware, so I think this is fine.
again, no need to squash GuC patches up to 20/97
Quoted 40 lines
With that:
Reviewed-by Matthew Brost <[email protected]>Quoted 36 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_ct.c +8
-6base =intel_guc_ggtt_offset (guc, ct->vma); -/* (re)initialize descriptors -* cmds buffers are in the second half of the blob page -*/ +/* blob should start with send descriptor */ + blob =__px_vaddr (ct->vma->obj); +GEM_BUG_ON (blob != ct->ctbs[CTB_SEND ].desc); + +/* (re)initialize descriptors */ for (i =0 ; i <ARRAY_SIZE (ct->ctbs); i++) {GEM_BUG_ON ((i !=CTB_SEND ) && (i !=CTB_RECV )); - cmds = base +PAGE_SIZE /4 * i +PAGE_SIZE /2 ; + cmds = base +ptrdiff (ct->ctbs[i].cmds, blob);CT_DEBUG (ct,"%d: cmds addr=%#x\n" , i, cmds);guc_ct_buffer_reset (&ct->ctbs[i], cmds);@@ -269,12 +273,12 @@ int intel_guc_ct_enable(struct intel_guc_ct *ct)* Register both CT buffers starting with RECV buffer. * Descriptors are in first half of the blob. */ - err =ct_register_buffer (ct, base +PAGE_SIZE /4 *CTB_RECV , + err =ct_register_buffer (ct, base +ptrdiff (ct->ctbs[CTB_RECV ].desc, blob),INTEL_GUC_CT_BUFFER_TYPE_RECV );if (unlikely (err)) goto err_out; - err =ct_register_buffer (ct, base +PAGE_SIZE /4 *CTB_SEND , + err =ct_register_buffer (ct, base +ptrdiff (ct->ctbs[CTB_SEND ].desc, blob),INTEL_GUC_CT_BUFFER_TYPE_SEND );if (unlikely (err)) goto err_deregister;Signature · 1 line
2.28.0
Re: [RFC PATCH 12/97] drm/i915/guc: Don't repeat CTB layout calculations
Quoted 37 lines · Michal Wajdeczko
Quoted 26 lines · Matthew Brost
Quoted 25 lines · Matthew Brost
From: Michal Wajdeczko <[email protected]>
We can retrieve offsets to cmds buffers and descriptor from actual pointers that we already keep locally.
Signed-off-by Michal Wajdeczko <[email protected]>Signed-off-by Matthew Brost <[email protected]>--- drivers/gpu/drm/i915/gt/uc/intel_guc_ct.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-)drivers/gpu/drm/i915/gt/uc/intel_guc_ct.c +1
-0@@ -244,6 +244,7 @@ int intel_guc_ct_enable(struct intel_guc_ct *ct) {struct intel_guc *guc =ct_to_guc (ct);u32 base, cmds; +void *blob;int err;int i;@@ -251,15 +252,18 @@ int intel_guc_ct_enable(struct intel_guc_ct *ct)Quoted 7 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_ct.c int intel_guc_ct_enable(struct intel_guc_ct *ct) · line 255
Quoted 3 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_ct.c +1
-0/* vma should be already allocated and map'ed */ GEM_BUG_ON (!ct->vma); +GEM_BUG_ON (!i915_gem_object_has_pinned_pages (ct->vma->obj));This doesn't really have anything to do with this patch, but again this patch will be squashed into a large patch updating the GuC firmware, so I think this is fine.
Quoted 2 lines
again, no need to squash GuC patches up to 20/97
Got it. As discussed I will post patches 4-20 after I done reviewing all of them.
Matt
Quoted 40 lines
Quoted 40 lines
With that:
Reviewed-by Matthew Brost <[email protected]>Quoted 36 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_ct.c +8
-6base =intel_guc_ggtt_offset (guc, ct->vma); -/* (re)initialize descriptors -* cmds buffers are in the second half of the blob page -*/ +/* blob should start with send descriptor */ + blob =__px_vaddr (ct->vma->obj); +GEM_BUG_ON (blob != ct->ctbs[CTB_SEND ].desc); + +/* (re)initialize descriptors */ for (i =0 ; i <ARRAY_SIZE (ct->ctbs); i++) {GEM_BUG_ON ((i !=CTB_SEND ) && (i !=CTB_RECV )); - cmds = base +PAGE_SIZE /4 * i +PAGE_SIZE /2 ; + cmds = base +ptrdiff (ct->ctbs[i].cmds, blob);CT_DEBUG (ct,"%d: cmds addr=%#x\n" , i, cmds);guc_ct_buffer_reset (&ct->ctbs[i], cmds);@@ -269,12 +273,12 @@ int intel_guc_ct_enable(struct intel_guc_ct *ct)* Register both CT buffers starting with RECV buffer. * Descriptors are in first half of the blob. */ - err =ct_register_buffer (ct, base +PAGE_SIZE /4 *CTB_RECV , + err =ct_register_buffer (ct, base +ptrdiff (ct->ctbs[CTB_RECV ].desc, blob),INTEL_GUC_CT_BUFFER_TYPE_RECV );if (unlikely (err)) goto err_out; - err =ct_register_buffer (ct, base +PAGE_SIZE /4 *CTB_SEND , + err =ct_register_buffer (ct, base +ptrdiff (ct->ctbs[CTB_SEND ].desc, blob),INTEL_GUC_CT_BUFFER_TYPE_SEND );if (unlikely (err)) goto err_deregister;Signature · 1 line
2.28.0
RFC PATCH 13/97 drm/i915/guc: Replace CTB array with explicit members
In reply to Matthew BrostFrom: Michal Wajdeczko <[email protected]>
Upcoming GuC firmware will always require just two CTBs and we also plan to configure them with different sizes, so definining them as array is no longer suitable.
--- drivers/gpu/drm/i915/gt/uc/intel_guc_ct.c | 46 ++++++++++++----------- drivers/gpu/drm/i915/gt/uc/intel_guc_ct.h | 7 +++- 2 files changed, 30 insertions(+), 23 deletions(-)
drivers/gpu/drm/i915/gt/uc/intel_guc_ct.c +25 -21
@@ -168,10 +168,10 @@ int intel_guc_ct_init(struct intel_guc_ct *ct)struct intel_guc *guc =ct_to_guc (ct);struct guc_ct_buffer_desc *desc;u32 blob_size; +u32 cmds_size;void *blob;u32 *cmds;int err; -int i;GEM_BUG_ON (ct->vma);
@@ -207,15 +207,23 @@ int intel_guc_ct_init(struct intel_guc_ct *ct)CT_DEBUG (ct,"base=%#x size=%u\n" ,intel_guc_ggtt_offset (guc, ct->vma), blob_size); -/* store pointers to desc and cmds */ -for (i =0 ; i <ARRAY_SIZE (ct->ctbs); i++) { -GEM_BUG_ON ((i !=CTB_SEND ) && (i !=CTB_RECV )); +/* store pointers to desc and cmds for send ctb */ + desc = blob; + cmds = blob +PAGE_SIZE /2 ; + cmds_size =PAGE_SIZE /4 ; +CT_DEBUG (ct,"%s desc %#lx cmds %#lx size %u\n" ,"send" , +ptrdiff (desc, blob),ptrdiff (cmds, blob), cmds_size); - desc = blob +PAGE_SIZE /4 * i; - cmds = blob +PAGE_SIZE /4 * i +PAGE_SIZE /2 ; +guc_ct_buffer_init (&ct->ctbs.send, desc, cmds, cmds_size); -guc_ct_buffer_init (&ct->ctbs[i], desc, cmds,PAGE_SIZE /4 ); - } +/* store pointers to desc and cmds for recv ctb */ + desc = blob +PAGE_SIZE /4 ; + cmds = blob +PAGE_SIZE /4 +PAGE_SIZE /2 ; + cmds_size =PAGE_SIZE /4 ; +CT_DEBUG (ct,"%s desc %#lx cmds %#lx size %u\n" ,"recv" , +ptrdiff (desc, blob),ptrdiff (cmds, blob), cmds_size); + +guc_ct_buffer_init (&ct->ctbs.recv, desc, cmds, cmds_size);return 0 ; }
@@ -246,7 +254,6 @@ int intel_guc_ct_enable(struct intel_guc_ct *ct)u32 base, cmds;void *blob;int err; -int i;GEM_BUG_ON (ct->enabled);
@@ -257,28 +264,25 @@ int intel_guc_ct_enable(struct intel_guc_ct *ct)/* blob should start with send descriptor */ blob =__px_vaddr (ct->vma->obj); -GEM_BUG_ON (blob != ct->ctbs[CTB_SEND ].desc); +GEM_BUG_ON (blob != ct->ctbs.send.desc);/* (re)initialize descriptors */ -for (i =0 ; i <ARRAY_SIZE (ct->ctbs); i++) { -GEM_BUG_ON ((i !=CTB_SEND ) && (i !=CTB_RECV )); + cmds = base +ptrdiff (ct->ctbs.send.cmds, blob); +guc_ct_buffer_reset (&ct->ctbs.send, cmds); - cmds = base +ptrdiff (ct->ctbs[i].cmds, blob); -CT_DEBUG (ct,"%d: cmds addr=%#x\n" , i, cmds); - -guc_ct_buffer_reset (&ct->ctbs[i], cmds); - } + cmds = base +ptrdiff (ct->ctbs.recv.cmds, blob); +guc_ct_buffer_reset (&ct->ctbs.recv, cmds);/* * Register both CT buffers starting with RECV buffer. * Descriptors are in first half of the blob. */ - err =ct_register_buffer (ct, base +ptrdiff (ct->ctbs[CTB_RECV ].desc, blob), + err =ct_register_buffer (ct, base +ptrdiff (ct->ctbs.recv.desc, blob),INTEL_GUC_CT_BUFFER_TYPE_RECV );if (unlikely (err)) goto err_out; - err =ct_register_buffer (ct, base +ptrdiff (ct->ctbs[CTB_SEND ].desc, blob), + err =ct_register_buffer (ct, base +ptrdiff (ct->ctbs.send.desc, blob),INTEL_GUC_CT_BUFFER_TYPE_SEND );if (unlikely (err)) goto err_deregister;
@@ -341,7 +345,7 @@ static int ct_write(struct intel_guc_ct *ct, u32 len /* in dwords */, u32 fence) { -struct intel_guc_ct_buffer *ctb = &ct->ctbs[CTB_SEND ]; +struct intel_guc_ct_buffer *ctb = &ct->ctbs.send;struct guc_ct_buffer_desc *desc = ctb->desc;u32 head = desc->head;u32 tail = desc->tail;
@@ -557,7 +561,7 @@ static inline bool ct_header_is_response(u32 header)static int ct_read (struct intel_guc_ct *ct,u32 *data) { -struct intel_guc_ct_buffer *ctb = &ct->ctbs[CTB_RECV ]; +struct intel_guc_ct_buffer *ctb = &ct->ctbs.recv;struct guc_ct_buffer_desc *desc = ctb->desc;u32 head = desc->head;u32 tail = desc->tail;
drivers/gpu/drm/i915/gt/uc/intel_guc_ct.h +5 -2
@@ -47,8 +47,11 @@ struct intel_guc_ct {struct i915_vma *vma;bool enabled; -/* buffers for sending(0) and receiving(1) commands */ -struct intel_guc_ct_buffer ctbs[2 ]; +/* buffers for sending and receiving commands */ +struct { +struct intel_guc_ct_buffer send; +struct intel_guc_ct_buffer recv; + } ctbs;struct {u32 last_fence;/* last fence used to send request */
Signature · 1 line
2.28.0
Re: [RFC PATCH 13/97] drm/i915/guc: Replace CTB array with explicit members
Quoted 8 lines · Matthew Brost
From: Michal Wajdeczko <[email protected]>
Upcoming GuC firmware will always require just two CTBs and we also plan to configure them with different sizes, so definining them as array is no longer suitable.
Signed-off-by Michal Wajdeczko <[email protected]>Signed-off-by Matthew Brost <[email protected]>
Quoted 135 lines
--- drivers/gpu/drm/i915/gt/uc/intel_guc_ct.c | 46 ++++++++++++----------- drivers/gpu/drm/i915/gt/uc/intel_guc_ct.h | 7 +++- 2 files changed, 30 insertions(+), 23 deletions(-)drivers/gpu/drm/i915/gt/uc/intel_guc_ct.c +25
-21@@ -168,10 +168,10 @@ int intel_guc_ct_init(struct intel_guc_ct *ct)struct intel_guc *guc =ct_to_guc (ct);struct guc_ct_buffer_desc *desc;u32 blob_size; +u32 cmds_size;void *blob;u32 *cmds;int err; -int i;GEM_BUG_ON (ct->vma);@@ -207,15 +207,23 @@ int intel_guc_ct_init(struct intel_guc_ct *ct)CT_DEBUG (ct,"base=%#x size=%u\n" ,intel_guc_ggtt_offset (guc, ct->vma), blob_size); -/* store pointers to desc and cmds */ -for (i =0 ; i <ARRAY_SIZE (ct->ctbs); i++) { -GEM_BUG_ON ((i !=CTB_SEND ) && (i !=CTB_RECV )); +/* store pointers to desc and cmds for send ctb */ + desc = blob; + cmds = blob +PAGE_SIZE /2 ; + cmds_size =PAGE_SIZE /4 ; +CT_DEBUG (ct,"%s desc %#lx cmds %#lx size %u\n" ,"send" , +ptrdiff (desc, blob),ptrdiff (cmds, blob), cmds_size); - desc = blob +PAGE_SIZE /4 * i; - cmds = blob +PAGE_SIZE /4 * i +PAGE_SIZE /2 ; +guc_ct_buffer_init (&ct->ctbs.send, desc, cmds, cmds_size); -guc_ct_buffer_init (&ct->ctbs[i], desc, cmds,PAGE_SIZE /4 ); - } +/* store pointers to desc and cmds for recv ctb */ + desc = blob +PAGE_SIZE /4 ; + cmds = blob +PAGE_SIZE /4 +PAGE_SIZE /2 ; + cmds_size =PAGE_SIZE /4 ; +CT_DEBUG (ct,"%s desc %#lx cmds %#lx size %u\n" ,"recv" , +ptrdiff (desc, blob),ptrdiff (cmds, blob), cmds_size); + +guc_ct_buffer_init (&ct->ctbs.recv, desc, cmds, cmds_size);return 0 ; }@@ -246,7 +254,6 @@ int intel_guc_ct_enable(struct intel_guc_ct *ct)u32 base, cmds;void *blob;int err; -int i;GEM_BUG_ON (ct->enabled);@@ -257,28 +264,25 @@ int intel_guc_ct_enable(struct intel_guc_ct *ct)/* blob should start with send descriptor */ blob =__px_vaddr (ct->vma->obj); -GEM_BUG_ON (blob != ct->ctbs[CTB_SEND ].desc); +GEM_BUG_ON (blob != ct->ctbs.send.desc);/* (re)initialize descriptors */ -for (i =0 ; i <ARRAY_SIZE (ct->ctbs); i++) { -GEM_BUG_ON ((i !=CTB_SEND ) && (i !=CTB_RECV )); + cmds = base +ptrdiff (ct->ctbs.send.cmds, blob); +guc_ct_buffer_reset (&ct->ctbs.send, cmds); - cmds = base +ptrdiff (ct->ctbs[i].cmds, blob); -CT_DEBUG (ct,"%d: cmds addr=%#x\n" , i, cmds); - -guc_ct_buffer_reset (&ct->ctbs[i], cmds); - } + cmds = base +ptrdiff (ct->ctbs.recv.cmds, blob); +guc_ct_buffer_reset (&ct->ctbs.recv, cmds);/* * Register both CT buffers starting with RECV buffer. * Descriptors are in first half of the blob. */ - err =ct_register_buffer (ct, base +ptrdiff (ct->ctbs[CTB_RECV ].desc, blob), + err =ct_register_buffer (ct, base +ptrdiff (ct->ctbs.recv.desc, blob),INTEL_GUC_CT_BUFFER_TYPE_RECV );if (unlikely (err)) goto err_out; - err =ct_register_buffer (ct, base +ptrdiff (ct->ctbs[CTB_SEND ].desc, blob), + err =ct_register_buffer (ct, base +ptrdiff (ct->ctbs.send.desc, blob),INTEL_GUC_CT_BUFFER_TYPE_SEND );if (unlikely (err)) goto err_deregister;@@ -341,7 +345,7 @@ static int ct_write(struct intel_guc_ct *ct, u32 len /* in dwords */, u32 fence) { -struct intel_guc_ct_buffer *ctb = &ct->ctbs[CTB_SEND ]; +struct intel_guc_ct_buffer *ctb = &ct->ctbs.send;struct guc_ct_buffer_desc *desc = ctb->desc;u32 head = desc->head;u32 tail = desc->tail;@@ -557,7 +561,7 @@ static inline bool ct_header_is_response(u32 header)static int ct_read (struct intel_guc_ct *ct,u32 *data) { -struct intel_guc_ct_buffer *ctb = &ct->ctbs[CTB_RECV ]; +struct intel_guc_ct_buffer *ctb = &ct->ctbs.recv;struct guc_ct_buffer_desc *desc = ctb->desc;u32 head = desc->head;u32 tail = desc->tail;drivers/gpu/drm/i915/gt/uc/intel_guc_ct.h +5
-2@@ -47,8 +47,11 @@ struct intel_guc_ct {struct i915_vma *vma;bool enabled; -/* buffers for sending(0) and receiving(1) commands */ -struct intel_guc_ct_buffer ctbs[2 ]; +/* buffers for sending and receiving commands */ +struct { +struct intel_guc_ct_buffer send; +struct intel_guc_ct_buffer recv; + } ctbs;struct {u32 last_fence;/* last fence used to send request */ Signature · 1 line
2.28.0
RFC PATCH 14/97 drm/i915/guc: Update sizes of CTB buffers
In reply to Matthew BrostFrom: Michal Wajdeczko <[email protected]>
Future GuC will require CTB buffers sizes to be multiple of 4K. Make these changes now as this shouldn't impact us too much.
--- drivers/gpu/drm/i915/gt/uc/intel_guc_ct.c | 60 ++++++++++++----------- 1 file changed, 32 insertions(+), 28 deletions(-)
drivers/gpu/drm/i915/gt/uc/intel_guc_ct.c +32 -28
@@ -38,6 +38,32 @@ static inline struct drm_device *ct_to_drm(struct intel_guc_ct *ct)#define CT_PROBE_ERROR (_ct, _fmt, ...) \ i915_probe_error(ct_to_i915(ct), "CT: " _fmt, ##__VA_ARGS__); +/** +* DOC: CTB Blob +* +* We allocate single blob to hold both CTB descriptors and buffers: +* +* +--------+-----------------------------------------------+------+ +* | offset | contents | size | +* +========+===============================================+======+ +* | 0x0000 | H2G `CTB Descriptor`_ (send) | | +* +--------+-----------------------------------------------+ 4K | +* | 0x0800 | G2H `CTB Descriptor`_ (recv) | | +* +--------+-----------------------------------------------+------+ +* | 0x1000 | H2G `CT Buffer`_ (send) | n*4K | +* | | | | +* +--------+-----------------------------------------------+------+ +* | 0x1000 | G2H `CT Buffer`_ (recv) | m*4K | +* | + n*4K | | | +* +--------+-----------------------------------------------+------+ +* +* Size of each `CT Buffer`_ must be multiple of 4K. +* As we don't expect too many messages, for now use minimum sizes. +*/ +#define CTB_DESC_SIZE ALIGN(sizeof(struct guc_ct_buffer_desc), SZ_2K) +#define CTB_H2G_BUFFER_SIZE (SZ_4K) +#define CTB_G2H_BUFFER_SIZE (SZ_4K) +struct ct_request {struct list_head link;u32 fence;
@@ -175,29 +201,7 @@ int intel_guc_ct_init(struct intel_guc_ct *ct)GEM_BUG_ON (ct->vma); -/* We allocate 1 page to hold both descriptors and both buffers. -* ___________..................... -* |desc (SEND)| : -* |___________| PAGE/4 -* :___________....................: -* |desc (RECV)| : -* |___________| PAGE/4 -* :_______________________________: -* |cmds (SEND) | -* | PAGE/4 -* |_______________________________| -* |cmds (RECV) | -* | PAGE/4 -* |_______________________________| -* -* Each message can use a maximum of 32 dwords and we don't expect to -* have more than 1 in flight at any time, so we have enough space. -* Some logic further ahead will rely on the fact that there is only 1 -* page and that it is always mapped, so if the size is changed the -* other code will need updating as well. -*/ - - blob_size =PAGE_SIZE ; + blob_size =2 *CTB_DESC_SIZE +CTB_H2G_BUFFER_SIZE +CTB_G2H_BUFFER_SIZE ; err =intel_guc_allocate_and_map_vma (guc, blob_size, &ct->vma, &blob);if (unlikely (err)) { CT_PROBE_ERROR(ct, "Failed to allocate %u for CTB data (%pe)\n",
@@ -209,17 +213,17 @@ int intel_guc_ct_init(struct intel_guc_ct *ct)/* store pointers to desc and cmds for send ctb */ desc = blob; - cmds = blob +PAGE_SIZE /2 ; - cmds_size =PAGE_SIZE /4 ; + cmds = blob +2 *CTB_DESC_SIZE ; + cmds_size =CTB_H2G_BUFFER_SIZE ;CT_DEBUG (ct,"%s desc %#lx cmds %#lx size %u\n" ,"send" ,ptrdiff (desc, blob),ptrdiff (cmds, blob), cmds_size);guc_ct_buffer_init (&ct->ctbs.send, desc, cmds, cmds_size);/* store pointers to desc and cmds for recv ctb */ - desc = blob +PAGE_SIZE /4 ; - cmds = blob +PAGE_SIZE /4 +PAGE_SIZE /2 ; - cmds_size =PAGE_SIZE /4 ; + desc = blob +CTB_DESC_SIZE ; + cmds = blob +2 *CTB_DESC_SIZE +CTB_H2G_BUFFER_SIZE ; + cmds_size =CTB_G2H_BUFFER_SIZE ;CT_DEBUG (ct,"%s desc %#lx cmds %#lx size %u\n" ,"recv" ,ptrdiff (desc, blob),ptrdiff (cmds, blob), cmds_size);
Signature · 1 line
2.28.0
Re: [RFC PATCH 14/97] drm/i915/guc: Update sizes of CTB buffers
Quoted 81 lines · Matthew Brost
From: Michal Wajdeczko <[email protected]>
Future GuC will require CTB buffers sizes to be multiple of 4K. Make these changes now as this shouldn't impact us too much.
Signed-off-by Michal Wajdeczko <[email protected]>Signed-off-by Matthew Brost <[email protected]>Cc John Harrison <[email protected]>--- drivers/gpu/drm/i915/gt/uc/intel_guc_ct.c | 60 ++++++++++++----------- 1 file changed, 32 insertions(+), 28 deletions(-)drivers/gpu/drm/i915/gt/uc/intel_guc_ct.c +27
-23@@ -38,6 +38,32 @@ static inline struct drm_device *ct_to_drm(struct intel_guc_ct *ct)#define CT_PROBE_ERROR (_ct, _fmt, ...) \ i915_probe_error(ct_to_i915(ct), "CT: " _fmt, ##__VA_ARGS__); +/** +* DOC: CTB Blob +* +* We allocate single blob to hold both CTB descriptors and buffers: +* +* +--------+-----------------------------------------------+------+ +* | offset | contents | size | +* +========+===============================================+======+ +* | 0x0000 | H2G `CTB Descriptor`_ (send) | | +* +--------+-----------------------------------------------+ 4K | +* | 0x0800 | G2H `CTB Descriptor`_ (recv) | | +* +--------+-----------------------------------------------+------+ +* | 0x1000 | H2G `CT Buffer`_ (send) | n*4K | +* | | | | +* +--------+-----------------------------------------------+------+ +* | 0x1000 | G2H `CT Buffer`_ (recv) | m*4K | +* | + n*4K | | | +* +--------+-----------------------------------------------+------+ +* +* Size of each `CT Buffer`_ must be multiple of 4K. +* As we don't expect too many messages, for now use minimum sizes. +*/ +#define CTB_DESC_SIZE ALIGN(sizeof(struct guc_ct_buffer_desc), SZ_2K) +#define CTB_H2G_BUFFER_SIZE (SZ_4K) +#define CTB_G2H_BUFFER_SIZE (SZ_4K) +struct ct_request {struct list_head link;u32 fence;@@ -175,29 +201,7 @@ int intel_guc_ct_init(struct intel_guc_ct *ct)GEM_BUG_ON (ct->vma); -/* We allocate 1 page to hold both descriptors and both buffers. -* ___________..................... -* |desc (SEND)| : -* |___________| PAGE/4 -* :___________....................: -* |desc (RECV)| : -* |___________| PAGE/4 -* :_______________________________: -* |cmds (SEND) | -* | PAGE/4 -* |_______________________________| -* |cmds (RECV) | -* | PAGE/4 -* |_______________________________| -* -* Each message can use a maximum of 32 dwords and we don't expect to -* have more than 1 in flight at any time, so we have enough space. -* Some logic further ahead will rely on the fact that there is only 1 -* page and that it is always mapped, so if the size is changed the -* other code will need updating as well. -*/ - - blob_size =PAGE_SIZE ; + blob_size =2 *CTB_DESC_SIZE +CTB_H2G_BUFFER_SIZE +CTB_G2H_BUFFER_SIZE ; err =intel_guc_allocate_and_map_vma (guc, blob_size, &ct->vma, &blob);if (unlikely (err)) { CT_PROBE_ERROR(ct, "Failed to allocate %u for CTB data (%pe)\n",
drivers/gpu/drm/i915/gt/uc/intel_guc_ct.c int intel_guc_ct_init(struct intel_guc_ct *ct) · line 216
Quoted 6 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_ct.c +1
-2@@ -209,17 +213,17 @@ int intel_guc_ct_init(struct intel_guc_ct *ct)/* store pointers to desc and cmds for send ctb */ desc = blob; - cmds = blob +PAGE_SIZE /2 ; - cmds_size =PAGE_SIZE /4 ; + cmds = blob +2 *CTB_DESC_SIZE ;
2 is a magic number here. Think it would be more clear with CTB_NUMBER_DESC define here.
Michal what do you think? We can fix this in the next post of this with your blessing.
With that nit:
Quoted 19 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_ct.c +4
-3+ cmds_size =CTB_H2G_BUFFER_SIZE ;CT_DEBUG (ct,"%s desc %#lx cmds %#lx size %u\n" ,"send" ,ptrdiff (desc, blob),ptrdiff (cmds, blob), cmds_size);guc_ct_buffer_init (&ct->ctbs.send, desc, cmds, cmds_size);/* store pointers to desc and cmds for recv ctb */ - desc = blob +PAGE_SIZE /4 ; - cmds = blob +PAGE_SIZE /4 +PAGE_SIZE /2 ; - cmds_size =PAGE_SIZE /4 ; + desc = blob +CTB_DESC_SIZE ; + cmds = blob +2 *CTB_DESC_SIZE +CTB_H2G_BUFFER_SIZE ; + cmds_size =CTB_G2H_BUFFER_SIZE ;CT_DEBUG (ct,"%s desc %#lx cmds %#lx size %u\n" ,"recv" ,ptrdiff (desc, blob),ptrdiff (cmds, blob), cmds_size);Signature · 1 line
2.28.0
RFC PATCH 15/97 drm/i915/guc: Relax CTB response timeout
In reply to Matthew BrostFrom: Michal Wajdeczko <[email protected]>
In upcoming patch we will allow more CTB requests to be sent in parallel to the GuC for procesing, so we shouldn't assume any more that GuC will always reply without 10ms.
Use bigger value from CONFIG_DRM_I915_HEARTBEAT_INTERVAL instead.
--- drivers/gpu/drm/i915/gt/uc/intel_guc_ct.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/gt/uc/intel_guc_ct.c +7 -1
@@ -436,17 +436,23 @@ static int ct_write(struct intel_guc_ct *ct,*/ static int wait_for_ct_request_update (struct ct_request *req,u32 *status) { +long timeout;int err;/* * Fast commands should complete in less than 10us, so sample quickly * up to that length of time, then switch to a slower sleep-wait loop. * No GuC command should ever take longer than 10ms. +* +* However, there might be other CT requests in flight before this one, +* so use @CONFIG_DRM_I915_HEARTBEAT_INTERVAL as backup timeout value. */ + timeout =max (10 ,CONFIG_DRM_I915_HEARTBEAT_INTERVAL ); +#define done INTEL_GUC_MSG_IS_RESPONSE(READ_ONCE(req->status)) err =wait_for_us (done,10 );if (err) - err =wait_for (done,10 ); + err =wait_for (done, timeout);#undef doneif (unlikely (err))
Signature · 6 lines
2.28.0 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [RFC PATCH 15/97] drm/i915/guc: Relax CTB response timeout
Quoted 8 lines · Matthew Brost
From: Michal Wajdeczko <[email protected]>
In upcoming patch we will allow more CTB requests to be sent in parallel to the GuC for procesing, so we shouldn't assume any more that GuC will always reply without 10ms.
Use bigger value from
CONFIG_DRM_I915_HEARTBEAT_INTERVALinstead.
I think this should be its own config option or we combine it with a config option suggested in patch 37.
What do you think Michal? If you agree I can fix this up in the post of these patches.
Matt
Quoted 38 lines
Signed-off-by Michal Wajdeczko <[email protected]>Signed-off-by Matthew Brost <[email protected]>--- drivers/gpu/drm/i915/gt/uc/intel_guc_ct.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)drivers/gpu/drm/i915/gt/uc/intel_guc_ct.c +7
-1@@ -436,17 +436,23 @@ static int ct_write(struct intel_guc_ct *ct,*/ static int wait_for_ct_request_update (struct ct_request *req,u32 *status) { +long timeout;int err;/* * Fast commands should complete in less than 10us, so sample quickly * up to that length of time, then switch to a slower sleep-wait loop. * No GuC command should ever take longer than 10ms. +* +* However, there might be other CT requests in flight before this one, +* so use @CONFIG_DRM_I915_HEARTBEAT_INTERVAL as backup timeout value. */ + timeout =max (10 ,CONFIG_DRM_I915_HEARTBEAT_INTERVAL ); +#define done INTEL_GUC_MSG_IS_RESPONSE(READ_ONCE(req->status)) err =wait_for_us (done,10 );if (err) - err =wait_for (done,10 ); + err =wait_for (done, timeout);#undef doneif (unlikely (err))Signature · 1 line
2.28.0
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [Intel-gfx] [RFC PATCH 15/97] drm/i915/guc: Relax CTB response timeout
Quoted 7 lines · Matthew Brost
Quoted 6 lines · Matthew Brost
From: Michal Wajdeczko <[email protected]>
In upcoming patch we will allow more CTB requests to be sent in parallel to the GuC for procesing, so we shouldn't assume any more that GuC will always reply without 10ms.
Quoted 8 lines
Quoted 2 lines
Use bigger value from
CONFIG_DRM_I915_HEARTBEAT_INTERVALinstead.I think this should be its own config option or we combine it with a config option suggested in patch 37.
What do you think Michal? If you agree I can fix this up in the post of these patches.
+ Tvrtko
yep, use of dedicated GuC CONFIG is what we also agree internally, existing HEARTBEAT_INTERVAL was just fastest way to bypass 10ms
so, yes, please go ahead and do it right
Quoted 46 lines
Matt
Quoted 38 lines
Signed-off-by Michal Wajdeczko <[email protected]>Signed-off-by Matthew Brost <[email protected]>--- drivers/gpu/drm/i915/gt/uc/intel_guc_ct.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)drivers/gpu/drm/i915/gt/uc/intel_guc_ct.c +7
-1@@ -436,17 +436,23 @@ static int ct_write(struct intel_guc_ct *ct,*/ static int wait_for_ct_request_update (struct ct_request *req,u32 *status) { +long timeout;int err;/* * Fast commands should complete in less than 10us, so sample quickly * up to that length of time, then switch to a slower sleep-wait loop. * No GuC command should ever take longer than 10ms. +* +* However, there might be other CT requests in flight before this one, +* so use @CONFIG_DRM_I915_HEARTBEAT_INTERVAL as backup timeout value. */ + timeout =max (10 ,CONFIG_DRM_I915_HEARTBEAT_INTERVAL ); +#define done INTEL_GUC_MSG_IS_RESPONSE(READ_ONCE(req->status)) err =wait_for_us (done,10 );if (err) - err =wait_for (done,10 ); + err =wait_for (done, timeout);#undef doneif (unlikely (err))Signature · 1 line
2.28.0_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
RFC PATCH 16/97 drm/i915/guc: Start protecting access to CTB descriptors
In reply to Matthew BrostFrom: Michal Wajdeczko <[email protected]>
We want to stop using guc.send_mutex while sending CTB messages so we have to start protecting access to CTB send descriptor.
For completeness protect also CTB send descriptor.
Add spinlock to struct intel_guc_ct_buffer and start using it.
--- drivers/gpu/drm/i915/gt/uc/intel_guc_ct.c | 14 ++++++++++++-- drivers/gpu/drm/i915/gt/uc/intel_guc_ct.h | 2 ++ 2 files changed, 14 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/gt/uc/intel_guc_ct.c +12 -2
@@ -89,6 +89,8 @@ static void ct_incoming_request_worker_func(struct work_struct *w);*/ void intel_guc_ct_init_early (struct intel_guc_ct *ct) { +spin_lock_init (&ct->ctbs.send.lock); +spin_lock_init (&ct->ctbs.recv.lock);spin_lock_init (&ct->requests.lock);INIT_LIST_HEAD (&ct->requests.pending);INIT_LIST_HEAD (&ct->requests.incoming);
@@ -479,17 +481,22 @@ static int ct_send(struct intel_guc_ct *ct,GEM_BUG_ON (len & ~GUC_CT_MSG_LEN_MASK );GEM_BUG_ON (!response_buf && response_buf_size); +spin_lock_irqsave (&ct->ctbs.send.lock, flags); + fence =ct_get_next_fence (ct); request.fence = fence; request.status =0 ; request.response_len = response_buf_size; request.response_buf = response_buf; -spin_lock_irqsave (&ct->requests.lock, flags); +spin_lock (&ct->requests.lock);list_add_tail (&request.link, &ct->requests.pending); -spin_unlock_irqrestore (&ct->requests.lock, flags); +spin_unlock (&ct->requests.lock); err =ct_write (ct, action, len, fence); + +spin_unlock_irqrestore (&ct->ctbs.send.lock, flags); +if (unlikely (err)) goto unlink;
@@ -825,6 +832,7 @@ static int ct_handle_request(struct intel_guc_ct *ct, const u32 *msg)void intel_guc_ct_event_handler (struct intel_guc_ct *ct) {u32 msg[GUC_CT_MSG_LEN_MASK +1 ];/* one extra dw for the header */ +unsigned long flags;int err =0 ;if (unlikely (!ct->enabled)) {
@@ -833,7 +841,9 @@ void intel_guc_ct_event_handler(struct intel_guc_ct *ct) } do { + spin_lock_irqsave(&ct->ctbs.recv.lock, flags); err = ct_read(ct, msg); + spin_unlock_irqrestore(&ct->ctbs.recv.lock, flags); if (err) break;
drivers/gpu/drm/i915/gt/uc/intel_guc_ct.h +2 -0
@@ -27,11 +27,13 @@ struct intel_guc;* record (command transport buffer descriptor) and the actual buffer which * holds the commands. * +* @lock: protects access to the commands buffer and buffer descriptor * @desc: pointer to the buffer descriptor * @cmds: pointer to the commands buffer * @size: size of the commands buffer */ struct intel_guc_ct_buffer { +spinlock_t lock;struct guc_ct_buffer_desc *desc;u32 *cmds;u32 size;
Signature · 6 lines
2.28.0 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [RFC PATCH 16/97] drm/i915/guc: Start protecting access to CTB descriptors
Quoted 6 lines · Matthew Brost
From: Michal Wajdeczko <[email protected]>
We want to stop using guc.send_mutex while sending CTB messages so we have to start protecting access to CTB send descriptor.
For completeness protect also CTB send descriptor.
Michal I think you have a typo here, receive descriptor, right? Again this is going to get squashed in the firmware update patch but thought I'd mention this.
With that:
Quoted 87 lines
Add spinlock to struct
intel_guc_ct_bufferand start using it.Signed-off-by Michal Wajdeczko <[email protected]>Signed-off-by Matthew Brost <[email protected]>--- drivers/gpu/drm/i915/gt/uc/intel_guc_ct.c | 14 ++++++++++++-- drivers/gpu/drm/i915/gt/uc/intel_guc_ct.h | 2 ++ 2 files changed, 14 insertions(+), 2 deletions(-)drivers/gpu/drm/i915/gt/uc/intel_guc_ct.c +12
-2@@ -89,6 +89,8 @@ static void ct_incoming_request_worker_func(struct work_struct *w);*/ void intel_guc_ct_init_early (struct intel_guc_ct *ct) { +spin_lock_init (&ct->ctbs.send.lock); +spin_lock_init (&ct->ctbs.recv.lock);spin_lock_init (&ct->requests.lock);INIT_LIST_HEAD (&ct->requests.pending);INIT_LIST_HEAD (&ct->requests.incoming);@@ -479,17 +481,22 @@ static int ct_send(struct intel_guc_ct *ct,GEM_BUG_ON (len & ~GUC_CT_MSG_LEN_MASK );GEM_BUG_ON (!response_buf && response_buf_size); +spin_lock_irqsave (&ct->ctbs.send.lock, flags); + fence =ct_get_next_fence (ct); request.fence = fence; request.status =0 ; request.response_len = response_buf_size; request.response_buf = response_buf; -spin_lock_irqsave (&ct->requests.lock, flags); +spin_lock (&ct->requests.lock);list_add_tail (&request.link, &ct->requests.pending); -spin_unlock_irqrestore (&ct->requests.lock, flags); +spin_unlock (&ct->requests.lock); err =ct_write (ct, action, len, fence); + +spin_unlock_irqrestore (&ct->ctbs.send.lock, flags); +if (unlikely (err)) goto unlink;@@ -825,6 +832,7 @@ static int ct_handle_request(struct intel_guc_ct *ct, const u32 *msg)void intel_guc_ct_event_handler (struct intel_guc_ct *ct) {u32 msg[GUC_CT_MSG_LEN_MASK +1 ];/* one extra dw for the header */ +unsigned long flags;int err =0 ;if (unlikely (!ct->enabled)) {@@ -833,7 +841,9 @@ void intel_guc_ct_event_handler(struct intel_guc_ct *ct) } do { + spin_lock_irqsave(&ct->ctbs.recv.lock, flags); err = ct_read(ct, msg); + spin_unlock_irqrestore(&ct->ctbs.recv.lock, flags); if (err) break;drivers/gpu/drm/i915/gt/uc/intel_guc_ct.h +2
-0@@ -27,11 +27,13 @@ struct intel_guc;* record (command transport buffer descriptor) and the actual buffer which * holds the commands. * +* @lock: protects access to the commands buffer and buffer descriptor * @desc: pointer to the buffer descriptor * @cmds: pointer to the commands buffer * @size: size of the commands buffer */ struct intel_guc_ct_buffer { +spinlock_t lock;struct guc_ct_buffer_desc *desc;u32 *cmds;u32 size;Signature · 1 line
2.28.0
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [Intel-gfx] [RFC PATCH 16/97] drm/i915/guc: Start protecting access to CTB descriptors
Quoted 9 lines · Matthew Brost
Quoted 6 lines · Matthew Brost
From: Michal Wajdeczko <[email protected]>
We want to stop using guc.send_mutex while sending CTB messages so we have to start protecting access to CTB send descriptor.
For completeness protect also CTB send descriptor.
Michal I think you have a typo here, receive descriptor, right? Again
oops, yes, it's typo
Quoted 2 lines
this is going to get squashed in the firmware update patch but thought I'd mention this.
again, please don't squash patches if not necessary
Quoted 87 lines
With that:
Reviewed-by Matthew Brost <[email protected]>Quoted 83 lines
Add spinlock to struct
intel_guc_ct_bufferand start using it.Signed-off-by Michal Wajdeczko <[email protected]>Signed-off-by Matthew Brost <[email protected]>--- drivers/gpu/drm/i915/gt/uc/intel_guc_ct.c | 14 ++++++++++++-- drivers/gpu/drm/i915/gt/uc/intel_guc_ct.h | 2 ++ 2 files changed, 14 insertions(+), 2 deletions(-)drivers/gpu/drm/i915/gt/uc/intel_guc_ct.c +12
-2@@ -89,6 +89,8 @@ static void ct_incoming_request_worker_func(struct work_struct *w);*/ void intel_guc_ct_init_early (struct intel_guc_ct *ct) { +spin_lock_init (&ct->ctbs.send.lock); +spin_lock_init (&ct->ctbs.recv.lock);spin_lock_init (&ct->requests.lock);INIT_LIST_HEAD (&ct->requests.pending);INIT_LIST_HEAD (&ct->requests.incoming);@@ -479,17 +481,22 @@ static int ct_send(struct intel_guc_ct *ct,GEM_BUG_ON (len & ~GUC_CT_MSG_LEN_MASK );GEM_BUG_ON (!response_buf && response_buf_size); +spin_lock_irqsave (&ct->ctbs.send.lock, flags); + fence =ct_get_next_fence (ct); request.fence = fence; request.status =0 ; request.response_len = response_buf_size; request.response_buf = response_buf; -spin_lock_irqsave (&ct->requests.lock, flags); +spin_lock (&ct->requests.lock);list_add_tail (&request.link, &ct->requests.pending); -spin_unlock_irqrestore (&ct->requests.lock, flags); +spin_unlock (&ct->requests.lock); err =ct_write (ct, action, len, fence); + +spin_unlock_irqrestore (&ct->ctbs.send.lock, flags); +if (unlikely (err)) goto unlink;@@ -825,6 +832,7 @@ static int ct_handle_request(struct intel_guc_ct *ct, const u32 *msg)void intel_guc_ct_event_handler (struct intel_guc_ct *ct) {u32 msg[GUC_CT_MSG_LEN_MASK +1 ];/* one extra dw for the header */ +unsigned long flags;int err =0 ;if (unlikely (!ct->enabled)) {@@ -833,7 +841,9 @@ void intel_guc_ct_event_handler(struct intel_guc_ct *ct) } do { + spin_lock_irqsave(&ct->ctbs.recv.lock, flags); err = ct_read(ct, msg); + spin_unlock_irqrestore(&ct->ctbs.recv.lock, flags); if (err) break;drivers/gpu/drm/i915/gt/uc/intel_guc_ct.h +2
-0@@ -27,11 +27,13 @@ struct intel_guc;* record (command transport buffer descriptor) and the actual buffer which * holds the commands. * +* @lock: protects access to the commands buffer and buffer descriptor * @desc: pointer to the buffer descriptor * @cmds: pointer to the commands buffer * @size: size of the commands buffer */ struct intel_guc_ct_buffer { +spinlock_t lock;struct guc_ct_buffer_desc *desc;u32 *cmds;
Quoted 9 lines
Quoted 4 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_ct.h +0
-0u32 size;Signature · 1 line
2.28.0_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [RFC PATCH 16/97] drm/i915/guc: Start protecting access to CTB descriptors
In reply to Matthew BrostQuoted 11 lines · Matthew Brost
From: Michal Wajdeczko <[email protected]>
We want to stop using guc.send_mutex while sending CTB messages so we have to start protecting access to CTB send descriptor.
For completeness protect also CTB send descriptor.
Add spinlock to struct
intel_guc_ct_bufferand start using it.Signed-off-by Michal Wajdeczko <[email protected]>Signed-off-by Matthew Brost <[email protected]>
Quoted 82 lines
--- drivers/gpu/drm/i915/gt/uc/intel_guc_ct.c | 14 ++++++++++++-- drivers/gpu/drm/i915/gt/uc/intel_guc_ct.h | 2 ++ 2 files changed, 14 insertions(+), 2 deletions(-)drivers/gpu/drm/i915/gt/uc/intel_guc_ct.c +12
-2@@ -89,6 +89,8 @@ static void ct_incoming_request_worker_func(struct work_struct *w);*/ void intel_guc_ct_init_early (struct intel_guc_ct *ct) { +spin_lock_init (&ct->ctbs.send.lock); +spin_lock_init (&ct->ctbs.recv.lock);spin_lock_init (&ct->requests.lock);INIT_LIST_HEAD (&ct->requests.pending);INIT_LIST_HEAD (&ct->requests.incoming);@@ -479,17 +481,22 @@ static int ct_send(struct intel_guc_ct *ct,GEM_BUG_ON (len & ~GUC_CT_MSG_LEN_MASK );GEM_BUG_ON (!response_buf && response_buf_size); +spin_lock_irqsave (&ct->ctbs.send.lock, flags); + fence =ct_get_next_fence (ct); request.fence = fence; request.status =0 ; request.response_len = response_buf_size; request.response_buf = response_buf; -spin_lock_irqsave (&ct->requests.lock, flags); +spin_lock (&ct->requests.lock);list_add_tail (&request.link, &ct->requests.pending); -spin_unlock_irqrestore (&ct->requests.lock, flags); +spin_unlock (&ct->requests.lock); err =ct_write (ct, action, len, fence); + +spin_unlock_irqrestore (&ct->ctbs.send.lock, flags); +if (unlikely (err)) goto unlink;@@ -825,6 +832,7 @@ static int ct_handle_request(struct intel_guc_ct *ct, const u32 *msg)void intel_guc_ct_event_handler (struct intel_guc_ct *ct) {u32 msg[GUC_CT_MSG_LEN_MASK +1 ];/* one extra dw for the header */ +unsigned long flags;int err =0 ;if (unlikely (!ct->enabled)) {@@ -833,7 +841,9 @@ void intel_guc_ct_event_handler(struct intel_guc_ct *ct) } do { + spin_lock_irqsave(&ct->ctbs.recv.lock, flags); err = ct_read(ct, msg); + spin_unlock_irqrestore(&ct->ctbs.recv.lock, flags); if (err) break;drivers/gpu/drm/i915/gt/uc/intel_guc_ct.h +2
-0@@ -27,11 +27,13 @@ struct intel_guc;* record (command transport buffer descriptor) and the actual buffer which * holds the commands. * +* @lock: protects access to the commands buffer and buffer descriptor * @desc: pointer to the buffer descriptor * @cmds: pointer to the commands buffer * @size: size of the commands buffer */ struct intel_guc_ct_buffer { +spinlock_t lock;struct guc_ct_buffer_desc *desc;u32 *cmds;u32 size;Signature · 1 line
2.28.0
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
RFC PATCH 17/97 drm/i915/guc: Stop using mutex while sending CTB messages
In reply to Matthew BrostFrom: Michal Wajdeczko <[email protected]>
We are no longer using descriptor to hold G2H replies and we are protecting access to the descriptor and command buffer by the separate spinlock, so we can stop using mutex.
--- drivers/gpu/drm/i915/gt/uc/intel_guc_ct.c | 4 ---- 1 file changed, 4 deletions(-)
drivers/gpu/drm/i915/gt/uc/intel_guc_ct.c +0 -4
@@ -537,7 +537,6 @@ static int ct_send(struct intel_guc_ct *ct,int intel_guc_ct_send (struct intel_guc_ct *ct,const u32 *action,u32 len,u32 *response_buf,u32 response_buf_size) { -struct intel_guc *guc =ct_to_guc (ct);u32 status = ~0 ;/* undefined */ int ret;
@@ -546,8 +545,6 @@ int intel_guc_ct_send(struct intel_guc_ct *ct, const u32 *action, u32 len,return -ENODEV ; } -mutex_lock (&guc->send_mutex); - ret =ct_send (ct, action, len, response_buf, response_buf_size, &status);if (unlikely (ret <0 )) { CT_ERROR(ct, "Sending action %#x failed (err=%d status=%#X)\n",
@@ -557,7 +554,6 @@ int intel_guc_ct_send(struct intel_guc_ct *ct, const u32 *action, u32 len, action[0], ret, ret); } -mutex_unlock (&guc->send_mutex);return ret; }
Signature · 6 lines
2.28.0 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [RFC PATCH 17/97] drm/i915/guc: Stop using mutex while sending CTB messages
Quoted 8 lines · Matthew Brost
From: Michal Wajdeczko <[email protected]>
We are no longer using descriptor to hold G2H replies and we are protecting access to the descriptor and command buffer by the separate spinlock, so we can stop using mutex.
Signed-off-by Michal Wajdeczko <[email protected]>Signed-off-by Matthew Brost <[email protected]>
Quoted 36 lines
--- drivers/gpu/drm/i915/gt/uc/intel_guc_ct.c | 4 ---- 1 file changed, 4 deletions(-)drivers/gpu/drm/i915/gt/uc/intel_guc_ct.c +0
-4@@ -537,7 +537,6 @@ static int ct_send(struct intel_guc_ct *ct,int intel_guc_ct_send (struct intel_guc_ct *ct,const u32 *action,u32 len,u32 *response_buf,u32 response_buf_size) { -struct intel_guc *guc =ct_to_guc (ct);u32 status = ~0 ;/* undefined */ int ret;@@ -546,8 +545,6 @@ int intel_guc_ct_send(struct intel_guc_ct *ct, const u32 *action, u32 len,return -ENODEV ; } -mutex_lock (&guc->send_mutex); - ret =ct_send (ct, action, len, response_buf, response_buf_size, &status);if (unlikely (ret <0 )) { CT_ERROR(ct, "Sending action %#x failed (err=%d status=%#X)\n",@@ -557,7 +554,6 @@ int intel_guc_ct_send(struct intel_guc_ct *ct, const u32 *action, u32 len, action[0], ret, ret); } -mutex_unlock (&guc->send_mutex);return ret; }Signature · 1 line
2.28.0
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
RFC PATCH 18/97 drm/i915/guc: Don't receive all G2H messages in irq handler
In reply to Matthew BrostFrom: Michal Wajdeczko <[email protected]>
In irq handler try to receive just single G2H message, let other messages to be received from tasklet.
--- drivers/gpu/drm/i915/gt/uc/intel_guc_ct.c | 67 ++++++++++++++++------- drivers/gpu/drm/i915/gt/uc/intel_guc_ct.h | 3 + 2 files changed, 50 insertions(+), 20 deletions(-)
drivers/gpu/drm/i915/gt/uc/intel_guc_ct.c +47 -20
@@ -81,6 +81,7 @@ enum { CTB_SEND = 0, CTB_RECV = 1 };enum {CTB_OWNER_HOST =0 }; +static void ct_receive_tasklet_func (unsigned long data);static void ct_incoming_request_worker_func (struct work_struct *w);/**
@@ -95,6 +96,7 @@ void intel_guc_ct_init_early(struct intel_guc_ct *ct)INIT_LIST_HEAD (&ct->requests.pending);INIT_LIST_HEAD (&ct->requests.incoming);INIT_WORK (&ct->requests.worker, ct_incoming_request_worker_func); +tasklet_init (&ct->receive_tasklet, ct_receive_tasklet_func, (unsigned long )ct); }static inline const char *guc_ct_buffer_type_to_str (u32 type)
@@ -244,6 +246,7 @@ void intel_guc_ct_fini(struct intel_guc_ct *ct) {GEM_BUG_ON (ct->enabled); +tasklet_kill (&ct->receive_tasklet);i915_vma_unpin_and_release (&ct->vma,I915_VMA_RELEASE_MAP );memset (ct,0 ,sizeof (*ct)); }
@@ -629,7 +632,7 @@ static int ct_read(struct intel_guc_ct *ct, u32 *data)CT_DEBUG (ct,"received %*ph\n" ,4 * len, data); desc->head = head *4 ; -return 0 ; +return available - len; corrupted: CT_ERROR(ct, "Corrupted descriptor addr=%#x head=%u tail=%u size=%u\n",
@@ -665,10 +668,10 @@ static int ct_handle_response(struct intel_guc_ct *ct, const u32 *msg)u32 status;u32 datalen;struct ct_request *req; +unsigned long flags;bool found = false;GEM_BUG_ON (!ct_header_is_response (header)); -GEM_BUG_ON (!in_irq ());/* Response payload shall at least include fence and status */ if (unlikely (len <2 )) {
@@ -688,7 +691,7 @@ static int ct_handle_response(struct intel_guc_ct *ct, const u32 *msg)CT_DEBUG (ct,"response fence %u status %#x\n" , fence, status); -spin_lock (&ct->requests.lock); +spin_lock_irqsave (&ct->requests.lock, flags);list_for_each_entry (req, &ct->requests.pending, link) {if (unlikely (fence != req->fence)) { CT_DEBUG(ct, "request %u awaits response\n",
@@ -707,7 +710,7 @@ static int ct_handle_response(struct intel_guc_ct *ct, const u32 *msg) found = true;break ; } -spin_unlock (&ct->requests.lock); +spin_unlock_irqrestore (&ct->requests.lock, flags);if (!found)CT_ERROR (ct,"Unsolicited response %*ph\n" , msgsize, msg);
@@ -821,31 +824,55 @@ static int ct_handle_request(struct intel_guc_ct *ct, const u32 *msg)return 0 ; } +static int ct_receive (struct intel_guc_ct *ct) +{ +u32 msg[GUC_CT_MSG_LEN_MASK +1 ];/* one extra dw for the header */ +unsigned long flags; +int ret; + +spin_lock_irqsave (&ct->ctbs.recv.lock, flags); + ret =ct_read (ct, msg); +spin_unlock_irqrestore (&ct->ctbs.recv.lock, flags); +if (ret <0 ) +return ret; + +if (ct_header_is_response (msg[0 ])) +ct_handle_response (ct, msg); +else +ct_handle_request (ct, msg); + +return ret; +} + +static void ct_try_receive_message (struct intel_guc_ct *ct) +{ +int ret; + +if (GEM_WARN_ON (!ct->enabled)) +return ; + + ret =ct_receive (ct); +if (ret >0 ) +tasklet_hi_schedule (&ct->receive_tasklet); +} + +static void ct_receive_tasklet_func (unsigned long data) +{ +struct intel_guc_ct *ct = (struct intel_guc_ct *)data; + +ct_try_receive_message (ct); +} +/* * When we're communicating with the GuC over CT, GuC uses events * to notify us about new messages being posted on the RECV buffer. */ void intel_guc_ct_event_handler (struct intel_guc_ct *ct) { -u32 msg[GUC_CT_MSG_LEN_MASK +1 ];/* one extra dw for the header */ -unsigned long flags; -int err =0 ; -if (unlikely (!ct->enabled)) {WARN (1 ,"Unexpected GuC event received while CT disabled!\n" );return ; } -do { -spin_lock_irqsave (&ct->ctbs.recv.lock, flags); - err =ct_read (ct, msg); -spin_unlock_irqrestore (&ct->ctbs.recv.lock, flags); -if (err) -break ; - -if (ct_header_is_response (msg[0 ])) - err =ct_handle_response (ct, msg); -else - err =ct_handle_request (ct, msg); - }while (!err); +ct_try_receive_message (ct); }
drivers/gpu/drm/i915/gt/uc/intel_guc_ct.h +3 -0
@@ -6,6 +6,7 @@#ifndef _INTEL_GUC_CT_H_#define _INTEL_GUC_CT_H_ +#include <linux/interrupt.h> #include <linux/spinlock.h> #include <linux/workqueue.h>
@@ -55,6 +56,8 @@ struct intel_guc_ct {struct intel_guc_ct_buffer recv; } ctbs; +struct tasklet_struct receive_tasklet; +struct {u32 last_fence;/* last fence used to send request */
Signature · 6 lines
2.28.0 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [RFC PATCH 18/97] drm/i915/guc: Don't receive all G2H messages in irq handler
Quoted 25 lines · Matthew Brost
From: Michal Wajdeczko <[email protected]>
In irq handler try to receive just single G2H message, let other messages to be received from tasklet.
Signed-off-by Michal Wajdeczko <[email protected]>Signed-off-by Matthew Brost <[email protected]>--- drivers/gpu/drm/i915/gt/uc/intel_guc_ct.c | 67 ++++++++++++++++------- drivers/gpu/drm/i915/gt/uc/intel_guc_ct.h | 3 + 2 files changed, 50 insertions(+), 20 deletions(-)drivers/gpu/drm/i915/gt/uc/intel_guc_ct.c +1
-0@@ -81,6 +81,7 @@ enum { CTB_SEND = 0, CTB_RECV = 1 };enum {CTB_OWNER_HOST =0 }; +static void ct_receive_tasklet_func (unsigned long data);static void ct_incoming_request_worker_func (struct work_struct *w);/**
drivers/gpu/drm/i915/gt/uc/intel_guc_ct.c void intel_guc_ct_init_early(struct intel_guc_ct *ct) · line 99
Quoted 4 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_ct.c +1
-0@@ -95,6 +96,7 @@ void intel_guc_ct_init_early(struct intel_guc_ct *ct)INIT_LIST_HEAD (&ct->requests.pending);INIT_LIST_HEAD (&ct->requests.incoming);INIT_WORK (&ct->requests.worker, ct_incoming_request_worker_func); +tasklet_init (&ct->receive_tasklet, ct_receive_tasklet_func, (unsigned long )ct);
This function is deprecated. tasklet_setup should be used. I can fix this up when I post the CTB patches.
Quoted 78 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_ct.c +29
-4}static inline const char *guc_ct_buffer_type_to_str (u32 type)@@ -244,6 +246,7 @@ void intel_guc_ct_fini(struct intel_guc_ct *ct) {GEM_BUG_ON (ct->enabled); +tasklet_kill (&ct->receive_tasklet);i915_vma_unpin_and_release (&ct->vma,I915_VMA_RELEASE_MAP );memset (ct,0 ,sizeof (*ct)); }@@ -629,7 +632,7 @@ static int ct_read(struct intel_guc_ct *ct, u32 *data)CT_DEBUG (ct,"received %*ph\n" ,4 * len, data); desc->head = head *4 ; -return 0 ; +return available - len; corrupted: CT_ERROR(ct, "Corrupted descriptor addr=%#x head=%u tail=%u size=%u\n",@@ -665,10 +668,10 @@ static int ct_handle_response(struct intel_guc_ct *ct, const u32 *msg)u32 status;u32 datalen;struct ct_request *req; +unsigned long flags;bool found = false;GEM_BUG_ON (!ct_header_is_response (header)); -GEM_BUG_ON (!in_irq ());/* Response payload shall at least include fence and status */ if (unlikely (len <2 )) {@@ -688,7 +691,7 @@ static int ct_handle_response(struct intel_guc_ct *ct, const u32 *msg)CT_DEBUG (ct,"response fence %u status %#x\n" , fence, status); -spin_lock (&ct->requests.lock); +spin_lock_irqsave (&ct->requests.lock, flags);list_for_each_entry (req, &ct->requests.pending, link) {if (unlikely (fence != req->fence)) { CT_DEBUG(ct, "request %u awaits response\n",@@ -707,7 +710,7 @@ static int ct_handle_response(struct intel_guc_ct *ct, const u32 *msg) found = true;break ; } -spin_unlock (&ct->requests.lock); +spin_unlock_irqrestore (&ct->requests.lock, flags);if (!found)CT_ERROR (ct,"Unsolicited response %*ph\n" , msgsize, msg);@@ -821,31 +824,55 @@ static int ct_handle_request(struct intel_guc_ct *ct, const u32 *msg)return 0 ; } +static int ct_receive (struct intel_guc_ct *ct) +{ +u32 msg[GUC_CT_MSG_LEN_MASK +1 ];/* one extra dw for the header */ +unsigned long flags; +int ret; + +spin_lock_irqsave (&ct->ctbs.recv.lock, flags); + ret =ct_read (ct, msg); +spin_unlock_irqrestore (&ct->ctbs.recv.lock, flags); +if (ret <0 ) +return ret; + +if (ct_header_is_response (msg[0 ])) +ct_handle_response (ct, msg); +else +ct_handle_request (ct, msg); + +return ret; +} + +static void ct_try_receive_message (struct intel_guc_ct *ct) +{ +int ret; +
drivers/gpu/drm/i915/gt/uc/intel_guc_ct.c static int ct_handle_request(struct intel_guc_ct *ct, const u32 *msg) · line 860
Quoted 10 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_ct.c +10
-0+if (GEM_WARN_ON (!ct->enabled)) +return ; + + ret =ct_receive (ct); +if (ret >0 ) +tasklet_hi_schedule (&ct->receive_tasklet); +} + +static void ct_receive_tasklet_func (unsigned long data) +{
As mentioned above tasklet_init is deprecated. The callback now accepts the tasklet structure and ct can be looked up via container_of macro.
Everything else looks good.
With that and changing to the new tasklet API:
Quoted 58 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_ct.c +6
-16+struct intel_guc_ct *ct = (struct intel_guc_ct *)data; + +ct_try_receive_message (ct); +} +/* * When we're communicating with the GuC over CT, GuC uses events * to notify us about new messages being posted on the RECV buffer. */ void intel_guc_ct_event_handler (struct intel_guc_ct *ct) { -u32 msg[GUC_CT_MSG_LEN_MASK +1 ];/* one extra dw for the header */ -unsigned long flags; -int err =0 ; -if (unlikely (!ct->enabled)) {WARN (1 ,"Unexpected GuC event received while CT disabled!\n" );return ; } -do { -spin_lock_irqsave (&ct->ctbs.recv.lock, flags); - err =ct_read (ct, msg); -spin_unlock_irqrestore (&ct->ctbs.recv.lock, flags); -if (err) -break ; - -if (ct_header_is_response (msg[0 ])) - err =ct_handle_response (ct, msg); -else - err =ct_handle_request (ct, msg); - }while (!err); +ct_try_receive_message (ct); }drivers/gpu/drm/i915/gt/uc/intel_guc_ct.h +3
-0@@ -6,6 +6,7 @@#ifndef _INTEL_GUC_CT_H_#define _INTEL_GUC_CT_H_ +#include <linux/interrupt.h> #include <linux/spinlock.h> #include <linux/workqueue.h> @@ -55,6 +56,8 @@ struct intel_guc_ct {struct intel_guc_ct_buffer recv; } ctbs; +struct tasklet_struct receive_tasklet; +struct {u32 last_fence;/* last fence used to send request */ Signature · 1 line
2.28.0
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [Intel-gfx] [RFC PATCH 18/97] drm/i915/guc: Don't receive all G2H messages in irq handler
Quoted 24 lines · Matthew Brost
Quoted 23 lines · Matthew Brost
From: Michal Wajdeczko <[email protected]>
In irq handler try to receive just single G2H message, let other messages to be received from tasklet.
Signed-off-by Michal Wajdeczko <[email protected]>Signed-off-by Matthew Brost <[email protected]>--- drivers/gpu/drm/i915/gt/uc/intel_guc_ct.c | 67 ++++++++++++++++------- drivers/gpu/drm/i915/gt/uc/intel_guc_ct.h | 3 + 2 files changed, 50 insertions(+), 20 deletions(-)drivers/gpu/drm/i915/gt/uc/intel_guc_ct.c +1
-0@@ -81,6 +81,7 @@ enum { CTB_SEND = 0, CTB_RECV = 1 };enum {CTB_OWNER_HOST =0 }; +static void ct_receive_tasklet_func (unsigned long data);static void ct_incoming_request_worker_func (struct work_struct *w);
Quoted 9 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_ct.c void intel_guc_ct_init_early(struct intel_guc_ct *ct) · line 99
Quoted 6 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_ct.c +1
-0/** @@ -95,6 +96,7 @@ void intel_guc_ct_init_early(struct intel_guc_ct *ct)INIT_LIST_HEAD (&ct->requests.pending);INIT_LIST_HEAD (&ct->requests.incoming);INIT_WORK (&ct->requests.worker, ct_incoming_request_worker_func); +tasklet_init (&ct->receive_tasklet, ct_receive_tasklet_func, (unsigned long )ct);This function is deprecated.
tasklet_setupshould be used. I can fix this up when I post the CTB patches.
I didn't notice that, but yes, passing struct to callback will be cleaner, so please fix it
Thanks,
Michal
Quoted 153 lines
Quoted 79 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_ct.c +29
-4}static inline const char *guc_ct_buffer_type_to_str (u32 type)@@ -244,6 +246,7 @@ void intel_guc_ct_fini(struct intel_guc_ct *ct) {GEM_BUG_ON (ct->enabled); +tasklet_kill (&ct->receive_tasklet);i915_vma_unpin_and_release (&ct->vma,I915_VMA_RELEASE_MAP );memset (ct,0 ,sizeof (*ct)); }@@ -629,7 +632,7 @@ static int ct_read(struct intel_guc_ct *ct, u32 *data)CT_DEBUG (ct,"received %*ph\n" ,4 * len, data); desc->head = head *4 ; -return 0 ; +return available - len; corrupted: CT_ERROR(ct, "Corrupted descriptor addr=%#x head=%u tail=%u size=%u\n",@@ -665,10 +668,10 @@ static int ct_handle_response(struct intel_guc_ct *ct, const u32 *msg)u32 status;u32 datalen;struct ct_request *req; +unsigned long flags;bool found = false;GEM_BUG_ON (!ct_header_is_response (header)); -GEM_BUG_ON (!in_irq ());/* Response payload shall at least include fence and status */ if (unlikely (len <2 )) {@@ -688,7 +691,7 @@ static int ct_handle_response(struct intel_guc_ct *ct, const u32 *msg)CT_DEBUG (ct,"response fence %u status %#x\n" , fence, status); -spin_lock (&ct->requests.lock); +spin_lock_irqsave (&ct->requests.lock, flags);list_for_each_entry (req, &ct->requests.pending, link) {if (unlikely (fence != req->fence)) { CT_DEBUG(ct, "request %u awaits response\n",@@ -707,7 +710,7 @@ static int ct_handle_response(struct intel_guc_ct *ct, const u32 *msg) found = true;break ; } -spin_unlock (&ct->requests.lock); +spin_unlock_irqrestore (&ct->requests.lock, flags);if (!found)CT_ERROR (ct,"Unsolicited response %*ph\n" , msgsize, msg);@@ -821,31 +824,55 @@ static int ct_handle_request(struct intel_guc_ct *ct, const u32 *msg)return 0 ; } +static int ct_receive (struct intel_guc_ct *ct) +{ +u32 msg[GUC_CT_MSG_LEN_MASK +1 ];/* one extra dw for the header */ +unsigned long flags; +int ret; + +spin_lock_irqsave (&ct->ctbs.recv.lock, flags); + ret =ct_read (ct, msg); +spin_unlock_irqrestore (&ct->ctbs.recv.lock, flags); +if (ret <0 ) +return ret; + +if (ct_header_is_response (msg[0 ])) +ct_handle_response (ct, msg); +else +ct_handle_request (ct, msg); + +return ret; +} + +static void ct_try_receive_message (struct intel_guc_ct *ct) +{ +int ret; +drivers/gpu/drm/i915/gt/uc/intel_guc_ct.c static int ct_handle_request(struct intel_guc_ct *ct, const u32 *msg) · line 860
Quoted 10 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_ct.c +10
-0+if (GEM_WARN_ON (!ct->enabled)) +return ; + + ret =ct_receive (ct); +if (ret >0 ) +tasklet_hi_schedule (&ct->receive_tasklet); +} + +static void ct_receive_tasklet_func (unsigned long data) +{As mentioned above
tasklet_initis deprecated. The callback now accepts the tasklet structure and ct can be looked up viacontainer_ofmacro.Everything else looks good.
With that and changing to the new tasklet API:
Reviewed-by Matthew Brost <[email protected]>Quoted 55 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_ct.c +6
-16+struct intel_guc_ct *ct = (struct intel_guc_ct *)data; + +ct_try_receive_message (ct); +} +/* * When we're communicating with the GuC over CT, GuC uses events * to notify us about new messages being posted on the RECV buffer. */ void intel_guc_ct_event_handler (struct intel_guc_ct *ct) { -u32 msg[GUC_CT_MSG_LEN_MASK +1 ];/* one extra dw for the header */ -unsigned long flags; -int err =0 ; -if (unlikely (!ct->enabled)) {WARN (1 ,"Unexpected GuC event received while CT disabled!\n" );return ; } -do { -spin_lock_irqsave (&ct->ctbs.recv.lock, flags); - err =ct_read (ct, msg); -spin_unlock_irqrestore (&ct->ctbs.recv.lock, flags); -if (err) -break ; - -if (ct_header_is_response (msg[0 ])) - err =ct_handle_response (ct, msg); -else - err =ct_handle_request (ct, msg); - }while (!err); +ct_try_receive_message (ct); }drivers/gpu/drm/i915/gt/uc/intel_guc_ct.h +3
-0@@ -6,6 +6,7 @@#ifndef _INTEL_GUC_CT_H_#define _INTEL_GUC_CT_H_ +#include <linux/interrupt.h> #include <linux/spinlock.h> #include <linux/workqueue.h> @@ -55,6 +56,8 @@ struct intel_guc_ct {struct intel_guc_ct_buffer recv; } ctbs; +struct tasklet_struct receive_tasklet; +struct {u32 last_fence;/* last fence used to send request */
Quoted 8 lines
Quoted 3 lines
Signature · 1 line
2.28.0_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
RFC PATCH 19/97 drm/i915/guc: Always copy CT message to new allocation
In reply to Matthew BrostFrom: Michal Wajdeczko <[email protected]>
Since most of future CT traffic will be based on G2H requests, instead of copying incoming CT message to static buffer and then create new allocation for such request, always copy incoming CT message to new allocation. Also by doing it while reading CT header, we can safely fallback if that atomic allocation fails.
--- drivers/gpu/drm/i915/gt/uc/intel_guc_ct.c | 180 ++++++++++++++-------- 1 file changed, 120 insertions(+), 60 deletions(-)
drivers/gpu/drm/i915/gt/uc/intel_guc_ct.c +120 -60
@@ -72,8 +72,9 @@ struct ct_request {u32 *response_buf; }; -struct ct_incoming_request { +struct ct_incoming_msg {struct list_head link; +u32 size;u32 msg[]; };
@@ -575,7 +576,26 @@ static inline bool ct_header_is_response(u32 header)return !!(header &GUC_CT_MSG_IS_RESPONSE ); } -static int ct_read (struct intel_guc_ct *ct,u32 *data) +static struct ct_incoming_msg *ct_alloc_msg (u32 num_dwords) +{ +struct ct_incoming_msg *msg; + + msg =kmalloc (sizeof (*msg) +sizeof (u32) * num_dwords,GFP_ATOMIC ); +if (msg) + msg->size = num_dwords; +return msg; +} + +static void ct_free_msg (struct ct_incoming_msg *msg) +{ +kfree (msg); +} + +/* +* Return: number available remaining dwords to read (0 if empty) +* or a negative error code on failure +*/ +static int ct_read (struct intel_guc_ct *ct,struct ct_incoming_msg **msg) {struct intel_guc_ct_buffer *ctb = &ct->ctbs.recv;struct guc_ct_buffer_desc *desc = ctb->desc;
@@ -586,6 +606,7 @@ static int ct_read(struct intel_guc_ct *ct, u32 *data)s32 available;unsigned int len;unsigned int i; +u32 header;if (unlikely (desc->is_in_error))return -EPIPE ;
@@ -601,8 +622,10 @@ static int ct_read(struct intel_guc_ct *ct, u32 *data)/* tail == head condition indicates empty */ available = tail - head; -if (unlikely (available ==0 )) -return -ENODATA ; +if (unlikely (available ==0 )) { + *msg =NULL ; +return 0 ; + }/* beware of buffer wrap case */ if (unlikely (available <0 ))
@@ -610,14 +633,14 @@ static int ct_read(struct intel_guc_ct *ct, u32 *data)CT_DEBUG (ct,"available %d (%u:%u)\n" , available, head, tail);GEM_BUG_ON (available <0 ); - data[0 ] = cmds[head]; + header = cmds[head]; head = (head +1 ) % size;/* message len with header */ - len =ct_header_get_len (data[0 ]) +1 ; + len =ct_header_get_len (header) +1 ;if (unlikely (len > (u32 )available)) { CT_ERROR(ct, "Incomplete message %*ph %*ph %*ph\n", - 4, data, + 4, &header, 4 * (head + available - 1 > size ? size - head : available - 1), &cmds[head], 4 * (head + available - 1 > size ?
@@ -625,11 +648,24 @@ static int ct_read(struct intel_guc_ct *ct, u32 *data) goto corrupted; } + *msg =ct_alloc_msg (len); +if (!*msg) { +CT_ERROR (ct,"No memory for message %*ph %*ph %*ph\n" , +4 , &header, +4 * (head + available -1 > size ? + size - head : available -1 ), &cmds[head], +4 * (head + available -1 > size ? + available -1 - size + head :0 ), &cmds[0 ]); +return available; + } + + (*msg)->msg[0 ] = header; +for (i =1 ; i < len; i++) { - data[i] = cmds[head]; + (*msg)->msg[i] = cmds[head]; head = (head +1 ) % size; } -CT_DEBUG (ct,"received %*ph\n" ,4 * len, data); +CT_DEBUG (ct,"received %*ph\n" ,4 * len, (*msg)->msg); desc->head = head *4 ;return available - len;
@@ -659,33 +695,33 @@ static int ct_read(struct intel_guc_ct *ct, u32 *data)* ^-----------------------len-----------------------^ */ -static int ct_handle_response (struct intel_guc_ct *ct,const u32 *msg) +static int ct_handle_response (struct intel_guc_ct *ct,struct ct_incoming_msg *response) { -u32 header = msg[0 ]; +u32 header = response->msg[0 ];u32 len =ct_header_get_len (header); -u32 msgsize = (len +1 ) *sizeof (u32);/* msg size in bytes w/header */ u32 fence;u32 status;u32 datalen;struct ct_request *req;unsigned long flags;bool found = false; +int err =0 ;GEM_BUG_ON (!ct_header_is_response (header));/* Response payload shall at least include fence and status */ if (unlikely (len <2 )) { -CT_ERROR (ct,"Corrupted response %*ph\n" , msgsize, msg); +CT_ERROR (ct,"Corrupted response (len %u)\n" , len);return -EPROTO ; } - fence = msg[1 ]; - status = msg[2 ]; + fence = response->msg[1 ]; + status = response->msg[2 ]; datalen = len -2 ;/* Format of the status follows RESPONSE message */ if (unlikely (!INTEL_GUC_MSG_IS_RESPONSE (status))) { -CT_ERROR (ct,"Corrupted response %*ph\n" , msgsize, msg); +CT_ERROR (ct,"Corrupted response (status %#x)\n" , status);return -EPROTO ; }
@@ -699,12 +735,13 @@ static int ct_handle_response(struct intel_guc_ct *ct, const u32 *msg)continue ; }if (unlikely (datalen > req->response_len)) { -CT_ERROR (ct,"Response for %u is too long %*ph\n" , - req->fence, msgsize, msg); - datalen =0 ; +CT_ERROR (ct,"Response %u too long (datalen %u > %u)\n" , + req->fence, datalen, req->response_len); + datalen =min (datalen, req->response_len); + err = -EMSGSIZE ; }if (datalen) -memcpy (req->response_buf, msg +3 ,4 * datalen); +memcpy (req->response_buf, response->msg +3 ,4 * datalen); req->response_len = datalen;WRITE_ONCE (req->status, status); found = true;
@@ -712,45 +749,61 @@ static int ct_handle_response(struct intel_guc_ct *ct, const u32 *msg) }spin_unlock_irqrestore (&ct->requests.lock, flags); -if (!found) -CT_ERROR (ct,"Unsolicited response %*ph\n" , msgsize, msg); +if (!found) { +CT_ERROR (ct,"Unsolicited response (fence %u)\n" , fence); +return -ENOKEY ; + } + +if (unlikely (err)) +return err; + +ct_free_msg (response);return 0 ; } -static void ct_process_request (struct intel_guc_ct *ct, -u32 action,u32 len,const u32 *payload) +static int ct_process_request (struct intel_guc_ct *ct,struct ct_incoming_msg *request) {struct intel_guc *guc =ct_to_guc (ct); +u32 header, action, len; +const u32 *payload;int ret; + header = request->msg[0 ]; + payload = &request->msg[1 ]; + action =ct_header_get_action (header); + len =ct_header_get_len (header); +CT_DEBUG (ct,"request %x %*ph\n" , action,4 * len, payload);switch (action) {case INTEL_GUC_ACTION_DEFAULT : ret =intel_guc_to_host_process_recv_msg (guc, payload, len); -if (unlikely (ret)) - goto fail_unexpected;break ; -default : -fail_unexpected: -CT_ERROR (ct,"Unexpected request %x %*ph\n" , - action,4 * len, payload); + ret = -EOPNOTSUPP ;break ; } + +if (unlikely (ret)) { +CT_ERROR (ct,"Failed to process request %04x (%pe)\n" , + action,ERR_PTR (ret)); +return ret; + } + +ct_free_msg (request); +return 0 ; }static bool ct_process_incoming_requests (struct intel_guc_ct *ct) {unsigned long flags; -struct ct_incoming_request *request; -u32 header; -u32 *payload; +struct ct_incoming_msg *request;bool done; +int err;spin_lock_irqsave (&ct->requests.lock, flags); request =list_first_entry_or_null (&ct->requests.incoming, - struct ct_incoming_request, link); + struct ct_incoming_msg, link);if (request)list_del (&request->link); done = !!list_empty (&ct->requests.incoming);
@@ -759,14 +812,13 @@ static bool ct_process_incoming_requests(struct intel_guc_ct *ct)if (!request)return true; - header = request->msg[0 ]; - payload = &request->msg[1 ]; -ct_process_request (ct, -ct_header_get_action (header), -ct_header_get_len (header), - payload); + err =ct_process_request (ct, request); +if (unlikely (err)) { +CT_ERROR (ct,"Failed to process CT message (%pe) %*ph\n" , +ERR_PTR (err),4 * request->size, request->msg); +ct_free_msg (request); + } -kfree (request);return done; }
@@ -799,22 +851,11 @@ static void ct_incoming_request_worker_func(struct work_struct *w)* ^-----------------------len-----------------------^ */ -static int ct_handle_request (struct intel_guc_ct *ct,const u32 *msg) +static int ct_handle_request (struct intel_guc_ct *ct,struct ct_incoming_msg *request) { -u32 header = msg[0 ]; -u32 len =ct_header_get_len (header); -u32 msgsize = (len +1 ) *sizeof (u32);/* msg size in bytes w/header */ -struct ct_incoming_request *request;unsigned long flags; -GEM_BUG_ON (ct_header_is_response (header)); - - request =kmalloc (sizeof (*request) + msgsize,GFP_ATOMIC ); -if (unlikely (!request)) { -CT_ERROR (ct,"Dropping request %*ph\n" , msgsize, msg); -return 0 ;/* XXX: -ENOMEM ? */ - } -memcpy (request->msg, msg, msgsize); +GEM_BUG_ON (ct_header_is_response (request->msg[0 ]));spin_lock_irqsave (&ct->requests.lock, flags);list_add_tail (&request->link, &ct->requests.incoming);
@@ -824,22 +865,41 @@ static int ct_handle_request(struct intel_guc_ct *ct, const u32 *msg)return 0 ; } +static void ct_handle_msg (struct intel_guc_ct *ct,struct ct_incoming_msg *msg) +{ +u32 header = msg->msg[0 ]; +int err; + +if (ct_header_is_response (header)) + err =ct_handle_response (ct, msg); +else + err =ct_handle_request (ct, msg); + +if (unlikely (err)) { +CT_ERROR (ct,"Failed to process CT message (%pe) %*ph\n" , +ERR_PTR (err),4 * msg->size, msg->msg); +ct_free_msg (msg); + } +} + +/* +* Return: number available remaining dwords to read (0 if empty) +* or a negative error code on failure +*/ static int ct_receive (struct intel_guc_ct *ct) { -u32 msg[GUC_CT_MSG_LEN_MASK +1 ];/* one extra dw for the header */ +struct ct_incoming_msg *msg =NULL ;unsigned long flags;int ret;spin_lock_irqsave (&ct->ctbs.recv.lock, flags); - ret =ct_read (ct, msg); + ret =ct_read (ct, &msg);spin_unlock_irqrestore (&ct->ctbs.recv.lock, flags);if (ret <0 )return ret; -if (ct_header_is_response (msg[0 ])) -ct_handle_response (ct, msg); -else -ct_handle_request (ct, msg); +if (msg) +ct_handle_msg (ct, msg);return ret; }
Signature · 1 line
2.28.0
Re: [RFC PATCH 19/97] drm/i915/guc: Always copy CT message to new allocation
Quoted 11 lines · Matthew Brost
From: Michal Wajdeczko <[email protected]>
Since most of future CT traffic will be based on G2H requests, instead of copying incoming CT message to static buffer and then create new allocation for such request, always copy incoming CT message to new allocation. Also by doing it while reading CT header, we can safely fallback if that atomic allocation fails.
Signed-off-by Michal Wajdeczko <[email protected]>Signed-off-by Matthew Brost <[email protected]>Cc Piotr Piórkowski <[email protected]>
Quoted 345 lines
--- drivers/gpu/drm/i915/gt/uc/intel_guc_ct.c | 180 ++++++++++++++-------- 1 file changed, 120 insertions(+), 60 deletions(-)drivers/gpu/drm/i915/gt/uc/intel_guc_ct.c +120
-60@@ -72,8 +72,9 @@ struct ct_request {u32 *response_buf; }; -struct ct_incoming_request { +struct ct_incoming_msg {struct list_head link; +u32 size;u32 msg[]; };@@ -575,7 +576,26 @@ static inline bool ct_header_is_response(u32 header)return !!(header &GUC_CT_MSG_IS_RESPONSE ); } -static int ct_read (struct intel_guc_ct *ct,u32 *data) +static struct ct_incoming_msg *ct_alloc_msg (u32 num_dwords) +{ +struct ct_incoming_msg *msg; + + msg =kmalloc (sizeof (*msg) +sizeof (u32) * num_dwords,GFP_ATOMIC ); +if (msg) + msg->size = num_dwords; +return msg; +} + +static void ct_free_msg (struct ct_incoming_msg *msg) +{ +kfree (msg); +} + +/* +* Return: number available remaining dwords to read (0 if empty) +* or a negative error code on failure +*/ +static int ct_read (struct intel_guc_ct *ct,struct ct_incoming_msg **msg) {struct intel_guc_ct_buffer *ctb = &ct->ctbs.recv;struct guc_ct_buffer_desc *desc = ctb->desc;@@ -586,6 +606,7 @@ static int ct_read(struct intel_guc_ct *ct, u32 *data)s32 available;unsigned int len;unsigned int i; +u32 header;if (unlikely (desc->is_in_error))return -EPIPE ;@@ -601,8 +622,10 @@ static int ct_read(struct intel_guc_ct *ct, u32 *data)/* tail == head condition indicates empty */ available = tail - head; -if (unlikely (available ==0 )) -return -ENODATA ; +if (unlikely (available ==0 )) { + *msg =NULL ; +return 0 ; + }/* beware of buffer wrap case */ if (unlikely (available <0 ))@@ -610,14 +633,14 @@ static int ct_read(struct intel_guc_ct *ct, u32 *data)CT_DEBUG (ct,"available %d (%u:%u)\n" , available, head, tail);GEM_BUG_ON (available <0 ); - data[0 ] = cmds[head]; + header = cmds[head]; head = (head +1 ) % size;/* message len with header */ - len =ct_header_get_len (data[0 ]) +1 ; + len =ct_header_get_len (header) +1 ;if (unlikely (len > (u32 )available)) { CT_ERROR(ct, "Incomplete message %*ph %*ph %*ph\n", - 4, data, + 4, &header, 4 * (head + available - 1 > size ? size - head : available - 1), &cmds[head], 4 * (head + available - 1 > size ?@@ -625,11 +648,24 @@ static int ct_read(struct intel_guc_ct *ct, u32 *data) goto corrupted; } + *msg =ct_alloc_msg (len); +if (!*msg) { +CT_ERROR (ct,"No memory for message %*ph %*ph %*ph\n" , +4 , &header, +4 * (head + available -1 > size ? + size - head : available -1 ), &cmds[head], +4 * (head + available -1 > size ? + available -1 - size + head :0 ), &cmds[0 ]); +return available; + } + + (*msg)->msg[0 ] = header; +for (i =1 ; i < len; i++) { - data[i] = cmds[head]; + (*msg)->msg[i] = cmds[head]; head = (head +1 ) % size; } -CT_DEBUG (ct,"received %*ph\n" ,4 * len, data); +CT_DEBUG (ct,"received %*ph\n" ,4 * len, (*msg)->msg); desc->head = head *4 ;return available - len;@@ -659,33 +695,33 @@ static int ct_read(struct intel_guc_ct *ct, u32 *data)* ^-----------------------len-----------------------^ */ -static int ct_handle_response (struct intel_guc_ct *ct,const u32 *msg) +static int ct_handle_response (struct intel_guc_ct *ct,struct ct_incoming_msg *response) { -u32 header = msg[0 ]; +u32 header = response->msg[0 ];u32 len =ct_header_get_len (header); -u32 msgsize = (len +1 ) *sizeof (u32);/* msg size in bytes w/header */ u32 fence;u32 status;u32 datalen;struct ct_request *req;unsigned long flags;bool found = false; +int err =0 ;GEM_BUG_ON (!ct_header_is_response (header));/* Response payload shall at least include fence and status */ if (unlikely (len <2 )) { -CT_ERROR (ct,"Corrupted response %*ph\n" , msgsize, msg); +CT_ERROR (ct,"Corrupted response (len %u)\n" , len);return -EPROTO ; } - fence = msg[1 ]; - status = msg[2 ]; + fence = response->msg[1 ]; + status = response->msg[2 ]; datalen = len -2 ;/* Format of the status follows RESPONSE message */ if (unlikely (!INTEL_GUC_MSG_IS_RESPONSE (status))) { -CT_ERROR (ct,"Corrupted response %*ph\n" , msgsize, msg); +CT_ERROR (ct,"Corrupted response (status %#x)\n" , status);return -EPROTO ; }@@ -699,12 +735,13 @@ static int ct_handle_response(struct intel_guc_ct *ct, const u32 *msg)continue ; }if (unlikely (datalen > req->response_len)) { -CT_ERROR (ct,"Response for %u is too long %*ph\n" , - req->fence, msgsize, msg); - datalen =0 ; +CT_ERROR (ct,"Response %u too long (datalen %u > %u)\n" , + req->fence, datalen, req->response_len); + datalen =min (datalen, req->response_len); + err = -EMSGSIZE ; }if (datalen) -memcpy (req->response_buf, msg +3 ,4 * datalen); +memcpy (req->response_buf, response->msg +3 ,4 * datalen); req->response_len = datalen;WRITE_ONCE (req->status, status); found = true;@@ -712,45 +749,61 @@ static int ct_handle_response(struct intel_guc_ct *ct, const u32 *msg) }spin_unlock_irqrestore (&ct->requests.lock, flags); -if (!found) -CT_ERROR (ct,"Unsolicited response %*ph\n" , msgsize, msg); +if (!found) { +CT_ERROR (ct,"Unsolicited response (fence %u)\n" , fence); +return -ENOKEY ; + } + +if (unlikely (err)) +return err; + +ct_free_msg (response);return 0 ; } -static void ct_process_request (struct intel_guc_ct *ct, -u32 action,u32 len,const u32 *payload) +static int ct_process_request (struct intel_guc_ct *ct,struct ct_incoming_msg *request) {struct intel_guc *guc =ct_to_guc (ct); +u32 header, action, len; +const u32 *payload;int ret; + header = request->msg[0 ]; + payload = &request->msg[1 ]; + action =ct_header_get_action (header); + len =ct_header_get_len (header); +CT_DEBUG (ct,"request %x %*ph\n" , action,4 * len, payload);switch (action) {case INTEL_GUC_ACTION_DEFAULT : ret =intel_guc_to_host_process_recv_msg (guc, payload, len); -if (unlikely (ret)) - goto fail_unexpected;break ; -default : -fail_unexpected: -CT_ERROR (ct,"Unexpected request %x %*ph\n" , - action,4 * len, payload); + ret = -EOPNOTSUPP ;break ; } + +if (unlikely (ret)) { +CT_ERROR (ct,"Failed to process request %04x (%pe)\n" , + action,ERR_PTR (ret)); +return ret; + } + +ct_free_msg (request); +return 0 ; }static bool ct_process_incoming_requests (struct intel_guc_ct *ct) {unsigned long flags; -struct ct_incoming_request *request; -u32 header; -u32 *payload; +struct ct_incoming_msg *request;bool done; +int err;spin_lock_irqsave (&ct->requests.lock, flags); request =list_first_entry_or_null (&ct->requests.incoming, - struct ct_incoming_request, link); + struct ct_incoming_msg, link);if (request)list_del (&request->link); done = !!list_empty (&ct->requests.incoming);@@ -759,14 +812,13 @@ static bool ct_process_incoming_requests(struct intel_guc_ct *ct)if (!request)return true; - header = request->msg[0 ]; - payload = &request->msg[1 ]; -ct_process_request (ct, -ct_header_get_action (header), -ct_header_get_len (header), - payload); + err =ct_process_request (ct, request); +if (unlikely (err)) { +CT_ERROR (ct,"Failed to process CT message (%pe) %*ph\n" , +ERR_PTR (err),4 * request->size, request->msg); +ct_free_msg (request); + } -kfree (request);return done; }@@ -799,22 +851,11 @@ static void ct_incoming_request_worker_func(struct work_struct *w)* ^-----------------------len-----------------------^ */ -static int ct_handle_request (struct intel_guc_ct *ct,const u32 *msg) +static int ct_handle_request (struct intel_guc_ct *ct,struct ct_incoming_msg *request) { -u32 header = msg[0 ]; -u32 len =ct_header_get_len (header); -u32 msgsize = (len +1 ) *sizeof (u32);/* msg size in bytes w/header */ -struct ct_incoming_request *request;unsigned long flags; -GEM_BUG_ON (ct_header_is_response (header)); - - request =kmalloc (sizeof (*request) + msgsize,GFP_ATOMIC ); -if (unlikely (!request)) { -CT_ERROR (ct,"Dropping request %*ph\n" , msgsize, msg); -return 0 ;/* XXX: -ENOMEM ? */ - } -memcpy (request->msg, msg, msgsize); +GEM_BUG_ON (ct_header_is_response (request->msg[0 ]));spin_lock_irqsave (&ct->requests.lock, flags);list_add_tail (&request->link, &ct->requests.incoming);@@ -824,22 +865,41 @@ static int ct_handle_request(struct intel_guc_ct *ct, const u32 *msg)return 0 ; } +static void ct_handle_msg (struct intel_guc_ct *ct,struct ct_incoming_msg *msg) +{ +u32 header = msg->msg[0 ]; +int err; + +if (ct_header_is_response (header)) + err =ct_handle_response (ct, msg); +else + err =ct_handle_request (ct, msg); + +if (unlikely (err)) { +CT_ERROR (ct,"Failed to process CT message (%pe) %*ph\n" , +ERR_PTR (err),4 * msg->size, msg->msg); +ct_free_msg (msg); + } +} + +/* +* Return: number available remaining dwords to read (0 if empty) +* or a negative error code on failure +*/ static int ct_receive (struct intel_guc_ct *ct) { -u32 msg[GUC_CT_MSG_LEN_MASK +1 ];/* one extra dw for the header */ +struct ct_incoming_msg *msg =NULL ;unsigned long flags;int ret;spin_lock_irqsave (&ct->ctbs.recv.lock, flags); - ret =ct_read (ct, msg); + ret =ct_read (ct, &msg);spin_unlock_irqrestore (&ct->ctbs.recv.lock, flags);if (ret <0 )return ret; -if (ct_header_is_response (msg[0 ])) -ct_handle_response (ct, msg); -else -ct_handle_request (ct, msg); +if (msg) +ct_handle_msg (ct, msg);return ret; }Signature · 1 line
2.28.0
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
RFC PATCH 20/97 drm/i915/guc: Introduce unified HXG messages
In reply to Matthew BrostFrom: Michal Wajdeczko <[email protected]>
New GuC firmware will unify format of MMIO and CTB H2G messages. Introduce their definitions now to allow gradual transition of our code to match new changes.
--- .../gpu/drm/i915/gt/uc/abi/guc_messages_abi.h | 226 ++++++++++++++++++ 1 file changed, 226 insertions(+)
drivers/gpu/drm/i915/gt/uc/abi/guc_messages_abi.h +226 -0
@@ -6,6 +6,232 @@#ifndef _ABI_GUC_MESSAGES_ABI_H#define _ABI_GUC_MESSAGES_ABI_H +/** +* DOC: HXG Message +* +* All messages exchanged with GuC are defined using 32 bit dwords. +* First dword is treated as a message header. Remaining dwords are optional. +* +* .. _HXG Message: +* +* +---+-------+--------------------------------------------------------------+ +* | | Bits | Description | +* +===+=======+==============================================================+ +* | | | | +* | 0 | 31 | **ORIGIN** - originator of the message | +* | | | - _`GUC_HXG_ORIGIN_HOST` = 0 | +* | | | - _`GUC_HXG_ORIGIN_GUC` = 1 | +* | | | | +* | +-------+--------------------------------------------------------------+ +* | | 30:28 | **TYPE** - message type | +* | | | - _`GUC_HXG_TYPE_REQUEST` = 0 | +* | | | - _`GUC_HXG_TYPE_EVENT` = 1 | +* | | | - _`GUC_HXG_TYPE_NO_RESPONSE_BUSY` = 3 | +* | | | - _`GUC_HXG_TYPE_NO_RESPONSE_RETRY` = 5 | +* | | | - _`GUC_HXG_TYPE_RESPONSE_FAILURE` = 6 | +* | | | - _`GUC_HXG_TYPE_RESPONSE_SUCCESS` = 7 | +* | +-------+--------------------------------------------------------------+ +* | | 27:0 | **AUX** - auxiliary data (depends TYPE) | +* +---+-------+--------------------------------------------------------------+ +* | 1 | 31:0 | optional payload (depends on TYPE) | +* +---+-------+ | +* |...| | | +* +---+-------+ | +* | n | 31:0 | | +* +---+-------+--------------------------------------------------------------+ +*/ + +#define GUC_HXG_MSG_MIN_LEN 1u +#define GUC_HXG_MSG_0_ORIGIN (0x1 << 31) +#define GUC_HXG_ORIGIN_HOST 0u +#define GUC_HXG_ORIGIN_GUC 1u +#define GUC_HXG_MSG_0_TYPE (0x7 << 28) +#define GUC_HXG_TYPE_REQUEST 0u +#define GUC_HXG_TYPE_EVENT 1u +#define GUC_HXG_TYPE_NO_RESPONSE_BUSY 3u +#define GUC_HXG_TYPE_NO_RESPONSE_RETRY 5u +#define GUC_HXG_TYPE_RESPONSE_FAILURE 6u +#define GUC_HXG_TYPE_RESPONSE_SUCCESS 7u +#define GUC_HXG_MSG_0_AUX (0xfffffff << 0) + +/** +* DOC: HXG Request +* +* The `HXG Request`_ message should be used to initiate synchronous activity +* for which confirmation or return data is expected. +* +* The recipient of this message shall use `HXG Response`_, `HXG Failure`_ +* or `HXG Retry`_ message as a definite reply, and may use `HXG Busy`_ +* message as a intermediate reply. +* +* Format of @DATA0 and all @DATAn fields depends on the @ACTION code. +* +* _HXG Request: +* +* +---+-------+--------------------------------------------------------------+ +* | | Bits | Description | +* +===+=======+==============================================================+ +* | 0 | 31 | ORIGIN | +* | +-------+--------------------------------------------------------------+ +* | | 30:28 | TYPE = GUC_HXG_TYPE_REQUEST_ | +* | +-------+--------------------------------------------------------------+ +* | | 27:16 | **DATA0** - request data (depends on ACTION) | +* | +-------+--------------------------------------------------------------+ +* | | 15:0 | **ACTION** - requested action code | +* +---+-------+--------------------------------------------------------------+ +* | 1 | 31:0 | **DATA1** - optional data (depends on ACTION) | +* +---+-------+--------------------------------------------------------------+ +* |...| | | +* +---+-------+--------------------------------------------------------------+ +* | n | 31:0 | **DATAn** - optional data (depends on ACTION) | +* +---+-------+--------------------------------------------------------------+ +*/ + +#define GUC_HXG_REQUEST_MSG_MIN_LEN GUC_HXG_MSG_MIN_LEN +#define GUC_HXG_REQUEST_MSG_0_DATA0 (0xfff << 16) +#define GUC_HXG_REQUEST_MSG_0_ACTION (0xffff << 0) +#define GUC_HXG_REQUEST_MSG_n_DATAn (0xffffffff << 0) + +/** +* DOC: HXG Event +* +* The `HXG Event`_ message should be used to initiate asynchronous activity +* that does not involves immediate confirmation nor data. +* +* Format of @DATA0 and all @DATAn fields depends on the @ACTION code. +* +* .. _HXG Event: +* +* +---+-------+--------------------------------------------------------------+ +* | | Bits | Description | +* +===+=======+==============================================================+ +* | 0 | 31 | ORIGIN | +* | +-------+--------------------------------------------------------------+ +* | | 30:28 | TYPE = GUC_HXG_TYPE_EVENT_ | +* | +-------+--------------------------------------------------------------+ +* | | 27:16 | **DATA0** - event data (depends on ACTION) | +* | +-------+--------------------------------------------------------------+ +* | | 15:0 | **ACTION** - event action code | +* +---+-------+--------------------------------------------------------------+ +* | 1 | 31:0 | **DATA1** - optional event data (depends on ACTION) | +* +---+-------+--------------------------------------------------------------+ +* |...| | | +* +---+-------+--------------------------------------------------------------+ +* | n | 31:0 | **DATAn** - optional event data (depends on ACTION) | +* +---+-------+--------------------------------------------------------------+ +*/ + +#define GUC_HXG_EVENT_MSG_MIN_LEN GUC_HXG_MSG_MIN_LEN +#define GUC_HXG_EVENT_MSG_0_DATA0 (0xfff << 16) +#define GUC_HXG_EVENT_MSG_0_ACTION (0xffff << 0) +#define GUC_HXG_EVENT_MSG_n_DATAn (0xffffffff << 0) + +/** +* DOC: HXG Busy +* +* The `HXG Busy`_ message may be used to acknowledge reception of the `HXG Request`_ +* message if the recipient expects that it processing will be longer than default +* timeout. +* +* The @COUNTER field may be used as a progress indicator. +* +* .. _HXG Busy: +* +* +---+-------+--------------------------------------------------------------+ +* | | Bits | Description | +* +===+=======+==============================================================+ +* | 0 | 31 | ORIGIN | +* | +-------+--------------------------------------------------------------+ +* | | 30:28 | TYPE = GUC_HXG_TYPE_NO_RESPONSE_BUSY_ | +* | +-------+--------------------------------------------------------------+ +* | | 27:0 | **COUNTER** - progress indicator | +* +---+-------+--------------------------------------------------------------+ +*/ + +#define GUC_HXG_BUSY_MSG_LEN GUC_HXG_MSG_MIN_LEN +#define GUC_HXG_BUSY_MSG_0_COUNTER GUC_HXG_MSG_0_AUX + +/** +* DOC: HXG Retry +* +* The `HXG Retry`_ message should be used by recipient to indicate that the +* `HXG Request`_ message was dropped and it should be resent again. +* +* The @REASON field may be used to provide additional information. +* +* .. _HXG Retry: +* +* +---+-------+--------------------------------------------------------------+ +* | | Bits | Description | +* +===+=======+==============================================================+ +* | 0 | 31 | ORIGIN | +* | +-------+--------------------------------------------------------------+ +* | | 30:28 | TYPE = GUC_HXG_TYPE_NO_RESPONSE_RETRY_ | +* | +-------+--------------------------------------------------------------+ +* | | 27:0 | **REASON** - reason for retry | +* | | | - _`GUC_HXG_RETRY_REASON_UNSPECIFIED` = 0 | +* +---+-------+--------------------------------------------------------------+ +*/ + +#define GUC_HXG_RETRY_MSG_LEN GUC_HXG_MSG_MIN_LEN +#define GUC_HXG_RETRY_MSG_0_REASON GUC_HXG_MSG_0_AUX +#define GUC_HXG_RETRY_REASON_UNSPECIFIED 0u + +/** +* DOC: HXG Failure +* +* The `HXG Failure`_ message shall be used as a reply to the `HXG Request`_ +* message that could not be processed due to an error. +* +* .. _HXG Failure: +* +* +---+-------+--------------------------------------------------------------+ +* | | Bits | Description | +* +===+=======+==============================================================+ +* | 0 | 31 | ORIGIN | +* | +-------+--------------------------------------------------------------+ +* | | 30:28 | TYPE = GUC_HXG_TYPE_RESPONSE_FAILURE_ | +* | +-------+--------------------------------------------------------------+ +* | | 27:16 | **HINT** - additional error hint | +* | +-------+--------------------------------------------------------------+ +* | | 15:0 | **ERROR** - error/result code | +* +---+-------+--------------------------------------------------------------+ +*/ + +#define GUC_HXG_FAILURE_MSG_LEN GUC_HXG_MSG_MIN_LEN +#define GUC_HXG_FAILURE_MSG_0_HINT (0xfff << 16) +#define GUC_HXG_FAILURE_MSG_0_ERROR (0xffff << 0) + +/** +* DOC: HXG Response +* +* The `HXG Response`_ message SHALL be used as a reply to the `HXG Request`_ +* message that was successfully processed without an error. +* +* .. _HXG Response: +* +* +---+-------+--------------------------------------------------------------+ +* | | Bits | Description | +* +===+=======+==============================================================+ +* | 0 | 31 | ORIGIN | +* | +-------+--------------------------------------------------------------+ +* | | 30:28 | TYPE = GUC_HXG_TYPE_RESPONSE_SUCCESS_ | +* | +-------+--------------------------------------------------------------+ +* | | 27:0 | **DATA0** - data (depends on ACTION from `HXG Request`_) | +* +---+-------+--------------------------------------------------------------+ +* | 1 | 31:0 | **DATA1** - data (depends on ACTION from `HXG Request`_) | +* +---+-------+--------------------------------------------------------------+ +* |...| | | +* +---+-------+--------------------------------------------------------------+ +* | n | 31:0 | **DATAn** - data (depends on ACTION from `HXG Request`_) | +* +---+-------+--------------------------------------------------------------+ +*/ + +#define GUC_HXG_RESPONSE_MSG_MIN_LEN GUC_HXG_MSG_MIN_LEN +#define GUC_HXG_RESPONSE_MSG_0_DATA0 GUC_HXG_MSG_0_AUX +#define GUC_HXG_RESPONSE_MSG_n_DATAn (0xffffffff << 0) + +/* deprecated */ #define INTEL_GUC_MSG_TYPE_SHIFT 28#define INTEL_GUC_MSG_TYPE_MASK (0xF << INTEL_GUC_MSG_TYPE_SHIFT)#define INTEL_GUC_MSG_DATA_SHIFT 16
Signature · 1 line
2.28.0
Re: [RFC PATCH 20/97] drm/i915/guc: Introduce unified HXG messages
Quoted 18 lines · Matthew Brost
From: Michal Wajdeczko <[email protected]>
New GuC firmware will unify format of MMIO and CTB H2G messages. Introduce their definitions now to allow gradual transition of our code to match new changes.
Signed-off-by Michal Wajdeczko <[email protected]>Signed-off-by Matthew Brost <[email protected]>Cc Michał Winiarski <[email protected]>--- .../gpu/drm/i915/gt/uc/abi/guc_messages_abi.h | 226 ++++++++++++++++++ 1 file changed, 226 insertions(+)drivers/gpu/drm/i915/gt/uc/abi/guc_messages_abi.h +0
-0
drivers/gpu/drm/i915/gt/uc/abi/guc_messages_abi.h line 10
Quoted 5 lines
drivers/gpu/drm/i915/gt/uc/abi/guc_messages_abi.h +2
-0@@ -6,6 +6,232 @@#ifndef _ABI_GUC_MESSAGES_ABI_H#define _ABI_GUC_MESSAGES_ABI_H +/** +* DOC: HXG Message
These aren't useful if we don't pull them in somewhere in the Documentation/gpu hierarchy. General comment, and also please check that it all renders correctly still.
btw if you respin a patch not originally by you we generally add a (v1) to the original s-o-b line (or whever the version split was) and explain in the usual changelog in the commit message what was changed.
This holds for the entire series ofc.
-Daniel
Quoted 230 lines
drivers/gpu/drm/i915/gt/uc/abi/guc_messages_abi.h +224
-0+* +* All messages exchanged with GuC are defined using 32 bit dwords. +* First dword is treated as a message header. Remaining dwords are optional. +* +* .. _HXG Message: +* +* +---+-------+--------------------------------------------------------------+ +* | | Bits | Description | +* +===+=======+==============================================================+ +* | | | | +* | 0 | 31 | **ORIGIN** - originator of the message | +* | | | - _`GUC_HXG_ORIGIN_HOST` = 0 | +* | | | - _`GUC_HXG_ORIGIN_GUC` = 1 | +* | | | | +* | +-------+--------------------------------------------------------------+ +* | | 30:28 | **TYPE** - message type | +* | | | - _`GUC_HXG_TYPE_REQUEST` = 0 | +* | | | - _`GUC_HXG_TYPE_EVENT` = 1 | +* | | | - _`GUC_HXG_TYPE_NO_RESPONSE_BUSY` = 3 | +* | | | - _`GUC_HXG_TYPE_NO_RESPONSE_RETRY` = 5 | +* | | | - _`GUC_HXG_TYPE_RESPONSE_FAILURE` = 6 | +* | | | - _`GUC_HXG_TYPE_RESPONSE_SUCCESS` = 7 | +* | +-------+--------------------------------------------------------------+ +* | | 27:0 | **AUX** - auxiliary data (depends TYPE) | +* +---+-------+--------------------------------------------------------------+ +* | 1 | 31:0 | optional payload (depends on TYPE) | +* +---+-------+ | +* |...| | | +* +---+-------+ | +* | n | 31:0 | | +* +---+-------+--------------------------------------------------------------+ +*/ + +#define GUC_HXG_MSG_MIN_LEN 1u +#define GUC_HXG_MSG_0_ORIGIN (0x1 << 31) +#define GUC_HXG_ORIGIN_HOST 0u +#define GUC_HXG_ORIGIN_GUC 1u +#define GUC_HXG_MSG_0_TYPE (0x7 << 28) +#define GUC_HXG_TYPE_REQUEST 0u +#define GUC_HXG_TYPE_EVENT 1u +#define GUC_HXG_TYPE_NO_RESPONSE_BUSY 3u +#define GUC_HXG_TYPE_NO_RESPONSE_RETRY 5u +#define GUC_HXG_TYPE_RESPONSE_FAILURE 6u +#define GUC_HXG_TYPE_RESPONSE_SUCCESS 7u +#define GUC_HXG_MSG_0_AUX (0xfffffff << 0) + +/** +* DOC: HXG Request +* +* The `HXG Request`_ message should be used to initiate synchronous activity +* for which confirmation or return data is expected. +* +* The recipient of this message shall use `HXG Response`_, `HXG Failure`_ +* or `HXG Retry`_ message as a definite reply, and may use `HXG Busy`_ +* message as a intermediate reply. +* +* Format of @DATA0 and all @DATAn fields depends on the @ACTION code. +* +* _HXG Request: +* +* +---+-------+--------------------------------------------------------------+ +* | | Bits | Description | +* +===+=======+==============================================================+ +* | 0 | 31 | ORIGIN | +* | +-------+--------------------------------------------------------------+ +* | | 30:28 | TYPE = GUC_HXG_TYPE_REQUEST_ | +* | +-------+--------------------------------------------------------------+ +* | | 27:16 | **DATA0** - request data (depends on ACTION) | +* | +-------+--------------------------------------------------------------+ +* | | 15:0 | **ACTION** - requested action code | +* +---+-------+--------------------------------------------------------------+ +* | 1 | 31:0 | **DATA1** - optional data (depends on ACTION) | +* +---+-------+--------------------------------------------------------------+ +* |...| | | +* +---+-------+--------------------------------------------------------------+ +* | n | 31:0 | **DATAn** - optional data (depends on ACTION) | +* +---+-------+--------------------------------------------------------------+ +*/ + +#define GUC_HXG_REQUEST_MSG_MIN_LEN GUC_HXG_MSG_MIN_LEN +#define GUC_HXG_REQUEST_MSG_0_DATA0 (0xfff << 16) +#define GUC_HXG_REQUEST_MSG_0_ACTION (0xffff << 0) +#define GUC_HXG_REQUEST_MSG_n_DATAn (0xffffffff << 0) + +/** +* DOC: HXG Event +* +* The `HXG Event`_ message should be used to initiate asynchronous activity +* that does not involves immediate confirmation nor data. +* +* Format of @DATA0 and all @DATAn fields depends on the @ACTION code. +* +* .. _HXG Event: +* +* +---+-------+--------------------------------------------------------------+ +* | | Bits | Description | +* +===+=======+==============================================================+ +* | 0 | 31 | ORIGIN | +* | +-------+--------------------------------------------------------------+ +* | | 30:28 | TYPE = GUC_HXG_TYPE_EVENT_ | +* | +-------+--------------------------------------------------------------+ +* | | 27:16 | **DATA0** - event data (depends on ACTION) | +* | +-------+--------------------------------------------------------------+ +* | | 15:0 | **ACTION** - event action code | +* +---+-------+--------------------------------------------------------------+ +* | 1 | 31:0 | **DATA1** - optional event data (depends on ACTION) | +* +---+-------+--------------------------------------------------------------+ +* |...| | | +* +---+-------+--------------------------------------------------------------+ +* | n | 31:0 | **DATAn** - optional event data (depends on ACTION) | +* +---+-------+--------------------------------------------------------------+ +*/ + +#define GUC_HXG_EVENT_MSG_MIN_LEN GUC_HXG_MSG_MIN_LEN +#define GUC_HXG_EVENT_MSG_0_DATA0 (0xfff << 16) +#define GUC_HXG_EVENT_MSG_0_ACTION (0xffff << 0) +#define GUC_HXG_EVENT_MSG_n_DATAn (0xffffffff << 0) + +/** +* DOC: HXG Busy +* +* The `HXG Busy`_ message may be used to acknowledge reception of the `HXG Request`_ +* message if the recipient expects that it processing will be longer than default +* timeout. +* +* The @COUNTER field may be used as a progress indicator. +* +* .. _HXG Busy: +* +* +---+-------+--------------------------------------------------------------+ +* | | Bits | Description | +* +===+=======+==============================================================+ +* | 0 | 31 | ORIGIN | +* | +-------+--------------------------------------------------------------+ +* | | 30:28 | TYPE = GUC_HXG_TYPE_NO_RESPONSE_BUSY_ | +* | +-------+--------------------------------------------------------------+ +* | | 27:0 | **COUNTER** - progress indicator | +* +---+-------+--------------------------------------------------------------+ +*/ + +#define GUC_HXG_BUSY_MSG_LEN GUC_HXG_MSG_MIN_LEN +#define GUC_HXG_BUSY_MSG_0_COUNTER GUC_HXG_MSG_0_AUX + +/** +* DOC: HXG Retry +* +* The `HXG Retry`_ message should be used by recipient to indicate that the +* `HXG Request`_ message was dropped and it should be resent again. +* +* The @REASON field may be used to provide additional information. +* +* .. _HXG Retry: +* +* +---+-------+--------------------------------------------------------------+ +* | | Bits | Description | +* +===+=======+==============================================================+ +* | 0 | 31 | ORIGIN | +* | +-------+--------------------------------------------------------------+ +* | | 30:28 | TYPE = GUC_HXG_TYPE_NO_RESPONSE_RETRY_ | +* | +-------+--------------------------------------------------------------+ +* | | 27:0 | **REASON** - reason for retry | +* | | | - _`GUC_HXG_RETRY_REASON_UNSPECIFIED` = 0 | +* +---+-------+--------------------------------------------------------------+ +*/ + +#define GUC_HXG_RETRY_MSG_LEN GUC_HXG_MSG_MIN_LEN +#define GUC_HXG_RETRY_MSG_0_REASON GUC_HXG_MSG_0_AUX +#define GUC_HXG_RETRY_REASON_UNSPECIFIED 0u + +/** +* DOC: HXG Failure +* +* The `HXG Failure`_ message shall be used as a reply to the `HXG Request`_ +* message that could not be processed due to an error. +* +* .. _HXG Failure: +* +* +---+-------+--------------------------------------------------------------+ +* | | Bits | Description | +* +===+=======+==============================================================+ +* | 0 | 31 | ORIGIN | +* | +-------+--------------------------------------------------------------+ +* | | 30:28 | TYPE = GUC_HXG_TYPE_RESPONSE_FAILURE_ | +* | +-------+--------------------------------------------------------------+ +* | | 27:16 | **HINT** - additional error hint | +* | +-------+--------------------------------------------------------------+ +* | | 15:0 | **ERROR** - error/result code | +* +---+-------+--------------------------------------------------------------+ +*/ + +#define GUC_HXG_FAILURE_MSG_LEN GUC_HXG_MSG_MIN_LEN +#define GUC_HXG_FAILURE_MSG_0_HINT (0xfff << 16) +#define GUC_HXG_FAILURE_MSG_0_ERROR (0xffff << 0) + +/** +* DOC: HXG Response +* +* The `HXG Response`_ message SHALL be used as a reply to the `HXG Request`_ +* message that was successfully processed without an error. +* +* .. _HXG Response: +* +* +---+-------+--------------------------------------------------------------+ +* | | Bits | Description | +* +===+=======+==============================================================+ +* | 0 | 31 | ORIGIN | +* | +-------+--------------------------------------------------------------+ +* | | 30:28 | TYPE = GUC_HXG_TYPE_RESPONSE_SUCCESS_ | +* | +-------+--------------------------------------------------------------+ +* | | 27:0 | **DATA0** - data (depends on ACTION from `HXG Request`_) | +* +---+-------+--------------------------------------------------------------+ +* | 1 | 31:0 | **DATA1** - data (depends on ACTION from `HXG Request`_) | +* +---+-------+--------------------------------------------------------------+ +* |...| | | +* +---+-------+--------------------------------------------------------------+ +* | n | 31:0 | **DATAn** - data (depends on ACTION from `HXG Request`_) | +* +---+-------+--------------------------------------------------------------+ +*/ + +#define GUC_HXG_RESPONSE_MSG_MIN_LEN GUC_HXG_MSG_MIN_LEN +#define GUC_HXG_RESPONSE_MSG_0_DATA0 GUC_HXG_MSG_0_AUX +#define GUC_HXG_RESPONSE_MSG_n_DATAn (0xffffffff << 0) + +/* deprecated */ #define INTEL_GUC_MSG_TYPE_SHIFT 28#define INTEL_GUC_MSG_TYPE_MASK (0xF << INTEL_GUC_MSG_TYPE_SHIFT)#define INTEL_GUC_MSG_DATA_SHIFT 16Signature · 1 line
2.28.0
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch
Re: [RFC PATCH 20/97] drm/i915/guc: Introduce unified HXG messages
Quoted 22 lines · Daniel Vetter
Quoted 21 lines · Matthew Brost
From: Michal Wajdeczko <[email protected]>
New GuC firmware will unify format of MMIO and CTB H2G messages. Introduce their definitions now to allow gradual transition of our code to match new changes.
Signed-off-by Michal Wajdeczko <[email protected]>Signed-off-by Matthew Brost <[email protected]>Cc Michał Winiarski <[email protected]>--- .../gpu/drm/i915/gt/uc/abi/guc_messages_abi.h | 226 ++++++++++++++++++ 1 file changed, 226 insertions(+)drivers/gpu/drm/i915/gt/uc/abi/guc_messages_abi.h +0
-0@@ -6,6 +6,232 @@#ifndef _ABI_GUC_MESSAGES_ABI_H#define _ABI_GUC_MESSAGES_ABI_H
Quoted 7 lines
drivers/gpu/drm/i915/gt/uc/abi/guc_messages_abi.h line 10
Quoted 2 lines
drivers/gpu/drm/i915/gt/uc/abi/guc_messages_abi.h +2
-0+/** +* DOC: HXG Message These aren't useful if we don't pull them in somewhere in the
Documentation/gpuhierarchy. General comment, and also please check that it all renders correctly still.
Sure. Let me figure this out before my next rev.
Quoted 4 lines
btw if you respin a patch not originally by you we generally add a (v1) to the original s-o-b line (or whever the version split was) and explain in the usual changelog in the commit message what was changed.
Still new to this process. Will do.
Matt
Quoted 225 lines
This holds for the entire series ofc.
-DanielQuoted 222 lines
drivers/gpu/drm/i915/gt/uc/abi/guc_messages_abi.h +222
-0+* +* All messages exchanged with GuC are defined using 32 bit dwords. +* First dword is treated as a message header. Remaining dwords are optional. +* +* .. _HXG Message: +* +* +---+-------+--------------------------------------------------------------+ +* | | Bits | Description | +* +===+=======+==============================================================+ +* | | | | +* | 0 | 31 | **ORIGIN** - originator of the message | +* | | | - _`GUC_HXG_ORIGIN_HOST` = 0 | +* | | | - _`GUC_HXG_ORIGIN_GUC` = 1 | +* | | | | +* | +-------+--------------------------------------------------------------+ +* | | 30:28 | **TYPE** - message type | +* | | | - _`GUC_HXG_TYPE_REQUEST` = 0 | +* | | | - _`GUC_HXG_TYPE_EVENT` = 1 | +* | | | - _`GUC_HXG_TYPE_NO_RESPONSE_BUSY` = 3 | +* | | | - _`GUC_HXG_TYPE_NO_RESPONSE_RETRY` = 5 | +* | | | - _`GUC_HXG_TYPE_RESPONSE_FAILURE` = 6 | +* | | | - _`GUC_HXG_TYPE_RESPONSE_SUCCESS` = 7 | +* | +-------+--------------------------------------------------------------+ +* | | 27:0 | **AUX** - auxiliary data (depends TYPE) | +* +---+-------+--------------------------------------------------------------+ +* | 1 | 31:0 | optional payload (depends on TYPE) | +* +---+-------+ | +* |...| | | +* +---+-------+ | +* | n | 31:0 | | +* +---+-------+--------------------------------------------------------------+ +*/ + +#define GUC_HXG_MSG_MIN_LEN 1u +#define GUC_HXG_MSG_0_ORIGIN (0x1 << 31) +#define GUC_HXG_ORIGIN_HOST 0u +#define GUC_HXG_ORIGIN_GUC 1u +#define GUC_HXG_MSG_0_TYPE (0x7 << 28) +#define GUC_HXG_TYPE_REQUEST 0u +#define GUC_HXG_TYPE_EVENT 1u +#define GUC_HXG_TYPE_NO_RESPONSE_BUSY 3u +#define GUC_HXG_TYPE_NO_RESPONSE_RETRY 5u +#define GUC_HXG_TYPE_RESPONSE_FAILURE 6u +#define GUC_HXG_TYPE_RESPONSE_SUCCESS 7u +#define GUC_HXG_MSG_0_AUX (0xfffffff << 0) + +/** +* DOC: HXG Request +* +* The `HXG Request`_ message should be used to initiate synchronous activity +* for which confirmation or return data is expected. +* +* The recipient of this message shall use `HXG Response`_, `HXG Failure`_ +* or `HXG Retry`_ message as a definite reply, and may use `HXG Busy`_ +* message as a intermediate reply. +* +* Format of @DATA0 and all @DATAn fields depends on the @ACTION code. +* +* _HXG Request: +* +* +---+-------+--------------------------------------------------------------+ +* | | Bits | Description | +* +===+=======+==============================================================+ +* | 0 | 31 | ORIGIN | +* | +-------+--------------------------------------------------------------+ +* | | 30:28 | TYPE = GUC_HXG_TYPE_REQUEST_ | +* | +-------+--------------------------------------------------------------+ +* | | 27:16 | **DATA0** - request data (depends on ACTION) | +* | +-------+--------------------------------------------------------------+ +* | | 15:0 | **ACTION** - requested action code | +* +---+-------+--------------------------------------------------------------+ +* | 1 | 31:0 | **DATA1** - optional data (depends on ACTION) | +* +---+-------+--------------------------------------------------------------+ +* |...| | | +* +---+-------+--------------------------------------------------------------+ +* | n | 31:0 | **DATAn** - optional data (depends on ACTION) | +* +---+-------+--------------------------------------------------------------+ +*/ + +#define GUC_HXG_REQUEST_MSG_MIN_LEN GUC_HXG_MSG_MIN_LEN +#define GUC_HXG_REQUEST_MSG_0_DATA0 (0xfff << 16) +#define GUC_HXG_REQUEST_MSG_0_ACTION (0xffff << 0) +#define GUC_HXG_REQUEST_MSG_n_DATAn (0xffffffff << 0) + +/** +* DOC: HXG Event +* +* The `HXG Event`_ message should be used to initiate asynchronous activity +* that does not involves immediate confirmation nor data. +* +* Format of @DATA0 and all @DATAn fields depends on the @ACTION code. +* +* .. _HXG Event: +* +* +---+-------+--------------------------------------------------------------+ +* | | Bits | Description | +* +===+=======+==============================================================+ +* | 0 | 31 | ORIGIN | +* | +-------+--------------------------------------------------------------+ +* | | 30:28 | TYPE = GUC_HXG_TYPE_EVENT_ | +* | +-------+--------------------------------------------------------------+ +* | | 27:16 | **DATA0** - event data (depends on ACTION) | +* | +-------+--------------------------------------------------------------+ +* | | 15:0 | **ACTION** - event action code | +* +---+-------+--------------------------------------------------------------+ +* | 1 | 31:0 | **DATA1** - optional event data (depends on ACTION) | +* +---+-------+--------------------------------------------------------------+ +* |...| | | +* +---+-------+--------------------------------------------------------------+ +* | n | 31:0 | **DATAn** - optional event data (depends on ACTION) | +* +---+-------+--------------------------------------------------------------+ +*/ + +#define GUC_HXG_EVENT_MSG_MIN_LEN GUC_HXG_MSG_MIN_LEN +#define GUC_HXG_EVENT_MSG_0_DATA0 (0xfff << 16) +#define GUC_HXG_EVENT_MSG_0_ACTION (0xffff << 0) +#define GUC_HXG_EVENT_MSG_n_DATAn (0xffffffff << 0) + +/** +* DOC: HXG Busy +* +* The `HXG Busy`_ message may be used to acknowledge reception of the `HXG Request`_ +* message if the recipient expects that it processing will be longer than default +* timeout. +* +* The @COUNTER field may be used as a progress indicator. +* +* .. _HXG Busy: +* +* +---+-------+--------------------------------------------------------------+ +* | | Bits | Description | +* +===+=======+==============================================================+ +* | 0 | 31 | ORIGIN | +* | +-------+--------------------------------------------------------------+ +* | | 30:28 | TYPE = GUC_HXG_TYPE_NO_RESPONSE_BUSY_ | +* | +-------+--------------------------------------------------------------+ +* | | 27:0 | **COUNTER** - progress indicator | +* +---+-------+--------------------------------------------------------------+ +*/ + +#define GUC_HXG_BUSY_MSG_LEN GUC_HXG_MSG_MIN_LEN +#define GUC_HXG_BUSY_MSG_0_COUNTER GUC_HXG_MSG_0_AUX + +/** +* DOC: HXG Retry +* +* The `HXG Retry`_ message should be used by recipient to indicate that the +* `HXG Request`_ message was dropped and it should be resent again. +* +* The @REASON field may be used to provide additional information. +* +* .. _HXG Retry: +* +* +---+-------+--------------------------------------------------------------+ +* | | Bits | Description | +* +===+=======+==============================================================+ +* | 0 | 31 | ORIGIN | +* | +-------+--------------------------------------------------------------+ +* | | 30:28 | TYPE = GUC_HXG_TYPE_NO_RESPONSE_RETRY_ | +* | +-------+--------------------------------------------------------------+ +* | | 27:0 | **REASON** - reason for retry | +* | | | - _`GUC_HXG_RETRY_REASON_UNSPECIFIED` = 0 | +* +---+-------+--------------------------------------------------------------+ +*/ + +#define GUC_HXG_RETRY_MSG_LEN GUC_HXG_MSG_MIN_LEN +#define GUC_HXG_RETRY_MSG_0_REASON GUC_HXG_MSG_0_AUX +#define GUC_HXG_RETRY_REASON_UNSPECIFIED 0u + +/** +* DOC: HXG Failure +* +* The `HXG Failure`_ message shall be used as a reply to the `HXG Request`_ +* message that could not be processed due to an error. +* +* .. _HXG Failure: +* +* +---+-------+--------------------------------------------------------------+ +* | | Bits | Description | +* +===+=======+==============================================================+ +* | 0 | 31 | ORIGIN | +* | +-------+--------------------------------------------------------------+ +* | | 30:28 | TYPE = GUC_HXG_TYPE_RESPONSE_FAILURE_ | +* | +-------+--------------------------------------------------------------+ +* | | 27:16 | **HINT** - additional error hint | +* | +-------+--------------------------------------------------------------+ +* | | 15:0 | **ERROR** - error/result code | +* +---+-------+--------------------------------------------------------------+ +*/ + +#define GUC_HXG_FAILURE_MSG_LEN GUC_HXG_MSG_MIN_LEN +#define GUC_HXG_FAILURE_MSG_0_HINT (0xfff << 16) +#define GUC_HXG_FAILURE_MSG_0_ERROR (0xffff << 0) + +/** +* DOC: HXG Response +* +* The `HXG Response`_ message SHALL be used as a reply to the `HXG Request`_ +* message that was successfully processed without an error. +* +* .. _HXG Response: +* +* +---+-------+--------------------------------------------------------------+ +* | | Bits | Description | +* +===+=======+==============================================================+ +* | 0 | 31 | ORIGIN | +* | +-------+--------------------------------------------------------------+ +* | | 30:28 | TYPE = GUC_HXG_TYPE_RESPONSE_SUCCESS_ | +* | +-------+--------------------------------------------------------------+ +* | | 27:0 | **DATA0** - data (depends on ACTION from `HXG Request`_) | +* +---+-------+--------------------------------------------------------------+ +* | 1 | 31:0 | **DATA1** - data (depends on ACTION from `HXG Request`_) | +* +---+-------+--------------------------------------------------------------+ +* |...| | | +* +---+-------+--------------------------------------------------------------+ +* | n | 31:0 | **DATAn** - data (depends on ACTION from `HXG Request`_) | +* +---+-------+--------------------------------------------------------------+ +*/ + +#define GUC_HXG_RESPONSE_MSG_MIN_LEN GUC_HXG_MSG_MIN_LEN +#define GUC_HXG_RESPONSE_MSG_0_DATA0 GUC_HXG_MSG_0_AUX +#define GUC_HXG_RESPONSE_MSG_n_DATAn (0xffffffff << 0)
Quoted 13 lines
Quoted 8 lines
drivers/gpu/drm/i915/gt/uc/abi/guc_messages_abi.h +2
-0+ +/* deprecated */ #define INTEL_GUC_MSG_TYPE_SHIFT 28#define INTEL_GUC_MSG_TYPE_MASK (0xF << INTEL_GUC_MSG_TYPE_SHIFT)#define INTEL_GUC_MSG_DATA_SHIFT 16Signature · 1 line
2.28.0Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [RFC PATCH 20/97] drm/i915/guc: Introduce unified HXG messages
In reply to Daniel VetterQuoted 22 lines · Daniel Vetter
Quoted 21 lines · Matthew Brost
From: Michal Wajdeczko <[email protected]>
New GuC firmware will unify format of MMIO and CTB H2G messages. Introduce their definitions now to allow gradual transition of our code to match new changes.
Signed-off-by Michal Wajdeczko <[email protected]>Signed-off-by Matthew Brost <[email protected]>Cc Michał Winiarski <[email protected]>--- .../gpu/drm/i915/gt/uc/abi/guc_messages_abi.h | 226 ++++++++++++++++++ 1 file changed, 226 insertions(+)drivers/gpu/drm/i915/gt/uc/abi/guc_messages_abi.h +0
-0@@ -6,6 +6,232 @@#ifndef _ABI_GUC_MESSAGES_ABI_H#define _ABI_GUC_MESSAGES_ABI_H
Quoted 6 lines
drivers/gpu/drm/i915/gt/uc/abi/guc_messages_abi.h line 10
Quoted 2 lines
drivers/gpu/drm/i915/gt/uc/abi/guc_messages_abi.h +2
-0+/** +* DOC: HXG Message These aren't useful if we don't pull them in somewhere in the
Documentation/gpuhierarchy. General comment, and also please check that it all renders correctly still.
Patch that connects all these DOC sections into i915.rst is still on private branch, where I'm trying to verify all html rendering, and ...
Quoted 13 lines
btw if you respin a patch not originally by you we generally add a (v1) to the original s-o-b line (or whever the version split was) and explain in the usual changelog in the commit message what was changed.
This holds for the entire series ofc.
-DanielQuoted 5 lines
drivers/gpu/drm/i915/gt/uc/abi/guc_messages_abi.h +5
-0+* +* All messages exchanged with GuC are defined using 32 bit dwords. +* First dword is treated as a message header. Remaining dwords are optional. +* +* .. _HXG Message:
where such workarounds from early documentation are already removed, since they are not needed any more starting from commit ef09989594bf ("scripts/kernel-doc: add internal hyperlink to DOC: sections")
Michal
Quoted 226 lines
Quoted 225 lines
drivers/gpu/drm/i915/gt/uc/abi/guc_messages_abi.h +219
-0+* +* +---+-------+--------------------------------------------------------------+ +* | | Bits | Description | +* +===+=======+==============================================================+ +* | | | | +* | 0 | 31 | **ORIGIN** - originator of the message | +* | | | - _`GUC_HXG_ORIGIN_HOST` = 0 | +* | | | - _`GUC_HXG_ORIGIN_GUC` = 1 | +* | | | | +* | +-------+--------------------------------------------------------------+ +* | | 30:28 | **TYPE** - message type | +* | | | - _`GUC_HXG_TYPE_REQUEST` = 0 | +* | | | - _`GUC_HXG_TYPE_EVENT` = 1 | +* | | | - _`GUC_HXG_TYPE_NO_RESPONSE_BUSY` = 3 | +* | | | - _`GUC_HXG_TYPE_NO_RESPONSE_RETRY` = 5 | +* | | | - _`GUC_HXG_TYPE_RESPONSE_FAILURE` = 6 | +* | | | - _`GUC_HXG_TYPE_RESPONSE_SUCCESS` = 7 | +* | +-------+--------------------------------------------------------------+ +* | | 27:0 | **AUX** - auxiliary data (depends TYPE) | +* +---+-------+--------------------------------------------------------------+ +* | 1 | 31:0 | optional payload (depends on TYPE) | +* +---+-------+ | +* |...| | | +* +---+-------+ | +* | n | 31:0 | | +* +---+-------+--------------------------------------------------------------+ +*/ + +#define GUC_HXG_MSG_MIN_LEN 1u +#define GUC_HXG_MSG_0_ORIGIN (0x1 << 31) +#define GUC_HXG_ORIGIN_HOST 0u +#define GUC_HXG_ORIGIN_GUC 1u +#define GUC_HXG_MSG_0_TYPE (0x7 << 28) +#define GUC_HXG_TYPE_REQUEST 0u +#define GUC_HXG_TYPE_EVENT 1u +#define GUC_HXG_TYPE_NO_RESPONSE_BUSY 3u +#define GUC_HXG_TYPE_NO_RESPONSE_RETRY 5u +#define GUC_HXG_TYPE_RESPONSE_FAILURE 6u +#define GUC_HXG_TYPE_RESPONSE_SUCCESS 7u +#define GUC_HXG_MSG_0_AUX (0xfffffff << 0) + +/** +* DOC: HXG Request +* +* The `HXG Request`_ message should be used to initiate synchronous activity +* for which confirmation or return data is expected. +* +* The recipient of this message shall use `HXG Response`_, `HXG Failure`_ +* or `HXG Retry`_ message as a definite reply, and may use `HXG Busy`_ +* message as a intermediate reply. +* +* Format of @DATA0 and all @DATAn fields depends on the @ACTION code. +* +* _HXG Request: +* +* +---+-------+--------------------------------------------------------------+ +* | | Bits | Description | +* +===+=======+==============================================================+ +* | 0 | 31 | ORIGIN | +* | +-------+--------------------------------------------------------------+ +* | | 30:28 | TYPE = GUC_HXG_TYPE_REQUEST_ | +* | +-------+--------------------------------------------------------------+ +* | | 27:16 | **DATA0** - request data (depends on ACTION) | +* | +-------+--------------------------------------------------------------+ +* | | 15:0 | **ACTION** - requested action code | +* +---+-------+--------------------------------------------------------------+ +* | 1 | 31:0 | **DATA1** - optional data (depends on ACTION) | +* +---+-------+--------------------------------------------------------------+ +* |...| | | +* +---+-------+--------------------------------------------------------------+ +* | n | 31:0 | **DATAn** - optional data (depends on ACTION) | +* +---+-------+--------------------------------------------------------------+ +*/ + +#define GUC_HXG_REQUEST_MSG_MIN_LEN GUC_HXG_MSG_MIN_LEN +#define GUC_HXG_REQUEST_MSG_0_DATA0 (0xfff << 16) +#define GUC_HXG_REQUEST_MSG_0_ACTION (0xffff << 0) +#define GUC_HXG_REQUEST_MSG_n_DATAn (0xffffffff << 0) + +/** +* DOC: HXG Event +* +* The `HXG Event`_ message should be used to initiate asynchronous activity +* that does not involves immediate confirmation nor data. +* +* Format of @DATA0 and all @DATAn fields depends on the @ACTION code. +* +* .. _HXG Event: +* +* +---+-------+--------------------------------------------------------------+ +* | | Bits | Description | +* +===+=======+==============================================================+ +* | 0 | 31 | ORIGIN | +* | +-------+--------------------------------------------------------------+ +* | | 30:28 | TYPE = GUC_HXG_TYPE_EVENT_ | +* | +-------+--------------------------------------------------------------+ +* | | 27:16 | **DATA0** - event data (depends on ACTION) | +* | +-------+--------------------------------------------------------------+ +* | | 15:0 | **ACTION** - event action code | +* +---+-------+--------------------------------------------------------------+ +* | 1 | 31:0 | **DATA1** - optional event data (depends on ACTION) | +* +---+-------+--------------------------------------------------------------+ +* |...| | | +* +---+-------+--------------------------------------------------------------+ +* | n | 31:0 | **DATAn** - optional event data (depends on ACTION) | +* +---+-------+--------------------------------------------------------------+ +*/ + +#define GUC_HXG_EVENT_MSG_MIN_LEN GUC_HXG_MSG_MIN_LEN +#define GUC_HXG_EVENT_MSG_0_DATA0 (0xfff << 16) +#define GUC_HXG_EVENT_MSG_0_ACTION (0xffff << 0) +#define GUC_HXG_EVENT_MSG_n_DATAn (0xffffffff << 0) + +/** +* DOC: HXG Busy +* +* The `HXG Busy`_ message may be used to acknowledge reception of the `HXG Request`_ +* message if the recipient expects that it processing will be longer than default +* timeout. +* +* The @COUNTER field may be used as a progress indicator. +* +* .. _HXG Busy: +* +* +---+-------+--------------------------------------------------------------+ +* | | Bits | Description | +* +===+=======+==============================================================+ +* | 0 | 31 | ORIGIN | +* | +-------+--------------------------------------------------------------+ +* | | 30:28 | TYPE = GUC_HXG_TYPE_NO_RESPONSE_BUSY_ | +* | +-------+--------------------------------------------------------------+ +* | | 27:0 | **COUNTER** - progress indicator | +* +---+-------+--------------------------------------------------------------+ +*/ + +#define GUC_HXG_BUSY_MSG_LEN GUC_HXG_MSG_MIN_LEN +#define GUC_HXG_BUSY_MSG_0_COUNTER GUC_HXG_MSG_0_AUX + +/** +* DOC: HXG Retry +* +* The `HXG Retry`_ message should be used by recipient to indicate that the +* `HXG Request`_ message was dropped and it should be resent again. +* +* The @REASON field may be used to provide additional information. +* +* .. _HXG Retry: +* +* +---+-------+--------------------------------------------------------------+ +* | | Bits | Description | +* +===+=======+==============================================================+ +* | 0 | 31 | ORIGIN | +* | +-------+--------------------------------------------------------------+ +* | | 30:28 | TYPE = GUC_HXG_TYPE_NO_RESPONSE_RETRY_ | +* | +-------+--------------------------------------------------------------+ +* | | 27:0 | **REASON** - reason for retry | +* | | | - _`GUC_HXG_RETRY_REASON_UNSPECIFIED` = 0 | +* +---+-------+--------------------------------------------------------------+ +*/ + +#define GUC_HXG_RETRY_MSG_LEN GUC_HXG_MSG_MIN_LEN +#define GUC_HXG_RETRY_MSG_0_REASON GUC_HXG_MSG_0_AUX +#define GUC_HXG_RETRY_REASON_UNSPECIFIED 0u + +/** +* DOC: HXG Failure +* +* The `HXG Failure`_ message shall be used as a reply to the `HXG Request`_ +* message that could not be processed due to an error. +* +* .. _HXG Failure: +* +* +---+-------+--------------------------------------------------------------+ +* | | Bits | Description | +* +===+=======+==============================================================+ +* | 0 | 31 | ORIGIN | +* | +-------+--------------------------------------------------------------+ +* | | 30:28 | TYPE = GUC_HXG_TYPE_RESPONSE_FAILURE_ | +* | +-------+--------------------------------------------------------------+ +* | | 27:16 | **HINT** - additional error hint | +* | +-------+--------------------------------------------------------------+ +* | | 15:0 | **ERROR** - error/result code | +* +---+-------+--------------------------------------------------------------+ +*/ + +#define GUC_HXG_FAILURE_MSG_LEN GUC_HXG_MSG_MIN_LEN +#define GUC_HXG_FAILURE_MSG_0_HINT (0xfff << 16) +#define GUC_HXG_FAILURE_MSG_0_ERROR (0xffff << 0) + +/** +* DOC: HXG Response +* +* The `HXG Response`_ message SHALL be used as a reply to the `HXG Request`_ +* message that was successfully processed without an error. +* +* .. _HXG Response: +* +* +---+-------+--------------------------------------------------------------+ +* | | Bits | Description | +* +===+=======+==============================================================+ +* | 0 | 31 | ORIGIN | +* | +-------+--------------------------------------------------------------+ +* | | 30:28 | TYPE = GUC_HXG_TYPE_RESPONSE_SUCCESS_ | +* | +-------+--------------------------------------------------------------+ +* | | 27:0 | **DATA0** - data (depends on ACTION from `HXG Request`_) | +* +---+-------+--------------------------------------------------------------+ +* | 1 | 31:0 | **DATA1** - data (depends on ACTION from `HXG Request`_) | +* +---+-------+--------------------------------------------------------------+ +* |...| | | +* +---+-------+--------------------------------------------------------------+ +* | n | 31:0 | **DATAn** - data (depends on ACTION from `HXG Request`_) | +* +---+-------+--------------------------------------------------------------+ +*/ + +#define GUC_HXG_RESPONSE_MSG_MIN_LEN GUC_HXG_MSG_MIN_LEN +#define GUC_HXG_RESPONSE_MSG_0_DATA0 GUC_HXG_MSG_0_AUX +#define GUC_HXG_RESPONSE_MSG_n_DATAn (0xffffffff << 0) + +/* deprecated */ #define INTEL_GUC_MSG_TYPE_SHIFT 28#define INTEL_GUC_MSG_TYPE_MASK (0xF << INTEL_GUC_MSG_TYPE_SHIFT)#define INTEL_GUC_MSG_DATA_SHIFT 16Signature · 1 line
2.28.0
Re: [RFC PATCH 20/97] drm/i915/guc: Introduce unified HXG messages
Quoted 49 lines · Michal Wajdeczko
Quoted 22 lines · Daniel Vetter
Quoted 21 lines · Matthew Brost
From: Michal Wajdeczko <[email protected]>
New GuC firmware will unify format of MMIO and CTB H2G messages. Introduce their definitions now to allow gradual transition of our code to match new changes.
Signed-off-by Michal Wajdeczko <[email protected]>Signed-off-by Matthew Brost <[email protected]>Cc Michał Winiarski <[email protected]>--- .../gpu/drm/i915/gt/uc/abi/guc_messages_abi.h | 226 ++++++++++++++++++ 1 file changed, 226 insertions(+)drivers/gpu/drm/i915/gt/uc/abi/guc_messages_abi.h +0
-0@@ -6,6 +6,232 @@#ifndef _ABI_GUC_MESSAGES_ABI_H#define _ABI_GUC_MESSAGES_ABI_HQuoted 6 lines
drivers/gpu/drm/i915/gt/uc/abi/guc_messages_abi.h line 10
Quoted 2 lines
drivers/gpu/drm/i915/gt/uc/abi/guc_messages_abi.h +2
-0+/** +* DOC: HXG Message These aren't useful if we don't pull them in somewhere in the
Documentation/gpuhierarchy. General comment, and also please check that it all renders correctly still.Patch that connects all these DOC sections into
i915.rstis still on private branch, where I'm trying to verify all html rendering, and ...Quoted 13 lines
btw if you respin a patch not originally by you we generally add a (v1) to the original s-o-b line (or whever the version split was) and explain in the usual changelog in the commit message what was changed.
This holds for the entire series ofc.
-DanielQuoted 5 lines
drivers/gpu/drm/i915/gt/uc/abi/guc_messages_abi.h +5
-0+* +* All messages exchanged with GuC are defined using 32 bit dwords. +* First dword is treated as a message header. Remaining dwords are optional. +* +* .. _HXG Message:
Quoted 3 lines
where such workarounds from early documentation are already removed, since they are not needed any more starting from commit
ef09989594bf("scripts/kernel-doc: add internal hyperlink to DOC: sections")
Oh this is nice. Fwiw the upstream commit is:
commit 06a755d6269c072ed0c9b84227eaf33113dc243f
Author: Michal Wajdeczko <[email protected]> Date: Mon Jan 18 12:08:13 2021 +0100
scripts/kernel-doc: add internal hyperlink to DOC: sections
I guess the sha1 you have is from your own branch? -Daniel
Quoted 229 lines
Michal
Quoted 226 lines
Quoted 225 lines
drivers/gpu/drm/i915/gt/uc/abi/guc_messages_abi.h +219
-0+* +* +---+-------+--------------------------------------------------------------+ +* | | Bits | Description | +* +===+=======+==============================================================+ +* | | | | +* | 0 | 31 | **ORIGIN** - originator of the message | +* | | | - _`GUC_HXG_ORIGIN_HOST` = 0 | +* | | | - _`GUC_HXG_ORIGIN_GUC` = 1 | +* | | | | +* | +-------+--------------------------------------------------------------+ +* | | 30:28 | **TYPE** - message type | +* | | | - _`GUC_HXG_TYPE_REQUEST` = 0 | +* | | | - _`GUC_HXG_TYPE_EVENT` = 1 | +* | | | - _`GUC_HXG_TYPE_NO_RESPONSE_BUSY` = 3 | +* | | | - _`GUC_HXG_TYPE_NO_RESPONSE_RETRY` = 5 | +* | | | - _`GUC_HXG_TYPE_RESPONSE_FAILURE` = 6 | +* | | | - _`GUC_HXG_TYPE_RESPONSE_SUCCESS` = 7 | +* | +-------+--------------------------------------------------------------+ +* | | 27:0 | **AUX** - auxiliary data (depends TYPE) | +* +---+-------+--------------------------------------------------------------+ +* | 1 | 31:0 | optional payload (depends on TYPE) | +* +---+-------+ | +* |...| | | +* +---+-------+ | +* | n | 31:0 | | +* +---+-------+--------------------------------------------------------------+ +*/ + +#define GUC_HXG_MSG_MIN_LEN 1u +#define GUC_HXG_MSG_0_ORIGIN (0x1 << 31) +#define GUC_HXG_ORIGIN_HOST 0u +#define GUC_HXG_ORIGIN_GUC 1u +#define GUC_HXG_MSG_0_TYPE (0x7 << 28) +#define GUC_HXG_TYPE_REQUEST 0u +#define GUC_HXG_TYPE_EVENT 1u +#define GUC_HXG_TYPE_NO_RESPONSE_BUSY 3u +#define GUC_HXG_TYPE_NO_RESPONSE_RETRY 5u +#define GUC_HXG_TYPE_RESPONSE_FAILURE 6u +#define GUC_HXG_TYPE_RESPONSE_SUCCESS 7u +#define GUC_HXG_MSG_0_AUX (0xfffffff << 0) + +/** +* DOC: HXG Request +* +* The `HXG Request`_ message should be used to initiate synchronous activity +* for which confirmation or return data is expected. +* +* The recipient of this message shall use `HXG Response`_, `HXG Failure`_ +* or `HXG Retry`_ message as a definite reply, and may use `HXG Busy`_ +* message as a intermediate reply. +* +* Format of @DATA0 and all @DATAn fields depends on the @ACTION code. +* +* _HXG Request: +* +* +---+-------+--------------------------------------------------------------+ +* | | Bits | Description | +* +===+=======+==============================================================+ +* | 0 | 31 | ORIGIN | +* | +-------+--------------------------------------------------------------+ +* | | 30:28 | TYPE = GUC_HXG_TYPE_REQUEST_ | +* | +-------+--------------------------------------------------------------+ +* | | 27:16 | **DATA0** - request data (depends on ACTION) | +* | +-------+--------------------------------------------------------------+ +* | | 15:0 | **ACTION** - requested action code | +* +---+-------+--------------------------------------------------------------+ +* | 1 | 31:0 | **DATA1** - optional data (depends on ACTION) | +* +---+-------+--------------------------------------------------------------+ +* |...| | | +* +---+-------+--------------------------------------------------------------+ +* | n | 31:0 | **DATAn** - optional data (depends on ACTION) | +* +---+-------+--------------------------------------------------------------+ +*/ + +#define GUC_HXG_REQUEST_MSG_MIN_LEN GUC_HXG_MSG_MIN_LEN +#define GUC_HXG_REQUEST_MSG_0_DATA0 (0xfff << 16) +#define GUC_HXG_REQUEST_MSG_0_ACTION (0xffff << 0) +#define GUC_HXG_REQUEST_MSG_n_DATAn (0xffffffff << 0) + +/** +* DOC: HXG Event +* +* The `HXG Event`_ message should be used to initiate asynchronous activity +* that does not involves immediate confirmation nor data. +* +* Format of @DATA0 and all @DATAn fields depends on the @ACTION code. +* +* .. _HXG Event: +* +* +---+-------+--------------------------------------------------------------+ +* | | Bits | Description | +* +===+=======+==============================================================+ +* | 0 | 31 | ORIGIN | +* | +-------+--------------------------------------------------------------+ +* | | 30:28 | TYPE = GUC_HXG_TYPE_EVENT_ | +* | +-------+--------------------------------------------------------------+ +* | | 27:16 | **DATA0** - event data (depends on ACTION) | +* | +-------+--------------------------------------------------------------+ +* | | 15:0 | **ACTION** - event action code | +* +---+-------+--------------------------------------------------------------+ +* | 1 | 31:0 | **DATA1** - optional event data (depends on ACTION) | +* +---+-------+--------------------------------------------------------------+ +* |...| | | +* +---+-------+--------------------------------------------------------------+ +* | n | 31:0 | **DATAn** - optional event data (depends on ACTION) | +* +---+-------+--------------------------------------------------------------+ +*/ + +#define GUC_HXG_EVENT_MSG_MIN_LEN GUC_HXG_MSG_MIN_LEN +#define GUC_HXG_EVENT_MSG_0_DATA0 (0xfff << 16) +#define GUC_HXG_EVENT_MSG_0_ACTION (0xffff << 0) +#define GUC_HXG_EVENT_MSG_n_DATAn (0xffffffff << 0) + +/** +* DOC: HXG Busy +* +* The `HXG Busy`_ message may be used to acknowledge reception of the `HXG Request`_ +* message if the recipient expects that it processing will be longer than default +* timeout. +* +* The @COUNTER field may be used as a progress indicator. +* +* .. _HXG Busy: +* +* +---+-------+--------------------------------------------------------------+ +* | | Bits | Description | +* +===+=======+==============================================================+ +* | 0 | 31 | ORIGIN | +* | +-------+--------------------------------------------------------------+ +* | | 30:28 | TYPE = GUC_HXG_TYPE_NO_RESPONSE_BUSY_ | +* | +-------+--------------------------------------------------------------+ +* | | 27:0 | **COUNTER** - progress indicator | +* +---+-------+--------------------------------------------------------------+ +*/ + +#define GUC_HXG_BUSY_MSG_LEN GUC_HXG_MSG_MIN_LEN +#define GUC_HXG_BUSY_MSG_0_COUNTER GUC_HXG_MSG_0_AUX + +/** +* DOC: HXG Retry +* +* The `HXG Retry`_ message should be used by recipient to indicate that the +* `HXG Request`_ message was dropped and it should be resent again. +* +* The @REASON field may be used to provide additional information. +* +* .. _HXG Retry: +* +* +---+-------+--------------------------------------------------------------+ +* | | Bits | Description | +* +===+=======+==============================================================+ +* | 0 | 31 | ORIGIN | +* | +-------+--------------------------------------------------------------+ +* | | 30:28 | TYPE = GUC_HXG_TYPE_NO_RESPONSE_RETRY_ | +* | +-------+--------------------------------------------------------------+ +* | | 27:0 | **REASON** - reason for retry | +* | | | - _`GUC_HXG_RETRY_REASON_UNSPECIFIED` = 0 | +* +---+-------+--------------------------------------------------------------+ +*/ + +#define GUC_HXG_RETRY_MSG_LEN GUC_HXG_MSG_MIN_LEN +#define GUC_HXG_RETRY_MSG_0_REASON GUC_HXG_MSG_0_AUX +#define GUC_HXG_RETRY_REASON_UNSPECIFIED 0u + +/** +* DOC: HXG Failure +* +* The `HXG Failure`_ message shall be used as a reply to the `HXG Request`_ +* message that could not be processed due to an error. +* +* .. _HXG Failure: +* +* +---+-------+--------------------------------------------------------------+ +* | | Bits | Description | +* +===+=======+==============================================================+ +* | 0 | 31 | ORIGIN | +* | +-------+--------------------------------------------------------------+ +* | | 30:28 | TYPE = GUC_HXG_TYPE_RESPONSE_FAILURE_ | +* | +-------+--------------------------------------------------------------+ +* | | 27:16 | **HINT** - additional error hint | +* | +-------+--------------------------------------------------------------+ +* | | 15:0 | **ERROR** - error/result code | +* +---+-------+--------------------------------------------------------------+ +*/ + +#define GUC_HXG_FAILURE_MSG_LEN GUC_HXG_MSG_MIN_LEN +#define GUC_HXG_FAILURE_MSG_0_HINT (0xfff << 16) +#define GUC_HXG_FAILURE_MSG_0_ERROR (0xffff << 0) + +/** +* DOC: HXG Response +* +* The `HXG Response`_ message SHALL be used as a reply to the `HXG Request`_ +* message that was successfully processed without an error. +* +* .. _HXG Response: +* +* +---+-------+--------------------------------------------------------------+ +* | | Bits | Description | +* +===+=======+==============================================================+ +* | 0 | 31 | ORIGIN | +* | +-------+--------------------------------------------------------------+ +* | | 30:28 | TYPE = GUC_HXG_TYPE_RESPONSE_SUCCESS_ | +* | +-------+--------------------------------------------------------------+ +* | | 27:0 | **DATA0** - data (depends on ACTION from `HXG Request`_) | +* +---+-------+--------------------------------------------------------------+ +* | 1 | 31:0 | **DATA1** - data (depends on ACTION from `HXG Request`_) | +* +---+-------+--------------------------------------------------------------+ +* |...| | | +* +---+-------+--------------------------------------------------------------+ +* | n | 31:0 | **DATAn** - data (depends on ACTION from `HXG Request`_) | +* +---+-------+--------------------------------------------------------------+ +*/ + +#define GUC_HXG_RESPONSE_MSG_MIN_LEN GUC_HXG_MSG_MIN_LEN +#define GUC_HXG_RESPONSE_MSG_0_DATA0 GUC_HXG_MSG_0_AUX +#define GUC_HXG_RESPONSE_MSG_n_DATAn (0xffffffff << 0) + +/* deprecated */ #define INTEL_GUC_MSG_TYPE_SHIFT 28#define INTEL_GUC_MSG_TYPE_MASK (0xF << INTEL_GUC_MSG_TYPE_SHIFT)#define INTEL_GUC_MSG_DATA_SHIFT 16Signature · 1 line
2.28.0
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch
RFC PATCH 21/97 drm/i915/guc: Update MMIO based communication
In reply to Matthew BrostFrom: Michal Wajdeczko <[email protected]>
The MMIO based Host-to-GuC communication protocol has been updated to use unified HXG messages.
Update our intel_guc_send_mmio() function by correctly handle BUSY, RETRY and FAILURE replies. Also update our documentation.
GuC: 55.0.0
--- .../gt/uc/abi/guc_communication_mmio_abi.h | 47 ++++-------- drivers/gpu/drm/i915/gt/uc/intel_guc.c | 75 ++++++++++++++----- 2 files changed, 70 insertions(+), 52 deletions(-)
drivers/gpu/drm/i915/gt/uc/abi/guc_communication_mmio_abi.h +15 -32
@@ -7,44 +7,27 @@#define _ABI_GUC_COMMUNICATION_MMIO_ABI_H/** -* DOC: MMIO based communication +* DOC: GuC MMIO based communication * -* The MMIO based communication between Host and GuC uses software scratch -* registers, where first register holds data treated as message header, -* and other registers are used to hold message payload. +* The MMIO based communication between Host and GuC relies on special +* hardware registers which format could be defined by the software +* (so called scratch registers). * -* For Gen9+, GuC uses software scratch registers 0xC180-0xC1B8, -* but no H2G command takes more than 8 parameters and the GuC FW -* itself uses an 8-element array to store the H2G message. -* -* +-----------+---------+---------+---------+ -* | MMIO[0] | MMIO[1] | ... | MMIO[n] | -* +-----------+---------+---------+---------+ -* | header | optional payload | -* +======+====+=========+=========+=========+ -* | 31:28|type| | | | -* +------+----+ | | | -* | 27:16|data| | | | -* +------+----+ | | | -* | 15:0|code| | | | -* +------+----+---------+---------+---------+ +* Each MMIO based message, both Host to GuC (H2G) and GuC to Host (G2H) +* messages, which maximum length depends on number of available scratch +* registers, is directly written into those scratch registers. * -* The message header consists of: -* -* - **type**, indicates message type -* - **code**, indicates message code, is specific for **type** -* - **data**, indicates message data, optional, depends on **code** +* For Gen9+, there are 16 software scratch registers 0xC180-0xC1B8, +* but no H2G command takes more than 8 parameters and the GuC firmware +* itself uses an 8-element array to store the H2G message. * -* The following message **types** are supported: +* For Gen11+, there are additional 4 registers 0x190240-0x19024C, which +* are, regardless on lower count, preffered over legacy ones. * -* - **REQUEST**, indicates Host-to-GuC request, requested GuC action code -* must be priovided in **code** field. Optional action specific parameters -* can be provided in remaining payload registers or **data** field. +* The MMIO based communication is mainly used during driver initialization +* phase to setup the CTB based communication that will be used afterwards. * -* - **RESPONSE**, indicates GuC-to-Host response from earlier GuC request, -* action response status will be provided in **code** field. Optional -* response data can be returned in remaining payload registers or **data** -* field. +* Format of the MMIO messages follows definitions of `HXG Message`_. */ #define GUC_MAX_MMIO_MSG_LEN 8
drivers/gpu/drm/i915/gt/uc/intel_guc.c +55 -20
108 lines not on this page · raw message
Signature · 6 lines
2.28.0 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
RFC PATCH 22/97 drm/i915/guc: Update CTB response status
In reply to Matthew BrostFrom: Michal Wajdeczko <[email protected]>
Format of the STATUS dword in CTB response message now follows definition of the HXG header. Update our code and remove any obsolete legacy definitions.
GuC: 55.0.0
--- drivers/gpu/drm/i915/gt/uc/abi/guc_errors_abi.h | 1 - drivers/gpu/drm/i915/gt/uc/intel_guc_ct.c | 12 ++++++------ drivers/gpu/drm/i915/gt/uc/intel_guc_fwif.h | 17 ----------------- 3 files changed, 6 insertions(+), 24 deletions(-)
drivers/gpu/drm/i915/gt/uc/abi/guc_errors_abi.h +0 -1
@@ -7,7 +7,6 @@#define _ABI_GUC_ERRORS_ABI_Henum intel_guc_response_status { -INTEL_GUC_RESPONSE_STATUS_SUCCESS =0x0 ,INTEL_GUC_RESPONSE_STATUS_GENERIC_FAIL =0xF000 , };
drivers/gpu/drm/i915/gt/uc/intel_guc_ct.c +6 -6
@@ -455,7 +455,7 @@ static int wait_for_ct_request_update(struct ct_request *req, u32 *status)*/ timeout =max (10 ,CONFIG_DRM_I915_HEARTBEAT_INTERVAL ); -#define done INTEL_GUC_MSG_IS_RESPONSE(READ_ONCE(req->status)) +#define done (FIELD_GET(GUC_HXG_MSG_0_ORIGIN, READ_ONCE(req->status)) == GUC_HXG_ORIGIN_GUC) err =wait_for_us (done,10 );if (err) err =wait_for (done, timeout);
@@ -510,21 +510,21 @@ static int ct_send(struct intel_guc_ct *ct,if (unlikely (err)) goto unlink; -if (!INTEL_GUC_MSG_IS_RESPONSE_SUCCESS (*status)) { +if (FIELD_GET (GUC_HXG_MSG_0_TYPE , *status) !=GUC_HXG_TYPE_RESPONSE_SUCCESS ) { err = -EIO ; goto unlink; }if (response_buf) {/* There shall be no data in the status */ -WARN_ON (INTEL_GUC_MSG_TO_DATA (request.status)); +WARN_ON (FIELD_GET (GUC_HXG_RESPONSE_MSG_0_DATA0 , request.status));/* Return actual response len */ err = request.response_len; }else {/* There shall be no response payload */ WARN_ON (request.response_len);/* Return data decoded from the status dword */ - err =INTEL_GUC_MSG_TO_DATA (*status); + err =FIELD_GET (GUC_HXG_RESPONSE_MSG_0_DATA0 , *status); } unlink:
@@ -719,8 +719,8 @@ static int ct_handle_response(struct intel_guc_ct *ct, struct ct_incoming_msg *r status = response->msg[2 ]; datalen = len -2 ; -/* Format of the status follows RESPONSE message */ -if (unlikely (!INTEL_GUC_MSG_IS_RESPONSE (status))) { +/* Format of the status dword follows HXG header */ +if (unlikely (FIELD_GET (GUC_HXG_MSG_0_ORIGIN , status) !=GUC_HXG_ORIGIN_GUC )) {CT_ERROR (ct,"Corrupted response (status %#x)\n" , status);return -EPROTO ; }
drivers/gpu/drm/i915/gt/uc/intel_guc_fwif.h +0 -17
@@ -388,23 +388,6 @@ struct guc_shared_ctx_data {struct guc_ctx_report preempt_ctx_report[GUC_MAX_ENGINES_NUM ]; } __packed; -#define __INTEL_GUC_MSG_GET (T , m) \ - (((m) & INTEL_GUC_MSG_ ## T ## _MASK) >> INTEL_GUC_MSG_ ## T ## _SHIFT) -#define INTEL_GUC_MSG_TO_TYPE (m) __INTEL_GUC_MSG_GET(TYPE, m) -#define INTEL_GUC_MSG_TO_DATA (m) __INTEL_GUC_MSG_GET(DATA, m) -#define INTEL_GUC_MSG_TO_CODE (m) __INTEL_GUC_MSG_GET(CODE, m) - -#define __INTEL_GUC_MSG_TYPE_IS (T , m) \ - (INTEL_GUC_MSG_TO_TYPE(m) == INTEL_GUC_MSG_TYPE_ ## T) -#define INTEL_GUC_MSG_IS_REQUEST (m) __INTEL_GUC_MSG_TYPE_IS(REQUEST, m) -#define INTEL_GUC_MSG_IS_RESPONSE (m) __INTEL_GUC_MSG_TYPE_IS(RESPONSE, m) - -#define INTEL_GUC_MSG_IS_RESPONSE_SUCCESS (m) \ - (typecheck(u32, (m)) && \ - ((m) & (INTEL_GUC_MSG_TYPE_MASK | INTEL_GUC_MSG_CODE_MASK)) == \ - ((INTEL_GUC_MSG_TYPE_RESPONSE << INTEL_GUC_MSG_TYPE_SHIFT) | \ - (INTEL_GUC_RESPONSE_STATUS_SUCCESS << INTEL_GUC_MSG_CODE_SHIFT))) -/* This action will be programmed in C1BC - SOFT_SCRATCH_15_REG */ enum intel_guc_recv_message {INTEL_GUC_RECV_MSG_CRASH_DUMP_POSTED =BIT (1 ),
Signature · 6 lines
2.28.0 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
RFC PATCH 23/97 drm/i915/guc: Support per context scheduling policies
In reply to Matthew BrostFrom: John Harrison <[email protected]>
GuC firmware v53.0.0 introduced per context scheduling policies. This includes changes to some of the ADS structures which are required to load the firmware even if not using GuC submission.
--- drivers/gpu/drm/i915/gt/uc/intel_guc_ads.c | 26 +++-------------- drivers/gpu/drm/i915/gt/uc/intel_guc_fwif.h | 31 +++++---------------- 2 files changed, 11 insertions(+), 46 deletions(-)
drivers/gpu/drm/i915/gt/uc/intel_guc_ads.c +4 -22
@@ -58,30 +58,12 @@ static u32 guc_ads_blob_size(struct intel_guc *guc)guc_ads_private_data_size (guc); } -static void guc_policy_init (struct guc_policy *policy) -{ - policy->execution_quantum =POLICY_DEFAULT_EXECUTION_QUANTUM_US ; - policy->preemption_time =POLICY_DEFAULT_PREEMPTION_TIME_US ; - policy->fault_time =POLICY_DEFAULT_FAULT_TIME_US ; - policy->policy_flags =0 ; -} -static void guc_policies_init (struct guc_policies *policies) { -struct guc_policy *policy; -u32 p, i; - - policies->dpc_promote_time =POLICY_DEFAULT_DPC_PROMOTE_TIME_US ; - policies->max_num_work_items =POLICY_MAX_NUM_WI ; - -for (p =0 ; p <GUC_CLIENT_PRIORITY_NUM ; p++) { -for (i =0 ; i <GUC_MAX_ENGINE_CLASSES ; i++) { - policy = &policies->policy[p][i]; - -guc_policy_init (policy); - } - } - + policies->dpc_promote_time =GLOBAL_POLICY_DEFAULT_DPC_PROMOTE_TIME_US ; + policies->max_num_work_items =GLOBAL_POLICY_MAX_NUM_WI ; +/* Disable automatic resets as not yet supported. */ + policies->global_flags =GLOBAL_POLICY_DISABLE_ENGINE_RESET ; policies->is_valid =1 ; }
drivers/gpu/drm/i915/gt/uc/intel_guc_fwif.h +7 -24
@@ -221,32 +221,14 @@ struct guc_stage_desc {/* Scheduling policy settings */ -/* Reset engine upon preempt failure */ -#define POLICY_RESET_ENGINE (1<<0) -/* Preempt to idle on quantum expiry */ -#define POLICY_PREEMPT_TO_IDLE (1<<1) - -#define POLICY_MAX_NUM_WI 15 -#define POLICY_DEFAULT_DPC_PROMOTE_TIME_US 500000 -#define POLICY_DEFAULT_EXECUTION_QUANTUM_US 1000000 -#define POLICY_DEFAULT_PREEMPTION_TIME_US 500000 -#define POLICY_DEFAULT_FAULT_TIME_US 250000 - -struct guc_policy { -/* Time for one workload to execute. (in micro seconds) */ -u32 execution_quantum; -/* Time to wait for a preemption request to completed before issuing a -* reset. (in micro seconds). */ -u32 preemption_time; -/* How much time to allow to run after the first fault is observed. -* Then preempt afterwards. (in micro seconds) */ -u32 fault_time; -u32 policy_flags; -u32 reserved[8 ]; -} __packed; +#define GLOBAL_POLICY_MAX_NUM_WI 15 + +/* Don't reset an engine upon preemption failure */ +#define GLOBAL_POLICY_DISABLE_ENGINE_RESET BIT(0) + +#define GLOBAL_POLICY_DEFAULT_DPC_PROMOTE_TIME_US 500000struct guc_policies { -struct guc_policy policy[GUC_CLIENT_PRIORITY_NUM ][GUC_MAX_ENGINE_CLASSES ];u32 submission_queue_depth[GUC_MAX_ENGINE_CLASSES ];/* In micro seconds. How much time to allow before DPC processing is * called back via interrupt (to prevent DPC queue drain starving).
@@ -260,6 +242,7 @@ struct guc_policies {* idle. */ u32 max_num_work_items; +u32 global_flags;u32 reserved[4 ]; } __packed;
Signature · 1 line
2.28.0
Re: [RFC PATCH 23/97] drm/i915/guc: Support per context scheduling policies
Quoted 8 lines · Matthew Brost
From: John Harrison <[email protected]>
GuC firmware v53.0.0 introduced per context scheduling policies. This includes changes to some of the ADS structures which are required to load the firmware even if not using GuC submission.
Signed-off-by John Harrison <[email protected]>Signed-off-by Matthew Brost <[email protected]>
Quoted 98 lines
--- drivers/gpu/drm/i915/gt/uc/intel_guc_ads.c | 26 +++-------------- drivers/gpu/drm/i915/gt/uc/intel_guc_fwif.h | 31 +++++---------------- 2 files changed, 11 insertions(+), 46 deletions(-)drivers/gpu/drm/i915/gt/uc/intel_guc_ads.c +4
-22@@ -58,30 +58,12 @@ static u32 guc_ads_blob_size(struct intel_guc *guc)guc_ads_private_data_size (guc); } -static void guc_policy_init (struct guc_policy *policy) -{ - policy->execution_quantum =POLICY_DEFAULT_EXECUTION_QUANTUM_US ; - policy->preemption_time =POLICY_DEFAULT_PREEMPTION_TIME_US ; - policy->fault_time =POLICY_DEFAULT_FAULT_TIME_US ; - policy->policy_flags =0 ; -} -static void guc_policies_init (struct guc_policies *policies) { -struct guc_policy *policy; -u32 p, i; - - policies->dpc_promote_time =POLICY_DEFAULT_DPC_PROMOTE_TIME_US ; - policies->max_num_work_items =POLICY_MAX_NUM_WI ; - -for (p =0 ; p <GUC_CLIENT_PRIORITY_NUM ; p++) { -for (i =0 ; i <GUC_MAX_ENGINE_CLASSES ; i++) { - policy = &policies->policy[p][i]; - -guc_policy_init (policy); - } - } - + policies->dpc_promote_time =GLOBAL_POLICY_DEFAULT_DPC_PROMOTE_TIME_US ; + policies->max_num_work_items =GLOBAL_POLICY_MAX_NUM_WI ; +/* Disable automatic resets as not yet supported. */ + policies->global_flags =GLOBAL_POLICY_DISABLE_ENGINE_RESET ; policies->is_valid =1 ; }drivers/gpu/drm/i915/gt/uc/intel_guc_fwif.h +7
-24@@ -221,32 +221,14 @@ struct guc_stage_desc {/* Scheduling policy settings */ -/* Reset engine upon preempt failure */ -#define POLICY_RESET_ENGINE (1<<0) -/* Preempt to idle on quantum expiry */ -#define POLICY_PREEMPT_TO_IDLE (1<<1) - -#define POLICY_MAX_NUM_WI 15 -#define POLICY_DEFAULT_DPC_PROMOTE_TIME_US 500000 -#define POLICY_DEFAULT_EXECUTION_QUANTUM_US 1000000 -#define POLICY_DEFAULT_PREEMPTION_TIME_US 500000 -#define POLICY_DEFAULT_FAULT_TIME_US 250000 - -struct guc_policy { -/* Time for one workload to execute. (in micro seconds) */ -u32 execution_quantum; -/* Time to wait for a preemption request to completed before issuing a -* reset. (in micro seconds). */ -u32 preemption_time; -/* How much time to allow to run after the first fault is observed. -* Then preempt afterwards. (in micro seconds) */ -u32 fault_time; -u32 policy_flags; -u32 reserved[8 ]; -} __packed; +#define GLOBAL_POLICY_MAX_NUM_WI 15 + +/* Don't reset an engine upon preemption failure */ +#define GLOBAL_POLICY_DISABLE_ENGINE_RESET BIT(0) + +#define GLOBAL_POLICY_DEFAULT_DPC_PROMOTE_TIME_US 500000struct guc_policies { -struct guc_policy policy[GUC_CLIENT_PRIORITY_NUM ][GUC_MAX_ENGINE_CLASSES ];u32 submission_queue_depth[GUC_MAX_ENGINE_CLASSES ];/* In micro seconds. How much time to allow before DPC processing is * called back via interrupt (to prevent DPC queue drain starving). @@ -260,6 +242,7 @@ struct guc_policies {* idle. */ u32 max_num_work_items; +u32 global_flags;u32 reserved[4 ]; } __packed;Signature · 1 line
2.28.0
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
RFC PATCH 24/97 drm/i915/guc: Add flag for mark broken CTB
In reply to Matthew BrostFrom: Michal Wajdeczko <[email protected]>
Once CTB descriptor is found in error state, either set by GuC or us, there is no need continue checking descriptor any more, we can rely on our internal flag.
--- drivers/gpu/drm/i915/gt/uc/intel_guc_ct.c | 13 +++++++++++-- drivers/gpu/drm/i915/gt/uc/intel_guc_ct.h | 2 ++ 2 files changed, 13 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/gt/uc/intel_guc_ct.c +11 -2
@@ -123,6 +123,7 @@ static void guc_ct_buffer_desc_init(struct guc_ct_buffer_desc *desc,static void guc_ct_buffer_reset (struct intel_guc_ct_buffer *ctb,u32 cmds_addr) { + ctb->broken = false;guc_ct_buffer_desc_init (ctb->desc, cmds_addr, ctb->size); }
@@ -365,9 +366,12 @@ static int ct_write(struct intel_guc_ct *ct,u32 *cmds = ctb->cmds;unsigned int i; -if (unlikely (desc->is_in_error)) +if (unlikely (ctb->broken))return -EPIPE ; +if (unlikely (desc->is_in_error)) + goto corrupted; +if (unlikely (!IS_ALIGNED (head | tail,4 ) || (tail | head) >= size)) goto corrupted;
@@ -423,6 +427,7 @@ static int ct_write(struct intel_guc_ct *ct,CT_ERROR (ct,"Corrupted descriptor addr=%#x head=%u tail=%u size=%u\n" , desc->addr, desc->head, desc->tail, desc->size); desc->is_in_error =1 ; + ctb->broken = true;return -EPIPE ; }
@@ -608,9 +613,12 @@ static int ct_read(struct intel_guc_ct *ct, struct ct_incoming_msg **msg)unsigned int i;u32 header; -if (unlikely (desc->is_in_error)) +if (unlikely (ctb->broken))return -EPIPE ; +if (unlikely (desc->is_in_error)) + goto corrupted; +if (unlikely (!IS_ALIGNED (head | tail,4 ) || (tail | head) >= size)) goto corrupted;
@@ -674,6 +682,7 @@ static int ct_read(struct intel_guc_ct *ct, struct ct_incoming_msg **msg)CT_ERROR (ct,"Corrupted descriptor addr=%#x head=%u tail=%u size=%u\n" , desc->addr, desc->head, desc->tail, desc->size); desc->is_in_error =1 ; + ctb->broken = true;return -EPIPE ; }
drivers/gpu/drm/i915/gt/uc/intel_guc_ct.h +2 -0
@@ -32,12 +32,14 @@ struct intel_guc;* @desc: pointer to the buffer descriptor * @cmds: pointer to the commands buffer * @size: size of the commands buffer +* @broken: flag to indicate if descriptor data is broken */ struct intel_guc_ct_buffer {spinlock_t lock;struct guc_ct_buffer_desc *desc;u32 *cmds;u32 size; +bool broken; };
Signature · 6 lines
2.28.0 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [RFC PATCH 24/97] drm/i915/guc: Add flag for mark broken CTB
Quoted 8 lines · Matthew Brost
From: Michal Wajdeczko <[email protected]>
Once CTB descriptor is found in error state, either set by GuC or us, there is no need continue checking descriptor any more, we can rely on our internal flag.
Signed-off-by Michal Wajdeczko <[email protected]>Signed-off-by Matthew Brost <[email protected]>
Quoted 84 lines
Cc Piotr Piórkowski <[email protected]>--- drivers/gpu/drm/i915/gt/uc/intel_guc_ct.c | 13 +++++++++++-- drivers/gpu/drm/i915/gt/uc/intel_guc_ct.h | 2 ++ 2 files changed, 13 insertions(+), 2 deletions(-)drivers/gpu/drm/i915/gt/uc/intel_guc_ct.c +11
-2@@ -123,6 +123,7 @@ static void guc_ct_buffer_desc_init(struct guc_ct_buffer_desc *desc,static void guc_ct_buffer_reset (struct intel_guc_ct_buffer *ctb,u32 cmds_addr) { + ctb->broken = false;guc_ct_buffer_desc_init (ctb->desc, cmds_addr, ctb->size); }@@ -365,9 +366,12 @@ static int ct_write(struct intel_guc_ct *ct,u32 *cmds = ctb->cmds;unsigned int i; -if (unlikely (desc->is_in_error)) +if (unlikely (ctb->broken))return -EPIPE ; +if (unlikely (desc->is_in_error)) + goto corrupted; +if (unlikely (!IS_ALIGNED (head | tail,4 ) || (tail | head) >= size)) goto corrupted;@@ -423,6 +427,7 @@ static int ct_write(struct intel_guc_ct *ct,CT_ERROR (ct,"Corrupted descriptor addr=%#x head=%u tail=%u size=%u\n" , desc->addr, desc->head, desc->tail, desc->size); desc->is_in_error =1 ; + ctb->broken = true;return -EPIPE ; }@@ -608,9 +613,12 @@ static int ct_read(struct intel_guc_ct *ct, struct ct_incoming_msg **msg)unsigned int i;u32 header; -if (unlikely (desc->is_in_error)) +if (unlikely (ctb->broken))return -EPIPE ; +if (unlikely (desc->is_in_error)) + goto corrupted; +if (unlikely (!IS_ALIGNED (head | tail,4 ) || (tail | head) >= size)) goto corrupted;@@ -674,6 +682,7 @@ static int ct_read(struct intel_guc_ct *ct, struct ct_incoming_msg **msg)CT_ERROR (ct,"Corrupted descriptor addr=%#x head=%u tail=%u size=%u\n" , desc->addr, desc->head, desc->tail, desc->size); desc->is_in_error =1 ; + ctb->broken = true;return -EPIPE ; }drivers/gpu/drm/i915/gt/uc/intel_guc_ct.h +2
-0@@ -32,12 +32,14 @@ struct intel_guc;* @desc: pointer to the buffer descriptor * @cmds: pointer to the commands buffer * @size: size of the commands buffer +* @broken: flag to indicate if descriptor data is broken */ struct intel_guc_ct_buffer {spinlock_t lock;struct guc_ct_buffer_desc *desc;u32 *cmds;u32 size; +bool broken; };Signature · 1 line
2.28.0
RFC PATCH 25/97 drm/i915/guc: New definition of the CTB descriptor
In reply to Matthew BrostFrom: Michal Wajdeczko <[email protected]>
Definition of the CTB descriptor has changed, leaving only minimal shared fields like HEAD/TAIL/STATUS.
Both HEAD and TAIL are now in dwords.
Add some ABI documentation and implement required changes.
GuC: 57.0.0
GuC: 60.0.0
--- .../gt/uc/abi/guc_communication_ctb_abi.h | 70 ++++++++++++++----- drivers/gpu/drm/i915/gt/uc/intel_guc_ct.c | 70 +++++++++---------- drivers/gpu/drm/i915/gt/uc/intel_guc_ct.h | 2 +- 3 files changed, 85 insertions(+), 57 deletions(-)
drivers/gpu/drm/i915/gt/uc/abi/guc_communication_ctb_abi.h +52 -18
@@ -7,6 +7,58 @@#define _ABI_GUC_COMMUNICATION_CTB_ABI_H#include <linux/types.h> +#include <linux/build_bug.h> + +#include "guc_messages_abi.h" + +/** +* DOC: CT Buffer +* +* TBD +*/ + +/** +* DOC: CTB Descriptor +* +* +---+-------+--------------------------------------------------------------+ +* | | Bits | Description | +* +===+=======+==============================================================+ +* | 0 | 31:0 | **HEAD** - offset (in dwords) to the last dword that was | +* | | | read from the `CT Buffer`_. | +* | | | It can only be updated by the receiver. | +* +---+-------+--------------------------------------------------------------+ +* | 1 | 31:0 | **TAIL** - offset (in dwords) to the last dword that was | +* | | | written to the `CT Buffer`_. | +* | | | It can only be updated by the sender. | +* +---+-------+--------------------------------------------------------------+ +* | 2 | 31:0 | **STATUS** - status of the CTB | +* | | | | +* | | | - _`GUC_CTB_STATUS_NO_ERROR` = 0 (normal operation) | +* | | | - _`GUC_CTB_STATUS_OVERFLOW` = 1 (head/tail too large) | +* | | | - _`GUC_CTB_STATUS_UNDERFLOW` = 2 (truncated message) | +* | | | - _`GUC_CTB_STATUS_MISMATCH` = 4 (head/tail modified) | +* | | | - _`GUC_CTB_STATUS_NO_BACKCHANNEL` = 8 | +* | | | - _`GUC_CTB_STATUS_MALFORMED_MSG` = 16 | +* +---+-------+--------------------------------------------------------------+ +* |...| | RESERVED = MBZ | +* +---+-------+--------------------------------------------------------------+ +* | 15| 31:0 | RESERVED = MBZ | +* +---+-------+--------------------------------------------------------------+ +*/ + +struct guc_ct_buffer_desc { +u32 head; +u32 tail; +u32 status; +#define GUC_CTB_STATUS_NO_ERROR 0 +#define GUC_CTB_STATUS_OVERFLOW (1 << 0) +#define GUC_CTB_STATUS_UNDERFLOW (1 << 1) +#define GUC_CTB_STATUS_MISMATCH (1 << 2) +#define GUC_CTB_STATUS_NO_BACKCHANNEL (1 << 3) +#define GUC_CTB_STATUS_MALFORMED_MSG (1 << 4) +u32 reserved[13 ]; +} __packed; +static_assert (sizeof (struct guc_ct_buffer_desc ) ==64 );/** * DOC: CTB based communication
@@ -60,24 +112,6 @@* - **flags**, holds various bits to control message handling */ -/* -* Describes single command transport buffer. -* Used by both guc-master and clients. -*/ -struct guc_ct_buffer_desc { -u32 addr;/* gfx address */ -u64 host_private;/* host private data */ -u32 size;/* size in bytes */ -u32 head;/* offset updated by GuC*/ -u32 tail;/* offset updated by owner */ -u32 is_in_error;/* error indicator */ -u32 reserved1; -u32 reserved2; -u32 owner;/* id of the channel owner */ -u32 owner_sub_id;/* owner-defined field for extra tracking */ -u32 reserved[5 ]; -} __packed; -/* Type of command transport buffer */ #define INTEL_GUC_CT_BUFFER_TYPE_SEND 0x0u#define INTEL_GUC_CT_BUFFER_TYPE_RECV 0x1u
drivers/gpu/drm/i915/gt/uc/intel_guc_ct.c +32 -38
141 lines not on this page · raw message
drivers/gpu/drm/i915/gt/uc/intel_guc_ct.h +1 -1
@@ -31,7 +31,7 @@ struct intel_guc;* @lock: protects access to the commands buffer and buffer descriptor * @desc: pointer to the buffer descriptor * @cmds: pointer to the commands buffer -* @size: size of the commands buffer +* @size: size of the commands buffer in dwords * @broken: flag to indicate if descriptor data is broken */ struct intel_guc_ct_buffer {
Signature · 1 line
2.28.0
RFC PATCH 26/97 drm/i915/guc: New definition of the CTB registration action
In reply to Matthew BrostFrom: Michal Wajdeczko <[email protected]>
Definition of the CTB registration action has changed. Add some ABI documentation and implement required changes.
GuC: 57.0.0
--- .../gpu/drm/i915/gt/uc/abi/guc_actions_abi.h | 107 ++++++++++++++++++ .../gt/uc/abi/guc_communication_ctb_abi.h | 4 - drivers/gpu/drm/i915/gt/uc/intel_guc_ct.c | 76 ++++++++----- 3 files changed, 152 insertions(+), 35 deletions(-)
drivers/gpu/drm/i915/gt/uc/abi/guc_actions_abi.h +107 -0
@@ -6,6 +6,113 @@#ifndef _ABI_GUC_ACTIONS_ABI_H#define _ABI_GUC_ACTIONS_ABI_H +/** +* DOC: HOST2GUC_REGISTER_CTB +* +* This message is used as part of the `CTB based communication`_ setup. +* +* This message must be sent as `MMIO H2G Message`_. +* +* +---+-------+--------------------------------------------------------------+ +* | | Bits | Description | +* +===+=======+==============================================================+ +* | 0 | 31 | ORIGIN = GUC_HXG_ORIGIN_HOST_ | +* | +-------+--------------------------------------------------------------+ +* | | 30:28 | TYPE = GUC_HXG_TYPE_REQUEST_ | +* | +-------+--------------------------------------------------------------+ +* | | 27:16 | DATA0 = MBZ | +* | +-------+--------------------------------------------------------------+ +* | | 15:0 | ACTION = _`GUC_ACTION_HOST2GUC_REGISTER_CTB` = 0x5200 | +* +---+-------+--------------------------------------------------------------+ +* | 1 | 31:12 | RESERVED = MBZ | +* | +-------+--------------------------------------------------------------+ +* | | 11:8 | **TYPE** - type for the CT buffer | +* | | | | +* | | | - _`GUC_CTB_TYPE_HOST2GUC` = 0 | +* | | | - _`GUC_CTB_TYPE_GUC2HOST` = 1 | +* | +-------+--------------------------------------------------------------+ +* | | 7:0 | **SIZE** - size of the `CT Buffer`_ in 4K units minus 1 | +* +---+-------+--------------------------------------------------------------+ +* | 2 | 31:0 | **DESC_ADDR** - GGTT address of the `CT Descriptor`_ | +* +---+-------+--------------------------------------------------------------+ +* | 3 | 31:0 | **BUFF_ADDF** - GGTT address of the `CT Buffer`_ | +* +---+-------+--------------------------------------------------------------+ +* +* +---+-------+--------------------------------------------------------------+ +* | | Bits | Description | +* +===+=======+==============================================================+ +* | 0 | 31 | ORIGIN = GUC_HXG_ORIGIN_GUC_ | +* | +-------+--------------------------------------------------------------+ +* | | 30:28 | TYPE = GUC_HXG_TYPE_RESPONSE_SUCCESS_ | +* | +-------+--------------------------------------------------------------+ +* | | 27:0 | DATA0 = MBZ | +* +---+-------+--------------------------------------------------------------+ +*/ +#define GUC_ACTION_HOST2GUC_REGISTER_CTB 0x4505 // FIXME 0x5200 + +#define HOST2GUC_REGISTER_CTB_REQUEST_MSG_LEN (GUC_HXG_REQUEST_MSG_MIN_LEN + 3u) +#define HOST2GUC_REGISTER_CTB_REQUEST_MSG_0_MBZ GUC_HXG_REQUEST_MSG_0_DATA0 +#define HOST2GUC_REGISTER_CTB_REQUEST_MSG_1_MBZ (0xfffff << 12) +#define HOST2GUC_REGISTER_CTB_REQUEST_MSG_1_TYPE (0xf << 8) +#define GUC_CTB_TYPE_HOST2GUC 0u +#define GUC_CTB_TYPE_GUC2HOST 1u +#define HOST2GUC_REGISTER_CTB_REQUEST_MSG_1_SIZE (0xff << 0) +#define HOST2GUC_REGISTER_CTB_REQUEST_MSG_2_DESC_ADDR GUC_HXG_REQUEST_MSG_n_DATAn +#define HOST2GUC_REGISTER_CTB_REQUEST_MSG_3_BUFF_ADDR GUC_HXG_REQUEST_MSG_n_DATAn + +#define HOST2GUC_REGISTER_CTB_RESPONSE_MSG_LEN GUC_HXG_RESPONSE_MSG_MIN_LEN +#define HOST2GUC_REGISTER_CTB_RESPONSE_MSG_0_MBZ GUC_HXG_RESPONSE_MSG_0_DATA0 + +/** +* DOC: HOST2GUC_DEREGISTER_CTB +* +* This message is used as part of the `CTB based communication`_ teardown. +* +* This message must be sent as `MMIO H2G Message`_. +* +* +---+-------+--------------------------------------------------------------+ +* | | Bits | Description | +* +===+=======+==============================================================+ +* | 0 | 31 | ORIGIN = GUC_HXG_ORIGIN_HOST_ | +* | +-------+--------------------------------------------------------------+ +* | | 30:28 | TYPE = GUC_HXG_TYPE_REQUEST_ | +* | +-------+--------------------------------------------------------------+ +* | | 27:16 | DATA0 = MBZ | +* | +-------+--------------------------------------------------------------+ +* | | 15:0 | ACTION = _`GUC_ACTION_HOST2GUC_DEREGISTER_CTB` = 0x5201 | +* +---+-------+--------------------------------------------------------------+ +* | 1 | 31:12 | RESERVED = MBZ | +* | +-------+--------------------------------------------------------------+ +* | | 11:8 | **TYPE** - type of the CT buffer | +* | | | | +* | | | see _`GUC_ACTION_HOST2GUC_REGISTER_CTB` | +* | +-------+--------------------------------------------------------------+ +* | | 7:0 | RESERVED = MBZ | +* +---+-------+--------------------------------------------------------------+ +* +* +---+-------+--------------------------------------------------------------+ +* | | Bits | Description | +* +===+=======+==============================================================+ +* | 0 | 31 | ORIGIN = GUC_HXG_ORIGIN_GUC_ | +* | +-------+--------------------------------------------------------------+ +* | | 30:28 | TYPE = GUC_HXG_TYPE_RESPONSE_SUCCESS_ | +* | +-------+--------------------------------------------------------------+ +* | | 27:0 | DATA0 = MBZ | +* +---+-------+--------------------------------------------------------------+ +*/ +#define GUC_ACTION_HOST2GUC_DEREGISTER_CTB 0x4506 // FIXME 0x5201 + +#define HOST2GUC_DEREGISTER_CTB_REQUEST_MSG_LEN (GUC_HXG_REQUEST_MSG_MIN_LEN + 1u) +#define HOST2GUC_DEREGISTER_CTB_REQUEST_MSG_0_MBZ GUC_HXG_REQUEST_MSG_0_DATA0 +#define HOST2GUC_DEREGISTER_CTB_REQUEST_MSG_1_MBZ (0xfffff << 12) +#define HOST2GUC_DEREGISTER_CTB_REQUEST_MSG_1_TYPE (0xf << 8) +#define HOST2GUC_DEREGISTER_CTB_REQUEST_MSG_1_MBZ2 (0xff << 0) + +#define HOST2GUC_DEREGISTER_CTB_RESPONSE_MSG_LEN GUC_HXG_RESPONSE_MSG_MIN_LEN +#define HOST2GUC_DEREGISTER_CTB_RESPONSE_MSG_0_MBZ GUC_HXG_RESPONSE_MSG_0_DATA0 + +/* legacy definitions */ +enum intel_guc_action {INTEL_GUC_ACTION_DEFAULT =0x0 , INTEL_GUC_ACTION_REQUEST_PREEMPTION = 0x2,
drivers/gpu/drm/i915/gt/uc/abi/guc_communication_ctb_abi.h +0 -4
@@ -112,10 +112,6 @@ static_assert(sizeof(struct guc_ct_buffer_desc) == 64);* - **flags**, holds various bits to control message handling */ -/* Type of command transport buffer */ -#define INTEL_GUC_CT_BUFFER_TYPE_SEND 0x0u -#define INTEL_GUC_CT_BUFFER_TYPE_RECV 0x1u -/* * Definition of the command transport message header (DW0) *
drivers/gpu/drm/i915/gt/uc/intel_guc_ct.c +45 -31
138 lines not on this page · raw message
Signature · 6 lines
2.28.0 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
RFC PATCH 27/97 drm/i915/guc: New CTB based communication
In reply to Matthew BrostFrom: Michal Wajdeczko <[email protected]>
Format of the CTB messages has changed:
- support for multiple formats
- message fence is now part of the header
- reuse of unified HXG message formats
--- .../gt/uc/abi/guc_communication_ctb_abi.h | 56 +++++ drivers/gpu/drm/i915/gt/uc/intel_guc_ct.c | 193 +++++++----------- drivers/gpu/drm/i915/gt/uc/intel_guc_ct.h | 2 +- 3 files changed, 134 insertions(+), 117 deletions(-)
drivers/gpu/drm/i915/gt/uc/abi/guc_communication_ctb_abi.h +56 -0
@@ -60,6 +60,62 @@ struct guc_ct_buffer_desc { } __packed;static_assert (sizeof (struct guc_ct_buffer_desc ) ==64 ); +/** +* DOC: CTB Message +* +* +---+-------+--------------------------------------------------------------+ +* | | Bits | Description | +* +===+=======+==============================================================+ +* | 0 | 31:16 | **FENCE** - message identifier | +* | +-------+--------------------------------------------------------------+ +* | | 15:12 | **FORMAT** - format of the CTB message | +* | | | - _`GUC_CTB_FORMAT_HXG` = 0 - see `CTB HXG Message`_ | +* | +-------+--------------------------------------------------------------+ +* | | 11:8 | **RESERVED** | +* | +-------+--------------------------------------------------------------+ +* | | 7:0 | **NUM_DWORDS** - length of the CTB message (w/o header) | +* +---+-------+--------------------------------------------------------------+ +* | 1 | 31:0 | optional (depends on FORMAT) | +* +---+-------+ | +* |...| | | +* +---+-------+ | +* | n | 31:0 | | +* +---+-------+--------------------------------------------------------------+ +*/ + +#define GUC_CTB_MSG_MIN_LEN 1u +#define GUC_CTB_MSG_MAX_LEN 256u +#define GUC_CTB_MSG_0_FENCE (0xffff << 16) +#define GUC_CTB_MSG_0_FORMAT (0xf << 12) +#define GUC_CTB_FORMAT_HXG 0u +#define GUC_CTB_MSG_0_RESERVED (0xf << 8) +#define GUC_CTB_MSG_0_NUM_DWORDS (0xff << 0) + +/** +* DOC: CTB HXG Message +* +* +---+-------+--------------------------------------------------------------+ +* | | Bits | Description | +* +===+=======+==============================================================+ +* | 0 | 31:16 | FENCE | +* | +-------+--------------------------------------------------------------+ +* | | 15:12 | FORMAT = GUC_CTB_FORMAT_HXG_ | +* | +-------+--------------------------------------------------------------+ +* | | 11:8 | RESERVED = MBZ | +* | +-------+--------------------------------------------------------------+ +* | | 7:0 | NUM_DWORDS = length (in dwords) of the embedded HXG message | +* +---+-------+--------------------------------------------------------------+ +* | 1 | 31:0 | +--------------------------------------------------------+ | +* +---+-------+ | | | +* |...| | | Embedded `HXG Message`_ | | +* +---+-------+ | | | +* | n | 31:0 | +--------------------------------------------------------+ | +* +---+-------+--------------------------------------------------------------+ +*/ + +#define GUC_CTB_HXG_MSG_MIN_LEN (GUC_CTB_MSG_MIN_LEN + GUC_HXG_MSG_MIN_LEN) +#define GUC_CTB_HXG_MSG_MAX_LEN GUC_CTB_MSG_MAX_LEN +/** * DOC: CTB based communication *
drivers/gpu/drm/i915/gt/uc/intel_guc_ct.c +77 -116
279 lines not on this page · raw message
drivers/gpu/drm/i915/gt/uc/intel_guc_ct.h +1 -1
@@ -61,7 +61,7 @@ struct intel_guc_ct {struct tasklet_struct receive_tasklet;struct { -u32 last_fence;/* last fence used to send request */ +u16 last_fence;/* last fence used to send request */ spinlock_t lock;/* protects pending requests list */ struct list_head pending;/* requests waiting for response */
Signature · 1 line
2.28.0
RFC PATCH 28/97 drm/i915/guc: Kill guc_clients.ct_pool
In reply to Matthew BrostFrom: Michal Wajdeczko <[email protected]>
CTB pool is now maintained internally by the GuC as part of its "private data". No need to allocate separate buffer and pass it to GuC as yet another ADS.
GuC: 57.0.0
--- drivers/gpu/drm/i915/gt/uc/intel_guc_ads.c | 12 ------------ drivers/gpu/drm/i915/gt/uc/intel_guc_fwif.h | 12 +----------- 2 files changed, 1 insertion(+), 23 deletions(-)
drivers/gpu/drm/i915/gt/uc/intel_guc_ads.c +0 -12
@@ -25,8 +25,6 @@* +---------------------------------------+ * | guc_clients_info | * +---------------------------------------+ -* | guc_ct_pool_entry[size] | -* +---------------------------------------+ * | padding | * +---------------------------------------+ <== 4K aligned * | private data |
@@ -39,7 +37,6 @@ struct __guc_ads_blob {struct guc_policies policies;struct guc_gt_system_info system_info;struct guc_clients_info clients_info; -struct guc_ct_pool_entry ct_pool[GUC_CT_POOL_SIZE ]; } __packed;static u32 guc_ads_private_data_size (struct intel_guc *guc)
@@ -67,11 +64,6 @@ static void guc_policies_init(struct guc_policies *policies) policies->is_valid =1 ; } -static void guc_ct_pool_entries_init (struct guc_ct_pool_entry *pool,u32 num) -{ -memset (pool,0 , num *sizeof (*pool)); -} -static void guc_mapping_table_init (struct intel_gt *gt,struct guc_gt_system_info *system_info) {
@@ -157,11 +149,7 @@ static void __guc_ads_init(struct intel_guc *guc) base =intel_guc_ggtt_offset (guc, guc->ads_vma);/* Clients info */ -guc_ct_pool_entries_init (blob->ct_pool,ARRAY_SIZE (blob->ct_pool)); - blob->clients_info.clients_num =1 ; - blob->clients_info.ct_pool_addr = base +ptr_offset (blob, ct_pool); - blob->clients_info.ct_pool_count =ARRAY_SIZE (blob->ct_pool);/* ADS */ blob->ads.scheduler_policies = base +ptr_offset (blob, policies);
drivers/gpu/drm/i915/gt/uc/intel_guc_fwif.h +1 -11
@@ -269,19 +269,9 @@ struct guc_gt_system_info { } __packed;/* Clients info */ -struct guc_ct_pool_entry { -struct guc_ct_buffer_desc desc; -u32 reserved[7 ]; -} __packed; - -#define GUC_CT_POOL_SIZE 2 -struct guc_clients_info {u32 clients_num; -u32 reserved0[13 ]; -u32 ct_pool_addr; -u32 ct_pool_count; -u32 reserved[4 ]; +u32 reserved[19 ]; } __packed;/* GuC Additional Data Struct */
Signature · 1 line
2.28.0
Re: [RFC PATCH 28/97] drm/i915/guc: Kill guc_clients.ct_pool
Quoted 11 lines · Matthew Brost
From: Michal Wajdeczko <[email protected]>
CTB pool is now maintained internally by the GuC as part of its "private data". No need to allocate separate buffer and pass it to GuC as yet another ADS.
GuC: 57.0.0
Signed-off-by Michal Wajdeczko <[email protected]>Signed-off-by Matthew Brost <[email protected]>Cc Janusz Krzysztofik <[email protected]>Cc Matthew Brost <[email protected]>
Quoted 78 lines
--- drivers/gpu/drm/i915/gt/uc/intel_guc_ads.c | 12 ------------ drivers/gpu/drm/i915/gt/uc/intel_guc_fwif.h | 12 +----------- 2 files changed, 1 insertion(+), 23 deletions(-)drivers/gpu/drm/i915/gt/uc/intel_guc_ads.c +0
-12@@ -25,8 +25,6 @@* +---------------------------------------+ * | guc_clients_info | * +---------------------------------------+ -* | guc_ct_pool_entry[size] | -* +---------------------------------------+ * | padding | * +---------------------------------------+ <== 4K aligned * | private data | @@ -39,7 +37,6 @@ struct __guc_ads_blob {struct guc_policies policies;struct guc_gt_system_info system_info;struct guc_clients_info clients_info; -struct guc_ct_pool_entry ct_pool[GUC_CT_POOL_SIZE ]; } __packed;static u32 guc_ads_private_data_size (struct intel_guc *guc)@@ -67,11 +64,6 @@ static void guc_policies_init(struct guc_policies *policies) policies->is_valid =1 ; } -static void guc_ct_pool_entries_init (struct guc_ct_pool_entry *pool,u32 num) -{ -memset (pool,0 , num *sizeof (*pool)); -} -static void guc_mapping_table_init (struct intel_gt *gt,struct guc_gt_system_info *system_info) {@@ -157,11 +149,7 @@ static void __guc_ads_init(struct intel_guc *guc) base =intel_guc_ggtt_offset (guc, guc->ads_vma);/* Clients info */ -guc_ct_pool_entries_init (blob->ct_pool,ARRAY_SIZE (blob->ct_pool)); - blob->clients_info.clients_num =1 ; - blob->clients_info.ct_pool_addr = base +ptr_offset (blob, ct_pool); - blob->clients_info.ct_pool_count =ARRAY_SIZE (blob->ct_pool);/* ADS */ blob->ads.scheduler_policies = base +ptr_offset (blob, policies);drivers/gpu/drm/i915/gt/uc/intel_guc_fwif.h +1
-11@@ -269,19 +269,9 @@ struct guc_gt_system_info { } __packed;/* Clients info */ -struct guc_ct_pool_entry { -struct guc_ct_buffer_desc desc; -u32 reserved[7 ]; -} __packed; - -#define GUC_CT_POOL_SIZE 2 -struct guc_clients_info {u32 clients_num; -u32 reserved0[13 ]; -u32 ct_pool_addr; -u32 ct_pool_count; -u32 reserved[4 ]; +u32 reserved[19 ]; } __packed;/* GuC Additional Data Struct */ Signature · 1 line
2.28.0
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
RFC PATCH 29/97 drm/i915/guc: Update firmware to v60.1.2
In reply to Matthew BrostFrom: John Harrison <[email protected]>
--- drivers/gpu/drm/i915/gt/uc/intel_uc_fw.c | 25 ++++++++++++------------ 1 file changed, 12 insertions(+), 13 deletions(-)
drivers/gpu/drm/i915/gt/uc/intel_uc_fw.c +12 -13
@@ -48,19 +48,18 @@ void intel_uc_fw_change_status(struct intel_uc_fw *uc_fw,* firmware as TGL. */ #define INTEL_UC_FIRMWARE_DEFS (fw_def, guc_def, huc_def) \ - fw_def(ALDERLAKE_S, 0, guc_def(tgl, 49, 0, 1), huc_def(tgl, 7, 5, 0)) \ - fw_def(ROCKETLAKE, 0, guc_def(tgl, 49, 0, 1), huc_def(tgl, 7, 5, 0)) \ - fw_def(TIGERLAKE, 0, guc_def(tgl, 49, 0, 1), huc_def(tgl, 7, 5, 0)) \ - fw_def(JASPERLAKE, 0, guc_def(ehl, 49, 0, 1), huc_def(ehl, 9, 0, 0)) \ - fw_def(ELKHARTLAKE, 0, guc_def(ehl, 49, 0, 1), huc_def(ehl, 9, 0, 0)) \ - fw_def(ICELAKE, 0, guc_def(icl, 49, 0, 1), huc_def(icl, 9, 0, 0)) \ - fw_def(COMETLAKE, 5, guc_def(cml, 49, 0, 1), huc_def(cml, 4, 0, 0)) \ - fw_def(COMETLAKE, 0, guc_def(kbl, 49, 0, 1), huc_def(kbl, 4, 0, 0)) \ - fw_def(COFFEELAKE, 0, guc_def(kbl, 49, 0, 1), huc_def(kbl, 4, 0, 0)) \ - fw_def(GEMINILAKE, 0, guc_def(glk, 49, 0, 1), huc_def(glk, 4, 0, 0)) \ - fw_def(KABYLAKE, 0, guc_def(kbl, 49, 0, 1), huc_def(kbl, 4, 0, 0)) \ - fw_def(BROXTON, 0, guc_def(bxt, 49, 0, 1), huc_def(bxt, 2, 0, 0)) \ - fw_def(SKYLAKE, 0, guc_def(skl, 49, 0, 1), huc_def(skl, 2, 0, 0)) + fw_def(ALDERLAKE_S, 0, guc_def(tgl, 60, 1, 2), huc_def(tgl, 7, 5, 0)) \ + fw_def(ROCKETLAKE, 0, guc_def(tgl, 60, 1, 2), huc_def(tgl, 7, 5, 0)) \ + fw_def(TIGERLAKE, 0, guc_def(tgl, 60, 1, 2), huc_def(tgl, 7, 5, 0)) \ + fw_def(JASPERLAKE, 0, guc_def(ehl, 60, 1, 2), huc_def(ehl, 9, 0, 0)) \ + fw_def(ELKHARTLAKE, 0, guc_def(ehl, 60, 1, 2), huc_def(ehl, 9, 0, 0)) \ + fw_def(ICELAKE, 0, guc_def(icl, 60, 1, 2), huc_def(icl, 9, 0, 0)) \ + fw_def(COMETLAKE, 5, guc_def(cml, 60, 1, 2), huc_def(cml, 4, 0, 0)) \ + fw_def(COFFEELAKE, 0, guc_def(kbl, 60, 1, 2), huc_def(kbl, 4, 0, 0)) \ + fw_def(GEMINILAKE, 0, guc_def(glk, 60, 1, 2), huc_def(glk, 4, 0, 0)) \ + fw_def(KABYLAKE, 0, guc_def(kbl, 60, 1, 2), huc_def(kbl, 4, 0, 0)) \ + fw_def(BROXTON, 0, guc_def(bxt, 60, 1, 2), huc_def(bxt, 2, 0, 0)) \ + fw_def(SKYLAKE, 0, guc_def(skl, 60, 1, 2), huc_def(skl, 2, 0, 0))#define __MAKE_UC_FW_PATH (prefix_, name_, major_, minor_, patch_) \ "i915/" \
Signature · 1 line
2.28.0
RFC PATCH 30/97 drm/i915/uc: turn on GuC/HuC auto mode by default
In reply to Matthew BrostFrom: Daniele Ceraolo Spurio <[email protected]>
This will enable HuC loading for Gen11+ by default if the binaries are available on the system. GuC submission still requires explicit enabling by the user.
--- drivers/gpu/drm/i915/i915_params.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_params.h +1 -1
@@ -59,7 +59,7 @@ struct drm_printer; param(int, disable_power_well, -1, 0400) \ param(int, enable_ips, 1, 0600) \ param(int, invert_brightness, 0, 0600) \ - param(int, enable_guc, 0, 0400) \ + param(int, enable_guc, -1, 0400) \ param(int, guc_log_level, -1, 0400) \ param(char *, guc_firmware_path, NULL, 0400) \ param(char *, huc_firmware_path, NULL, 0400) \
Signature · 1 line
2.28.0
Re: [RFC PATCH 30/97] drm/i915/uc: turn on GuC/HuC auto mode by default
Quoted 19 lines · Matthew Brost
From: Daniele Ceraolo Spurio <[email protected]>
This will enable HuC loading for Gen11+ by default if the binaries are available on the system. GuC submission still requires explicit enabling by the user.
Signed-off-by Daniele Ceraolo Spurio <[email protected]>Signed-off-by Matthew Brost <[email protected]>Cc Michal Wajdeczko <[email protected]>Cc John Harrison <[email protected]>--- drivers/gpu/drm/i915/i915_params.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpu/drm/i915/i915_params.h +0
-0
drivers/gpu/drm/i915/i915_params.h struct drm_printer; · line 62
Quoted 5 lines
drivers/gpu/drm/i915/i915_params.h +1
-1@@ -59,7 +59,7 @@ struct drm_printer; param(int, disable_power_well, -1, 0400) \ param(int, enable_ips, 1, 0600) \ param(int, invert_brightness, 0, 0600) \ -param (int, enable_guc,0 ,0400 ) \ +param (int, enable_guc,-1 ,0400 ) \
you also want to update param description from
"(-1=auto, 0=disable [default], 1=GuC submission, 2=HuC load)"); to "(-1=auto [default], 0=disable, 1=GuC submission, 2=HuC load)");
Quoted 4 lines
drivers/gpu/drm/i915/i915_params.h +0
-0param(int, guc_log_level, -1, 0400) \ param(char *, guc_firmware_path, NULL, 0400) \ param(char *, huc_firmware_path, NULL, 0400) \
RFC PATCH 31/97 drm/i915/guc: Early initialization of GuC send registers
In reply to Matthew BrostFrom: Michal Wajdeczko <[email protected]>
Base offset and count of the GuC scratch registers, used for sending MMIO messages to GuC, can be initialized earlier with other GuC members that also depends on platform.
--- drivers/gpu/drm/i915/gt/uc/intel_guc.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-)
drivers/gpu/drm/i915/gt/uc/intel_guc.c +9 -9
@@ -60,15 +60,8 @@ void intel_guc_init_send_regs(struct intel_guc *guc)enum forcewake_domains fw_domains =0 ;unsigned int i; -if (INTEL_GEN (gt->i915) >=11 ) { - guc->send_regs.base = -i915_mmio_reg_offset (GEN11_SOFT_SCRATCH (0 )); - guc->send_regs.count =GEN11_SOFT_SCRATCH_COUNT ; - }else { - guc->send_regs.base =i915_mmio_reg_offset (SOFT_SCRATCH (0 )); - guc->send_regs.count =GUC_MAX_MMIO_MSG_LEN ; -BUILD_BUG_ON (GUC_MAX_MMIO_MSG_LEN >SOFT_SCRATCH_COUNT ); - } +GEM_BUG_ON (!guc->send_regs.base); +GEM_BUG_ON (!guc->send_regs.count);for (i =0 ; i < guc->send_regs.count; i++) { fw_domains |= intel_uncore_forcewake_for_reg(gt->uncore,
@@ -181,11 +174,18 @@ void intel_guc_init_early(struct intel_guc *guc) guc->interrupts.reset = gen11_reset_guc_interrupts; guc->interrupts.enable = gen11_enable_guc_interrupts; guc->interrupts.disable = gen11_disable_guc_interrupts; + guc->send_regs.base = +i915_mmio_reg_offset (GEN11_SOFT_SCRATCH (0 )); + guc->send_regs.count =GEN11_SOFT_SCRATCH_COUNT ; + }else { guc->notify_reg =GUC_SEND_INTERRUPT ; guc->interrupts.reset = gen9_reset_guc_interrupts; guc->interrupts.enable = gen9_enable_guc_interrupts; guc->interrupts.disable = gen9_disable_guc_interrupts; + guc->send_regs.base =i915_mmio_reg_offset (SOFT_SCRATCH (0 )); + guc->send_regs.count =GUC_MAX_MMIO_MSG_LEN ; +BUILD_BUG_ON (GUC_MAX_MMIO_MSG_LEN >SOFT_SCRATCH_COUNT ); } }
Signature · 6 lines
2.28.0 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [RFC PATCH 31/97] drm/i915/guc: Early initialization of GuC send registers
Quoted 9 lines · Matthew Brost
From: Michal Wajdeczko <[email protected]>
Base offset and count of the GuC scratch registers, used for sending MMIO messages to GuC, can be initialized earlier with other GuC members that also depends on platform.
Signed-off-by Michal Wajdeczko <[email protected]>Signed-off-by Matthew Brost <[email protected]>Cc Daniele Ceraolo Spurio <[email protected]>
Quoted 48 lines
--- drivers/gpu/drm/i915/gt/uc/intel_guc.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-)drivers/gpu/drm/i915/gt/uc/intel_guc.c +9
-9@@ -60,15 +60,8 @@ void intel_guc_init_send_regs(struct intel_guc *guc)enum forcewake_domains fw_domains =0 ;unsigned int i; -if (INTEL_GEN (gt->i915) >=11 ) { - guc->send_regs.base = -i915_mmio_reg_offset (GEN11_SOFT_SCRATCH (0 )); - guc->send_regs.count =GEN11_SOFT_SCRATCH_COUNT ; - }else { - guc->send_regs.base =i915_mmio_reg_offset (SOFT_SCRATCH (0 )); - guc->send_regs.count =GUC_MAX_MMIO_MSG_LEN ; -BUILD_BUG_ON (GUC_MAX_MMIO_MSG_LEN >SOFT_SCRATCH_COUNT ); - } +GEM_BUG_ON (!guc->send_regs.base); +GEM_BUG_ON (!guc->send_regs.count);for (i =0 ; i < guc->send_regs.count; i++) { fw_domains |= intel_uncore_forcewake_for_reg(gt->uncore,@@ -181,11 +174,18 @@ void intel_guc_init_early(struct intel_guc *guc) guc->interrupts.reset = gen11_reset_guc_interrupts; guc->interrupts.enable = gen11_enable_guc_interrupts; guc->interrupts.disable = gen11_disable_guc_interrupts; + guc->send_regs.base = +i915_mmio_reg_offset (GEN11_SOFT_SCRATCH (0 )); + guc->send_regs.count =GEN11_SOFT_SCRATCH_COUNT ; + }else { guc->notify_reg =GUC_SEND_INTERRUPT ; guc->interrupts.reset = gen9_reset_guc_interrupts; guc->interrupts.enable = gen9_enable_guc_interrupts; guc->interrupts.disable = gen9_disable_guc_interrupts; + guc->send_regs.base =i915_mmio_reg_offset (SOFT_SCRATCH (0 )); + guc->send_regs.count =GUC_MAX_MMIO_MSG_LEN ; +BUILD_BUG_ON (GUC_MAX_MMIO_MSG_LEN >SOFT_SCRATCH_COUNT ); } }Signature · 1 line
2.28.0
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
RFC PATCH 32/97 drm/i915: Introduce i915_sched_engine object
In reply to Matthew BrostIntroduce i915_sched_engine object which is lower level data structure that i915_scheduler / generic code can operate on without touching execlist specific structures. This allows additional submission backends to be added without breaking the layer.
--- drivers/gpu/drm/i915/gem/i915_gem_wait.c | 4 +- drivers/gpu/drm/i915/gt/intel_engine.h | 16 - drivers/gpu/drm/i915/gt/intel_engine_cs.c | 77 ++-- .../gpu/drm/i915/gt/intel_engine_heartbeat.c | 4 +- drivers/gpu/drm/i915/gt/intel_engine_pm.c | 10 +- drivers/gpu/drm/i915/gt/intel_engine_types.h | 42 +-- drivers/gpu/drm/i915/gt/intel_engine_user.c | 2 +- .../drm/i915/gt/intel_execlists_submission.c | 350 +++++++++++------- .../gpu/drm/i915/gt/intel_ring_submission.c | 13 +- drivers/gpu/drm/i915/gt/mock_engine.c | 17 +- drivers/gpu/drm/i915/gt/selftest_execlists.c | 36 +- drivers/gpu/drm/i915/gt/selftest_hangcheck.c | 6 +- drivers/gpu/drm/i915/gt/selftest_lrc.c | 6 +- drivers/gpu/drm/i915/gt/selftest_reset.c | 2 +- .../gpu/drm/i915/gt/uc/intel_guc_submission.c | 75 ++-- drivers/gpu/drm/i915/i915_gpu_error.c | 7 +- drivers/gpu/drm/i915/i915_request.c | 50 +-- drivers/gpu/drm/i915/i915_request.h | 2 +- drivers/gpu/drm/i915/i915_scheduler.c | 168 ++++----- drivers/gpu/drm/i915/i915_scheduler.h | 65 +++- drivers/gpu/drm/i915/i915_scheduler_types.h | 63 ++++ 21 files changed, 575 insertions(+), 440 deletions(-)
drivers/gpu/drm/i915/gem/i915_gem_wait.c +2 -2
@@ -104,8 +104,8 @@ static void fence_set_priority(struct dma_fence *fence, engine = rq->engine;rcu_read_lock ();/* RCU serialisation for set-wedged protection */ -if (engine->schedule) - engine->schedule (rq, attr); +if (engine->sched_engine->schedule) + engine->sched_engine->schedule (rq, attr);rcu_read_unlock (); }
drivers/gpu/drm/i915/gt/intel_engine.h +0 -16
@@ -123,20 +123,6 @@ execlists_active(const struct intel_engine_execlists *execlists)return active; } -static inline void -execlists_active_lock_bh (struct intel_engine_execlists *execlists) -{ -local_bh_disable ();/* prevent local softirq and lock recursion */ -tasklet_lock (&execlists->tasklet); -} - -static inline void -execlists_active_unlock_bh (struct intel_engine_execlists *execlists) -{ -tasklet_unlock (&execlists->tasklet); -local_bh_enable ();/* restore softirq, and kick ksoftirqd! */ -} -struct i915_request *execlists_unwind_incomplete_requests (struct intel_engine_execlists *execlists);
@@ -257,8 +243,6 @@ intel_engine_find_active_request(struct intel_engine_cs *engine);u32 intel_engine_context_size (struct intel_gt *gt,u8 class); -void intel_engine_init_active (struct intel_engine_cs *engine, -unsigned int subclass);#define ENGINE_PHYSICAL 0#define ENGINE_MOCK 1#define ENGINE_VIRTUAL 2
drivers/gpu/drm/i915/gt/intel_engine_cs.c +30 -47
194 lines not on this page · raw message
drivers/gpu/drm/i915/gt/intel_engine_heartbeat.c +2 -2
@@ -121,7 +121,7 @@ static void heartbeat(struct work_struct *wrk)* but all other contexts, including the kernel * context are stuck waiting for the signal. */ - }else if (engine->schedule && + }else if (engine->sched_engine->schedule && rq->sched.attr.priority <I915_PRIORITY_BARRIER ) {/* * Gradually raise the priority of the heartbeat to
@@ -136,7 +136,7 @@ static void heartbeat(struct work_struct *wrk) attr.priority =I915_PRIORITY_BARRIER ;local_bh_disable (); - engine->schedule (rq, &attr); + engine->sched_engine->schedule (rq, &attr);local_bh_enable (); }else {if (IS_ENABLED (CONFIG_DRM_I915_DEBUG_GEM ))
drivers/gpu/drm/i915/gt/intel_engine_pm.c +6 -4
@@ -274,14 +274,16 @@ static int __engine_park(struct intel_wakeref *wf)intel_engine_park_heartbeat (engine);intel_breadcrumbs_park (engine->breadcrumbs); -/* Must be reset upon idling, or we may miss the busy wakeup. */ -GEM_BUG_ON (engine->execlists.queue_priority_hint !=INT_MIN ); +/* +* XXX: Must be reset upon idling, or we may miss the busy wakeup. +* queue_priority_hint only used in execlists submission but works in +* other modes as default is INT_MIN. +*/ +GEM_BUG_ON (engine->sched_engine->queue_priority_hint !=INT_MIN );if (engine->park) engine->park (engine); - engine->execlists.no_priolist = false; -/* While gt calls i915_vma_parked(), we have to break the lock cycle */ intel_gt_pm_put_async (engine->gt);return 0 ;
drivers/gpu/drm/i915/gt/intel_engine_types.h +3 -39
85 lines not on this page · raw message
drivers/gpu/drm/i915/gt/intel_engine_user.c +1 -1
@@ -107,7 +107,7 @@ static void set_scheduler_caps(struct drm_i915_private *i915)for_each_uabi_engine (engine, i915) {/* all engines must agree! */ int i; -if (engine->schedule) +if (engine->sched_engine->schedule) enabled |= (I915_SCHEDULER_CAP_ENABLED |I915_SCHEDULER_CAP_PRIORITY );else
drivers/gpu/drm/i915/gt/intel_execlists_submission.c +213 -137
944 lines not on this page · raw message
drivers/gpu/drm/i915/gt/intel_ring_submission.c +7 -6
@@ -339,9 +339,9 @@ static void reset_rewind(struct intel_engine_cs *engine, bool stalled)u32 head; rq =NULL ; -spin_lock_irqsave (&engine->active.lock, flags); +spin_lock_irqsave (&engine->sched_engine->lock, flags);rcu_read_lock (); -list_for_each_entry (pos, &engine->active.requests, sched.link) { +list_for_each_entry (pos, &engine->sched_engine->requests, sched.link) {if (!__i915_request_is_complete (pos)) { rq = pos;break ;
@@ -396,7 +396,7 @@ static void reset_rewind(struct intel_engine_cs *engine, bool stalled) } engine->legacy.ring->head =intel_ring_wrap (engine->legacy.ring, head); -spin_unlock_irqrestore (&engine->active.lock, flags); +spin_unlock_irqrestore (&engine->sched_engine->lock, flags); }static void reset_finish (struct intel_engine_cs *engine)
@@ -408,16 +408,17 @@ static void reset_cancel(struct intel_engine_cs *engine)struct i915_request *request;unsigned long flags; -spin_lock_irqsave (&engine->active.lock, flags); +spin_lock_irqsave (&engine->sched_engine->lock, flags);/* Mark all submitted requests as skipped. */ -list_for_each_entry (request, &engine->active.requests, sched.link) +list_for_each_entry (request, &engine->sched_engine->requests, + sched.link)i915_request_put (i915_request_mark_eio (request));intel_engine_signal_breadcrumbs (engine);/* Remaining _unready_ requests will be nop'ed when submitted */ -spin_unlock_irqrestore (&engine->active.lock, flags); +spin_unlock_irqrestore (&engine->sched_engine->lock, flags); }static void i9xx_submit_request (struct i915_request *request)
drivers/gpu/drm/i915/gt/mock_engine.c +12 -5
@@ -253,10 +253,10 @@ static void mock_reset_cancel(struct intel_engine_cs *engine)del_timer_sync (&mock->hw_delay); -spin_lock_irqsave (&engine->active.lock, flags); +spin_lock_irqsave (&engine->sched_engine->lock, flags);/* Mark all submitted requests as skipped. */ -list_for_each_entry (rq, &engine->active.requests, sched.link) +list_for_each_entry (rq, &engine->sched_engine->requests, sched.link)i915_request_put (i915_request_mark_eio (rq));intel_engine_signal_breadcrumbs (engine);
@@ -269,7 +269,7 @@ static void mock_reset_cancel(struct intel_engine_cs *engine) }INIT_LIST_HEAD (&mock->hw_queue); -spin_unlock_irqrestore (&engine->active.lock, flags); +spin_unlock_irqrestore (&engine->sched_engine->lock, flags); }static void mock_reset_finish (struct intel_engine_cs *engine)
@@ -283,6 +283,7 @@ static void mock_engine_release(struct intel_engine_cs *engine)GEM_BUG_ON (timer_pending (&mock->hw_delay)); +i915_sched_engine_put (engine->sched_engine);intel_breadcrumbs_free (engine->breadcrumbs);intel_context_unpin (engine->kernel_context);
@@ -345,14 +346,18 @@ int mock_engine_init(struct intel_engine_cs *engine) {struct intel_context *ce; -intel_engine_init_active (engine,ENGINE_MOCK ); + engine->sched_engine =i915_sched_engine_create (ENGINE_MOCK ); +if (!engine->sched_engine) +return -ENOMEM ; + engine->sched_engine->engine = engine; +intel_engine_init_execlists (engine);intel_engine_init__pm (engine);intel_engine_init_retire (engine); engine->breadcrumbs =intel_breadcrumbs_create (NULL );if (!engine->breadcrumbs) -return -ENOMEM ; + goto err_schedule; ce =create_kernel_context (engine);if (IS_ERR (ce))
@@ -366,6 +371,8 @@ int mock_engine_init(struct intel_engine_cs *engine) err_breadcrumbs:intel_breadcrumbs_free (engine->breadcrumbs); +err_schedule: +i915_sched_engine_put (engine->sched_engine);return -ENOMEM ; }
drivers/gpu/drm/i915/gt/selftest_execlists.c +18 -18
@@ -43,7 +43,7 @@ static int wait_for_submit(struct intel_engine_cs *engine, unsigned long timeout) {/* Ignore our own attempts to suppress excess tasklets */ -tasklet_hi_schedule (&engine->execlists.tasklet); +i915_sched_engine_hi_kick (engine->sched_engine); timeout += jiffies; do {
@@ -273,7 +273,7 @@ static int live_unlite_restore(struct intel_gt *gt, int prio) };/* Alternatively preempt the spinner with ce[1] */ - engine->schedule (rq[1 ], &attr); + engine->sched_engine->schedule (rq[1 ], &attr); }/* And switch back to ce[0] for good measure */
@@ -606,9 +606,9 @@ static int live_hold_reset(void *arg) err = -EBUSY ; goto out; } -tasklet_disable (&engine->execlists.tasklet); +tasklet_disable (&engine->sched_engine->tasklet); - engine->execlists.tasklet.callback (&engine->execlists.tasklet); + engine->sched_engine->tasklet.callback (&engine->sched_engine->tasklet);GEM_BUG_ON (execlists_active (&engine->execlists) != rq);i915_request_get (rq);
@@ -618,7 +618,7 @@ static int live_hold_reset(void *arg)__intel_engine_reset_bh (engine,NULL );GEM_BUG_ON (rq->fence.error != -EIO ); -tasklet_enable (&engine->execlists.tasklet); +tasklet_enable (&engine->sched_engine->tasklet);clear_and_wake_up_bit (I915_RESET_ENGINE + id, >->reset.flags);local_bh_enable ();
@@ -900,7 +900,7 @@ release_queue(struct intel_engine_cs *engine,i915_request_add (rq);local_bh_disable (); - engine->schedule (rq, &attr); + engine->sched_engine->schedule (rq, &attr);local_bh_enable ();/* kick tasklet */ i915_request_put (rq);
@@ -1183,7 +1183,7 @@ static int live_timeslice_rewind(void *arg)while (i915_request_is_active (rq[A2 ])) {/* semaphore yield! */ /* Wait for the timeslice to kick in */ del_timer (&engine->execlists.timer); -tasklet_hi_schedule (&engine->execlists.tasklet); +i915_sched_engine_hi_kick (engine->sched_engine);intel_engine_flush_submission (engine); }/* -> ELSP[] = { { A:rq1 }, { B:rq1 } } */
@@ -1325,7 +1325,7 @@ static int live_timeslice_queue(void *arg) err =PTR_ERR (rq); goto err_heartbeat; } - engine->schedule (rq, &attr); + engine->sched_engine->schedule (rq, &attr); err =wait_for_submit (engine, rq,HZ /2 );if (err) { pr_err("%s: Timed out trying to submit semaphores\n",
@@ -1867,7 +1867,7 @@ static int live_late_preempt(void *arg) } attr.priority =I915_PRIORITY_MAX ; - engine->schedule (rq, &attr); + engine->sched_engine->schedule (rq, &attr);if (!igt_wait_for_spinner (&spin_hi, rq)) {pr_err ("High priority context failed to preempt the low priority context\n" );
@@ -2480,7 +2480,7 @@ static int live_suppress_self_preempt(void *arg)i915_request_add (rq_b);GEM_BUG_ON (i915_request_completed (rq_a)); - engine->schedule (rq_a, &attr); + engine->sched_engine->schedule (rq_a, &attr);igt_spinner_end (&a.spin);if (!igt_wait_for_spinner (&b.spin, rq_b)) {
@@ -2612,7 +2612,7 @@ static int live_chain_preempt(void *arg)i915_request_get (rq);i915_request_add (rq); - engine->schedule (rq, &attr); + engine->sched_engine->schedule (rq, &attr);igt_spinner_end (&hi.spin);if (i915_request_wait (rq,0 ,HZ /5 ) <0 ) {
@@ -2971,7 +2971,7 @@ static int live_preempt_gang(void *arg)break ;/* Submit each spinner at increasing priority */ - engine->schedule (rq, &attr); + engine->sched_engine->schedule (rq, &attr); }while (prio <=I915_PRIORITY_MAX && !__igt_timeout (end_time,NULL )); pr_debug("%s: Preempt chain of %d requests\n",
@@ -3219,7 +3219,7 @@ static int preempt_user(struct intel_engine_cs *engine,i915_request_get (rq);i915_request_add (rq); - engine->schedule (rq, &attr); + engine->sched_engine->schedule (rq, &attr);if (i915_request_wait (rq,0 ,HZ /2 ) <0 ) err = -ETIME ;
@@ -4593,15 +4593,15 @@ static int reset_virtual_engine(struct intel_gt *gt, err = -EBUSY ; goto out_heartbeat; } -tasklet_disable (&engine->execlists.tasklet); +tasklet_disable (&engine->sched_engine->tasklet); - engine->execlists.tasklet.callback (&engine->execlists.tasklet); + engine->sched_engine->tasklet.callback (&engine->sched_engine->tasklet);GEM_BUG_ON (execlists_active (&engine->execlists) != rq);/* Fake a preemption event; failed of course */ -spin_lock_irq (&engine->active.lock); +spin_lock_irq (&engine->sched_engine->lock);__unwind_incomplete_requests (engine); -spin_unlock_irq (&engine->active.lock); +spin_unlock_irq (&engine->sched_engine->lock);GEM_BUG_ON (rq->engine != engine);/* Reset the engine while keeping our active request on hold */
@@ -4612,7 +4612,7 @@ static int reset_virtual_engine(struct intel_gt *gt,GEM_BUG_ON (rq->fence.error != -EIO );/* Release our grasp on the engine, letting CS flow again */ -tasklet_enable (&engine->execlists.tasklet); +tasklet_enable (&engine->sched_engine->tasklet);clear_and_wake_up_bit (I915_RESET_ENGINE + engine->id, >->reset.flags);local_bh_enable ();
drivers/gpu/drm/i915/gt/selftest_hangcheck.c +3 -3
@@ -858,12 +858,12 @@ static int active_engine(void *data) rq[idx] =i915_request_get (new);i915_request_add (new); -if (engine->schedule && arg->flags &TEST_PRIORITY ) { +if (engine->sched_engine->schedule && arg->flags &TEST_PRIORITY ) {struct i915_sched_attr attr = { .priority =i915_prandom_u32_max_state (512 , &prng), }; - engine->schedule (rq[idx], &attr); + engine->sched_engine->schedule (rq[idx], &attr); } err =active_request_put (old);
@@ -1702,7 +1702,7 @@ static int __igt_atomic_reset_engine(struct intel_engine_cs *engine,const struct igt_atomic_section *p, const char *mode) { - struct tasklet_struct * const t = &engine->execlists.tasklet; + struct tasklet_struct * const t = &engine->sched_engine->tasklet;int err; GEM_TRACE("i915_reset_engine(%s:%s) under %s\n",
drivers/gpu/drm/i915/gt/selftest_lrc.c +3 -3
@@ -49,7 +49,7 @@ static int wait_for_submit(struct intel_engine_cs *engine, unsigned long timeout) {/* Ignore our own attempts to suppress excess tasklets */ -tasklet_hi_schedule (&engine->execlists.tasklet); +i915_sched_engine_hi_kick (engine->sched_engine); timeout += jiffies; do {
@@ -1613,12 +1613,12 @@ static void garbage_reset(struct intel_engine_cs *engine,local_bh_disable ();if (!test_and_set_bit (bit, lock)) { -tasklet_disable (&engine->execlists.tasklet); +tasklet_disable (&engine->sched_engine->tasklet);if (!rq->fence.error)__intel_engine_reset_bh (engine,NULL ); -tasklet_enable (&engine->execlists.tasklet); +tasklet_enable (&engine->sched_engine->tasklet);clear_and_wake_up_bit (bit, lock); }local_bh_enable ();
drivers/gpu/drm/i915/gt/selftest_reset.c +1 -1
@@ -321,7 +321,7 @@ static int igt_atomic_engine_reset(void *arg) goto out_unlock;for_each_engine (engine, gt, id) { -struct tasklet_struct *t = &engine->execlists.tasklet; +struct tasklet_struct *t = &engine->sched_engine->tasklet;if (t->func)tasklet_disable (t);
drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c +40 -35
223 lines not on this page · raw message
drivers/gpu/drm/i915/i915_gpu_error.c +4 -3
@@ -1247,7 +1247,8 @@ static void record_request(const struct i915_request *request,static void engine_record_execlists (struct intel_engine_coredump *ee) { -const struct intel_engine_execlists *const el = &ee->engine->execlists; +const struct intel_engine_execlists *const el = + &ee->engine->execlists;struct i915_request *const *port = el->active;unsigned int n =0 ;
@@ -1441,12 +1442,12 @@ capture_engine(struct intel_engine_cs *engine,if (!ee)return NULL ; -spin_lock_irqsave (&engine->active.lock, flags); +spin_lock_irqsave (&engine->sched_engine->lock, flags); rq =intel_engine_find_active_request (engine);if (rq) capture =intel_engine_coredump_add_request (ee, rq,ATOMIC_MAYFAIL ); -spin_unlock_irqrestore (&engine->active.lock, flags); +spin_unlock_irqrestore (&engine->sched_engine->lock, flags);if (!capture) {kfree (ee);return NULL ;
drivers/gpu/drm/i915/i915_request.c +25 -25
162 lines not on this page · raw message
drivers/gpu/drm/i915/i915_request.h +1 -1
@@ -613,7 +613,7 @@ i915_request_active_timeline(const struct i915_request *rq)* this submission. */ return rcu_dereference_protected (rq->timeline, -lockdep_is_held (&rq->engine->active.lock)); +lockdep_is_held (&rq->engine->sched_engine->lock)); } static inline u32
drivers/gpu/drm/i915/i915_scheduler.c +77 -91
278 lines not on this page · raw message
drivers/gpu/drm/i915/i915_scheduler.h +64 -1
75 lines not on this page · raw message
drivers/gpu/drm/i915/i915_scheduler_types.h +63 -0
67 lines not on this page · raw message
Signature · 1 line
2.28.0