Skip to contentSkip to conversation

Enable GuC based power management features

PATCH Superseded Vinay Belgaumkar 4 participants 53 messages Jul 10, 2021 – Jul 21, 2021

Subsystems (2)

v1 of 6 Superseded Latest is v6 →

lore
Share & tools
lore
#0 lore raw

cover Enable GuC based power management features

This series enables Single Loop Power Control (SLPC) feature in GuC. GuC implements various power management algorithms as part of it's operation. These need to be specifically enabled by KMD. They replace the legacy host based management of these features.

With this series, we will enable two PM features - GTPerf and GuCRC. These are the Turbo and RC6 equivalents of the host based version. GuC provides various interfaces via host-to-guc messaging, which allows KMD to enable these features after GuC is loaded and GuC submission is enabled. We will specifically disable the IA/GT Balancer and Duty Cycle control features in SLPC.

To enable GTPerf, KMD sends a specific h2g message after setting up some shared data structures. As part of this, we will gate host RPS as well. GuC takes over the duties of requesting frequencies by monitoring GPU busyness. We can influence what GuC requests by modifying the min and max frequencies setup by SLPC through the sysfs interfaces that have been exposed by legacy Turbo. SLPC typically requests efficient frequency instead of minimum frequency to optimize performance. It also does not necessarily stick to platform max, and can request frequencies that are much higher since pcode will ultimately grant the appropriate values. However, we will force it to adhere to platform min and max values so as to maintain legacy behavior. SLPC does not have the concept of waitboost, so the boost_freq sysfs will show a '0' value for now. There is a patch forthcoming to ensure the interface is not exposed when slpc is enabled.

GuCRC is enabled similarly through a h2g message. We still need to enable RC6 feature bit (GEN6_RC_CTL_RC6_ENABLE) before we send this out. Render/Media power gating still needs to be enabled by host as before. GuC will take care of setting up the hysterisis values for RC6, host does not need to set this up anymore.

Matthew Brost (1):
drm/i915/guc: Squashed patch - DO NOT REVIEW

Vinay Belgaumkar (15):
drm/i915/guc/slpc: Initial definitions for slpc drm/i915/guc/slpc: Gate Host RPS when slpc is enabled drm/i915/guc/slpc: Lay out slpc init/enable/disable/fini drm/i915/guc/slpc: Adding slpc communication interfaces drm/i915/guc/slpc: Allocate, initialize and release slpc drm/i915/guc/slpc: Enable slpc and add related H2G events drm/i915/guc/slpc: Add methods to set min/max frequency drm/i915/guc/slpc: Add get max/min freq hooks drm/i915/guc/slpc: Add debugfs for slpc info drm/i915/guc/slpc: Enable ARAT timer interrupt drm/i915/guc/slpc: Cache platform frequency limits for slpc drm/i915/guc/slpc: Update slpc to use platform min/max drm/i915/guc/slpc: Sysfs hooks for slpc drm/i915/guc/slpc: slpc selftest
drm/i915/guc/rc: Setup and enable GUCRC feature

 drivers/gpu/drm/i915/Makefile                 |    3 +
 drivers/gpu/drm/i915/gem/i915_gem_context.c   |   21 +-
 drivers/gpu/drm/i915/gem/i915_gem_context.h   |    1 +
 drivers/gpu/drm/i915/gem/i915_gem_mman.c      |    3 +-
 drivers/gpu/drm/i915/gt/gen8_engine_cs.c      |    6 +-
 drivers/gpu/drm/i915/gt/intel_breadcrumbs.c   |   41 +-
 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       |   50 +-
 drivers/gpu/drm/i915/gt/intel_context_types.h |   54 +
 drivers/gpu/drm/i915/gt/intel_engine.h        |   54 +-
 drivers/gpu/drm/i915/gt/intel_engine_cs.c     |  182 +-
 .../gpu/drm/i915/gt/intel_engine_heartbeat.c  |   71 +-
 .../gpu/drm/i915/gt/intel_engine_heartbeat.h  |    4 +
 drivers/gpu/drm/i915/gt/intel_engine_types.h  |   12 +-
 .../drm/i915/gt/intel_execlists_submission.c  |   95 +-
 .../drm/i915/gt/intel_execlists_submission.h  |    4 -
 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_pm.c         |    6 +-
 drivers/gpu/drm/i915/gt/intel_gt_requests.c   |   23 +-
 drivers/gpu/drm/i915/gt/intel_gt_requests.h   |    9 +-
 drivers/gpu/drm/i915/gt/intel_lrc_reg.h       |    1 -
 drivers/gpu/drm/i915/gt/intel_rc6.c           |   22 +-
 drivers/gpu/drm/i915/gt/intel_reset.c         |   50 +-
 .../gpu/drm/i915/gt/intel_ring_submission.c   |   48 +
 drivers/gpu/drm/i915/gt/intel_rps.c           |  160 ++
 drivers/gpu/drm/i915/gt/intel_rps.h           |    5 +
 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         |   41 +-
 drivers/gpu/drm/i915/gt/selftest_context.c    |   10 +
 .../drm/i915/gt/selftest_engine_heartbeat.c   |   22 +
 .../drm/i915/gt/selftest_engine_heartbeat.h   |    2 +
 drivers/gpu/drm/i915/gt/selftest_execlists.c  |   12 +-
 drivers/gpu/drm/i915/gt/selftest_hangcheck.c  |  314 +-
 drivers/gpu/drm/i915/gt/selftest_mocs.c       |   50 +-
 drivers/gpu/drm/i915/gt/selftest_slpc.c       |  333 +++
 drivers/gpu/drm/i915/gt/selftest_slpc.h       |   12 +
 .../gpu/drm/i915/gt/selftest_workarounds.c    |  132 +-
 .../gpu/drm/i915/gt/uc/abi/guc_actions_abi.h  |   21 +
 .../gt/uc/abi/guc_communication_ctb_abi.h     |    3 +-
 drivers/gpu/drm/i915/gt/uc/intel_guc.c        |   99 +-
 drivers/gpu/drm/i915/gt/uc/intel_guc.h        |  114 +-
 drivers/gpu/drm/i915/gt/uc/intel_guc_ads.c    |  460 ++-
 drivers/gpu/drm/i915/gt/uc/intel_guc_ads.h    |    3 +
 drivers/gpu/drm/i915/gt/uc/intel_guc_ct.c     |  368 ++-
 drivers/gpu/drm/i915/gt/uc/intel_guc_ct.h     |   28 +-
 .../gpu/drm/i915/gt/uc/intel_guc_debugfs.c    |   41 +-
 drivers/gpu/drm/i915/gt/uc/intel_guc_fwif.h   |   90 +-
 drivers/gpu/drm/i915/gt/uc/intel_guc_rc.c     |   79 +
 drivers/gpu/drm/i915/gt/uc/intel_guc_rc.h     |   32 +
 drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c   |  606 ++++
 drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.h   |   47 +
 .../gpu/drm/i915/gt/uc/intel_guc_slpc_fwif.h  |  255 ++
 .../gpu/drm/i915/gt/uc/intel_guc_submission.c | 2528 +++++++++++++++--
 .../gpu/drm/i915/gt/uc/intel_guc_submission.h |   33 +-
 drivers/gpu/drm/i915/gt/uc/intel_uc.c         |  126 +-
 drivers/gpu/drm/i915/gt/uc/intel_uc.h         |   14 +
 drivers/gpu/drm/i915/i915_debugfs.c           |    2 +
 drivers/gpu/drm/i915/i915_debugfs_params.c    |   31 +
 drivers/gpu/drm/i915/i915_gem_evict.c         |    1 +
 drivers/gpu/drm/i915/i915_gpu_error.c         |   25 +-
 drivers/gpu/drm/i915/i915_pmu.c               |    2 +-
 drivers/gpu/drm/i915/i915_reg.h               |    4 +
 drivers/gpu/drm/i915/i915_request.c           |  168 +-
 drivers/gpu/drm/i915/i915_request.h           |   21 +
 drivers/gpu/drm/i915/i915_scheduler.c         |    9 +-
 drivers/gpu/drm/i915/i915_scheduler.h         |   10 +-
 drivers/gpu/drm/i915/i915_scheduler_types.h   |   10 +
 drivers/gpu/drm/i915/i915_sysfs.c             |   71 +-
 drivers/gpu/drm/i915/i915_trace.h             |  207 +-
 .../drm/i915/selftests/i915_live_selftests.h  |    1 +
 drivers/gpu/drm/i915/selftests/i915_request.c |    4 +-
 .../gpu/drm/i915/selftests/igt_flush_test.c   |    2 +-
 .../gpu/drm/i915/selftests/igt_live_test.c    |    2 +-
 .../i915/selftests/intel_scheduler_helpers.c  |   89 +
 .../i915/selftests/intel_scheduler_helpers.h  |   35 +
 .../gpu/drm/i915/selftests/mock_gem_device.c  |    3 +-
 80 files changed, 6705 insertions(+), 935 deletions(-)
 create mode 100644 drivers/gpu/drm/i915/gt/selftest_slpc.c
 create mode 100644 drivers/gpu/drm/i915/gt/selftest_slpc.h
 create mode 100644 drivers/gpu/drm/i915/gt/uc/intel_guc_rc.c
 create mode 100644 drivers/gpu/drm/i915/gt/uc/intel_guc_rc.h
 create mode 100644 drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c
 create mode 100644 drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.h
 create mode 100644 drivers/gpu/drm/i915/gt/uc/intel_guc_slpc_fwif.h
 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.25.0

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#1 lore raw

PATCH 1/16 drm/i915/guc: Squashed patch - DO NOT REVIEW

From: Matthew Brost <[email protected]>

Squashed patches needed for CI to execute. These
patches are already in review in a separate
series - (DO NOT REVIEW WITH THIS SERIES) -

https://patchwork.freedesktop.org/series/89844/
https://patchwork.freedesktop.org/series/91417/

drm/i915/guc: Improve error message for unsolicited CT response

Improve the error message when a unsolicited CT response is received by printing fence that couldn't be found, the last fence, and all requests with a response outstanding.

drm/i915/guc: Increase size of CTB buffers

With the introduction of non-blocking CTBs more than one CTB can be in flight at a time. Increasing the size of the CTBs should reduce how often software hits the case where no space is available in the CTB buffer.

drm/i915/guc: Add non blocking CTB send function

Add non blocking CTB send function, intel_guc_send_nb. GuC submission will send CTBs in the critical path and does not need to wait for these CTBs to complete before moving on, hence the need for this new function.

The non-blocking CTB now must have a flow control mechanism to ensure the buffer isn't overrun. A lazy spin wait is used as we believe the flow control condition should be rare with a properly sized buffer.

The function, intel_guc_send_nb, is exported in this patch but unused. Several patches later in the series make use of this function.

v2:
(Michal)
- Use define for H2G room calculations
- Move INTEL_GUC_SEND_NB define
(Daniel Vetter)
- Use msleep_interruptible rather than cond_resched
v3:
(Michal)
- Move includes to following patch
- s/INTEL_GUC_SEND_NB/INTEL_GUC_CT_SEND_NB/g
v4:
(John H)
- Update comment, add type local variable

drm/i915/guc: Add stall timer to non blocking CTB send function

Implement a stall timer which fails H2G CTBs once a period of time with no forward progress is reached to prevent deadlock.

v2:
(Michal)
- Improve error message in ct_deadlock()
- Set broken when ct_deadlock() returns true
- Return -EPIPE on ct_deadlock()
v3:
(Michal)
- Add ms to stall timer comment
(Matthew)
- Move broken check to intel_guc_ct_send()

drm/i915/guc: Optimize CTB writes and reads

CTB writes are now in the path of command submission and should be optimized for performance. Rather than reading CTB descriptor values (e.g. head, tail) which could result in accesses across the PCIe bus, store shadow local copies and only read/write the descriptor values when absolutely necessary. Also store the current space in the each channel locally.

v2:
(Michal)
- Add additional sanity checks for head / tail pointers
- Use GUC_CTB_HDR_LEN rather than magic 1
v3:
(Michal / John H)
- Drop redundant check of head value
v4:
(John H)
- Drop redundant checks of tail / head values
v5:
(Michal)
- Address more nits
v6:
(Michal)
- Add GEM_BUG_ON sanity check on ctb->space

drm/i915/guc: Module load failure test for CT buffer creation

Add several module failure load inject points in the CT buffer creation code path.

drm/i915/guc: Add new GuC interface defines and structures

Add new GuC interface defines and structures while maintaining old ones in parallel.

drm/i915/guc: Remove GuC stage descriptor, add LRC descriptor

Remove old GuC stage descriptor, add LRC descriptor which will be used by the new GuC interface implemented in this patch series.

v2:
(John Harrison)
- s/lrc/LRC/g

drm/i915/guc: Add LRC descriptor context lookup array

Add LRC descriptor context lookup array which can resolve the intel_context from the LRC descriptor index. In addition to lookup, it can determine in the LRC descriptor context is currently registered with the GuC by checking if an entry for a descriptor index is present. Future patches in the series will make use of this array.

v2:
(Michal)
- "linux/xarray.h" -> <linux/xarray.h>
- s/lrc/LRC

drm/i915/guc: Implement GuC submission tasklet

Implement GuC submission tasklet for new interface. The new GuC interface uses H2G to submit contexts to the GuC. Since H2G use a single channel, a single tasklet submits is used for the submission path.

Also the per engine interrupt handler has been updated to disable the rescheduling of the physical engine tasklet, when using GuC scheduling, as the physical engine tasklet is no longer used.

In this patch the field, guc_id, has been added to intel_context and is not assigned. Patches later in the series will assign this value.

v2:
(John Harrison)
- Clean up some comments

drm/i915/guc: Add bypass tasklet submission path to GuC

Add bypass tasklet submission path to GuC. The tasklet is only used if H2G channel has backpresure.

drm/i915/guc: Implement GuC context operations for new inteface

Implement GuC context operations which includes GuC specific operations alloc, pin, unpin, and destroy.

v2:
(Daniel Vetter)
- Use msleep_interruptible rather than cond_resched in busy loop
(Michal)
- Remove C++ style comment

drm/i915/guc: Insert fence on context when deregistering

Sometime during context pinning a context with the same guc_id is registered with the GuC. In this a case deregister must be before before the context can be registered. A fence is inserted on all requests while the deregister is in flight. Once the G2H is received indicating the deregistration is complete the context is registered and the fence is released.

drm/i915/guc: Defer context unpin until scheduling is disabled

With GuC scheduling, it isn't safe to unpin a context while scheduling is enabled for that context as the GuC may touch some of the pinned state (e.g. LRC). To ensure scheduling isn't enabled when an unpin is done, a call back is added to intel_context_unpin when pin count == 1 to disable scheduling for that context. When the response CTB is received it is safe to do the final unpin.

Future patches may add a heuristic / delay to schedule the disable call back to avoid thrashing on schedule enable / disable.

drm/i915/guc: Disable engine barriers with GuC during unpin

Disable engine barriers for unpinning with GuC. This feature isn't needed with the GuC as it disables context scheduling before unpinning which guarantees the HW will not reference the context. Hence it is not necessary to defer unpinning until a kernel context request completes on each engine in the context engine mask.

drm/i915/guc: Extend deregistration fence to schedule disable

Extend the deregistration context fence to fence whne a GuC context has scheduling disable pending.

drm/i915: Disable preempt busywait when using GuC scheduling

Disable preempt busywait when using GuC scheduling. This isn't need as the GuC control preemption when scheduling.

drm/i915/guc: Ensure request ordering via completion fences

If two requests are on the same ring, they are explicitly ordered by the HW. So, a submission fence is sufficient to ensure ordering when using the new GuC submission interface. Conversely, if two requests share a timeline and are on the same physical engine but different context this doesn't ensure ordering on the new GuC submission interface. So, a completion fence needs to be used to ensure ordering.

drm/i915/guc: Disable semaphores when using GuC scheduling

Semaphores are an optimization and not required for basic GuC submission to work properly. Disable until we have time to do the implementation to enable semaphores and tune them for performance. Also long direction is just to delete semaphores from the i915 so another reason to not enable these for GuC submission.

v2: Reword commit message

drm/i915/guc: Ensure G2H response has space in buffer

Ensure G2H response has space in the buffer before sending H2G CTB as the GuC can't handle any backpressure on the G2H interface.

v2:
(Matthew)
- s/INTEL_GUC_SEND/INTEL_GUC_CT_SEND
v3:
(Matthew)
- Add G2H credit accounting to blocking path, add g2h_release_space helper

drm/i915/guc: Update intel_gt_wait_for_idle to work with GuC

When running the GuC the GPU can't be considered idle if the GuC still has contexts pinned. As such, a call has been added in intel_gt_wait_for_idle to idle the UC and in turn the GuC by waiting for the number of unpinned contexts to go to zero.

v2: rtimeout -> remaining_timeout

drm/i915/guc: Update GuC debugfs to support new GuC

Update GuC debugfs to support the new GuC structures.

drm/i915/guc: Add several request trace points

Add trace points for request dependencies and GuC submit. Extended existing request trace points to include submit fence value,, guc_id, and ring tail value.

drm/i915: Add intel_context tracing

Add intel_context tracing. These trace points are particular helpful when debugging the GuC firmware and can be enabled via CONFIG_DRM_I915_LOW_LEVEL_TRACEPOINTS kernel config option.

drm/i915/guc: GuC virtual engines

Implement GuC virtual engines. Rather simple implementation, basically just allocate an engine, setup context enter / exit function to virtual engine specific functions, set all other variables / functions to guc versions, and set the engine mask to that of all the siblings.

v2: Update to work with proto-ctx

Cc Daniele Ceraolo Spurio <[email protected]>

drm/i915: Track 'serial' counts for virtual engines

The serial number tracking of engines happens at the backend of request submission and was expecting to only be given physical engines. However, in GuC submission mode, the decomposition of virtual to physical engines does not happen in i915. Instead, requests are submitted to their virtual engine mask all the way through to the hardware (i.e. to GuC). This would mean that the heart beat code thinks the physical engines are idle due to the serial number not incrementing.

This patch updates the tracking to decompose virtual engines into their physical constituents and tracks the request against each. This is not entirely accurate as the GuC will only be issuing the request to one physical engine. However, it is the best that i915 can do given that it has no knowledge of the GuC's scheduling decisions.

drm/i915: Hold reference to intel_context over life of i915_request

Hold a reference to the intel_context over life of an i915_request. Without this an i915_request can exist after the context has been destroyed (e.g. request retired, context closed, but user space holds a reference to the request from an out fence). In the case of GuC submission + virtual engine, the engine that the request references is also destroyed which can trigger bad pointer dref in fence ops (e.g. i915_fence_get_driver_name). We could likely change i915_fence_get_driver_name to avoid touching the engine but let's just be safe and hold the intel_context reference.

drm/i915/guc: Disable bonding extension with GuC submission

Update the bonding extension to return -ENODEV when using GuC submission as this extension fundamentally will not work with the GuC submission interface.

drm/i915/guc: Direct all breadcrumbs for a class to single breadcrumbs

With GuC virtual engines the physical engine which a request executes and completes on isn't known to the i915. Therefore we can't attach a request to a physical engines breadcrumbs. To work around this we create a single breadcrumbs per engine class when using GuC submission and direct all physical engine interrupts to this breadcrumbs.

drm/i915: Add i915_sched_engine destroy vfunc

This help the backends clean up when the schedule engine object gets destroyed.

drm/i915/guc: Reset implementation for new GuC interface

Reset implementation for new GuC interface. This is the legacy reset implementation which is called when the i915 owns the engine hang check. Future patches will offload the engine hang check to GuC but we will continue to maintain this legacy path as a fallback and this code path is also required if the GuC dies.

With the new GuC interface it is not possible to reset individual engines - it is only possible to reset the GPU entirely. This patch forces an entire chip reset if any engine hangs.

v2:
(Michal)
- Check for -EPIPE rather than -EIO (CT deadlock/corrupt check)

drm/i915: Reset GPU immediately if submission is disabled

If submission is disabled by the backend for any reason, reset the GPU immediately in the heartbeat code as the backend can't be reenabled until the GPU is reset.

drm/i915/guc: Add disable interrupts to guc sanitize

Add disable GuC interrupts to intel_guc_sanitize(). Part of this requires moving the guc_*_interrupt wrapper function into header file intel_guc.h.

Cc Daniele Ceraolo Spurio <[email protected]

drm/i915/guc: Suspend/resume implementation for new interface

The new GuC interface introduces an MMIO H2G command, INTEL_GUC_ACTION_RESET_CLIENT, which is used to implement suspend. This MMIO tears down any active contexts generating a context reset G2H CTB for each. Once that step completes the GuC tears down the CTB channels. It is safe to suspend once this MMIO H2G command completes and all G2H CTBs have been processed. In practice the i915 will likely never receive a G2H as suspend should only be called after the GPU is idle.

Resume is implemented in the same manner as before - simply reload the GuC firmware and reinitialize everything (e.g. CTB channels, contexts, etc..).

drm/i915/guc: Handle context reset notification

GuC will issue a reset on detecting an engine hang and will notify the driver via a G2H message. The driver will service the notification by resetting the guilty context to a simple state or banning it completely.

Cc Matthew Brost <[email protected]>
Cc John Harrison <[email protected]>

drm/i915/guc: Handle engine reset failure notification

GuC will notify the driver, via G2H, if it fails to reset an engine. We recover by resorting to a full GPU reset.

drm/i915/guc: Enable the timer expired interrupt for GuC

The GuC can implement execution qunatums, detect hung contexts and other such things but it requires the timer expired interrupt to do so.

drm/i915/guc: Provide mmio list to be saved/restored on engine reset

The driver must provide GuC with a list of mmio registers that should be saved/restored during a GuC-based engine reset. Unfortunately, the list must be dynamically allocated as its size is variable. That means the driver must generate the list twice - once to work out the size and a second time to actually save it.

v2:
(Alan / CI)
- GEN7_GT_MODE -> GEN6_GT_MODE to fix WA selftest failure

drm/i915/guc: Don't complain about reset races

It is impossible to seal all race conditions of resets occurring concurrent to other operations. At least, not without introducing excesive mutex locking. Instead, don't complain if it occurs. In particular, don't complain if trying to send a H2G during a reset. Whatever the H2G was about should get redone once the reset is over.

drm/i915/guc: Enable GuC engine reset

Clear the 'disable resets' flag to allow GuC to reset hung contexts (detected via pre-emption timeout).

drm/i915/guc: Capture error state on context reset

We receive notification of an engine reset from GuC at its completion. Meaning GuC has potentially cleared any HW state we may have been interested in capturing. GuC resumes scheduling on the engine post-reset, as the resets are meant to be transparent, further muddling our error state.

There is ongoing work to define an API for a GuC debug state dump. The suggestion for now is to manually disable FW initiated resets in cases where debug state is needed.

drm/i915/guc: Fix for error capture after full GPU reset with GuC

In the case of a full GPU reset (e.g. because GuC has died or because GuC's hang detection has been disabled), the driver can't rely on GuC reporting the guilty context. Instead, the driver needs to scan all active contexts and find one that is currently executing, as per the execlist mode behaviour. In GuC mode, this scan is different to execlist mode as the active request list is handled very differently.

Similarly, the request state dump in debugfs needs to be handled differently when in GuC submission mode.

Also refactured some of the request scanning code to avoid duplication across the multiple code paths that are now replicating it.

drm/i915/guc: Hook GuC scheduling policies up

Use the official driver default scheduling policies for configuring the GuC scheduler rather than a bunch of hardcoded values.

drm/i915/guc: Connect reset modparam updates to GuC policy flags

Changing the reset module parameter has no effect on a running GuC. The corresponding entry in the ADS must be updated and then the GuC informed via a Host2GuC message.

The new debugfs interface to module parameters allows this to happen. However, connecting the parameter data address back to anything useful is messy. One option would be to pass a new private data structure address through instead of just the parameter pointer. However, that means having a new (and different) data structure for each parameter and a new (and different) write function for each parameter. This method keeps everything generic by instead using a string lookup on the directory entry name.

drm/i915/guc: Include scheduling policies in the debugfs state dump

Added the scheduling policy parameters to the 'guc_info' debugfs state dump.

drm/i915/guc: Add golden context to GuC ADS

The media watchdog mechanism involves GuC doing a silent reset and continue of the hung context. This requires the i915 driver provide a golden context to GuC in the ADS.

drm/i915/guc: Implement banned contexts for GuC submission

When using GuC submission, if a context gets banned disable scheduling and mark all inflight requests as complete.

drm/i915/guc: Support request cancellation

This adds GuC backend support for i915_request_cancel(), which in turn makes CONFIG_DRM_I915_REQUEST_TIMEOUT work.

drm/i915/selftest: Better error reporting from hangcheck selftest

There are many ways in which the hangcheck selftest can fail. Very few of them actually printed an error message to say what happened. So, fill in the missing messages.

Cc Daniele Ceraolo Spurio <[email protected]>

drm/i915/selftest: Fix workarounds selftest for GuC submission

When GuC submission is enabled, the GuC controls engine resets. Rather than explicitly triggering a reset, the driver must submit a hanging context to GuC and wait for the reset to occur.

Cc Daniele Ceraolo Spurio <[email protected]>
Cc Matthew Brost <[email protected]>

drm/i915/selftest: Fix MOCS selftest for GuC submission

When GuC submission is enabled, the GuC controls engine resets. Rather than explicitly triggering a reset, the driver must submit a hanging context to GuC and wait for the reset to occur.

Cc Daniele Ceraolo Spurio <[email protected]>
Cc Matthew Brost <[email protected]>

drm/i915/selftest: Increase some timeouts in live_requests

Requests may take slightly longer with GuC submission, let's increase the timeouts in live_requests.

drm/i915/selftest: Fix hangcheck self test for GuC submission

When GuC submission is enabled, the GuC controls engine resets. Rather than explicitly triggering a reset, the driver must submit a hanging context to GuC and wait for the reset to occur.

Conversely, one of the tests specifically sends hanging batches to the engines but wants them to sit around until a manual reset of the full GT (including GuC itself). That means disabling GuC based engine resets to prevent those from killing the hanging batch too soon. So, add support to the scheduling policy helper for disabling resets as well as making them quicker!

In GuC submission mode, the 'is engine idle' test basically turns into 'is engine PM wakelock held'. Independently, there is a heartbeat disable helper function that the tests use. For unexplained reasons, this acquires the engine wakelock before disabling the heartbeat and only releases it when re-enabling the heartbeat. As one of the tests tries to do a wait for idle in the middle of a heartbeat disabled section, it is therefore guaranteed to always fail. Added a 'no_pm' variant of the heartbeat helper that allows the engine to be asleep while also having heartbeats disabled.

Cc Daniele Ceraolo Spurio <[email protected]>
Cc Matthew Brost <[email protected]>

drm/i915/selftest: Bump selftest timeouts for hangcheck

Some testing environments and some heavier tests are slower than previous limits allowed for. For example, it can take multiple seconds for the 'context has been reset' notification handler to reach the 'kill the requests' code in the 'active' version of the 'reset engines' test. During which time the selftest gets bored, gives up waiting and fails the test.

There is also an async thread that the selftest uses to pump work through the hardware in parallel to the context that is marked for reset. That also could get bored waiting for completions and kill the test off.

Lastly, the flush at the of various test sections can also see timeouts due to the large amount of work backed up. This is also true of the live_hwsp_read test.

Cc Daniele Ceraolo Spurio <[email protected]>

drm/i915/guc: Unblock GuC submission on Gen11+

Unblock GuC submission on Gen11+ platforms.

---
 drivers/gpu/drm/i915/Makefile                 |    1 +
 drivers/gpu/drm/i915/gem/i915_gem_context.c   |   21 +-
 drivers/gpu/drm/i915/gem/i915_gem_context.h   |    1 +
 drivers/gpu/drm/i915/gem/i915_gem_mman.c      |    3 +-
 drivers/gpu/drm/i915/gt/gen8_engine_cs.c      |    6 +-
 drivers/gpu/drm/i915/gt/intel_breadcrumbs.c   |   41 +-
 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       |   50 +-
 drivers/gpu/drm/i915/gt/intel_context_types.h |   54 +
 drivers/gpu/drm/i915/gt/intel_engine.h        |   54 +-
 drivers/gpu/drm/i915/gt/intel_engine_cs.c     |  182 +-
 .../gpu/drm/i915/gt/intel_engine_heartbeat.c  |   71 +-
 .../gpu/drm/i915/gt/intel_engine_heartbeat.h  |    4 +
 drivers/gpu/drm/i915/gt/intel_engine_types.h  |   12 +-
 .../drm/i915/gt/intel_execlists_submission.c  |   95 +-
 .../drm/i915/gt/intel_execlists_submission.h  |    4 -
 drivers/gpu/drm/i915/gt/intel_gt.c            |   21 +
 drivers/gpu/drm/i915/gt/intel_gt.h            |    2 +
 drivers/gpu/drm/i915/gt/intel_gt_pm.c         |    6 +-
 drivers/gpu/drm/i915/gt/intel_gt_requests.c   |   23 +-
 drivers/gpu/drm/i915/gt/intel_gt_requests.h   |    9 +-
 drivers/gpu/drm/i915/gt/intel_lrc_reg.h       |    1 -
 drivers/gpu/drm/i915/gt/intel_reset.c         |   50 +-
 .../gpu/drm/i915/gt/intel_ring_submission.c   |   48 +
 drivers/gpu/drm/i915/gt/intel_rps.c           |    4 +
 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         |   41 +-
 drivers/gpu/drm/i915/gt/selftest_context.c    |   10 +
 .../drm/i915/gt/selftest_engine_heartbeat.c   |   22 +
 .../drm/i915/gt/selftest_engine_heartbeat.h   |    2 +
 drivers/gpu/drm/i915/gt/selftest_execlists.c  |   12 +-
 drivers/gpu/drm/i915/gt/selftest_hangcheck.c  |  314 +-
 drivers/gpu/drm/i915/gt/selftest_mocs.c       |   50 +-
 .../gpu/drm/i915/gt/selftest_workarounds.c    |  132 +-
 .../gpu/drm/i915/gt/uc/abi/guc_actions_abi.h  |   15 +
 .../gt/uc/abi/guc_communication_ctb_abi.h     |    3 +-
 drivers/gpu/drm/i915/gt/uc/intel_guc.c        |   82 +-
 drivers/gpu/drm/i915/gt/uc/intel_guc.h        |  108 +-
 drivers/gpu/drm/i915/gt/uc/intel_guc_ads.c    |  460 ++-
 drivers/gpu/drm/i915/gt/uc/intel_guc_ads.h    |    3 +
 drivers/gpu/drm/i915/gt/uc/intel_guc_ct.c     |  368 ++-
 drivers/gpu/drm/i915/gt/uc/intel_guc_ct.h     |   28 +-
 .../gpu/drm/i915/gt/uc/intel_guc_debugfs.c    |   25 +-
 drivers/gpu/drm/i915/gt/uc/intel_guc_fwif.h   |   88 +-
 .../gpu/drm/i915/gt/uc/intel_guc_submission.c | 2527 +++++++++++++++--
 .../gpu/drm/i915/gt/uc/intel_guc_submission.h |   17 +-
 drivers/gpu/drm/i915/gt/uc/intel_uc.c         |  102 +-
 drivers/gpu/drm/i915/gt/uc/intel_uc.h         |   11 +
 drivers/gpu/drm/i915/i915_debugfs.c           |    2 +
 drivers/gpu/drm/i915/i915_debugfs_params.c    |   31 +
 drivers/gpu/drm/i915/i915_gem_evict.c         |    1 +
 drivers/gpu/drm/i915/i915_gpu_error.c         |   25 +-
 drivers/gpu/drm/i915/i915_reg.h               |    2 +
 drivers/gpu/drm/i915/i915_request.c           |  168 +-
 drivers/gpu/drm/i915/i915_request.h           |   21 +
 drivers/gpu/drm/i915/i915_scheduler.c         |    9 +-
 drivers/gpu/drm/i915/i915_scheduler.h         |   10 +-
 drivers/gpu/drm/i915/i915_scheduler_types.h   |   10 +
 drivers/gpu/drm/i915/i915_trace.h             |  207 +-
 drivers/gpu/drm/i915/selftests/i915_request.c |    4 +-
 .../gpu/drm/i915/selftests/igt_flush_test.c   |    2 +-
 .../gpu/drm/i915/selftests/igt_live_test.c    |    2 +-
 .../i915/selftests/intel_scheduler_helpers.c  |   89 +
 .../i915/selftests/intel_scheduler_helpers.h  |   35 +
 .../gpu/drm/i915/selftests/mock_gem_device.c  |    3 +-
 68 files changed, 5048 insertions(+), 874 deletions(-)
 create mode 100644 drivers/gpu/drm/i915/selftests/intel_scheduler_helpers.c
 create mode 100644 drivers/gpu/drm/i915/selftests/intel_scheduler_helpers.h
drivers/gpu/drm/i915/Makefile +1 -0
index 10b3bb6207ba..ab7679957623 100644
@@ -280,6 +280,7 @@ i915-$(CONFIG_DRM_I915_CAPTURE_ERROR) += i915_gpu_error.o
 i915-$(CONFIG_DRM_I915_SELFTEST) += \
 	gem/selftests/i915_gem_client_blt.o \
 	gem/selftests/igt_gem_utils.o \
+	selftests/intel_scheduler_helpers.o \
 	selftests/i915_random.o \
 	selftests/i915_selftest.o \
 	selftests/igt_atomic.o \
drivers/gpu/drm/i915/gem/i915_gem_context.c +12 -9
index 7d6f52d8a801..d87a4c6da5bc 100644
@@ -74,7 +74,6 @@
 #include "gt/intel_context_param.h"
 #include "gt/intel_engine_heartbeat.h"
 #include "gt/intel_engine_user.h"
-#include "gt/intel_execlists_submission.h" /* virtual_engine */
 #include "gt/intel_gpu_commands.h"
 #include "gt/intel_ring.h"
 
@@ -363,9 +362,6 @@ set_proto_ctx_engines_balance(struct i915_user_extension __user *base,
 	if (!HAS_EXECLISTS(i915))
 		return -ENODEV;
 
-	if (intel_uc_uses_guc_submission(&i915->gt.uc))
-		return -ENODEV; /* not implement yet */
-
 	if (get_user(idx, &ext->engine_index))
 		return -EFAULT;
 
@@ -495,6 +491,11 @@ set_proto_ctx_engines_bond(struct i915_user_extension __user *base, void *data)
 		return -EINVAL;
 	}
 
+	if (intel_engine_uses_guc(master)) {
+		DRM_DEBUG("bonding extension not supported with GuC submission");
+		return -ENODEV;
+	}
+
 	if (get_user(num_bonds, &ext->num_bonds))
 		return -EFAULT;
 
@@ -799,7 +800,8 @@ static int intel_context_set_gem(struct intel_context *ce,
 	}
 
 	if (ctx->sched.priority >= I915_PRIORITY_NORMAL &&
-	    intel_engine_has_timeslices(ce->engine))
+	    intel_engine_has_timeslices(ce->engine) &&
+	    intel_engine_has_semaphores(ce->engine))
 		__set_bit(CONTEXT_USE_SEMAPHORES, &ce->flags);
 
 	if (IS_ACTIVE(CONFIG_DRM_I915_REQUEST_TIMEOUT) &&
@@ -949,8 +951,8 @@ static struct i915_gem_engines *user_engines(struct i915_gem_context *ctx,
 			break;
 
 		case I915_GEM_ENGINE_TYPE_BALANCED:
-			ce = intel_execlists_create_virtual(pe[n].siblings,
-							    pe[n].num_siblings);
+			ce = intel_engine_create_virtual(pe[n].siblings,
+							 pe[n].num_siblings);
 			break;
 
 		case I915_GEM_ENGINE_TYPE_INVALID:
@@ -1082,7 +1084,7 @@ static void kill_engines(struct i915_gem_engines *engines, bool ban)
 	for_each_gem_engine(ce, engines, it) {
 		struct intel_engine_cs *engine;
 
-		if (ban && intel_context_set_banned(ce))
+		if (ban && intel_context_ban(ce, NULL))
 			continue;
 
 		/*
@@ -1778,7 +1780,8 @@ static void __apply_priority(struct intel_context *ce, void *arg)
 	if (!intel_engine_has_timeslices(ce->engine))
 		return;
 
-	if (ctx->sched.priority >= I915_PRIORITY_NORMAL)
+	if (ctx->sched.priority >= I915_PRIORITY_NORMAL &&
+	    intel_engine_has_semaphores(ce->engine))
 		intel_context_set_use_semaphores(ce);
 	else
 		intel_context_clear_use_semaphores(ce);
drivers/gpu/drm/i915/gem/i915_gem_context.h +1 -0
index 20411db84914..2639c719a7a6 100644
@@ -10,6 +10,7 @@
 #include "i915_gem_context_types.h"
 
 #include "gt/intel_context.h"
+#include "gt/intel_engine.h"
 
 #include "i915_drv.h"
 #include "i915_gem.h"
drivers/gpu/drm/i915/gem/i915_gem_mman.c +2 -1
index a90f796e85c0..6fffd4d377c2 100644
@@ -645,7 +645,8 @@ mmap_offset_attach(struct drm_i915_gem_object *obj,
 		goto insert;
 
 	/* Attempt to reap some mmap space from dead objects */
-	err = intel_gt_retire_requests_timeout(&i915->gt, MAX_SCHEDULE_TIMEOUT);
+	err = intel_gt_retire_requests_timeout(&i915->gt, MAX_SCHEDULE_TIMEOUT,
+					       NULL);
 	if (err)
 		goto err;
 
drivers/gpu/drm/i915/gt/gen8_engine_cs.c +4 -2
index 87b06572fd2e..f7aae502ec3d 100644
@@ -506,7 +506,8 @@ gen8_emit_fini_breadcrumb_tail(struct i915_request *rq, u32 *cs)
 	*cs++ = MI_USER_INTERRUPT;
 
 	*cs++ = MI_ARB_ON_OFF | MI_ARB_ENABLE;
-	if (intel_engine_has_semaphores(rq->engine))
+	if (intel_engine_has_semaphores(rq->engine) &&
+	    !intel_uc_uses_guc_submission(&rq->engine->gt->uc))
 		cs = emit_preempt_busywait(rq, cs);
 
 	rq->tail = intel_ring_offset(rq, cs);
@@ -598,7 +599,8 @@ gen12_emit_fini_breadcrumb_tail(struct i915_request *rq, u32 *cs)
 	*cs++ = MI_USER_INTERRUPT;
 
 	*cs++ = MI_ARB_ON_OFF | MI_ARB_ENABLE;
-	if (intel_engine_has_semaphores(rq->engine))
+	if (intel_engine_has_semaphores(rq->engine) &&
+	    !intel_uc_uses_guc_submission(&rq->engine->gt->uc))
 		cs = gen12_emit_preempt_busywait(rq, cs);
 
 	rq->tail = intel_ring_offset(rq, cs);
drivers/gpu/drm/i915/gt/intel_breadcrumbs.c +17 -24

92 lines not on this page · raw message

drivers/gpu/drm/i915/gt/intel_breadcrumbs.h +13 -1
index 3ce5ce270b04..72105b74663d 100644
@@ -17,7 +17,7 @@ struct intel_breadcrumbs;
 
 struct intel_breadcrumbs *
 intel_breadcrumbs_create(struct intel_engine_cs *irq_engine);
-void intel_breadcrumbs_free(struct intel_breadcrumbs *b);
+void intel_breadcrumbs_free(struct kref *kref);
 
 void intel_breadcrumbs_reset(struct intel_breadcrumbs *b);
 void __intel_breadcrumbs_park(struct intel_breadcrumbs *b);
@@ -48,4 +48,16 @@ void i915_request_cancel_breadcrumb(struct i915_request *request);
 void intel_context_remove_breadcrumbs(struct intel_context *ce,
 				      struct intel_breadcrumbs *b);
 
+static inline struct intel_breadcrumbs *
+intel_breadcrumbs_get(struct intel_breadcrumbs *b)
+{
+	kref_get(&b->ref);
+	return b;
+}
+
+static inline void intel_breadcrumbs_put(struct intel_breadcrumbs *b)
+{
+	kref_put(&b->ref, intel_breadcrumbs_free);
+}
+
 #endif /* __INTEL_BREADCRUMBS__ */
drivers/gpu/drm/i915/gt/intel_breadcrumbs_types.h +7 -0
index 3a084ce8ff5e..a4e146684be8 100644
@@ -7,10 +7,13 @@
 #define __INTEL_BREADCRUMBS_TYPES__
 
 #include <linux/irq_work.h>
+#include <linux/kref.h>
 #include <linux/list.h>
 #include <linux/spinlock.h>
 #include <linux/types.h>
 
+typedef u8 intel_engine_mask_t;
+
 /*
  * Rather than have every client wait upon all user interrupts,
  * with the herd waking after every interrupt and each doing the
@@ -29,6 +32,7 @@
  * the overhead of waking that client is much preferred.
  */
 struct intel_breadcrumbs {
+	struct kref ref;
 	atomic_t active;
 
 	spinlock_t signalers_lock; /* protects the list of signalers */
@@ -42,7 +46,10 @@ struct intel_breadcrumbs {
 	bool irq_armed;
 
 	/* Not all breadcrumbs are attached to physical HW */
+	intel_engine_mask_t	engine_mask;
 	struct intel_engine_cs *irq_engine;
+	bool	(*irq_enable)(struct intel_breadcrumbs *b);
+	void	(*irq_disable)(struct intel_breadcrumbs *b);
 };
 
 #endif /* __INTEL_BREADCRUMBS_TYPES__ */
drivers/gpu/drm/i915/gt/intel_context.c +47 -3

111 lines not on this page · raw message

drivers/gpu/drm/i915/gt/intel_context.h +49 -1

80 lines not on this page · raw message

drivers/gpu/drm/i915/gt/intel_context_types.h +54 -0

88 lines not on this page · raw message

drivers/gpu/drm/i915/gt/intel_engine.h +52 -2

83 lines not on this page · raw message

drivers/gpu/drm/i915/gt/intel_engine_cs.c +137 -45

234 lines not on this page · raw message

drivers/gpu/drm/i915/gt/intel_engine_heartbeat.c +58 -13

95 lines not on this page · raw message

drivers/gpu/drm/i915/gt/intel_engine_heartbeat.h +4 -0
index a488ea3e84a3..5da6d809a87a 100644
@@ -7,6 +7,7 @@
 #define INTEL_ENGINE_HEARTBEAT_H
 
 struct intel_engine_cs;
+struct intel_gt;
 
 void intel_engine_init_heartbeat(struct intel_engine_cs *engine);
 
@@ -16,6 +17,9 @@ int intel_engine_set_heartbeat(struct intel_engine_cs *engine,
 void intel_engine_park_heartbeat(struct intel_engine_cs *engine);
 void intel_engine_unpark_heartbeat(struct intel_engine_cs *engine);
 
+void intel_gt_park_heartbeats(struct intel_gt *gt);
+void intel_gt_unpark_heartbeats(struct intel_gt *gt);
+
 int intel_engine_pulse(struct intel_engine_cs *engine);
 int intel_engine_flush_barriers(struct intel_engine_cs *engine);
 
drivers/gpu/drm/i915/gt/intel_engine_types.h +11 -1
index 1cb9c3b70b29..e1935c69f7d2 100644
@@ -64,7 +64,6 @@ struct intel_gt;
 struct intel_ring;
 struct intel_uncore;
 
-typedef u8 intel_engine_mask_t;
 #define ALL_ENGINES ((intel_engine_mask_t)~0ul)
 
 struct intel_hw_status_page {
@@ -304,6 +303,8 @@ struct intel_engine_cs {
 	/* keep a request in reserve for a [pm] barrier under oom */
 	struct i915_request *request_pool;
 
+	struct intel_context *hung_ce;
+
 	struct llist_head barrier_tasks;
 
 	struct intel_context *kernel_context; /* pinned */
@@ -388,6 +389,8 @@ struct intel_engine_cs {
 	void		(*park)(struct intel_engine_cs *engine);
 	void		(*unpark)(struct intel_engine_cs *engine);
 
+	void		(*bump_serial)(struct intel_engine_cs *engine);
+
 	void		(*set_default_submission)(struct intel_engine_cs *engine);
 
 	const struct intel_context_ops *cops;
@@ -418,6 +421,12 @@ struct intel_engine_cs {
 
 	void		(*release)(struct intel_engine_cs *engine);
 
+	/*
+	 * Add / remove request from engine active tracking
+	 */
+	void		(*add_active_request)(struct i915_request *rq);
+	void		(*remove_active_request)(struct i915_request *rq);
+
 	struct intel_engine_execlists execlists;
 
 	/*
@@ -439,6 +448,7 @@ struct intel_engine_cs {
 #define I915_ENGINE_IS_VIRTUAL       BIT(5)
 #define I915_ENGINE_HAS_RELATIVE_MMIO BIT(6)
 #define I915_ENGINE_REQUIRES_CMD_PARSER BIT(7)
+#define I915_ENGINE_WANT_FORCED_PREEMPTION BIT(8)
 	unsigned int flags;
 
 	/*
drivers/gpu/drm/i915/gt/intel_execlists_submission.c +85 -10

182 lines not on this page · raw message

drivers/gpu/drm/i915/gt/intel_execlists_submission.h +0 -4
index ad4f3e1a0fde..a1aa92c983a5 100644
@@ -32,10 +32,6 @@ void intel_execlists_show_requests(struct intel_engine_cs *engine,
 							int indent),
 				   unsigned int max);
 
-struct intel_context *
-intel_execlists_create_virtual(struct intel_engine_cs **siblings,
-			       unsigned int count);
-
 bool
 intel_engine_in_execlists_submission_mode(const struct intel_engine_cs *engine);
 
drivers/gpu/drm/i915/gt/intel_gt.c +21 -0
index e714e21c0a4d..ceeb517ba259 100644
@@ -585,6 +585,25 @@ static void __intel_gt_disable(struct intel_gt *gt)
 	GEM_BUG_ON(intel_gt_pm_is_awake(gt));
 }
 
+int intel_gt_wait_for_idle(struct intel_gt *gt, long timeout)
+{
+	long remaining_timeout;
+
+	/* If the device is asleep, we have no requests outstanding */
+	if (!intel_gt_pm_is_awake(gt))
+		return 0;
+
+	while ((timeout = intel_gt_retire_requests_timeout(gt, timeout,
+							   &remaining_timeout)) > 0) {
+		cond_resched();
+		if (signal_pending(current))
+			return -EINTR;
+	}
+
+	return timeout ? timeout : intel_uc_wait_for_idle(&gt->uc,
+							  remaining_timeout);
+}
+
 int intel_gt_init(struct intel_gt *gt)
 {
 	int err;
@@ -635,6 +654,8 @@ int intel_gt_init(struct intel_gt *gt)
 	if (err)
 		goto err_gt;
 
+	intel_uc_init_late(&gt->uc);
+
 	err = i915_inject_probe_error(gt->i915, -EIO);
 	if (err)
 		goto err_gt;
drivers/gpu/drm/i915/gt/intel_gt.h +2 -0
index e7aabe0cc5bf..74e771871a9b 100644
@@ -48,6 +48,8 @@ void intel_gt_driver_release(struct intel_gt *gt);
 
 void intel_gt_driver_late_release(struct intel_gt *gt);
 
+int intel_gt_wait_for_idle(struct intel_gt *gt, long timeout);
+
 void intel_gt_check_and_clear_faults(struct intel_gt *gt);
 void intel_gt_clear_error_registers(struct intel_gt *gt,
 				    intel_engine_mask_t engine_mask);
drivers/gpu/drm/i915/gt/intel_gt_pm.c +4 -2
index aef3084e8b16..463a6ae605a0 100644
@@ -174,8 +174,6 @@ static void gt_sanitize(struct intel_gt *gt, bool force)
 	if (intel_gt_is_wedged(gt))
 		intel_gt_unset_wedged(gt);
 
-	intel_uc_sanitize(&gt->uc);
-
 	for_each_engine(engine, gt, id)
 		if (engine->reset.prepare)
 			engine->reset.prepare(engine);
@@ -191,6 +189,8 @@ static void gt_sanitize(struct intel_gt *gt, bool force)
 			__intel_engine_reset(engine, false);
 	}
 
+	intel_uc_reset(&gt->uc, false);
+
 	for_each_engine(engine, gt, id)
 		if (engine->reset.finish)
 			engine->reset.finish(engine);
@@ -243,6 +243,8 @@ int intel_gt_resume(struct intel_gt *gt)
 		goto err_wedged;
 	}
 
+	intel_uc_reset_finish(&gt->uc);
+
 	intel_rps_enable(&gt->rps);
 	intel_llc_enable(&gt->llc);
 
drivers/gpu/drm/i915/gt/intel_gt_requests.c +7 -16
index 647eca9d867a..9ae5ee256898 100644
@@ -13,6 +13,8 @@
 #include "intel_gt_pm.h"
 #include "intel_gt_requests.h"
 #include "intel_timeline.h"
+#include "intel_context.h"
+#include "uc/intel_uc.h"
 
 static bool retire_requests(struct intel_timeline *tl)
 {
@@ -130,7 +132,8 @@ void intel_engine_fini_retire(struct intel_engine_cs *engine)
 	GEM_BUG_ON(engine->retire);
 }
 
-long intel_gt_retire_requests_timeout(struct intel_gt *gt, long timeout)
+long intel_gt_retire_requests_timeout(struct intel_gt *gt, long timeout,
+				      long *remaining_timeout)
 {
 	struct intel_gt_timelines *timelines = &gt->timelines;
 	struct intel_timeline *tl, *tn;
@@ -195,22 +198,10 @@ out_active:	spin_lock(&timelines->lock);
 	if (flush_submission(gt, timeout)) /* Wait, there's more! */
 		active_count++;
 
-	return active_count ? timeout : 0;
-}
-
-int intel_gt_wait_for_idle(struct intel_gt *gt, long timeout)
-{
-	/* If the device is asleep, we have no requests outstanding */
-	if (!intel_gt_pm_is_awake(gt))
-		return 0;
-
-	while ((timeout = intel_gt_retire_requests_timeout(gt, timeout)) > 0) {
-		cond_resched();
-		if (signal_pending(current))
-			return -EINTR;
-	}
+	if (remaining_timeout)
+		*remaining_timeout = timeout;
 
-	return timeout;
+	return active_count ? timeout : 0;
 }
 
 static void retire_work_handler(struct work_struct *work)
drivers/gpu/drm/i915/gt/intel_gt_requests.h +5 -4
index fcc30a6e4fe9..51dbe0e3294e 100644
@@ -6,14 +6,17 @@
 #ifndef INTEL_GT_REQUESTS_H
 #define INTEL_GT_REQUESTS_H
 
+#include <stddef.h>
+
 struct intel_engine_cs;
 struct intel_gt;
 struct intel_timeline;
 
-long intel_gt_retire_requests_timeout(struct intel_gt *gt, long timeout);
+long intel_gt_retire_requests_timeout(struct intel_gt *gt, long timeout,
+				      long *remaining_timeout);
 static inline void intel_gt_retire_requests(struct intel_gt *gt)
 {
-	intel_gt_retire_requests_timeout(gt, 0);
+	intel_gt_retire_requests_timeout(gt, 0, NULL);
 }
 
 void intel_engine_init_retire(struct intel_engine_cs *engine);
@@ -21,8 +24,6 @@ void intel_engine_add_retire(struct intel_engine_cs *engine,
 			     struct intel_timeline *tl);
 void intel_engine_fini_retire(struct intel_engine_cs *engine);
 
-int intel_gt_wait_for_idle(struct intel_gt *gt, long timeout);
-
 void intel_gt_init_requests(struct intel_gt *gt);
 void intel_gt_park_requests(struct intel_gt *gt);
 void intel_gt_unpark_requests(struct intel_gt *gt);
drivers/gpu/drm/i915/gt/intel_lrc_reg.h +0 -1
index 41e5350a7a05..49d4857ad9b7 100644
@@ -87,7 +87,6 @@
 #define GEN11_CSB_WRITE_PTR_MASK	(GEN11_CSB_PTR_MASK << 0)
 
 #define MAX_CONTEXT_HW_ID	(1 << 21) /* exclusive */
-#define MAX_GUC_CONTEXT_HW_ID	(1 << 20) /* exclusive */
 #define GEN11_MAX_CONTEXT_HW_ID	(1 << 11) /* exclusive */
 /* in Gen12 ID 0x7FF is reserved to indicate idle */
 #define GEN12_MAX_CONTEXT_HW_ID	(GEN11_MAX_CONTEXT_HW_ID - 1)
drivers/gpu/drm/i915/gt/intel_reset.c +20 -30

132 lines not on this page · raw message

drivers/gpu/drm/i915/gt/intel_ring_submission.c +48 -0

71 lines not on this page · raw message

drivers/gpu/drm/i915/gt/intel_rps.c +4 -0
index 06e9a8ed4e03..0c8e7f2b06f0 100644
@@ -1877,6 +1877,10 @@ void intel_rps_init(struct intel_rps *rps)
 
 	if (GRAPHICS_VER(i915) >= 8 && GRAPHICS_VER(i915) < 11)
 		rps->pm_intrmsk_mbz |= GEN8_PMINTR_DISABLE_REDIRECT_TO_GUC;
+
+	/* GuC needs ARAT expired interrupt unmasked */
+	if (intel_uc_uses_guc_submission(&rps_to_gt(rps)->uc))
+		rps->pm_intrmsk_mbz |= ARAT_EXPIRED_INTRMSK;
 }
 
 void intel_rps_sanitize(struct intel_rps *rps)
drivers/gpu/drm/i915/gt/intel_workarounds.c +24 -22

129 lines not on this page · raw message

drivers/gpu/drm/i915/gt/intel_workarounds_types.h +1 -0
index c214111ea367..1e873681795d 100644
@@ -15,6 +15,7 @@ struct i915_wa {
 	u32		clr;
 	u32		set;
 	u32		read;
+	bool		masked_reg;
 };
 
 struct i915_wa_list {
drivers/gpu/drm/i915/gt/mock_engine.c +39 -2

74 lines not on this page · raw message

drivers/gpu/drm/i915/gt/selftest_context.c +10 -0
index 26685b927169..fa7b99a671dd 100644
@@ -209,7 +209,13 @@ static int __live_active_context(struct intel_engine_cs *engine)
 	 * This test makes sure that the context is kept alive until a
 	 * subsequent idle-barrier (emitted when the engine wakeref hits 0
 	 * with no more outstanding requests).
+	 *
+	 * In GuC submission mode we don't use idle barriers and we instead
+	 * get a message from the GuC to signal that it is safe to unpin the
+	 * context from memory.
 	 */
+	if (intel_engine_uses_guc(engine))
+		return 0;
 
 	if (intel_engine_pm_is_awake(engine)) {
 		pr_err("%s is awake before starting %s!\n",
@@ -357,7 +363,11 @@ static int __live_remote_context(struct intel_engine_cs *engine)
 	 * on the context image remotely (intel_context_prepare_remote_request),
 	 * which inserts foreign fences into intel_context.active, does not
 	 * clobber the idle-barrier.
+	 *
+	 * In GuC submission mode we don't use idle barriers.
 	 */
+	if (intel_engine_uses_guc(engine))
+		return 0;
 
 	if (intel_engine_pm_is_awake(engine)) {
 		pr_err("%s is awake before starting %s!\n",
drivers/gpu/drm/i915/gt/selftest_engine_heartbeat.c +22 -0
index 4896e4ccad50..317eebf086c3 100644
@@ -405,3 +405,25 @@ void st_engine_heartbeat_enable(struct intel_engine_cs *engine)
 	engine->props.heartbeat_interval_ms =
 		engine->defaults.heartbeat_interval_ms;
 }
+
+void st_engine_heartbeat_disable_no_pm(struct intel_engine_cs *engine)
+{
+	engine->props.heartbeat_interval_ms = 0;
+
+	/*
+	 * Park the heartbeat but without holding the PM lock as that
+	 * makes the engines appear not-idle. Note that if/when unpark
+	 * is called due to the PM lock being acquired later the
+	 * heartbeat still won't be enabled because of the above = 0.
+	 */
+	if (intel_engine_pm_get_if_awake(engine)) {
+		intel_engine_park_heartbeat(engine);
+		intel_engine_pm_put(engine);
+	}
+}
+
+void st_engine_heartbeat_enable_no_pm(struct intel_engine_cs *engine)
+{
+	engine->props.heartbeat_interval_ms =
+		engine->defaults.heartbeat_interval_ms;
+}
drivers/gpu/drm/i915/gt/selftest_engine_heartbeat.h +2 -0
index cd27113d5400..81da2cd8e406 100644
@@ -9,6 +9,8 @@
 struct intel_engine_cs;
 
 void st_engine_heartbeat_disable(struct intel_engine_cs *engine);
+void st_engine_heartbeat_disable_no_pm(struct intel_engine_cs *engine);
 void st_engine_heartbeat_enable(struct intel_engine_cs *engine);
+void st_engine_heartbeat_enable_no_pm(struct intel_engine_cs *engine);
 
 #endif /* SELFTEST_ENGINE_HEARTBEAT_H */
drivers/gpu/drm/i915/gt/selftest_execlists.c +6 -6
index 73ddc6e14730..59cf8afc6d6f 100644
@@ -3727,7 +3727,7 @@ static int nop_virtual_engine(struct intel_gt *gt,
 	GEM_BUG_ON(!nctx || nctx > ARRAY_SIZE(ve));
 
 	for (n = 0; n < nctx; n++) {
-		ve[n] = intel_execlists_create_virtual(siblings, nsibling);
+		ve[n] = intel_engine_create_virtual(siblings, nsibling);
 		if (IS_ERR(ve[n])) {
 			err = PTR_ERR(ve[n]);
 			nctx = n;
@@ -3923,7 +3923,7 @@ static int mask_virtual_engine(struct intel_gt *gt,
 	 * restrict it to our desired engine within the virtual engine.
 	 */
 
-	ve = intel_execlists_create_virtual(siblings, nsibling);
+	ve = intel_engine_create_virtual(siblings, nsibling);
 	if (IS_ERR(ve)) {
 		err = PTR_ERR(ve);
 		goto out_close;
@@ -4054,7 +4054,7 @@ static int slicein_virtual_engine(struct intel_gt *gt,
 		i915_request_add(rq);
 	}
 
-	ce = intel_execlists_create_virtual(siblings, nsibling);
+	ce = intel_engine_create_virtual(siblings, nsibling);
 	if (IS_ERR(ce)) {
 		err = PTR_ERR(ce);
 		goto out;
@@ -4106,7 +4106,7 @@ static int sliceout_virtual_engine(struct intel_gt *gt,
 
 	/* XXX We do not handle oversubscription and fairness with normal rq */
 	for (n = 0; n < nsibling; n++) {
-		ce = intel_execlists_create_virtual(siblings, nsibling);
+		ce = intel_engine_create_virtual(siblings, nsibling);
 		if (IS_ERR(ce)) {
 			err = PTR_ERR(ce);
 			goto out;
@@ -4208,7 +4208,7 @@ static int preserved_virtual_engine(struct intel_gt *gt,
 	if (err)
 		goto out_scratch;
 
-	ve = intel_execlists_create_virtual(siblings, nsibling);
+	ve = intel_engine_create_virtual(siblings, nsibling);
 	if (IS_ERR(ve)) {
 		err = PTR_ERR(ve);
 		goto out_scratch;
@@ -4348,7 +4348,7 @@ static int reset_virtual_engine(struct intel_gt *gt,
 	if (igt_spinner_init(&spin, gt))
 		return -ENOMEM;
 
-	ve = intel_execlists_create_virtual(siblings, nsibling);
+	ve = intel_engine_create_virtual(siblings, nsibling);
 	if (IS_ERR(ve)) {
 		err = PTR_ERR(ve);
 		goto out_spin;
drivers/gpu/drm/i915/gt/selftest_hangcheck.c +242 -72

670 lines not on this page · raw message

drivers/gpu/drm/i915/gt/selftest_mocs.c +36 -14

98 lines not on this page · raw message

drivers/gpu/drm/i915/gt/selftest_workarounds.c +98 -34

216 lines not on this page · raw message

drivers/gpu/drm/i915/gt/uc/abi/guc_actions_abi.h +15 -0
index 2d6198e63ebe..596cf4b818e5 100644
@@ -124,10 +124,25 @@ enum intel_guc_action {
 	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_GLOBAL_SCHED_POLICY_CHANGE = 0x506,
+	INTEL_GUC_ACTION_SCHED_CONTEXT = 0x1000,
+	INTEL_GUC_ACTION_SCHED_CONTEXT_MODE_SET = 0x1001,
+	INTEL_GUC_ACTION_SCHED_CONTEXT_MODE_DONE = 0x1002,
+	INTEL_GUC_ACTION_SCHED_ENGINE_MODE_SET = 0x1003,
+	INTEL_GUC_ACTION_SCHED_ENGINE_MODE_DONE = 0x1004,
+	INTEL_GUC_ACTION_SET_CONTEXT_PRIORITY = 0x1005,
+	INTEL_GUC_ACTION_SET_CONTEXT_EXECUTION_QUANTUM = 0x1006,
+	INTEL_GUC_ACTION_SET_CONTEXT_PREEMPTION_TIMEOUT = 0x1007,
+	INTEL_GUC_ACTION_CONTEXT_RESET_NOTIFICATION = 0x1008,
+	INTEL_GUC_ACTION_ENGINE_FAILURE_NOTIFICATION = 0x1009,
 	INTEL_GUC_ACTION_SLPC_REQUEST = 0x3003,
 	INTEL_GUC_ACTION_AUTHENTICATE_HUC = 0x4000,
+	INTEL_GUC_ACTION_REGISTER_CONTEXT = 0x4502,
+	INTEL_GUC_ACTION_DEREGISTER_CONTEXT = 0x4503,
 	INTEL_GUC_ACTION_REGISTER_COMMAND_TRANSPORT_BUFFER = 0x4505,
 	INTEL_GUC_ACTION_DEREGISTER_COMMAND_TRANSPORT_BUFFER = 0x4506,
+	INTEL_GUC_ACTION_DEREGISTER_CONTEXT_DONE = 0x4600,
+	INTEL_GUC_ACTION_RESET_CLIENT = 0x5B01,
 	INTEL_GUC_ACTION_LIMIT
 };
 
drivers/gpu/drm/i915/gt/uc/abi/guc_communication_ctb_abi.h +2 -1
index e933ca02d0eb..99e1fad5ca20 100644
@@ -79,7 +79,8 @@ static_assert(sizeof(struct guc_ct_buffer_desc) == 64);
  *  +---+-------+--------------------------------------------------------------+
  */
 
-#define GUC_CTB_MSG_MIN_LEN			1u
+#define GUC_CTB_HDR_LEN				1u
+#define GUC_CTB_MSG_MIN_LEN			GUC_CTB_HDR_LEN
 #define GUC_CTB_MSG_MAX_LEN			256u
 #define GUC_CTB_MSG_0_FENCE			(0xffff << 16)
 #define GUC_CTB_MSG_0_FORMAT			(0xf << 12)
drivers/gpu/drm/i915/gt/uc/intel_guc.c +31 -51

109 lines not on this page · raw message

drivers/gpu/drm/i915/gt/uc/intel_guc.h +102 -6

13 lines not on this page · raw message

drivers/gpu/drm/i915/gt/uc/intel_guc_ads.c +428 -32

460 lines not on this page · raw message

drivers/gpu/drm/i915/gt/uc/intel_guc_ads.h +3 -0
index b00d3ae1113a..dac0dc32da34 100644

Lines of this file are not shown. View the raw message.

drivers/gpu/drm/i915/gt/uc/intel_guc_ct.c +315 -53

368 lines not on this page · raw message

drivers/gpu/drm/i915/gt/uc/intel_guc_ct.h +26 -2
index 1ae2dde6db93..82f0249a11df 100644

Lines of this file are not shown. View the raw message.

drivers/gpu/drm/i915/gt/uc/intel_guc_debugfs.c +24 -1
index fe7cb7b29a1e..9a03ff56e654 100644

Lines of this file are not shown. View the raw message.

drivers/gpu/drm/i915/gt/uc/intel_guc_fwif.h +34 -54

88 lines not on this page · raw message

drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c +2305 -222

2,527 lines not on this page · raw message

drivers/gpu/drm/i915/gt/uc/intel_guc_submission.h +15 -2
index 3f7005018939..be767eb6ff71 100644

Lines of this file are not shown. View the raw message.

drivers/gpu/drm/i915/gt/uc/intel_uc.c +72 -30

102 lines not on this page · raw message

drivers/gpu/drm/i915/gt/uc/intel_uc.h +11 -0
index 9c954c589edf..e2da2b6e76e1 100644

Lines of this file are not shown. View the raw message.

drivers/gpu/drm/i915/i915_debugfs.c +2 -0
index cc745751ac53..a9084789deff 100644

Lines of this file are not shown. View the raw message.

drivers/gpu/drm/i915/i915_debugfs_params.c +31 -0
index 4e2b077692cb..8ecd8b42f048 100644

Lines of this file are not shown. View the raw message.

drivers/gpu/drm/i915/i915_gem_evict.c +1 -0
index 4d2d59a9942b..2b73ddb11c66 100644

Lines of this file are not shown. View the raw message.

drivers/gpu/drm/i915/i915_gpu_error.c +21 -4
index a2c58b54a592..0f08bcfbe964 100644

Lines of this file are not shown. View the raw message.

drivers/gpu/drm/i915/i915_reg.h +2 -0
index e915ec034c98..7d9e90aa3ec0 100644

Lines of this file are not shown. View the raw message.

drivers/gpu/drm/i915/i915_request.c +84 -84

168 lines not on this page · raw message

drivers/gpu/drm/i915/i915_request.h +21 -0
index 5deb65ec5fa5..a3d4728ea06c 100644

Lines of this file are not shown. View the raw message.

drivers/gpu/drm/i915/i915_scheduler.c +8 -1
index 3a58a9130309..8766a8643469 100644

Lines of this file are not shown. View the raw message.

drivers/gpu/drm/i915/i915_scheduler.h +7 -3
index 650ab8e0db9f..f4d9811ade5b 100644

Lines of this file are not shown. View the raw message.

drivers/gpu/drm/i915/i915_scheduler_types.h +10 -0
index 5935c3152bdc..eaef233e9080 100644

Lines of this file are not shown. View the raw message.

drivers/gpu/drm/i915/i915_trace.h +203 -4

207 lines not on this page · raw message

drivers/gpu/drm/i915/selftests/i915_request.c +2 -2
index bd5c96a77ba3..d67710d10615 100644

Lines of this file are not shown. View the raw message.

drivers/gpu/drm/i915/selftests/igt_flush_test.c +1 -1
index 7b0939e3f007..a6c71fca61aa 100644

Lines of this file are not shown. View the raw message.

drivers/gpu/drm/i915/selftests/igt_live_test.c +1 -1
index c130010a7033..1c721542e277 100644

Lines of this file are not shown. View the raw message.

drivers/gpu/drm/i915/selftests/intel_scheduler_helpers.c new file +89 -0

89 lines not on this page · raw message

drivers/gpu/drm/i915/selftests/intel_scheduler_helpers.h new file +35 -0
new file mode 100644
index 000000000000..050bc5a8ba8b

Lines of this file are not shown. View the raw message.

drivers/gpu/drm/i915/selftests/mock_gem_device.c +2 -1
index d189c4bd4bef..4f8180146888 100644

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

Signature · 6 lines
2.25.0

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

Part of the diff is not shown here. View the raw message.

#2 lore raw

PATCH 2/16 drm/i915/guc/slpc: Initial definitions for slpc

In reply to Vinay Belgaumkar

Add macros to check for slpc support. This feature is currently supported for gen12+ and enabled whenever guc submission is enabled/selected.

---
 drivers/gpu/drm/i915/gt/uc/intel_guc.c        |  1 +
 drivers/gpu/drm/i915/gt/uc/intel_guc.h        |  2 ++
 .../gpu/drm/i915/gt/uc/intel_guc_submission.c | 21 +++++++++++++++++++
 .../gpu/drm/i915/gt/uc/intel_guc_submission.h | 16 ++++++++++++++
 drivers/gpu/drm/i915/gt/uc/intel_uc.c         |  6 ++++--
 drivers/gpu/drm/i915/gt/uc/intel_uc.h         |  1 +
 6 files changed, 45 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/gt/uc/intel_guc.c +1 -0
index 979128e28372..b9a809f2d221 100644
@@ -157,6 +157,7 @@ void intel_guc_init_early(struct intel_guc *guc)
 	intel_guc_ct_init_early(&guc->ct);
 	intel_guc_log_init_early(&guc->log);
 	intel_guc_submission_init_early(guc);
+	intel_guc_slpc_init_early(guc);
 
 	mutex_init(&guc->send_mutex);
 	spin_lock_init(&guc->irq_lock);
drivers/gpu/drm/i915/gt/uc/intel_guc.h +2 -0
index 5d94cf482516..e5a456918b88 100644
@@ -57,6 +57,8 @@ struct intel_guc {
 
 	bool submission_supported;
 	bool submission_selected;
+	bool slpc_supported;
+	bool slpc_selected;
 
 	struct i915_vma *ads_vma;
 	struct __guc_ads_blob *ads_blob;
drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c +21 -0
index 9c102bf0c8e3..e2644a05f298 100644
@@ -2351,6 +2351,27 @@ void intel_guc_submission_init_early(struct intel_guc *guc)
 	guc->submission_selected = __guc_submission_selected(guc);
 }
 
+static bool __guc_slpc_supported(struct intel_guc *guc)
+{
+	/* GuC slpc is unavailable for pre-Gen12 */
+	return guc->submission_supported &&
+		GRAPHICS_VER(guc_to_gt(guc)->i915) >= 12;
+}
+
+static bool __guc_slpc_selected(struct intel_guc *guc)
+{
+	if (!intel_guc_slpc_is_supported(guc))
+		return false;
+
+	return guc->submission_selected;
+}
+
+void intel_guc_slpc_init_early(struct intel_guc *guc)
+{
+	guc->slpc_supported = __guc_slpc_supported(guc);
+	guc->slpc_selected = __guc_slpc_selected(guc);
+}
+
 static inline struct intel_context *
 g2h_context_lookup(struct intel_guc *guc, u32 desc_idx)
 {
drivers/gpu/drm/i915/gt/uc/intel_guc_submission.h +16 -0
index be767eb6ff71..7ae5fd052faf 100644
@@ -13,6 +13,7 @@
 struct drm_printer;
 struct intel_engine_cs;
 
+void intel_guc_slpc_init_early(struct intel_guc *guc);
 void intel_guc_submission_init_early(struct intel_guc *guc);
 int intel_guc_submission_init(struct intel_guc *guc);
 void intel_guc_submission_enable(struct intel_guc *guc);
@@ -50,4 +51,19 @@ static inline bool intel_guc_submission_is_used(struct intel_guc *guc)
 	return intel_guc_is_used(guc) && intel_guc_submission_is_wanted(guc);
 }
 
+static inline bool intel_guc_slpc_is_supported(struct intel_guc *guc)
+{
+	return guc->slpc_supported;
+}
+
+static inline bool intel_guc_slpc_is_wanted(struct intel_guc *guc)
+{
+	return guc->slpc_selected;
+}
+
+static inline bool intel_guc_slpc_is_used(struct intel_guc *guc)
+{
+	return intel_guc_submission_is_used(guc) && intel_guc_slpc_is_wanted(guc);
+}
+
 #endif
drivers/gpu/drm/i915/gt/uc/intel_uc.c +4 -2
index 61be0aa81492..dca5f6d0641b 100644
@@ -76,16 +76,18 @@ static void __confirm_options(struct intel_uc *uc)
 	struct drm_i915_private *i915 = uc_to_gt(uc)->i915;
 
 	drm_dbg(&i915->drm,
-		"enable_guc=%d (guc:%s submission:%s huc:%s)\n",
+		"enable_guc=%d (guc:%s submission:%s huc:%s slpc:%s)\n",
 		i915->params.enable_guc,
 		yesno(intel_uc_wants_guc(uc)),
 		yesno(intel_uc_wants_guc_submission(uc)),
-		yesno(intel_uc_wants_huc(uc)));
+		yesno(intel_uc_wants_huc(uc)),
+		yesno(intel_uc_wants_guc_slpc(uc)));
 
 	if (i915->params.enable_guc == 0) {
 		GEM_BUG_ON(intel_uc_wants_guc(uc));
 		GEM_BUG_ON(intel_uc_wants_guc_submission(uc));
 		GEM_BUG_ON(intel_uc_wants_huc(uc));
+		GEM_BUG_ON(intel_uc_wants_guc_slpc(uc));
 		return;
 	}
 
drivers/gpu/drm/i915/gt/uc/intel_uc.h +1 -0
index e2da2b6e76e1..38e465fd8a0c 100644
@@ -83,6 +83,7 @@ __uc_state_checker(x, func, uses, used)
 uc_state_checkers(guc, guc);
 uc_state_checkers(huc, huc);
 uc_state_checkers(guc, guc_submission);
+uc_state_checkers(guc, guc_slpc);
 
 #undef uc_state_checkers
 #undef __uc_state_checker
Signature · 1 line
2.25.0
#3 lore raw

Re: [PATCH 02/16] drm/i915/guc/slpc: Initial definitions for slpc

Hi Vinay,

Quoted 2 lines · Vinay Belgaumkar

Add macros to check for slpc support. This feature is currently supported for gen12+ and enabled whenever guc submission is enabled/selected.

please try to use consistent names across all patches:

s/slpc/SLPC
s/gen12/Gen12
s/guc/GuC

Quoted 43 lines
---
 drivers/gpu/drm/i915/gt/uc/intel_guc.c        |  1 +
 drivers/gpu/drm/i915/gt/uc/intel_guc.h        |  2 ++
 .../gpu/drm/i915/gt/uc/intel_guc_submission.c | 21 +++++++++++++++++++
 .../gpu/drm/i915/gt/uc/intel_guc_submission.h | 16 ++++++++++++++
 drivers/gpu/drm/i915/gt/uc/intel_uc.c         |  6 ++++--
 drivers/gpu/drm/i915/gt/uc/intel_uc.h         |  1 +
 6 files changed, 45 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/gt/uc/intel_guc.c +1 -0
index 979128e28372..b9a809f2d221 100644
@@ -157,6 +157,7 @@ void intel_guc_init_early(struct intel_guc *guc)
 	intel_guc_ct_init_early(&guc->ct);
 	intel_guc_log_init_early(&guc->log);
 	intel_guc_submission_init_early(guc);
+	intel_guc_slpc_init_early(guc);
 
 	mutex_init(&guc->send_mutex);
 	spin_lock_init(&guc->irq_lock);
drivers/gpu/drm/i915/gt/uc/intel_guc.h +2 -0
index 5d94cf482516..e5a456918b88 100644
@@ -57,6 +57,8 @@ struct intel_guc {
 
 	bool submission_supported;
 	bool submission_selected;
+	bool slpc_supported;
+	bool slpc_selected;
 
 	struct i915_vma *ads_vma;
 	struct __guc_ads_blob *ads_blob;
drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c +0 -0
index 9c102bf0c8e3..e2644a05f298 100644

drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c void intel_guc_submission_init_early(struct intel_guc *guc) · line 2354

Quoted 4 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c +1 -0
@@ -2351,6 +2351,27 @@ void intel_guc_submission_init_early(struct intel_guc *guc)
 	guc->submission_selected = __guc_submission_selected(guc);
 }
 
+static bool __guc_slpc_supported(struct intel_guc *guc)

hmm, easy to confuse with intel_guc_slpc_is_supported, so maybe:

__detect_slpc_supported()

(yes, I know you were following code above)

drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c void intel_guc_submission_init_early(struct intel_guc *guc) · line 2356

Quoted 2 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c +2 -0
+{
+	/* GuC slpc is unavailable for pre-Gen12 */

s/slpc/SLPC

Quoted 7 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c +7 -0
+	return guc->submission_supported &&
+		GRAPHICS_VER(guc_to_gt(guc)->i915) >= 12;
+}
+
+static bool __guc_slpc_selected(struct intel_guc *guc)
+{
+	if (!intel_guc_slpc_is_supported(guc))

drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c void intel_guc_submission_init_early(struct intel_guc *guc) · line 2373

Quoted 10 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c +10 -0
+		return false;
+
+	return guc->submission_selected;
+}
+
+void intel_guc_slpc_init_early(struct intel_guc *guc)
+{
+	guc->slpc_supported = __guc_slpc_supported(guc);
+	guc->slpc_selected = __guc_slpc_selected(guc);
+}

in patch 4/16 you are introducing intel_guc_slpc.c|h so to have proper encapsulation better to define this function as

void intel_guc_slpc_init_early(struct intel_guc_slpc *slpc) { }

and move it to intel_guc_slpc.c

drivers/gpu/drm/i915/gt/uc/intel_guc_submission.h line 16

Quoted 13 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c +1 -0
+
 static inline struct intel_context *
 g2h_context_lookup(struct intel_guc *guc, u32 desc_idx)
 {
drivers/gpu/drm/i915/gt/uc/intel_guc_submission.h +1 -0
index be767eb6ff71..7ae5fd052faf 100644
@@ -13,6 +13,7 @@
 struct drm_printer;
 struct intel_engine_cs;
 
+void intel_guc_slpc_init_early(struct intel_guc *guc);

it really does not belong to this .h

Quoted 11 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_submission.h +4 -0
 void intel_guc_submission_init_early(struct intel_guc *guc);
 int intel_guc_submission_init(struct intel_guc *guc);
 void intel_guc_submission_enable(struct intel_guc *guc);
@@ -50,4 +51,19 @@ static inline bool intel_guc_submission_is_used(struct intel_guc *guc)
 	return intel_guc_is_used(guc) && intel_guc_submission_is_wanted(guc);
 }
 
+static inline bool intel_guc_slpc_is_supported(struct intel_guc *guc)
+{
+	return guc->slpc_supported;
+}

drivers/gpu/drm/i915/gt/uc/intel_guc_submission.h static inline bool intel_guc_submission_is_used(struct intel_guc *guc) · line 67

Quoted 10 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_submission.h +10 -0
+
+static inline bool intel_guc_slpc_is_wanted(struct intel_guc *guc)
+{
+	return guc->slpc_selected;
+}
+
+static inline bool intel_guc_slpc_is_used(struct intel_guc *guc)
+{
+	return intel_guc_submission_is_used(guc) && intel_guc_slpc_is_wanted(guc);
+}

did you try to define them in intel_guc_slpc.h ?

note that to avoid circular dependencies you can define slpc struct in intel_guc_slpc_types.h and then

in intel_guc.h:

	#include "intel_guc_slpc_types.h" instead of intel_guc_slpc.h

in intel_guc_slpc.h:

	#include "intel_guc.h"
	#include "intel_guc_slpc_types.h"
	#include "intel_guc_submission.h"
Quoted 33 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_submission.h +1 -0
+
 #endif
drivers/gpu/drm/i915/gt/uc/intel_uc.c +4 -2
index 61be0aa81492..dca5f6d0641b 100644
@@ -76,16 +76,18 @@ static void __confirm_options(struct intel_uc *uc)
 	struct drm_i915_private *i915 = uc_to_gt(uc)->i915;
 
 	drm_dbg(&i915->drm,
-		"enable_guc=%d (guc:%s submission:%s huc:%s)\n",
+		"enable_guc=%d (guc:%s submission:%s huc:%s slpc:%s)\n",
 		i915->params.enable_guc,
 		yesno(intel_uc_wants_guc(uc)),
 		yesno(intel_uc_wants_guc_submission(uc)),
-		yesno(intel_uc_wants_huc(uc)));
+		yesno(intel_uc_wants_huc(uc)),
+		yesno(intel_uc_wants_guc_slpc(uc)));
 
 	if (i915->params.enable_guc == 0) {
 		GEM_BUG_ON(intel_uc_wants_guc(uc));
 		GEM_BUG_ON(intel_uc_wants_guc_submission(uc));
 		GEM_BUG_ON(intel_uc_wants_huc(uc));
+		GEM_BUG_ON(intel_uc_wants_guc_slpc(uc));
 		return;
 	}
 
drivers/gpu/drm/i915/gt/uc/intel_uc.h +0 -0
index e2da2b6e76e1..38e465fd8a0c 100644

drivers/gpu/drm/i915/gt/uc/intel_uc.h __uc_state_checker(x, func, uses, used) · line 89

Quoted 7 lines
drivers/gpu/drm/i915/gt/uc/intel_uc.h +1 -0
@@ -83,6 +83,7 @@ __uc_state_checker(x, func, uses, used)
 uc_state_checkers(guc, guc);
 uc_state_checkers(huc, huc);
 uc_state_checkers(guc, guc_submission);
+uc_state_checkers(guc, guc_slpc);
 
 #undef uc_state_checkers
 #undef __uc_state_checker

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#4 lore raw

Re: [PATCH 02/16] drm/i915/guc/slpc: Initial definitions for slpc

Quoted 58 lines · Michal Wajdeczko

Hi Vinay,

Quoted 2 lines · Vinay Belgaumkar

Add macros to check for slpc support. This feature is currently supported for gen12+ and enabled whenever guc submission is enabled/selected.

please try to use consistent names across all patches:

s/slpc/SLPC
s/gen12/Gen12
s/guc/GuC

Quoted 46 lines
---
  drivers/gpu/drm/i915/gt/uc/intel_guc.c        |  1 +
  drivers/gpu/drm/i915/gt/uc/intel_guc.h        |  2 ++
  .../gpu/drm/i915/gt/uc/intel_guc_submission.c | 21 +++++++++++++++++++
  .../gpu/drm/i915/gt/uc/intel_guc_submission.h | 16 ++++++++++++++
  drivers/gpu/drm/i915/gt/uc/intel_uc.c         |  6 ++++--
  drivers/gpu/drm/i915/gt/uc/intel_uc.h         |  1 +
  6 files changed, 45 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/gt/uc/intel_guc.c +1 -0
index 979128e28372..b9a809f2d221 100644
@@ -157,6 +157,7 @@ void intel_guc_init_early(struct intel_guc *guc)
  	intel_guc_ct_init_early(&guc->ct);
  	intel_guc_log_init_early(&guc->log);
  	intel_guc_submission_init_early(guc);
+	intel_guc_slpc_init_early(guc);
 
  	mutex_init(&guc->send_mutex);
  	spin_lock_init(&guc->irq_lock);
drivers/gpu/drm/i915/gt/uc/intel_guc.h +2 -0
index 5d94cf482516..e5a456918b88 100644
@@ -57,6 +57,8 @@ struct intel_guc {
 
  	bool submission_supported;
  	bool submission_selected;
+	bool slpc_supported;
+	bool slpc_selected;
 
  	struct i915_vma *ads_vma;
  	struct __guc_ads_blob *ads_blob;
drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c +0 -0
index 9c102bf0c8e3..e2644a05f298 100644
@@ -2351,6 +2351,27 @@ void intel_guc_submission_init_early(struct intel_guc *guc)
  	guc->submission_selected = __guc_submission_selected(guc);
  }
 
Quoted 5 lines

drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c void intel_guc_submission_init_early(struct intel_guc *guc) · line 2354

Quoted 1 line
drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c +1 -0
+static bool __guc_slpc_supported(struct intel_guc *guc)

hmm, easy to confuse with intel_guc_slpc_is_supported, so maybe:

__detect_slpc_supported()

ok.

Quoted 29 lines

(yes, I know you were following code above)

drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c void intel_guc_submission_init_early(struct intel_guc *guc) · line 2356

Quoted 2 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c +2 -0
+{
+	/* GuC slpc is unavailable for pre-Gen12 */

s/slpc/SLPC

Quoted 7 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c +7 -0
+	return guc->submission_supported &&
+		GRAPHICS_VER(guc_to_gt(guc)->i915) >= 12;
+}
+
+static bool __guc_slpc_selected(struct intel_guc *guc)
+{
+	if (!intel_guc_slpc_is_supported(guc))

drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c void intel_guc_submission_init_early(struct intel_guc *guc) · line 2373

Quoted 10 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c +10 -0
+		return false;
+
+	return guc->submission_selected;
+}
+
+void intel_guc_slpc_init_early(struct intel_guc *guc)
+{
+	guc->slpc_supported = __guc_slpc_supported(guc);
+	guc->slpc_selected = __guc_slpc_selected(guc);
+}

in patch 4/16 you are introducing intel_guc_slpc.c|h so to have proper encapsulation better to define this function as

Quoted 1 line

void intel_guc_slpc_init_early(struct intel_guc_slpc *slpc) { }

the uc_state_checkers force the use of struct intel_guc *guc as the param. don't think I can change that to refer to slpc instead.

static inline bool intel_guc_slpc_is_supported(struct intel_guc *guc)

{
        return guc->slpc_supported;
}

slpc_supported needs to be inside the guc struct.

Quoted 46 lines

and move it to intel_guc_slpc.c

drivers/gpu/drm/i915/gt/uc/intel_guc_submission.h line 16

Quoted 13 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c +1 -0
+
  static inline struct intel_context *
  g2h_context_lookup(struct intel_guc *guc, u32 desc_idx)
  {
drivers/gpu/drm/i915/gt/uc/intel_guc_submission.h +1 -0
index be767eb6ff71..7ae5fd052faf 100644
@@ -13,6 +13,7 @@
  struct drm_printer;
  struct intel_engine_cs;
 
+void intel_guc_slpc_init_early(struct intel_guc *guc);

it really does not belong to this .h

Quoted 11 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_submission.h +4 -0
  void intel_guc_submission_init_early(struct intel_guc *guc);
  int intel_guc_submission_init(struct intel_guc *guc);
  void intel_guc_submission_enable(struct intel_guc *guc);
@@ -50,4 +51,19 @@ static inline bool intel_guc_submission_is_used(struct intel_guc *guc)
  	return intel_guc_is_used(guc) && intel_guc_submission_is_wanted(guc);
  }
 
+static inline bool intel_guc_slpc_is_supported(struct intel_guc *guc)
+{
+	return guc->slpc_supported;
+}

drivers/gpu/drm/i915/gt/uc/intel_guc_submission.h static inline bool intel_guc_submission_is_used(struct intel_guc *guc) · line 67

Quoted 10 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_submission.h +10 -0
+
+static inline bool intel_guc_slpc_is_wanted(struct intel_guc *guc)
+{
+	return guc->slpc_selected;
+}
+
+static inline bool intel_guc_slpc_is_used(struct intel_guc *guc)
+{
+	return intel_guc_submission_is_used(guc) && intel_guc_slpc_is_wanted(guc);
+}

did you try to define them in intel_guc_slpc.h ?

note that to avoid circular dependencies you can define slpc struct in intel_guc_slpc_types.h and then

Quoted 7 lines

in intel_guc.h:

	#include "intel_guc_slpc_types.h" instead of intel_guc_slpc.h

in intel_guc_slpc.h:

	#include "intel_guc.h"
	#include "intel_guc_slpc_types.h"
	#include "intel_guc_submission.h"

Sure, will give that a try.

Quoted 41 lines
Quoted 41 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_submission.h +1 -0
+
  #endif
drivers/gpu/drm/i915/gt/uc/intel_uc.c +4 -2
index 61be0aa81492..dca5f6d0641b 100644
@@ -76,16 +76,18 @@ static void __confirm_options(struct intel_uc *uc)
  	struct drm_i915_private *i915 = uc_to_gt(uc)->i915;
 
  	drm_dbg(&i915->drm,
-		"enable_guc=%d (guc:%s submission:%s huc:%s)\n",
+		"enable_guc=%d (guc:%s submission:%s huc:%s slpc:%s)\n",
  		i915->params.enable_guc,
  		yesno(intel_uc_wants_guc(uc)),
  		yesno(intel_uc_wants_guc_submission(uc)),
-		yesno(intel_uc_wants_huc(uc)));
+		yesno(intel_uc_wants_huc(uc)),
+		yesno(intel_uc_wants_guc_slpc(uc)));
 
  	if (i915->params.enable_guc == 0) {
  		GEM_BUG_ON(intel_uc_wants_guc(uc));
  		GEM_BUG_ON(intel_uc_wants_guc_submission(uc));
  		GEM_BUG_ON(intel_uc_wants_huc(uc));
+		GEM_BUG_ON(intel_uc_wants_guc_slpc(uc));
  		return;
  	}
 
drivers/gpu/drm/i915/gt/uc/intel_uc.h +1 -0
index e2da2b6e76e1..38e465fd8a0c 100644
@@ -83,6 +83,7 @@ __uc_state_checker(x, func, uses, used)
  uc_state_checkers(guc, guc);
  uc_state_checkers(huc, huc);
  uc_state_checkers(guc, guc_submission);
+uc_state_checkers(guc, guc_slpc);
 
  #undef uc_state_checkers
  #undef __uc_state_checker
#5 lore raw

Re: [PATCH 02/16] drm/i915/guc/slpc: Initial definitions for slpc

In reply to Michal Wajdeczko
Quoted 11 lines · Michal Wajdeczko

Hi Vinay,

Quoted 2 lines · Vinay Belgaumkar

Add macros to check for slpc support. This feature is currently supported for gen12+ and enabled whenever guc submission is enabled/selected.

please try to use consistent names across all patches:

s/slpc/SLPC
s/gen12/Gen12
s/guc/GuC

Ok.

Quoted 51 lines
Quoted 44 lines
---
  drivers/gpu/drm/i915/gt/uc/intel_guc.c        |  1 +
  drivers/gpu/drm/i915/gt/uc/intel_guc.h        |  2 ++
  .../gpu/drm/i915/gt/uc/intel_guc_submission.c | 21 +++++++++++++++++++
  .../gpu/drm/i915/gt/uc/intel_guc_submission.h | 16 ++++++++++++++
  drivers/gpu/drm/i915/gt/uc/intel_uc.c         |  6 ++++--
  drivers/gpu/drm/i915/gt/uc/intel_uc.h         |  1 +
  6 files changed, 45 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/gt/uc/intel_guc.c +1 -0
index 979128e28372..b9a809f2d221 100644
@@ -157,6 +157,7 @@ void intel_guc_init_early(struct intel_guc *guc)
  	intel_guc_ct_init_early(&guc->ct);
  	intel_guc_log_init_early(&guc->log);
  	intel_guc_submission_init_early(guc);
+	intel_guc_slpc_init_early(guc);
 
  	mutex_init(&guc->send_mutex);
  	spin_lock_init(&guc->irq_lock);
drivers/gpu/drm/i915/gt/uc/intel_guc.h +2 -0
index 5d94cf482516..e5a456918b88 100644
@@ -57,6 +57,8 @@ struct intel_guc {
 
  	bool submission_supported;
  	bool submission_selected;
+	bool slpc_supported;
+	bool slpc_selected;
 
  	struct i915_vma *ads_vma;
  	struct __guc_ads_blob *ads_blob;
drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c +0 -0
index 9c102bf0c8e3..e2644a05f298 100644

drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c void intel_guc_submission_init_early(struct intel_guc *guc) · line 2354

Quoted 4 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c +1 -0
@@ -2351,6 +2351,27 @@ void intel_guc_submission_init_early(struct intel_guc *guc)
  	guc->submission_selected = __guc_submission_selected(guc);
  }
 
+static bool __guc_slpc_supported(struct intel_guc *guc)

hmm, easy to confuse with intel_guc_slpc_is_supported, so maybe:

Quoted 8 lines

__detect_slpc_supported()

(yes, I know you were following code above)

drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c void intel_guc_submission_init_early(struct intel_guc *guc) · line 2356

Quoted 2 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c +2 -0
+{
+	/* GuC slpc is unavailable for pre-Gen12 */

s/slpc/SLPC

Ok.

Quoted 22 lines
Quoted 8 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c +7 -0
+	return guc->submission_supported &&
+		GRAPHICS_VER(guc_to_gt(guc)->i915) >= 12;
+}
+
+static bool __guc_slpc_selected(struct intel_guc *guc)
+{
+	if (!intel_guc_slpc_is_supported(guc))

drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c void intel_guc_submission_init_early(struct intel_guc *guc) · line 2373

Quoted 10 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c +10 -0
+		return false;
+
+	return guc->submission_selected;
+}
+
+void intel_guc_slpc_init_early(struct intel_guc *guc)
+{
+	guc->slpc_supported = __guc_slpc_supported(guc);
+	guc->slpc_selected = __guc_slpc_selected(guc);
+}

in patch 4/16 you are introducing intel_guc_slpc.c|h so to have proper encapsulation better to define this function as

Quoted 3 lines

void intel_guc_slpc_init_early(struct intel_guc_slpc *slpc) { }

and move it to intel_guc_slpc.c

done.

Quoted 44 lines
Quoted 10 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c +1 -0
+
  static inline struct intel_context *
  g2h_context_lookup(struct intel_guc *guc, u32 desc_idx)
  {
drivers/gpu/drm/i915/gt/uc/intel_guc_submission.h +0 -0
index be767eb6ff71..7ae5fd052faf 100644

drivers/gpu/drm/i915/gt/uc/intel_guc_submission.h line 16

Quoted 4 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_submission.h +1 -0
@@ -13,6 +13,7 @@
  struct drm_printer;
  struct intel_engine_cs;
 
+void intel_guc_slpc_init_early(struct intel_guc *guc);

it really does not belong to this .h

Quoted 11 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_submission.h +4 -0
  void intel_guc_submission_init_early(struct intel_guc *guc);
  int intel_guc_submission_init(struct intel_guc *guc);
  void intel_guc_submission_enable(struct intel_guc *guc);
@@ -50,4 +51,19 @@ static inline bool intel_guc_submission_is_used(struct intel_guc *guc)
  	return intel_guc_is_used(guc) && intel_guc_submission_is_wanted(guc);
  }
 
+static inline bool intel_guc_slpc_is_supported(struct intel_guc *guc)
+{
+	return guc->slpc_supported;
+}

drivers/gpu/drm/i915/gt/uc/intel_guc_submission.h static inline bool intel_guc_submission_is_used(struct intel_guc *guc) · line 67

Quoted 10 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_submission.h +10 -0
+
+static inline bool intel_guc_slpc_is_wanted(struct intel_guc *guc)
+{
+	return guc->slpc_selected;
+}
+
+static inline bool intel_guc_slpc_is_used(struct intel_guc *guc)
+{
+	return intel_guc_submission_is_used(guc) && intel_guc_slpc_is_wanted(guc);
+}

did you try to define them in intel_guc_slpc.h ?

note that to avoid circular dependencies you can define slpc struct in intel_guc_slpc_types.h and then

Quoted 8 lines

in intel_guc.h:

	#include "intel_guc_slpc_types.h" instead of intel_guc_slpc.h

in intel_guc_slpc.h:

	#include "intel_guc.h"
	#include "intel_guc_slpc_types.h"
	#include "intel_guc_submission.h"

that worked.

Thanks,
Vinay.

Quoted 40 lines
Quoted 40 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_submission.h +1 -0
+
  #endif
drivers/gpu/drm/i915/gt/uc/intel_uc.c +4 -2
index 61be0aa81492..dca5f6d0641b 100644
@@ -76,16 +76,18 @@ static void __confirm_options(struct intel_uc *uc)
  	struct drm_i915_private *i915 = uc_to_gt(uc)->i915;
 
  	drm_dbg(&i915->drm,
-		"enable_guc=%d (guc:%s submission:%s huc:%s)\n",
+		"enable_guc=%d (guc:%s submission:%s huc:%s slpc:%s)\n",
  		i915->params.enable_guc,
  		yesno(intel_uc_wants_guc(uc)),
  		yesno(intel_uc_wants_guc_submission(uc)),
-		yesno(intel_uc_wants_huc(uc)));
+		yesno(intel_uc_wants_huc(uc)),
+		yesno(intel_uc_wants_guc_slpc(uc)));
 
  	if (i915->params.enable_guc == 0) {
  		GEM_BUG_ON(intel_uc_wants_guc(uc));
  		GEM_BUG_ON(intel_uc_wants_guc_submission(uc));
  		GEM_BUG_ON(intel_uc_wants_huc(uc));
+		GEM_BUG_ON(intel_uc_wants_guc_slpc(uc));
  		return;
  	}
 
drivers/gpu/drm/i915/gt/uc/intel_uc.h +1 -0
index e2da2b6e76e1..38e465fd8a0c 100644
@@ -83,6 +83,7 @@ __uc_state_checker(x, func, uses, used)
  uc_state_checkers(guc, guc);
  uc_state_checkers(huc, huc);
  uc_state_checkers(guc, guc_submission);
+uc_state_checkers(guc, guc_slpc);
 
  #undef uc_state_checkers
  #undef __uc_state_checker
#6 lore raw

PATCH 3/16 drm/i915/guc/slpc: Gate Host RPS when slpc is enabled

In reply to Vinay Belgaumkar

Disable RPS when slpc is enabled. Also ensure uc_init is called before we initialize RPS so that we can check for slpc support. We do not need to enable up/down interrupts when slpc is enabled. However, we still need the ARAT interrupt, which will be enabled separately.

---
 drivers/gpu/drm/i915/gt/intel_gt.c  |  2 +-
 drivers/gpu/drm/i915/gt/intel_rps.c | 20 ++++++++++++++++++++
 2 files changed, 21 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/gt/intel_gt.c +1 -1
index ceeb517ba259..f94d2e1ec3fe 100644
@@ -41,8 +41,8 @@ void intel_gt_init_early(struct intel_gt *gt, struct drm_i915_private *i915)
 	intel_gt_init_timelines(gt);
 	intel_gt_pm_init_early(gt);
 
-	intel_rps_init_early(&gt->rps);
 	intel_uc_init_early(&gt->uc);
+	intel_rps_init_early(&gt->rps);
 }
 
 int intel_gt_probe_lmem(struct intel_gt *gt)
drivers/gpu/drm/i915/gt/intel_rps.c +20 -0
index 0c8e7f2b06f0..e858eeb2c59d 100644
@@ -37,6 +37,13 @@ static struct intel_uncore *rps_to_uncore(struct intel_rps *rps)
 	return rps_to_gt(rps)->uncore;
 }
 
+static bool rps_uses_slpc(struct intel_rps *rps)
+{
+	struct intel_gt *gt = rps_to_gt(rps);
+
+	return intel_uc_uses_guc_slpc(&gt->uc);
+}
+
 static u32 rps_pm_sanitize_mask(struct intel_rps *rps, u32 mask)
 {
 	return mask & ~rps->pm_intrmsk_mbz;
@@ -167,6 +174,8 @@ static void rps_enable_interrupts(struct intel_rps *rps)
 {
 	struct intel_gt *gt = rps_to_gt(rps);
 
+	GEM_BUG_ON(rps_uses_slpc(rps));
+
 	GT_TRACE(gt, "interrupts:on rps->pm_events: %x, rps_pm_mask:%x\n",
 		 rps->pm_events, rps_pm_mask(rps, rps->last_freq));
 
@@ -771,6 +780,8 @@ static int gen6_rps_set(struct intel_rps *rps, u8 val)
 	struct drm_i915_private *i915 = rps_to_i915(rps);
 	u32 swreq;
 
+	GEM_BUG_ON(rps_uses_slpc(rps));
+
 	if (GRAPHICS_VER(i915) >= 9)
 		swreq = GEN9_FREQUENCY(val);
 	else if (IS_HASWELL(i915) || IS_BROADWELL(i915))
@@ -861,6 +872,9 @@ void intel_rps_park(struct intel_rps *rps)
 {
 	int adj;
 
+	if (!intel_rps_is_enabled(rps))
+		return;
+
 	GEM_BUG_ON(atomic_read(&rps->num_waiters));
 
 	if (!intel_rps_clear_active(rps))
@@ -1829,6 +1843,9 @@ void intel_rps_init(struct intel_rps *rps)
 {
 	struct drm_i915_private *i915 = rps_to_i915(rps);
 
+	if (rps_uses_slpc(rps))
+		return;
+
 	if (IS_CHERRYVIEW(i915))
 		chv_rps_init(rps);
 	else if (IS_VALLEYVIEW(i915))
@@ -1885,6 +1902,9 @@ void intel_rps_init(struct intel_rps *rps)
 
 void intel_rps_sanitize(struct intel_rps *rps)
 {
+	if (rps_uses_slpc(rps))
+		return;
+
 	if (GRAPHICS_VER(rps_to_i915(rps)) >= 6)
 		rps_disable_interrupts(rps);
 }
Signature · 6 lines
2.25.0

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#7 lore raw

PATCH 4/16 drm/i915/guc/slpc: Lay out slpc init/enable/disable/fini

In reply to Vinay Belgaumkar

Declare header and source files for SLPC, along with init and enable/disable function templates.

---
 drivers/gpu/drm/i915/Makefile               |  1 +
 drivers/gpu/drm/i915/gt/uc/intel_guc.h      |  2 ++
 drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c | 34 +++++++++++++++++++++
 drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.h | 16 ++++++++++
 4 files changed, 53 insertions(+)
 create mode 100644 drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c
 create mode 100644 drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.h
drivers/gpu/drm/i915/Makefile +1 -0
index ab7679957623..d8eac4468df9 100644
@@ -186,6 +186,7 @@ i915-y += gt/uc/intel_uc.o \
 	  gt/uc/intel_guc_fw.o \
 	  gt/uc/intel_guc_log.o \
 	  gt/uc/intel_guc_log_debugfs.o \
+	  gt/uc/intel_guc_slpc.o \
 	  gt/uc/intel_guc_submission.o \
 	  gt/uc/intel_huc.o \
 	  gt/uc/intel_huc_debugfs.o \
drivers/gpu/drm/i915/gt/uc/intel_guc.h +2 -0
index e5a456918b88..0dbbd9cf553f 100644
@@ -15,6 +15,7 @@
 #include "intel_guc_ct.h"
 #include "intel_guc_log.h"
 #include "intel_guc_reg.h"
+#include "intel_guc_slpc.h"
 #include "intel_uc_fw.h"
 #include "i915_utils.h"
 #include "i915_vma.h"
@@ -30,6 +31,7 @@ struct intel_guc {
 	struct intel_uc_fw fw;
 	struct intel_guc_log log;
 	struct intel_guc_ct ct;
+	struct intel_guc_slpc slpc;
 
 	/* Global engine used to submit requests to GuC */
 	struct i915_sched_engine *sched_engine;
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c new file +34 -0
new file mode 100644
index 000000000000..c1f569d2300d
@@ -0,0 +1,34 @@
+/*
+ * SPDX-License-Identifier: MIT
+ *
+ * Copyright © 2020 Intel Corporation
+ */
+
+#include "intel_guc_slpc.h"
+
+int intel_guc_slpc_init(struct intel_guc_slpc *slpc)
+{
+	return 0;
+}
+
+/*
+ * intel_guc_slpc_enable() - Start SLPC
+ * @slpc: pointer to intel_guc_slpc.
+ *
+ * SLPC is enabled by setting up the shared data structure and
+ * sending reset event to GuC SLPC. Initial data is setup in
+ * intel_guc_slpc_init. Here we send the reset event. We do
+ * not currently need a slpc_disable since this is taken care
+ * of automatically when a reset/suspend occurs and the guc
+ * channels are destroyed.
+ *
+ * Return: 0 on success, non-zero error code on failure.
+ */
+int intel_guc_slpc_enable(struct intel_guc_slpc *slpc)
+{
+	return 0;
+}
+
+void intel_guc_slpc_fini(struct intel_guc_slpc *slpc)
+{
+}
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.h new file +16 -0
new file mode 100644
index 000000000000..74fd86769163
@@ -0,0 +1,16 @@
+/*
+ * SPDX-License-Identifier: MIT
+ *
+ * Copyright © 2020 Intel Corporation
+ */
+#ifndef _INTEL_GUC_SLPC_H_
+#define _INTEL_GUC_SLPC_H_
+
+struct intel_guc_slpc {
+};
+
+int intel_guc_slpc_init(struct intel_guc_slpc *slpc);
+int intel_guc_slpc_enable(struct intel_guc_slpc *slpc);
+void intel_guc_slpc_fini(struct intel_guc_slpc *slpc);
+
+#endif
Signature · 1 line
2.25.0
#8 lore raw

Re: [Intel-gfx] [PATCH 04/16] drm/i915/guc/slpc: Lay out slpc init/enable/disable/fini

Quoted 2 lines · Vinay Belgaumkar

Declare header and source files for SLPC, along with init and enable/disable function templates.

later you claim that "disable" is not needed

Quoted 50 lines
---
 drivers/gpu/drm/i915/Makefile               |  1 +
 drivers/gpu/drm/i915/gt/uc/intel_guc.h      |  2 ++
 drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c | 34 +++++++++++++++++++++
 drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.h | 16 ++++++++++
 4 files changed, 53 insertions(+)
 create mode 100644 drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c
 create mode 100644 drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.h
drivers/gpu/drm/i915/Makefile +1 -0
index ab7679957623..d8eac4468df9 100644
@@ -186,6 +186,7 @@ i915-y += gt/uc/intel_uc.o \
 	  gt/uc/intel_guc_fw.o \
 	  gt/uc/intel_guc_log.o \
 	  gt/uc/intel_guc_log_debugfs.o \
+	  gt/uc/intel_guc_slpc.o \
 	  gt/uc/intel_guc_submission.o \
 	  gt/uc/intel_huc.o \
 	  gt/uc/intel_huc_debugfs.o \
drivers/gpu/drm/i915/gt/uc/intel_guc.h +2 -0
index e5a456918b88..0dbbd9cf553f 100644
@@ -15,6 +15,7 @@
 #include "intel_guc_ct.h"
 #include "intel_guc_log.h"
 #include "intel_guc_reg.h"
+#include "intel_guc_slpc.h"
 #include "intel_uc_fw.h"
 #include "i915_utils.h"
 #include "i915_vma.h"
@@ -30,6 +31,7 @@ struct intel_guc {
 	struct intel_uc_fw fw;
 	struct intel_guc_log log;
 	struct intel_guc_ct ct;
+	struct intel_guc_slpc slpc;
 
 	/* Global engine used to submit requests to GuC */
 	struct i915_sched_engine *sched_engine;
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c new file +0 -0
new file mode 100644
index 000000000000..c1f569d2300d

drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c line 2

Quoted 2 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c new file +2 -0
@@ -0,0 +1,34 @@
+/*
+ * SPDX-License-Identifier: MIT

SPDX tag shall be in very first line, for .c:

// SPDX-License-Identifier: MIT

drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c line 4

Quoted 2 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c new file +2 -0
+ *
+ * Copyright © 2020 Intel Corporation

2021

Quoted 8 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c new file +8 -0
+ */
+
+#include "intel_guc_slpc.h"
+
+int intel_guc_slpc_init(struct intel_guc_slpc *slpc)
+{
+	return 0;
+}

drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c line 22

Quoted 10 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c new file +10 -0
+
+/*
+ * intel_guc_slpc_enable() - Start SLPC
+ * @slpc: pointer to intel_guc_slpc.
+ *
+ * SLPC is enabled by setting up the shared data structure and
+ * sending reset event to GuC SLPC. Initial data is setup in
+ * intel_guc_slpc_init. Here we send the reset event. We do
+ * not currently need a slpc_disable since this is taken care
+ * of automatically when a reset/suspend occurs and the guc

s/guc/GuC

drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c line 23

Quoted 1 line
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c new file +1 -0
+ * channels are destroyed.

you mean CTB ?

Quoted 17 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c new file +11 -0
+ *
+ * Return: 0 on success, non-zero error code on failure.
+ */
+int intel_guc_slpc_enable(struct intel_guc_slpc *slpc)
+{
+	return 0;
+}
+
+void intel_guc_slpc_fini(struct intel_guc_slpc *slpc)
+{
+}
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.h new file +0 -0
new file mode 100644
index 000000000000..74fd86769163

drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.h line 2

Quoted 2 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.h new file +2 -0
@@ -0,0 +1,16 @@
+/*
+ * SPDX-License-Identifier: MIT

SPDX tag shall be in very first line, for .h:

/* SPDX-License-Identifier: MIT */

drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.h line 4

Quoted 2 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.h new file +2 -0
+ *
+ * Copyright © 2020 Intel Corporation

2021

drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.h line 10

Quoted 6 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.h new file +6 -0
+ */
+#ifndef _INTEL_GUC_SLPC_H_
+#define _INTEL_GUC_SLPC_H_
+
+struct intel_guc_slpc {
+};

move all data definitions to intel_guc_slpc_types.h and include it here

drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.h line 16

Quoted 7 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.h new file +6 -0
+
+int intel_guc_slpc_init(struct intel_guc_slpc *slpc);
+int intel_guc_slpc_enable(struct intel_guc_slpc *slpc);
+void intel_guc_slpc_fini(struct intel_guc_slpc *slpc);
+
+#endif

and as suggested in comment to 2/14 you should likely move this patch to the front of the series

Michal

#9 lore raw

Re: [Intel-gfx] [PATCH 04/16] drm/i915/guc/slpc: Lay out slpc init/enable/disable/fini

Quoted 7 lines · Michal Wajdeczko
Quoted 2 lines · Vinay Belgaumkar

Declare header and source files for SLPC, along with init and enable/disable function templates.

later you claim that "disable" is not needed

Changed.

Quoted 56 lines
Quoted 51 lines
---
  drivers/gpu/drm/i915/Makefile               |  1 +
  drivers/gpu/drm/i915/gt/uc/intel_guc.h      |  2 ++
  drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c | 34 +++++++++++++++++++++
  drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.h | 16 ++++++++++
  4 files changed, 53 insertions(+)

create mode 100644 drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c create mode 100644 drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.h

drivers/gpu/drm/i915/Makefile +1 -0
index ab7679957623..d8eac4468df9 100644
@@ -186,6 +186,7 @@ i915-y += gt/uc/intel_uc.o \
  	  gt/uc/intel_guc_fw.o \
  	  gt/uc/intel_guc_log.o \
  	  gt/uc/intel_guc_log_debugfs.o \
+	  gt/uc/intel_guc_slpc.o \
  	  gt/uc/intel_guc_submission.o \
  	  gt/uc/intel_huc.o \
  	  gt/uc/intel_huc_debugfs.o \
drivers/gpu/drm/i915/gt/uc/intel_guc.h +2 -0
index e5a456918b88..0dbbd9cf553f 100644
@@ -15,6 +15,7 @@
  #include "intel_guc_ct.h"
  #include "intel_guc_log.h"
  #include "intel_guc_reg.h"
+#include "intel_guc_slpc.h"
  #include "intel_uc_fw.h"
  #include "i915_utils.h"
  #include "i915_vma.h"
@@ -30,6 +31,7 @@ struct intel_guc {
  	struct intel_uc_fw fw;
  	struct intel_guc_log log;
  	struct intel_guc_ct ct;
+	struct intel_guc_slpc slpc;
 
  	/* Global engine used to submit requests to GuC */
  	struct i915_sched_engine *sched_engine;
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c new file +0 -0
new file mode 100644
index 000000000000..c1f569d2300d

drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c line 2

Quoted 2 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c new file +2 -0
@@ -0,0 +1,34 @@
+/*
+ * SPDX-License-Identifier: MIT

SPDX tag shall be in very first line, for .c:

Quoted 6 lines

// SPDX-License-Identifier: MIT

drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c line 4

Quoted 2 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c new file +2 -0
+ *
+ * Copyright © 2020 Intel Corporation

2021

done.

Quoted 22 lines
Quoted 9 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c new file +8 -0
+ */
+
+#include "intel_guc_slpc.h"
+
+int intel_guc_slpc_init(struct intel_guc_slpc *slpc)
+{
+	return 0;
+}

drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c line 22

Quoted 10 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c new file +10 -0
+
+/*
+ * intel_guc_slpc_enable() - Start SLPC
+ * @slpc: pointer to intel_guc_slpc.
+ *
+ * SLPC is enabled by setting up the shared data structure and
+ * sending reset event to GuC SLPC. Initial data is setup in
+ * intel_guc_slpc_init. Here we send the reset event. We do
+ * not currently need a slpc_disable since this is taken care
+ * of automatically when a reset/suspend occurs and the guc

s/guc/GuC

Quoted 3 lines

drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c line 23

Quoted 1 line
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c new file +1 -0
+ * channels are destroyed.

you mean CTB ?

yes, fixed.

Quoted 39 lines
Quoted 18 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c new file +11 -0
+ *
+ * Return: 0 on success, non-zero error code on failure.
+ */
+int intel_guc_slpc_enable(struct intel_guc_slpc *slpc)
+{
+	return 0;
+}
+
+void intel_guc_slpc_fini(struct intel_guc_slpc *slpc)
+{
+}
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.h new file +0 -0
new file mode 100644
index 000000000000..74fd86769163

drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.h line 2

Quoted 2 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.h new file +2 -0
@@ -0,0 +1,16 @@
+/*
+ * SPDX-License-Identifier: MIT

SPDX tag shall be in very first line, for .h:

/* SPDX-License-Identifier: MIT */

drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.h line 4

Quoted 2 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.h new file +2 -0
+ *
+ * Copyright © 2020 Intel Corporation

2021

drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.h line 10

Quoted 6 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.h new file +6 -0
+ */
+#ifndef _INTEL_GUC_SLPC_H_
+#define _INTEL_GUC_SLPC_H_
+
+struct intel_guc_slpc {
+};

move all data definitions to intel_guc_slpc_types.h and include it here

Quoted 10 lines

drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.h line 16

Quoted 7 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.h new file +6 -0
+
+int intel_guc_slpc_init(struct intel_guc_slpc *slpc);
+int intel_guc_slpc_enable(struct intel_guc_slpc *slpc);
+void intel_guc_slpc_fini(struct intel_guc_slpc *slpc);
+
+#endif

and as suggested in comment to 2/14 you should likely move this patch to the front of the series

Yes, squashed with the first patch.

Thanks,
Vinay.

Quoted 3 lines

Michal

#10 lore raw

PATCH 5/16 drm/i915/guc/slpc: Adding slpc communication interfaces

In reply to Vinay Belgaumkar

Replicate the SLPC header file in GuC for the most part. There are some SLPC mode based parameters which haven't been included since we are not using them.

---
 drivers/gpu/drm/i915/gt/uc/intel_guc.c        |   4 +
 drivers/gpu/drm/i915/gt/uc/intel_guc_fwif.h   |   2 +
 drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.h   |   2 +
 .../gpu/drm/i915/gt/uc/intel_guc_slpc_fwif.h  | 255 ++++++++++++++++++
 4 files changed, 263 insertions(+)
 create mode 100644 drivers/gpu/drm/i915/gt/uc/intel_guc_slpc_fwif.h
drivers/gpu/drm/i915/gt/uc/intel_guc.c +4 -0
index b9a809f2d221..9d61b2d54de4 100644
@@ -202,11 +202,15 @@ static u32 guc_ctl_debug_flags(struct intel_guc *guc)
 
 static u32 guc_ctl_feature_flags(struct intel_guc *guc)
 {
+	struct intel_gt *gt = guc_to_gt(guc);
 	u32 flags = 0;
 
 	if (!intel_guc_submission_is_used(guc))
 		flags |= GUC_CTL_DISABLE_SCHEDULER;
 
+	if (intel_uc_uses_guc_slpc(&gt->uc))
+		flags |= GUC_CTL_ENABLE_SLPC;
+
 	return flags;
 }
 
drivers/gpu/drm/i915/gt/uc/intel_guc_fwif.h +2 -0
index 94bb1ca6f889..19e2504d7a36 100644
@@ -114,6 +114,8 @@
 #define   GUC_ADS_ADDR_SHIFT		1
 #define   GUC_ADS_ADDR_MASK		(0xFFFFF << GUC_ADS_ADDR_SHIFT)
 
+#define GUC_CTL_ENABLE_SLPC            BIT(2)
+
 #define GUC_CTL_MAX_DWORDS		(SOFT_SCRATCH_COUNT - 2) /* [1..14] */
 
 /* Generic GT SysInfo data types */
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.h +2 -0
index 74fd86769163..98036459a1a3 100644
@@ -6,6 +6,8 @@
 #ifndef _INTEL_GUC_SLPC_H_
 #define _INTEL_GUC_SLPC_H_
 
+#include "intel_guc_slpc_fwif.h"
+
 struct intel_guc_slpc {
 };
 
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc_fwif.h new file +255 -0

255 lines not on this page · raw message

Signature · 6 lines
2.25.0

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#11 lore raw

Re: [PATCH 05/16] drm/i915/guc/slpc: Adding slpc communication interfaces

Quoted 1 line · Vinay Belgaumkar

Replicate the SLPC header file in GuC for the most part. There are

what you mean by "replicate" here?

Quoted 38 lines

some SLPC mode based parameters which haven't been included since we are not using them.

---
 drivers/gpu/drm/i915/gt/uc/intel_guc.c        |   4 +
 drivers/gpu/drm/i915/gt/uc/intel_guc_fwif.h   |   2 +
 drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.h   |   2 +
 .../gpu/drm/i915/gt/uc/intel_guc_slpc_fwif.h  | 255 ++++++++++++++++++
 4 files changed, 263 insertions(+)
 create mode 100644 drivers/gpu/drm/i915/gt/uc/intel_guc_slpc_fwif.h
drivers/gpu/drm/i915/gt/uc/intel_guc.c +4 -0
index b9a809f2d221..9d61b2d54de4 100644
@@ -202,11 +202,15 @@ static u32 guc_ctl_debug_flags(struct intel_guc *guc)
 
 static u32 guc_ctl_feature_flags(struct intel_guc *guc)
 {
+	struct intel_gt *gt = guc_to_gt(guc);
 	u32 flags = 0;
 
 	if (!intel_guc_submission_is_used(guc))
 		flags |= GUC_CTL_DISABLE_SCHEDULER;
 
+	if (intel_uc_uses_guc_slpc(&gt->uc))
+		flags |= GUC_CTL_ENABLE_SLPC;
+
 	return flags;
 }
 
drivers/gpu/drm/i915/gt/uc/intel_guc_fwif.h +0 -0
index 94bb1ca6f889..19e2504d7a36 100644

drivers/gpu/drm/i915/gt/uc/intel_guc_fwif.h line 117

Quoted 4 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_fwif.h +1 -0
@@ -114,6 +114,8 @@
 #define   GUC_ADS_ADDR_SHIFT		1
 #define   GUC_ADS_ADDR_MASK		(0xFFFFF << GUC_ADS_ADDR_SHIFT)
 
+#define GUC_CTL_ENABLE_SLPC            BIT(2)

this should be defined closer to GUC_CTL_FEATURE

drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.h line 9

Quoted 13 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_fwif.h +1 -0
+
 #define GUC_CTL_MAX_DWORDS		(SOFT_SCRATCH_COUNT - 2) /* [1..14] */
 
 /* Generic GT SysInfo data types */
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.h +1 -0
index 74fd86769163..98036459a1a3 100644
@@ -6,6 +6,8 @@
 #ifndef _INTEL_GUC_SLPC_H_
 #define _INTEL_GUC_SLPC_H_
 
+#include "intel_guc_slpc_fwif.h"

doesn't seem to be needed right now

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

Quoted 9 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.h +1 -0
+
 struct intel_guc_slpc {
 };
 
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc_fwif.h new file +0 -0
new file mode 100644
index 000000000000..2a5e71428374

I've started to move all pure ABI definitions to files in abi/ folder, leaving in guc_fwif.h only our next level helpers/wrappers.

Can you move these SLPC definition there too ? maybe as dedicated:

abi/guc_slpc_abi.h

drivers/gpu/drm/i915/gt/uc/intel_guc_slpc_fwif.h line 2

Quoted 3 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc_fwif.h new file +2 -0
@@ -0,0 +1,255 @@
+/*
+ * SPDX-License-Identifier: MIT

use proper format

drivers/gpu/drm/i915/gt/uc/intel_guc_slpc_fwif.h line 4

Quoted 2 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc_fwif.h new file +2 -0
+ *
+ * Copyright © 2020 Intel Corporation

2021

drivers/gpu/drm/i915/gt/uc/intel_guc_slpc_fwif.h line 13

Quoted 9 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc_fwif.h new file +9 -0
+ */
+#ifndef _INTEL_GUC_SLPC_FWIF_H_
+#define _INTEL_GUC_SLPC_FWIF_H_
+
+#include <linux/types.h>
+
+/* This file replicates the header in GuC code for handling SLPC related
+ * data structures and sizes
+ */

use proper format for multi-line comments:

	/*
	 * blah blah
	 * blah blah
	 */
Quoted 10 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc_fwif.h new file +10 -0
+
+/* SLPC exposes certain parameters for global configuration by the host.
+ * These are referred to as override parameters, because in most cases
+ * the host will not need to modify the default values used by SLPC.
+ * SLPC remembers the default values which allows the host to easily restore
+ * them by simply unsetting the override. The host can set or unset override
+ * parameters during SLPC (re-)initialization using the SLPC Reset event.
+ * The host can also set or unset override parameters on the fly using the
+ * Parameter Set and Parameter Unset events
+ */

drivers/gpu/drm/i915/gt/uc/intel_guc_slpc_fwif.h line 33

Quoted 10 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc_fwif.h new file +10 -0
+#define SLPC_MAX_OVERRIDE_PARAMETERS	256
+#define SLPC_OVERRIDE_BITFIELD_SIZE \
+		(SLPC_MAX_OVERRIDE_PARAMETERS / 32)
+
+#define SLPC_PAGE_SIZE_BYTES			4096
+#define SLPC_CACHELINE_SIZE_BYTES		64
+#define SLPC_SHARE_DATA_SIZE_BYTE_HEADER	SLPC_CACHELINE_SIZE_BYTES
+#define SLPC_SHARE_DATA_SIZE_BYTE_PLATFORM_INFO	SLPC_CACHELINE_SIZE_BYTES
+#define SLPC_SHARE_DATA_SIZE_BYTE_TASK_STATE	SLPC_CACHELINE_SIZE_BYTES
+#define SLPC_SHARE_DATA_MODE_DEFN_TABLE_SIZE	SLPC_PAGE_SIZE_BYTES

can you put some simply diagram that would describe this layout ?

Quoted 13 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc_fwif.h new file +13 -0
+
+#define SLPC_SHARE_DATA_SIZE_BYTE_MAX		(2 * SLPC_PAGE_SIZE_BYTES)
+
+/* Cacheline size aligned (Total size needed for
+ * SLPM_KMD_MAX_OVERRIDE_PARAMETERS=256 is 1088 bytes)
+ */
+#define SLPC_SHARE_DATA_SIZE_BYTE_PARAM		(((((SLPC_MAX_OVERRIDE_PARAMETERS * 4) \
+						+ ((SLPC_MAX_OVERRIDE_PARAMETERS / 32) * 4)) \
+		+ (SLPC_CACHELINE_SIZE_BYTES-1)) / SLPC_CACHELINE_SIZE_BYTES)*SLPC_CACHELINE_SIZE_BYTES)
+
+#define SLPC_SHARE_DATA_SIZE_BYTE_OTHER		(SLPC_SHARE_DATA_SIZE_BYTE_MAX - \
+					(SLPC_SHARE_DATA_SIZE_BYTE_HEADER \
+					+ SLPC_SHARE_DATA_SIZE_BYTE_PLATFORM_INFO \

drivers/gpu/drm/i915/gt/uc/intel_guc_slpc_fwif.h line 56

Quoted 10 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc_fwif.h new file +10 -0
+					+ SLPC_SHARE_DATA_SIZE_BYTE_TASK_STATE \
+					+ SLPC_SHARE_DATA_SIZE_BYTE_PARAM \
+					+ SLPC_SHARE_DATA_MODE_DEFN_TABLE_SIZE))
+
+#define SLPC_EVENT(id, argc)			((u32)(id) << 8 | (argc))
+
+#define SLPC_PARAM_TASK_DEFAULT			0
+#define SLPC_PARAM_TASK_ENABLED			1
+#define SLPC_PARAM_TASK_DISABLED		2
+#define SLPC_PARAM_TASK_UNKNOWN			3

many values below are defined as enum, why these values are #defines ?

and is there any relation to these ones defined below (look similar)?

+ SLPC_PARAM_TASK_ENABLE_GTPERF = 0,
+ SLPC_PARAM_TASK_DISABLE_GTPERF = 1,
+ SLPC_PARAM_TASK_ENABLE_BALANCER = 2,
+ SLPC_PARAM_TASK_DISABLE_BALANCER = 3,
+ SLPC_PARAM_TASK_ENABLE_DCC = 4,
+ SLPC_PARAM_TASK_DISABLE_DCC = 5,

Quoted 59 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc_fwif.h new file +59 -0
+
+enum slpc_status {
+	SLPC_STATUS_OK = 0,
+	SLPC_STATUS_ERROR = 1,
+	SLPC_STATUS_ILLEGAL_COMMAND = 2,
+	SLPC_STATUS_INVALID_ARGS = 3,
+	SLPC_STATUS_INVALID_PARAMS = 4,
+	SLPC_STATUS_INVALID_DATA = 5,
+	SLPC_STATUS_OUT_OF_RANGE = 6,
+	SLPC_STATUS_NOT_SUPPORTED = 7,
+	SLPC_STATUS_NOT_IMPLEMENTED = 8,
+	SLPC_STATUS_NO_DATA = 9,
+	SLPC_STATUS_EVENT_NOT_REGISTERED = 10,
+	SLPC_STATUS_REGISTER_LOCKED = 11,
+	SLPC_STATUS_TEMPORARILY_UNAVAILABLE = 12,
+	SLPC_STATUS_VALUE_ALREADY_SET = 13,
+	SLPC_STATUS_VALUE_ALREADY_UNSET = 14,
+	SLPC_STATUS_VALUE_NOT_CHANGED = 15,
+	SLPC_STATUS_MEMIO_ERROR = 16,
+	SLPC_STATUS_EVENT_QUEUED_REQ_DPC = 17,
+	SLPC_STATUS_EVENT_QUEUED_NOREQ_DPC = 18,
+	SLPC_STATUS_NO_EVENT_QUEUED = 19,
+	SLPC_STATUS_OUT_OF_SPACE = 20,
+	SLPC_STATUS_TIMEOUT = 21,
+	SLPC_STATUS_NO_LOCK = 22,
+	SLPC_STATUS_MAX
+};
+
+enum slpc_event_id {
+	SLPC_EVENT_RESET = 0,
+	SLPC_EVENT_SHUTDOWN = 1,
+	SLPC_EVENT_PLATFORM_INFO_CHANGE = 2,
+	SLPC_EVENT_DISPLAY_MODE_CHANGE = 3,
+	SLPC_EVENT_FLIP_COMPLETE = 4,
+	SLPC_EVENT_QUERY_TASK_STATE = 5,
+	SLPC_EVENT_PARAMETER_SET = 6,
+	SLPC_EVENT_PARAMETER_UNSET = 7,
+};
+
+enum slpc_param_id {
+	SLPC_PARAM_TASK_ENABLE_GTPERF = 0,
+	SLPC_PARAM_TASK_DISABLE_GTPERF = 1,
+	SLPC_PARAM_TASK_ENABLE_BALANCER = 2,
+	SLPC_PARAM_TASK_DISABLE_BALANCER = 3,
+	SLPC_PARAM_TASK_ENABLE_DCC = 4,
+	SLPC_PARAM_TASK_DISABLE_DCC = 5,
+	SLPC_PARAM_GLOBAL_MIN_GT_UNSLICE_FREQ_MHZ = 6,
+	SLPC_PARAM_GLOBAL_MAX_GT_UNSLICE_FREQ_MHZ = 7,
+	SLPC_PARAM_GLOBAL_MIN_GT_SLICE_FREQ_MHZ = 8,
+	SLPC_PARAM_GLOBAL_MAX_GT_SLICE_FREQ_MHZ = 9,
+	SLPC_PARAM_GTPERF_THRESHOLD_MAX_FPS = 10,
+	SLPC_PARAM_GLOBAL_DISABLE_GT_FREQ_MANAGEMENT = 11,
+	SLPC_PARAM_GTPERF_ENABLE_FRAMERATE_STALLING = 12,
+	SLPC_PARAM_GLOBAL_DISABLE_RC6_MODE_CHANGE = 13,
+	SLPC_PARAM_GLOBAL_OC_UNSLICE_FREQ_MHZ = 14,
+	SLPC_PARAM_GLOBAL_OC_SLICE_FREQ_MHZ = 15,
+	SLPC_PARAM_GLOBAL_ENABLE_IA_GT_BALANCING = 16,
+	SLPC_PARAM_GLOBAL_ENABLE_ADAPTIVE_BURST_TURBO = 17,
+	SLPC_PARAM_GLOBAL_ENABLE_EVAL_MODE = 18,

drivers/gpu/drm/i915/gt/uc/intel_guc_slpc_fwif.h line 125

Quoted 10 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc_fwif.h new file +10 -0
+	SLPC_PARAM_GLOBAL_ENABLE_BALANCER_IN_NON_GAMING_MODE = 19,
+	SLPC_PARAM_GLOBAL_RT_MODE_TURBO_FREQ_DELTA_MHZ = 20,
+	SLPC_PARAM_PWRGATE_RC_MODE = 21,
+	SLPC_PARAM_EDR_MODE_COMPUTE_TIMEOUT_MS = 22,
+	SLPC_PARAM_EDR_QOS_FREQ_MHZ = 23,
+	SLPC_PARAM_MEDIA_FF_RATIO_MODE = 24,
+	SLPC_PARAM_ENABLE_IA_FREQ_LIMITING = 25,
+	SLPC_PARAM_STRATEGIES = 26,
+	SLPC_PARAM_POWER_PROFILE = 27,
+	SLPC_IGNORE_EFFICIENT_FREQUENCY = 28,

no PARAM tag inside this enum name

drivers/gpu/drm/i915/gt/uc/intel_guc_slpc_fwif.h line 126

Quoted 1 line
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc_fwif.h new file +1 -0
+	SLPC_MAX_PARAM = 32,

can we move this out of enum, maybe as standalone #define ? or remove it as doesn't seem to be useful at all

Quoted 32 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc_fwif.h new file +32 -0
+};
+
+enum slpc_global_state {
+	SLPC_GLOBAL_STATE_NOT_RUNNING = 0,
+	SLPC_GLOBAL_STATE_INITIALIZING = 1,
+	SLPC_GLOBAL_STATE_RESETTING = 2,
+	SLPC_GLOBAL_STATE_RUNNING = 3,
+	SLPC_GLOBAL_STATE_SHUTTING_DOWN = 4,
+	SLPC_GLOBAL_STATE_ERROR = 5
+};
+
+enum slpc_platform_sku {
+	SLPC_PLATFORM_SKU_UNDEFINED = 0,
+	SLPC_PLATFORM_SKU_ULX = 1,
+	SLPC_PLATFORM_SKU_ULT = 2,
+	SLPC_PLATFORM_SKU_T = 3,
+	SLPC_PLATFORM_SKU_MOBL = 4,
+	SLPC_PLATFORM_SKU_DT = 5,
+	SLPC_PLATFORM_SKU_UNKNOWN = 6,
+};
+
+struct slpc_platform_info {
+	union {
+		u32 sku;  /**< SKU info */
+		struct {
+			u32 reserved:8;
+			u32 fused_slice_count:8;
+			u32 reserved1:16;
+		};
+	};
+        union
+	{

drivers/gpu/drm/i915/gt/uc/intel_guc_slpc_fwif.h line 168

Quoted 10 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc_fwif.h new file +10 -0
+		u32 bitfield2;       /**< IA capability info*/
+		struct {
+			u32 max_p0_freq_bins:8;
+			u32 p1_freq_bins:8;
+			u32 pe_freq_bins:8;
+			u32 pn_freq_bins:8;
+		};
+	};
+	u32 reserved2[2];
+} __packed;

I'm not a big fan of using C bitfields for interface definitions

can we switch to regular #defines and use FIELD_GET|PREP ?

Quoted 28 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc_fwif.h new file +28 -0
+
+struct slpc_task_state_data {
+	union {
+		u32 bitfield1;
+		struct {
+			u32 gtperf_task_active:1;
+			u32 gtperf_stall_possible:1;
+			u32 gtperf_gaming_mode:1;
+			u32 gtperf_target_fps:8;
+			u32 dcc_task_active:1;
+			u32 in_dcc:1;
+			u32 in_dct:1;
+			u32 freq_switch_active:1;
+			u32 ibc_enabled:1;
+			u32 ibc_active:1;
+			u32 pg1_enabled:1;
+			u32 pg1_active:1;
+		};
+	};
+	union {
+		u32 bitfield2;
+		struct {
+			u32 max_unslice_freq:8;
+			u32 min_unslice_freq:8;
+			u32 max_slice_freq:8;
+			u32 min_slice_freq:8;
+		};
+	};

drivers/gpu/drm/i915/gt/uc/intel_guc_slpc_fwif.h line 206

Quoted 10 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc_fwif.h new file +10 -0
+} __packed;
+
+struct slpc_shared_data {
+	union {
+		struct {
+			/* Total size in bytes of this buffer. */
+			u32 shared_data_size;
+			u32 global_state;
+			u32 display_data_addr;
+		};

below all structs are named, this one not, why ?

drivers/gpu/drm/i915/gt/uc/intel_guc_slpc_fwif.h line 207

Quoted 1 line
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc_fwif.h new file +1 -0
+		unsigned char reserved_header[SLPC_SHARE_DATA_SIZE_BYTE_HEADER];

this could be just "u8"

and I assume all these "reserved" are in fact padding, no ?

drivers/gpu/drm/i915/gt/uc/intel_guc_slpc_fwif.h line 213

Quoted 6 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc_fwif.h new file +6 -0
+	};
+
+	union {
+		struct slpc_platform_info platform_info;
+		unsigned char reserved_platform[SLPC_SHARE_DATA_SIZE_BYTE_PLATFORM_INFO];
+	};

maybe we can avoid these unions by declaring padding explicitly:

	struct slpc_platform_info platform_info;
	u8 platform_info_pad[SLPC_SHARE_DATA_SIZE_BYTE_PLATFORM_INFO -
	                     sizeof(struct slpc_platform_info)];
Quoted 24 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc_fwif.h new file +24 -0
+
+	union {
+		struct slpc_task_state_data task_state_data;
+		unsigned char reserved_task_state[SLPC_SHARE_DATA_SIZE_BYTE_TASK_STATE];
+	};
+
+	union {
+		struct {
+		u32 override_params_set_bits[SLPC_OVERRIDE_BITFIELD_SIZE];
+		u32 override_params_values[SLPC_MAX_OVERRIDE_PARAMETERS];
+		};
+		unsigned char reserved_override_parameter[SLPC_SHARE_DATA_SIZE_BYTE_PARAM];
+	};
+
+	unsigned char reserved_other[SLPC_SHARE_DATA_SIZE_BYTE_OTHER];
+
+	/* PAGE 2 (4096 bytes), mode based parameter will be removed soon */
+	unsigned char reserved_mode_definition[4096];
+} __packed;
+
+enum slpc_reset_flags {
+	SLPC_RESET_FLAG_TDR_OCCURRED = (1 << 0)
+};
+

drivers/gpu/drm/i915/gt/uc/intel_guc_slpc_fwif.h line 247

Quoted 10 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc_fwif.h new file +10 -0
+#define SLPC_EVENT_MAX_INPUT_ARGS  9
+#define SLPC_EVENT_MAX_OUTPUT_ARGS 1
+
+union slpc_event_input_header {
+	u32 value;
+	struct {
+		u32 num_args:8;
+		u32 event_id:8;
+	};
+};

I guess earlier #define SLPC_EVENT is related to above can we keep related definitions together ?

drivers/gpu/drm/i915/gt/uc/intel_guc_slpc_fwif.h line 253

Quoted 6 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc_fwif.h new file +6 -0
+
+struct slpc_event_input {
+	u32 h2g_action_id;
+	union slpc_event_input_header header;
+	u32 args[SLPC_EVENT_MAX_INPUT_ARGS];
+} __packed;

this looks like a attempt to define details of the INTEL_GUC_ACTION_SLPC_REQUEST HXG request message.

so maybe it can be moved to abi/guc_actions_slpc_abi.h ? best if you can define it in the same fashion as CTB registration one

Michal

drivers/gpu/drm/i915/gt/uc/intel_guc_slpc_fwif.h line 255

Quoted 3 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc_fwif.h new file +2 -0
+
+#endif

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#12 lore raw

Re: [PATCH 05/16] drm/i915/guc/slpc: Adding slpc communication interfaces

Quoted 48 lines · Michal Wajdeczko
Quoted 1 line · Vinay Belgaumkar

Replicate the SLPC header file in GuC for the most part. There are

what you mean by "replicate" here?

Quoted 41 lines

some SLPC mode based parameters which haven't been included since we are not using them.

---
  drivers/gpu/drm/i915/gt/uc/intel_guc.c        |   4 +
  drivers/gpu/drm/i915/gt/uc/intel_guc_fwif.h   |   2 +
  drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.h   |   2 +
  .../gpu/drm/i915/gt/uc/intel_guc_slpc_fwif.h  | 255 ++++++++++++++++++
  4 files changed, 263 insertions(+)

create mode 100644 drivers/gpu/drm/i915/gt/uc/intel_guc_slpc_fwif.h

drivers/gpu/drm/i915/gt/uc/intel_guc.c +4 -0
index b9a809f2d221..9d61b2d54de4 100644
@@ -202,11 +202,15 @@ static u32 guc_ctl_debug_flags(struct intel_guc *guc)
 
  static u32 guc_ctl_feature_flags(struct intel_guc *guc)
  {
+	struct intel_gt *gt = guc_to_gt(guc);
  	u32 flags = 0;
 
  	if (!intel_guc_submission_is_used(guc))
  		flags |= GUC_CTL_DISABLE_SCHEDULER;
 
+	if (intel_uc_uses_guc_slpc(&gt->uc))
+		flags |= GUC_CTL_ENABLE_SLPC;
+
  	return flags;
  }
 
drivers/gpu/drm/i915/gt/uc/intel_guc_fwif.h +0 -0
index 94bb1ca6f889..19e2504d7a36 100644
@@ -114,6 +114,8 @@
  #define   GUC_ADS_ADDR_SHIFT		1
  #define   GUC_ADS_ADDR_MASK		(0xFFFFF << GUC_ADS_ADDR_SHIFT)
 
Quoted 3 lines

drivers/gpu/drm/i915/gt/uc/intel_guc_fwif.h line 117

Quoted 1 line
drivers/gpu/drm/i915/gt/uc/intel_guc_fwif.h +1 -0
+#define GUC_CTL_ENABLE_SLPC            BIT(2)

this should be defined closer to GUC_CTL_FEATURE

done.

Quoted 13 lines
Quoted 13 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_fwif.h +1 -0
+
  #define GUC_CTL_MAX_DWORDS		(SOFT_SCRATCH_COUNT - 2) /* [1..14] */
 
  /* Generic GT SysInfo data types */
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.h +0 -0
index 74fd86769163..98036459a1a3 100644
@@ -6,6 +6,8 @@
  #ifndef _INTEL_GUC_SLPC_H_
  #define _INTEL_GUC_SLPC_H_
 
Quoted 3 lines

drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.h line 9

Quoted 1 line
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.h +1 -0
+#include "intel_guc_slpc_fwif.h"

doesn't seem to be needed right now

Removed for this patch.

Quoted 14 lines

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

Quoted 10 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.h +1 -0
+
  struct intel_guc_slpc {
  };
 
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc_fwif.h new file +0 -0
new file mode 100644
index 000000000000..2a5e71428374

I've started to move all pure ABI definitions to files in abi/ folder, leaving in guc_fwif.h only our next level helpers/wrappers.

Quoted 3 lines

Can you move these SLPC definition there too ? maybe as dedicated:

abi/guc_slpc_abi.h

done.

Quoted 24 lines

drivers/gpu/drm/i915/gt/uc/intel_guc_slpc_fwif.h line 2

Quoted 4 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc_fwif.h new file +2 -0
@@ -0,0 +1,255 @@
+/*
+ * SPDX-License-Identifier: MIT

use proper format

drivers/gpu/drm/i915/gt/uc/intel_guc_slpc_fwif.h line 4

Quoted 2 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc_fwif.h new file +2 -0
+ *
+ * Copyright © 2020 Intel Corporation

2021

drivers/gpu/drm/i915/gt/uc/intel_guc_slpc_fwif.h line 13

Quoted 9 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc_fwif.h new file +9 -0
+ */
+#ifndef _INTEL_GUC_SLPC_FWIF_H_
+#define _INTEL_GUC_SLPC_FWIF_H_
+
+#include <linux/types.h>
+
+/* This file replicates the header in GuC code for handling SLPC related
+ * data structures and sizes
+ */

use proper format for multi-line comments:

Quoted 4 lines
	/*
	 * blah blah
	 * blah blah
	 */

done.

Quoted 15 lines
Quoted 15 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc_fwif.h new file +14 -0
+
+/* SLPC exposes certain parameters for global configuration by the host.
+ * These are referred to as override parameters, because in most cases
+ * the host will not need to modify the default values used by SLPC.
+ * SLPC remembers the default values which allows the host to easily restore
+ * them by simply unsetting the override. The host can set or unset override
+ * parameters during SLPC (re-)initialization using the SLPC Reset event.
+ * The host can also set or unset override parameters on the fly using the
+ * Parameter Set and Parameter Unset events
+ */
+#define SLPC_MAX_OVERRIDE_PARAMETERS	256
+#define SLPC_OVERRIDE_BITFIELD_SIZE \
+		(SLPC_MAX_OVERRIDE_PARAMETERS / 32)
+
Quoted 8 lines

drivers/gpu/drm/i915/gt/uc/intel_guc_slpc_fwif.h line 33

Quoted 6 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc_fwif.h new file +6 -0
+#define SLPC_PAGE_SIZE_BYTES			4096
+#define SLPC_CACHELINE_SIZE_BYTES		64
+#define SLPC_SHARE_DATA_SIZE_BYTE_HEADER	SLPC_CACHELINE_SIZE_BYTES
+#define SLPC_SHARE_DATA_SIZE_BYTE_PLATFORM_INFO	SLPC_CACHELINE_SIZE_BYTES
+#define SLPC_SHARE_DATA_SIZE_BYTE_TASK_STATE	SLPC_CACHELINE_SIZE_BYTES
+#define SLPC_SHARE_DATA_MODE_DEFN_TABLE_SIZE	SLPC_PAGE_SIZE_BYTES

can you put some simply diagram that would describe this layout ?

done for the shared data struct.

Quoted 27 lines
Quoted 14 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc_fwif.h new file +13 -0
+
+#define SLPC_SHARE_DATA_SIZE_BYTE_MAX		(2 * SLPC_PAGE_SIZE_BYTES)
+
+/* Cacheline size aligned (Total size needed for
+ * SLPM_KMD_MAX_OVERRIDE_PARAMETERS=256 is 1088 bytes)
+ */
+#define SLPC_SHARE_DATA_SIZE_BYTE_PARAM		(((((SLPC_MAX_OVERRIDE_PARAMETERS * 4) \
+						+ ((SLPC_MAX_OVERRIDE_PARAMETERS / 32) * 4)) \
+		+ (SLPC_CACHELINE_SIZE_BYTES-1)) / SLPC_CACHELINE_SIZE_BYTES)*SLPC_CACHELINE_SIZE_BYTES)
+
+#define SLPC_SHARE_DATA_SIZE_BYTE_OTHER		(SLPC_SHARE_DATA_SIZE_BYTE_MAX - \
+					(SLPC_SHARE_DATA_SIZE_BYTE_HEADER \
+					+ SLPC_SHARE_DATA_SIZE_BYTE_PLATFORM_INFO \

drivers/gpu/drm/i915/gt/uc/intel_guc_slpc_fwif.h line 56

Quoted 10 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc_fwif.h new file +10 -0
+					+ SLPC_SHARE_DATA_SIZE_BYTE_TASK_STATE \
+					+ SLPC_SHARE_DATA_SIZE_BYTE_PARAM \
+					+ SLPC_SHARE_DATA_MODE_DEFN_TABLE_SIZE))
+
+#define SLPC_EVENT(id, argc)			((u32)(id) << 8 | (argc))
+
+#define SLPC_PARAM_TASK_DEFAULT			0
+#define SLPC_PARAM_TASK_ENABLED			1
+#define SLPC_PARAM_TASK_DISABLED		2
+#define SLPC_PARAM_TASK_UNKNOWN			3

many values below are defined as enum, why these values are #defines ?

Quoted 1 line

and is there any relation to these ones defined below (look similar)?

No, they are different, added an enum.

Quoted 80 lines

+ SLPC_PARAM_TASK_ENABLE_GTPERF = 0,
+ SLPC_PARAM_TASK_DISABLE_GTPERF = 1,
+ SLPC_PARAM_TASK_ENABLE_BALANCER = 2,
+ SLPC_PARAM_TASK_DISABLE_BALANCER = 3,
+ SLPC_PARAM_TASK_ENABLE_DCC = 4,
+ SLPC_PARAM_TASK_DISABLE_DCC = 5,

Quoted 59 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc_fwif.h new file +59 -0
+
+enum slpc_status {
+	SLPC_STATUS_OK = 0,
+	SLPC_STATUS_ERROR = 1,
+	SLPC_STATUS_ILLEGAL_COMMAND = 2,
+	SLPC_STATUS_INVALID_ARGS = 3,
+	SLPC_STATUS_INVALID_PARAMS = 4,
+	SLPC_STATUS_INVALID_DATA = 5,
+	SLPC_STATUS_OUT_OF_RANGE = 6,
+	SLPC_STATUS_NOT_SUPPORTED = 7,
+	SLPC_STATUS_NOT_IMPLEMENTED = 8,
+	SLPC_STATUS_NO_DATA = 9,
+	SLPC_STATUS_EVENT_NOT_REGISTERED = 10,
+	SLPC_STATUS_REGISTER_LOCKED = 11,
+	SLPC_STATUS_TEMPORARILY_UNAVAILABLE = 12,
+	SLPC_STATUS_VALUE_ALREADY_SET = 13,
+	SLPC_STATUS_VALUE_ALREADY_UNSET = 14,
+	SLPC_STATUS_VALUE_NOT_CHANGED = 15,
+	SLPC_STATUS_MEMIO_ERROR = 16,
+	SLPC_STATUS_EVENT_QUEUED_REQ_DPC = 17,
+	SLPC_STATUS_EVENT_QUEUED_NOREQ_DPC = 18,
+	SLPC_STATUS_NO_EVENT_QUEUED = 19,
+	SLPC_STATUS_OUT_OF_SPACE = 20,
+	SLPC_STATUS_TIMEOUT = 21,
+	SLPC_STATUS_NO_LOCK = 22,
+	SLPC_STATUS_MAX
+};
+
+enum slpc_event_id {
+	SLPC_EVENT_RESET = 0,
+	SLPC_EVENT_SHUTDOWN = 1,
+	SLPC_EVENT_PLATFORM_INFO_CHANGE = 2,
+	SLPC_EVENT_DISPLAY_MODE_CHANGE = 3,
+	SLPC_EVENT_FLIP_COMPLETE = 4,
+	SLPC_EVENT_QUERY_TASK_STATE = 5,
+	SLPC_EVENT_PARAMETER_SET = 6,
+	SLPC_EVENT_PARAMETER_UNSET = 7,
+};
+
+enum slpc_param_id {
+	SLPC_PARAM_TASK_ENABLE_GTPERF = 0,
+	SLPC_PARAM_TASK_DISABLE_GTPERF = 1,
+	SLPC_PARAM_TASK_ENABLE_BALANCER = 2,
+	SLPC_PARAM_TASK_DISABLE_BALANCER = 3,
+	SLPC_PARAM_TASK_ENABLE_DCC = 4,
+	SLPC_PARAM_TASK_DISABLE_DCC = 5,
+	SLPC_PARAM_GLOBAL_MIN_GT_UNSLICE_FREQ_MHZ = 6,
+	SLPC_PARAM_GLOBAL_MAX_GT_UNSLICE_FREQ_MHZ = 7,
+	SLPC_PARAM_GLOBAL_MIN_GT_SLICE_FREQ_MHZ = 8,
+	SLPC_PARAM_GLOBAL_MAX_GT_SLICE_FREQ_MHZ = 9,
+	SLPC_PARAM_GTPERF_THRESHOLD_MAX_FPS = 10,
+	SLPC_PARAM_GLOBAL_DISABLE_GT_FREQ_MANAGEMENT = 11,
+	SLPC_PARAM_GTPERF_ENABLE_FRAMERATE_STALLING = 12,
+	SLPC_PARAM_GLOBAL_DISABLE_RC6_MODE_CHANGE = 13,
+	SLPC_PARAM_GLOBAL_OC_UNSLICE_FREQ_MHZ = 14,
+	SLPC_PARAM_GLOBAL_OC_SLICE_FREQ_MHZ = 15,
+	SLPC_PARAM_GLOBAL_ENABLE_IA_GT_BALANCING = 16,
+	SLPC_PARAM_GLOBAL_ENABLE_ADAPTIVE_BURST_TURBO = 17,
+	SLPC_PARAM_GLOBAL_ENABLE_EVAL_MODE = 18,

drivers/gpu/drm/i915/gt/uc/intel_guc_slpc_fwif.h line 125

Quoted 10 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc_fwif.h new file +10 -0
+	SLPC_PARAM_GLOBAL_ENABLE_BALANCER_IN_NON_GAMING_MODE = 19,
+	SLPC_PARAM_GLOBAL_RT_MODE_TURBO_FREQ_DELTA_MHZ = 20,
+	SLPC_PARAM_PWRGATE_RC_MODE = 21,
+	SLPC_PARAM_EDR_MODE_COMPUTE_TIMEOUT_MS = 22,
+	SLPC_PARAM_EDR_QOS_FREQ_MHZ = 23,
+	SLPC_PARAM_MEDIA_FF_RATIO_MODE = 24,
+	SLPC_PARAM_ENABLE_IA_FREQ_LIMITING = 25,
+	SLPC_PARAM_STRATEGIES = 26,
+	SLPC_PARAM_POWER_PROFILE = 27,
+	SLPC_IGNORE_EFFICIENT_FREQUENCY = 28,

no PARAM tag inside this enum name

Quoted 4 lines

drivers/gpu/drm/i915/gt/uc/intel_guc_slpc_fwif.h line 126

Quoted 1 line
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc_fwif.h new file +1 -0
+	SLPC_MAX_PARAM = 32,

can we move this out of enum, maybe as standalone #define ? or remove it as doesn't seem to be useful at all

Added PARAM tag, it needs to be part of this.

Quoted 46 lines
Quoted 33 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc_fwif.h new file +32 -0
+};
+
+enum slpc_global_state {
+	SLPC_GLOBAL_STATE_NOT_RUNNING = 0,
+	SLPC_GLOBAL_STATE_INITIALIZING = 1,
+	SLPC_GLOBAL_STATE_RESETTING = 2,
+	SLPC_GLOBAL_STATE_RUNNING = 3,
+	SLPC_GLOBAL_STATE_SHUTTING_DOWN = 4,
+	SLPC_GLOBAL_STATE_ERROR = 5
+};
+
+enum slpc_platform_sku {
+	SLPC_PLATFORM_SKU_UNDEFINED = 0,
+	SLPC_PLATFORM_SKU_ULX = 1,
+	SLPC_PLATFORM_SKU_ULT = 2,
+	SLPC_PLATFORM_SKU_T = 3,
+	SLPC_PLATFORM_SKU_MOBL = 4,
+	SLPC_PLATFORM_SKU_DT = 5,
+	SLPC_PLATFORM_SKU_UNKNOWN = 6,
+};
+
+struct slpc_platform_info {
+	union {
+		u32 sku;  /**< SKU info */
+		struct {
+			u32 reserved:8;
+			u32 fused_slice_count:8;
+			u32 reserved1:16;
+		};
+	};
+        union
+	{

drivers/gpu/drm/i915/gt/uc/intel_guc_slpc_fwif.h line 168

Quoted 10 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc_fwif.h new file +10 -0
+		u32 bitfield2;       /**< IA capability info*/
+		struct {
+			u32 max_p0_freq_bins:8;
+			u32 p1_freq_bins:8;
+			u32 pe_freq_bins:8;
+			u32 pn_freq_bins:8;
+		};
+	};
+	u32 reserved2[2];
+} __packed;

I'm not a big fan of using C bitfields for interface definitions

Quoted 1 line

can we switch to regular #defines and use FIELD_GET|PREP ?

Done.

Quoted 109 lines
Quoted 29 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc_fwif.h new file +28 -0
+
+struct slpc_task_state_data {
+	union {
+		u32 bitfield1;
+		struct {
+			u32 gtperf_task_active:1;
+			u32 gtperf_stall_possible:1;
+			u32 gtperf_gaming_mode:1;
+			u32 gtperf_target_fps:8;
+			u32 dcc_task_active:1;
+			u32 in_dcc:1;
+			u32 in_dct:1;
+			u32 freq_switch_active:1;
+			u32 ibc_enabled:1;
+			u32 ibc_active:1;
+			u32 pg1_enabled:1;
+			u32 pg1_active:1;
+		};
+	};
+	union {
+		u32 bitfield2;
+		struct {
+			u32 max_unslice_freq:8;
+			u32 min_unslice_freq:8;
+			u32 max_slice_freq:8;
+			u32 min_slice_freq:8;
+		};
+	};

drivers/gpu/drm/i915/gt/uc/intel_guc_slpc_fwif.h line 206

Quoted 10 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc_fwif.h new file +10 -0
+} __packed;
+
+struct slpc_shared_data {
+	union {
+		struct {
+			/* Total size in bytes of this buffer. */
+			u32 shared_data_size;
+			u32 global_state;
+			u32 display_data_addr;
+		};

below all structs are named, this one not, why ?

drivers/gpu/drm/i915/gt/uc/intel_guc_slpc_fwif.h line 207

Quoted 1 line
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc_fwif.h new file +1 -0
+		unsigned char reserved_header[SLPC_SHARE_DATA_SIZE_BYTE_HEADER];

this could be just "u8"

and I assume all these "reserved" are in fact padding, no ?

drivers/gpu/drm/i915/gt/uc/intel_guc_slpc_fwif.h line 213

Quoted 6 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc_fwif.h new file +6 -0
+	};
+
+	union {
+		struct slpc_platform_info platform_info;
+		unsigned char reserved_platform[SLPC_SHARE_DATA_SIZE_BYTE_PLATFORM_INFO];
+	};

maybe we can avoid these unions by declaring padding explicitly:

	struct slpc_platform_info platform_info;
	u8 platform_info_pad[SLPC_SHARE_DATA_SIZE_BYTE_PLATFORM_INFO -
	                     sizeof(struct slpc_platform_info)];
Quoted 24 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc_fwif.h new file +24 -0
+
+	union {
+		struct slpc_task_state_data task_state_data;
+		unsigned char reserved_task_state[SLPC_SHARE_DATA_SIZE_BYTE_TASK_STATE];
+	};
+
+	union {
+		struct {
+		u32 override_params_set_bits[SLPC_OVERRIDE_BITFIELD_SIZE];
+		u32 override_params_values[SLPC_MAX_OVERRIDE_PARAMETERS];
+		};
+		unsigned char reserved_override_parameter[SLPC_SHARE_DATA_SIZE_BYTE_PARAM];
+	};
+
+	unsigned char reserved_other[SLPC_SHARE_DATA_SIZE_BYTE_OTHER];
+
+	/* PAGE 2 (4096 bytes), mode based parameter will be removed soon */
+	unsigned char reserved_mode_definition[4096];
+} __packed;
+
+enum slpc_reset_flags {
+	SLPC_RESET_FLAG_TDR_OCCURRED = (1 << 0)
+};
+

drivers/gpu/drm/i915/gt/uc/intel_guc_slpc_fwif.h line 247

Quoted 10 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc_fwif.h new file +10 -0
+#define SLPC_EVENT_MAX_INPUT_ARGS  9
+#define SLPC_EVENT_MAX_OUTPUT_ARGS 1
+
+union slpc_event_input_header {
+	u32 value;
+	struct {
+		u32 num_args:8;
+		u32 event_id:8;
+	};
+};

I guess earlier #define SLPC_EVENT is related to above can we keep related definitions together ?

drivers/gpu/drm/i915/gt/uc/intel_guc_slpc_fwif.h line 253

Quoted 6 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc_fwif.h new file +6 -0
+
+struct slpc_event_input {
+	u32 h2g_action_id;
+	union slpc_event_input_header header;
+	u32 args[SLPC_EVENT_MAX_INPUT_ARGS];
+} __packed;

this looks like a attempt to define details of the INTEL_GUC_ACTION_SLPC_REQUEST HXG request message.

Quoted 3 lines

so maybe it can be moved to abi/guc_actions_slpc_abi.h ? best if you can define it in the same fashion as CTB registration one

Moved all this to the slpc_abi file and removed the fwif file for now.

Thanks,
Vinay.

Quoted 5 lines

Michal

Quoted 3 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc_fwif.h new file +2 -0
+
+#endif
#13 lore raw

PATCH 6/16 drm/i915/guc/slpc: Allocate, initialize and release slpc

In reply to Vinay Belgaumkar

Allocate data structures for SLPC and functions for initializing on host side.

---
 drivers/gpu/drm/i915/gt/uc/intel_guc.c      | 11 +++++++
 drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c | 36 ++++++++++++++++++++-
 drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.h | 20 ++++++++++++
 3 files changed, 66 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/gt/uc/intel_guc.c +11 -0
index 9d61b2d54de4..82863a9bc8e8 100644
@@ -336,6 +336,12 @@ int intel_guc_init(struct intel_guc *guc)
 			goto err_ct;
 	}
 
+	if (intel_guc_slpc_is_used(guc)) {
+		ret = intel_guc_slpc_init(&guc->slpc);
+		if (ret)
+			goto err_submission;
+	}
+
 	/* now that everything is perma-pinned, initialize the parameters */
 	guc_init_params(guc);
 
@@ -346,6 +352,8 @@ int intel_guc_init(struct intel_guc *guc)
 
 	return 0;
 
+err_submission:
+	intel_guc_submission_fini(guc);
 err_ct:
 	intel_guc_ct_fini(&guc->ct);
 err_ads:
@@ -368,6 +376,9 @@ void intel_guc_fini(struct intel_guc *guc)
 
 	i915_ggtt_disable_guc(gt->ggtt);
 
+	if (intel_guc_slpc_is_used(guc))
+		intel_guc_slpc_fini(&guc->slpc);
+
 	if (intel_guc_submission_is_used(guc))
 		intel_guc_submission_fini(guc);
 
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c +35 -1
index c1f569d2300d..94e2f19951aa 100644
@@ -4,11 +4,41 @@
  * Copyright © 2020 Intel Corporation
  */
 
+#include <asm/msr-index.h>
+
+#include "gt/intel_gt.h"
+#include "gt/intel_rps.h"
+
+#include "i915_drv.h"
 #include "intel_guc_slpc.h"
+#include "intel_pm.h"
+
+static inline struct intel_guc *slpc_to_guc(struct intel_guc_slpc *slpc)
+{
+	return container_of(slpc, struct intel_guc, slpc);
+}
+
+static int slpc_shared_data_init(struct intel_guc_slpc *slpc)
+{
+	struct intel_guc *guc = slpc_to_guc(slpc);
+	int err;
+	u32 size = PAGE_ALIGN(sizeof(struct slpc_shared_data));
+
+	err = intel_guc_allocate_and_map_vma(guc, size, &slpc->vma, &slpc->vaddr);
+	if (unlikely(err)) {
+		DRM_ERROR("Failed to allocate slpc struct (err=%d)\n", err);
+		i915_vma_unpin_and_release(&slpc->vma, I915_VMA_RELEASE_MAP);
+		return err;
+	}
+
+	return err;
+}
 
 int intel_guc_slpc_init(struct intel_guc_slpc *slpc)
 {
-	return 0;
+	GEM_BUG_ON(slpc->vma);
+
+	return slpc_shared_data_init(slpc);
 }
 
 /*
@@ -31,4 +61,8 @@ int intel_guc_slpc_enable(struct intel_guc_slpc *slpc)
 
 void intel_guc_slpc_fini(struct intel_guc_slpc *slpc)
 {
+	if (!slpc->vma)
+		return;
+
+	i915_vma_unpin_and_release(&slpc->vma, I915_VMA_RELEASE_MAP);
 }
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.h +20 -0
index 98036459a1a3..a2643b904165 100644
@@ -3,12 +3,32 @@
  *
  * Copyright © 2020 Intel Corporation
  */
+
 #ifndef _INTEL_GUC_SLPC_H_
 #define _INTEL_GUC_SLPC_H_
 
+#include <linux/mutex.h>
 #include "intel_guc_slpc_fwif.h"
 
 struct intel_guc_slpc {
+	/*Protects access to vma and SLPC actions */
+	struct i915_vma *vma;
+	void *vaddr;
+
+	/* platform frequency limits */
+	u32 min_freq;
+	u32 rp0_freq;
+	u32 rp1_freq;
+
+	/* frequency softlimits */
+	u32 min_freq_softlimit;
+	u32 max_freq_softlimit;
+
+	struct {
+		u32 param_id;
+		u32 param_value;
+		u32 param_override;
+	} debug;
 };
 
 int intel_guc_slpc_init(struct intel_guc_slpc *slpc);
Signature · 6 lines
2.25.0

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#14 lore raw

Re: [PATCH 06/16] drm/i915/guc/slpc: Allocate, initialize and release slpc

Quoted 52 lines · Vinay Belgaumkar

Allocate data structures for SLPC and functions for initializing on host side.

---
 drivers/gpu/drm/i915/gt/uc/intel_guc.c      | 11 +++++++
 drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c | 36 ++++++++++++++++++++-
 drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.h | 20 ++++++++++++
 3 files changed, 66 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/gt/uc/intel_guc.c +11 -0
index 9d61b2d54de4..82863a9bc8e8 100644
@@ -336,6 +336,12 @@ int intel_guc_init(struct intel_guc *guc)
 			goto err_ct;
 	}
 
+	if (intel_guc_slpc_is_used(guc)) {
+		ret = intel_guc_slpc_init(&guc->slpc);
+		if (ret)
+			goto err_submission;
+	}
+
 	/* now that everything is perma-pinned, initialize the parameters */
 	guc_init_params(guc);
 
@@ -346,6 +352,8 @@ int intel_guc_init(struct intel_guc *guc)
 
 	return 0;
 
+err_submission:
+	intel_guc_submission_fini(guc);
 err_ct:
 	intel_guc_ct_fini(&guc->ct);
 err_ads:
@@ -368,6 +376,9 @@ void intel_guc_fini(struct intel_guc *guc)
 
 	i915_ggtt_disable_guc(gt->ggtt);
 
+	if (intel_guc_slpc_is_used(guc))
+		intel_guc_slpc_fini(&guc->slpc);
+
 	if (intel_guc_submission_is_used(guc))
 		intel_guc_submission_fini(guc);
 
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c +0 -0
index c1f569d2300d..94e2f19951aa 100644

drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c line 7

Quoted 4 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c +1 -0
@@ -4,11 +4,41 @@
  * Copyright © 2020 Intel Corporation
  */
 
+#include <asm/msr-index.h>

hmm, what exactly is needed from this header ?

Quoted 8 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c +7 -0
+
+#include "gt/intel_gt.h"
+#include "gt/intel_rps.h"
+
+#include "i915_drv.h"
 #include "intel_guc_slpc.h"
+#include "intel_pm.h"
+

drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c line 25

Quoted 10 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c +10 -0
+static inline struct intel_guc *slpc_to_guc(struct intel_guc_slpc *slpc)
+{
+	return container_of(slpc, struct intel_guc, slpc);
+}
+
+static int slpc_shared_data_init(struct intel_guc_slpc *slpc)
+{
+	struct intel_guc *guc = slpc_to_guc(slpc);
+	int err;
+	u32 size = PAGE_ALIGN(sizeof(struct slpc_shared_data));

move err decl here

drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c line 29

Quoted 4 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c +4 -0
+
+	err = intel_guc_allocate_and_map_vma(guc, size, &slpc->vma, &slpc->vaddr);
+	if (unlikely(err)) {
+		DRM_ERROR("Failed to allocate slpc struct (err=%d)\n", err);

s/slpc/SLPC

and use drm_err instead
and you may also want to print error as %pe

drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c line 30

Quoted 1 line
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c +1 -0
+		i915_vma_unpin_and_release(&slpc->vma, I915_VMA_RELEASE_MAP);

do you really need this ?

Quoted 29 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c +12 -1
+		return err;
+	}
+
+	return err;
+}
 
 int intel_guc_slpc_init(struct intel_guc_slpc *slpc)
 {
-	return 0;
+	GEM_BUG_ON(slpc->vma);
+
+	return slpc_shared_data_init(slpc);
 }
 
 /*
@@ -31,4 +61,8 @@ int intel_guc_slpc_enable(struct intel_guc_slpc *slpc)
 
 void intel_guc_slpc_fini(struct intel_guc_slpc *slpc)
 {
+	if (!slpc->vma)
+		return;
+
+	i915_vma_unpin_and_release(&slpc->vma, I915_VMA_RELEASE_MAP);
 }
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.h +0 -0
index 98036459a1a3..a2643b904165 100644

drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.h line 6

Quoted 4 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.h +1 -0
@@ -3,12 +3,32 @@
  *
  * Copyright © 2020 Intel Corporation
  */
+

should be fixed in earlier patch

drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.h line 14

Quoted 8 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.h +2 -0
 #ifndef _INTEL_GUC_SLPC_H_
 #define _INTEL_GUC_SLPC_H_
 
+#include <linux/mutex.h>
 #include "intel_guc_slpc_fwif.h"
 
 struct intel_guc_slpc {
+	/*Protects access to vma and SLPC actions */

hmm, missing mutex ;)

drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.h line 16

Quoted 2 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.h +2 -0
+	struct i915_vma *vma;
+	void *vaddr;

no need to be void, define it as ptr to slpc_shared_data

Quoted 5 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.h +5 -0
+
+	/* platform frequency limits */
+	u32 min_freq;
+	u32 rp0_freq;
+	u32 rp1_freq;

drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.h line 31

Quoted 10 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.h +10 -0
+
+	/* frequency softlimits */
+	u32 min_freq_softlimit;
+	u32 max_freq_softlimit;
+
+	struct {
+		u32 param_id;
+		u32 param_value;
+		u32 param_override;
+	} debug;

can you add all these extra fields in patches which will need them?

Michal

Quoted 4 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.h +0 -0
 };
 
 int intel_guc_slpc_init(struct intel_guc_slpc *slpc);
#15 lore raw

Re: [PATCH 06/16] drm/i915/guc/slpc: Allocate, initialize and release slpc

Quoted 58 lines · Michal Wajdeczko
Quoted 55 lines · Vinay Belgaumkar

Allocate data structures for SLPC and functions for initializing on host side.

---
  drivers/gpu/drm/i915/gt/uc/intel_guc.c      | 11 +++++++
  drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c | 36 ++++++++++++++++++++-
  drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.h | 20 ++++++++++++
  3 files changed, 66 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/gt/uc/intel_guc.c +11 -0
index 9d61b2d54de4..82863a9bc8e8 100644
@@ -336,6 +336,12 @@ int intel_guc_init(struct intel_guc *guc)
  			goto err_ct;
  	}
 
+	if (intel_guc_slpc_is_used(guc)) {
+		ret = intel_guc_slpc_init(&guc->slpc);
+		if (ret)
+			goto err_submission;
+	}
+
  	/* now that everything is perma-pinned, initialize the parameters */
  	guc_init_params(guc);
 
@@ -346,6 +352,8 @@ int intel_guc_init(struct intel_guc *guc)
 
  	return 0;
 
+err_submission:
+	intel_guc_submission_fini(guc);
  err_ct:
  	intel_guc_ct_fini(&guc->ct);
  err_ads:
@@ -368,6 +376,9 @@ void intel_guc_fini(struct intel_guc *guc)
 
  	i915_ggtt_disable_guc(gt->ggtt);
 
+	if (intel_guc_slpc_is_used(guc))
+		intel_guc_slpc_fini(&guc->slpc);
+
  	if (intel_guc_submission_is_used(guc))
  		intel_guc_submission_fini(guc);
 
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c +0 -0
index c1f569d2300d..94e2f19951aa 100644
@@ -4,11 +4,41 @@
   * Copyright © 2020 Intel Corporation
   */
 
Quoted 3 lines

drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c line 7

Quoted 1 line
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c +1 -0
+#include <asm/msr-index.h>

hmm, what exactly is needed from this header ?

Was being used in a previous version for MSR reads, removed.

Quoted 29 lines
Quoted 9 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c +7 -0
+
+#include "gt/intel_gt.h"
+#include "gt/intel_rps.h"
+
+#include "i915_drv.h"
  #include "intel_guc_slpc.h"
+#include "intel_pm.h"
+

drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c line 25

Quoted 10 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c +10 -0
+static inline struct intel_guc *slpc_to_guc(struct intel_guc_slpc *slpc)
+{
+	return container_of(slpc, struct intel_guc, slpc);
+}
+
+static int slpc_shared_data_init(struct intel_guc_slpc *slpc)
+{
+	struct intel_guc *guc = slpc_to_guc(slpc);
+	int err;
+	u32 size = PAGE_ALIGN(sizeof(struct slpc_shared_data));

move err decl here

drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c line 29

Quoted 4 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c +4 -0
+
+	err = intel_guc_allocate_and_map_vma(guc, size, &slpc->vma, &slpc->vaddr);
+	if (unlikely(err)) {
+		DRM_ERROR("Failed to allocate slpc struct (err=%d)\n", err);

s/slpc/SLPC

Quoted 2 lines

and use drm_err instead
and you may also want to print error as %pe

added.

Quoted 4 lines

drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c line 30

Quoted 2 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c +1 -0
+		i915_vma_unpin_and_release(&slpc->vma, I915_VMA_RELEASE_MAP);

do you really need this ?

removed.

Quoted 40 lines
Quoted 30 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c +12 -1
+		return err;
+	}
+
+	return err;
+}
 
  int intel_guc_slpc_init(struct intel_guc_slpc *slpc)
  {
-	return 0;
+	GEM_BUG_ON(slpc->vma);
+
+	return slpc_shared_data_init(slpc);
  }
 
  /*
@@ -31,4 +61,8 @@ int intel_guc_slpc_enable(struct intel_guc_slpc *slpc)
 
  void intel_guc_slpc_fini(struct intel_guc_slpc *slpc)
  {
+	if (!slpc->vma)
+		return;
+
+	i915_vma_unpin_and_release(&slpc->vma, I915_VMA_RELEASE_MAP);
  }
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.h +0 -0
index 98036459a1a3..a2643b904165 100644

drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.h line 6

Quoted 4 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.h +1 -0
@@ -3,12 +3,32 @@
   *
   * Copyright © 2020 Intel Corporation
   */
+

should be fixed in earlier patch

Quoted 3 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.h +0 -0
  #ifndef _INTEL_GUC_SLPC_H_
  #define _INTEL_GUC_SLPC_H_
 
Quoted 7 lines

drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.h line 14

Quoted 5 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.h +2 -0
+#include <linux/mutex.h>
  #include "intel_guc_slpc_fwif.h"
 
  struct intel_guc_slpc {
+	/*Protects access to vma and SLPC actions */

hmm, missing mutex ;)

Removed.

Quoted 24 lines

drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.h line 16

Quoted 3 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.h +2 -0
+	struct i915_vma *vma;
+	void *vaddr;

no need to be void, define it as ptr to slpc_shared_data

Quoted 5 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.h +5 -0
+
+	/* platform frequency limits */
+	u32 min_freq;
+	u32 rp0_freq;
+	u32 rp1_freq;

drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.h line 31

Quoted 10 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.h +10 -0
+
+	/* frequency softlimits */
+	u32 min_freq_softlimit;
+	u32 max_freq_softlimit;
+
+	struct {
+		u32 param_id;
+		u32 param_value;
+		u32 param_override;
+	} debug;

can you add all these extra fields in patches which will need them?

Quoted 1 line

Michal

Done.

Thanks,
Vinay.

Quoted 6 lines

drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.h line 34

Quoted 5 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.h +0 -0
  };
 
  int intel_guc_slpc_init(struct intel_guc_slpc *slpc);

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#16 lore raw

PATCH 7/16 drm/i915/guc/slpc: Enable slpc and add related H2G events

In reply to Vinay Belgaumkar

Add methods for interacting with guc for enabling SLPC. Enable SLPC after guc submission has been established. GuC load will fail if SLPC cannot be successfully initialized. Add various helper methods to set/unset the parameters for SLPC. They can be set using h2g calls or directly setting bits in the shared data structure.

---
 drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c   | 221 ++++++++++++++++++
 .../gpu/drm/i915/gt/uc/intel_guc_submission.c |   4 -
 drivers/gpu/drm/i915/gt/uc/intel_uc.c         |  10 +
 3 files changed, 231 insertions(+), 4 deletions(-)
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c +221 -0
index 94e2f19951aa..e579408d1c19 100644
@@ -18,6 +18,61 @@ static inline struct intel_guc *slpc_to_guc(struct intel_guc_slpc *slpc)
 	return container_of(slpc, struct intel_guc, slpc);
 }
 
+static inline struct intel_gt *slpc_to_gt(struct intel_guc_slpc *slpc)
+{
+	return guc_to_gt(slpc_to_guc(slpc));
+}
+
+static inline struct drm_i915_private *slpc_to_i915(struct intel_guc_slpc *slpc)
+{
+	return (slpc_to_gt(slpc))->i915;
+}
+
+static void slpc_mem_set_param(struct slpc_shared_data *data,
+				u32 id, u32 value)
+{
+	GEM_BUG_ON(id >= SLPC_MAX_OVERRIDE_PARAMETERS);
+	/* When the flag bit is set, corresponding value will be read
+	 * and applied by slpc.
+	 */
+	data->override_params_set_bits[id >> 5] |= (1 << (id % 32));
+	data->override_params_values[id] = value;
+}
+
+static void slpc_mem_unset_param(struct slpc_shared_data *data,
+				 u32 id)
+{
+	GEM_BUG_ON(id >= SLPC_MAX_OVERRIDE_PARAMETERS);
+	/* When the flag bit is unset, corresponding value will not be
+	 * read by slpc.
+	 */
+	data->override_params_set_bits[id >> 5] &= (~(1 << (id % 32)));
+	data->override_params_values[id] = 0;
+}
+
+static void slpc_mem_task_control(struct slpc_shared_data *data,
+				 u64 val, u32 enable_id, u32 disable_id)
+{
+	/* Enabling a param involves setting the enable_id
+	 * to 1 and disable_id to 0. Setting it to default
+	 * will unset both enable and disable ids and let
+	 * slpc choose it's default values.
+	 */
+	if (val == SLPC_PARAM_TASK_DEFAULT) {
+		/* set default */
+		slpc_mem_unset_param(data, enable_id);
+		slpc_mem_unset_param(data, disable_id);
+	} else if (val == SLPC_PARAM_TASK_ENABLED) {
+		/* set enable */
+		slpc_mem_set_param(data, enable_id, 1);
+		slpc_mem_set_param(data, disable_id, 0);
+	} else if (val == SLPC_PARAM_TASK_DISABLED) {
+		/* set disable */
+		slpc_mem_set_param(data, disable_id, 1);
+		slpc_mem_set_param(data, enable_id, 0);
+	}
+}
+
 static int slpc_shared_data_init(struct intel_guc_slpc *slpc)
 {
 	struct intel_guc *guc = slpc_to_guc(slpc);
@@ -34,6 +89,128 @@ static int slpc_shared_data_init(struct intel_guc_slpc *slpc)
 	return err;
 }
 
+/*
+ * Send SLPC event to guc
+ *
+ */
+static int slpc_send(struct intel_guc_slpc *slpc,
+			struct slpc_event_input *input,
+			u32 in_len)
+{
+	struct intel_guc *guc = slpc_to_guc(slpc);
+	u32 *action;
+
+	action = (u32 *)input;
+	action[0] = INTEL_GUC_ACTION_SLPC_REQUEST;
+
+	return intel_guc_send(guc, action, in_len);
+}
+
+static bool slpc_running(struct intel_guc_slpc *slpc)
+{
+	struct slpc_shared_data *data;
+	u32 slpc_global_state;
+
+	GEM_BUG_ON(!slpc->vma);
+
+	drm_clflush_virt_range(slpc->vaddr, sizeof(struct slpc_shared_data));
+	data = slpc->vaddr;
+
+	slpc_global_state = data->global_state;
+
+	return (data->global_state == SLPC_GLOBAL_STATE_RUNNING);
+}
+
+static int host2guc_slpc_query_task_state(struct intel_guc_slpc *slpc)
+{
+	struct intel_guc *guc = slpc_to_guc(slpc);
+	u32 shared_data_gtt_offset = intel_guc_ggtt_offset(guc, slpc->vma);
+	struct slpc_event_input data = {0};
+
+	data.header.value = SLPC_EVENT(SLPC_EVENT_QUERY_TASK_STATE, 2);
+	data.args[0] = shared_data_gtt_offset;
+	data.args[1] = 0;
+
+	return slpc_send(slpc, &data, 4);
+}
+
+static int slpc_read_task_state(struct intel_guc_slpc *slpc)
+{
+	return host2guc_slpc_query_task_state(slpc);
+}
+
+static const char *slpc_state_stringify(enum slpc_global_state state)
+{
+	const char *str = NULL;
+
+	switch (state) {
+	case SLPC_GLOBAL_STATE_NOT_RUNNING:
+		str = "not running";
+		break;
+	case SLPC_GLOBAL_STATE_INITIALIZING:
+		str = "initializing";
+		break;
+	case SLPC_GLOBAL_STATE_RESETTING:
+		str = "resetting";
+		break;
+	case SLPC_GLOBAL_STATE_RUNNING:
+		str = "running";
+		break;
+	case SLPC_GLOBAL_STATE_SHUTTING_DOWN:
+		str = "shutting down";
+		break;
+	case SLPC_GLOBAL_STATE_ERROR:
+		str = "error";
+		break;
+	default:
+		str = "unknown";
+		break;
+	}
+
+	return str;
+}
+
+static const char *get_slpc_state(struct intel_guc_slpc *slpc)
+{
+	struct slpc_shared_data *data;
+	u32 slpc_global_state;
+
+	GEM_BUG_ON(!slpc->vma);
+
+	drm_clflush_virt_range(slpc->vaddr, sizeof(struct slpc_shared_data));
+	data = slpc->vaddr;
+
+	slpc_global_state = data->global_state;
+
+	return slpc_state_stringify(slpc_global_state);
+}
+
+static int host2guc_slpc_reset(struct intel_guc_slpc *slpc)
+{
+	struct intel_guc *guc = slpc_to_guc(slpc);
+	u32 shared_data_gtt_offset = intel_guc_ggtt_offset(guc, slpc->vma);
+	struct slpc_event_input data = {0};
+	int ret;
+
+	data.header.value = SLPC_EVENT(SLPC_EVENT_RESET, 2);
+	data.args[0] = shared_data_gtt_offset;
+	data.args[1] = 0;
+
+	/* TODO: Hardcoded 4 needs define */
+	ret = slpc_send(slpc, &data, 4);
+
+	if (!ret) {
+		/* TODO: How long to Wait until SLPC is running */
+		if (wait_for(slpc_running(slpc), 5)) {
+			DRM_ERROR("SLPC not enabled! State = %s\n",
+				  get_slpc_state(slpc));
+			return -EIO;
+		}
+	}
+
+	return ret;
+}
+
 int intel_guc_slpc_init(struct intel_guc_slpc *slpc)
 {
 	GEM_BUG_ON(slpc->vma);
@@ -56,6 +233,50 @@ int intel_guc_slpc_init(struct intel_guc_slpc *slpc)
  */
 int intel_guc_slpc_enable(struct intel_guc_slpc *slpc)
 {
+	struct drm_i915_private *i915 = slpc_to_i915(slpc);
+	struct slpc_shared_data *data;
+	int ret;
+
+	GEM_BUG_ON(!slpc->vma);
+
+	memset(slpc->vaddr, 0, sizeof(struct slpc_shared_data));
+
+	data = slpc->vaddr;
+	data->shared_data_size = sizeof(struct slpc_shared_data);
+
+	/* Enable only GTPERF task, Disable others */
+	slpc_mem_task_control(data, SLPC_PARAM_TASK_ENABLED,
+				SLPC_PARAM_TASK_ENABLE_GTPERF,
+				SLPC_PARAM_TASK_DISABLE_GTPERF);
+
+	slpc_mem_task_control(data, SLPC_PARAM_TASK_DISABLED,
+				SLPC_PARAM_TASK_ENABLE_BALANCER,
+				SLPC_PARAM_TASK_DISABLE_BALANCER);
+
+	slpc_mem_task_control(data, SLPC_PARAM_TASK_DISABLED,
+				SLPC_PARAM_TASK_ENABLE_DCC,
+				SLPC_PARAM_TASK_DISABLE_DCC);
+
+	ret = host2guc_slpc_reset(slpc);
+	if (ret) {
+		drm_err(&i915->drm, "SLPC Reset event returned %d", ret);
+		return -EIO;
+	}
+
+	DRM_INFO("SLPC state: %s\n", get_slpc_state(slpc));
+
+	if (slpc_read_task_state(slpc))
+		drm_err(&i915->drm, "Unable to read task state data");
+
+	drm_clflush_virt_range(slpc->vaddr, sizeof(struct slpc_shared_data));
+
+	/* min and max frequency limits being used by SLPC */
+	drm_info(&i915->drm, "SLPC min freq: %u Mhz, max is %u Mhz",
+			DIV_ROUND_CLOSEST(data->task_state_data.min_unslice_freq *
+				GT_FREQUENCY_MULTIPLIER, GEN9_FREQ_SCALER),
+			DIV_ROUND_CLOSEST(data->task_state_data.max_unslice_freq *
+				GT_FREQUENCY_MULTIPLIER, GEN9_FREQ_SCALER));
+
 	return 0;
 }
 
drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c +0 -4
index e2644a05f298..3e76d4d5f7bb 100644
@@ -2321,10 +2321,6 @@ void intel_guc_submission_enable(struct intel_guc *guc)
 
 void intel_guc_submission_disable(struct intel_guc *guc)
 {
-	struct intel_gt *gt = guc_to_gt(guc);
-
-	GEM_BUG_ON(gt->awake); /* GT should be parked first */
-
 	/* Note: By the time we're here, GuC may have already been reset */
 }
 
drivers/gpu/drm/i915/gt/uc/intel_uc.c +10 -0
index dca5f6d0641b..7b6c767d3eb0 100644
@@ -501,6 +501,14 @@ static int __uc_init_hw(struct intel_uc *uc)
 	if (intel_uc_uses_guc_submission(uc))
 		intel_guc_submission_enable(guc);
 
+	if (intel_uc_uses_guc_slpc(uc)) {
+		ret = intel_guc_slpc_enable(&guc->slpc);
+		if (ret)
+			goto err_submission;
+		drm_info(&i915->drm, "GuC SLPC %s\n",
+			 enableddisabled(intel_uc_uses_guc_slpc(uc)));
+	}
+
 	drm_info(&i915->drm, "%s firmware %s version %u.%u %s:%s\n",
 		 intel_uc_fw_type_repr(INTEL_UC_FW_TYPE_GUC), guc->fw.path,
 		 guc->fw.major_ver_found, guc->fw.minor_ver_found,
@@ -521,6 +529,8 @@ static int __uc_init_hw(struct intel_uc *uc)
 	/*
 	 * We've failed to load the firmware :(
 	 */
+err_submission:
+	intel_guc_submission_disable(guc);
 err_log_capture:
 	__uc_capture_load_err_log(uc);
 err_out:
Signature · 6 lines
2.25.0

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#17 lore raw

Re: [Intel-gfx] [PATCH 07/16] drm/i915/guc/slpc: Enable slpc and add related H2G events

Quoted 2 lines · Vinay Belgaumkar

Add methods for interacting with guc for enabling SLPC. Enable SLPC after guc submission has been established. GuC load will

s/guc/GuC

Quoted 3 lines

fail if SLPC cannot be successfully initialized. Add various helper methods to set/unset the parameters for SLPC. They can be set using h2g calls or directly setting bits in the shared

/h2g/H2G

Quoted 24 lines

data structure.

---
 drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c   | 221 ++++++++++++++++++
 .../gpu/drm/i915/gt/uc/intel_guc_submission.c |   4 -
 drivers/gpu/drm/i915/gt/uc/intel_uc.c         |  10 +
 3 files changed, 231 insertions(+), 4 deletions(-)
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c +6 -0
index 94e2f19951aa..e579408d1c19 100644
@@ -18,6 +18,61 @@ static inline struct intel_guc *slpc_to_guc(struct intel_guc_slpc *slpc)
 	return container_of(slpc, struct intel_guc, slpc);
 }
 
+static inline struct intel_gt *slpc_to_gt(struct intel_guc_slpc *slpc)
+{
+	return guc_to_gt(slpc_to_guc(slpc));
+}
+
+static inline struct drm_i915_private *slpc_to_i915(struct intel_guc_slpc *slpc)

drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c static inline struct intel_guc *slpc_to_guc(struct intel_guc_slpc *slpc) · line 36

Quoted 10 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c +10 -0
+{
+	return (slpc_to_gt(slpc))->i915;
+}
+
+static void slpc_mem_set_param(struct slpc_shared_data *data,
+				u32 id, u32 value)
+{
+	GEM_BUG_ON(id >= SLPC_MAX_OVERRIDE_PARAMETERS);
+	/* When the flag bit is set, corresponding value will be read
+	 * and applied by slpc.

fix format of multi-line comment
s/slpc/SLPC

drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c static inline struct intel_guc *slpc_to_guc(struct intel_guc_slpc *slpc) · line 38

Quoted 2 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c +2 -0
+	 */
+	data->override_params_set_bits[id >> 5] |= (1 << (id % 32));

use __set_bit instead

drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c static inline struct intel_guc *slpc_to_guc(struct intel_guc_slpc *slpc) · line 49

Quoted 11 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c +11 -0
+	data->override_params_values[id] = value;
+}
+
+static void slpc_mem_unset_param(struct slpc_shared_data *data,
+				 u32 id)
+{
+	GEM_BUG_ON(id >= SLPC_MAX_OVERRIDE_PARAMETERS);
+	/* When the flag bit is unset, corresponding value will not be
+	 * read by slpc.
+	 */
+	data->override_params_set_bits[id >> 5] &= (~(1 << (id % 32)));

same here

drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c static inline struct intel_guc *slpc_to_guc(struct intel_guc_slpc *slpc) · line 54

Quoted 5 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c +5 -0
+	data->override_params_values[id] = 0;
+}
+
+static void slpc_mem_task_control(struct slpc_shared_data *data,
+				 u64 val, u32 enable_id, u32 disable_id)

hmm, u64 to pass simple tri-state flag ?

drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c static inline struct intel_guc *slpc_to_guc(struct intel_guc_slpc *slpc) · line 59

Quoted 5 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c +5 -0
+{
+	/* Enabling a param involves setting the enable_id
+	 * to 1 and disable_id to 0. Setting it to default
+	 * will unset both enable and disable ids and let
+	 * slpc choose it's default values.

fix format + s/slpc/SLPC

Quoted 4 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c +4 -0
+	 */
+	if (val == SLPC_PARAM_TASK_DEFAULT) {
+		/* set default */
+		slpc_mem_unset_param(data, enable_id);

drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c static inline struct intel_guc *slpc_to_guc(struct intel_guc_slpc *slpc) · line 73

Quoted 10 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c +10 -0
+		slpc_mem_unset_param(data, disable_id);
+	} else if (val == SLPC_PARAM_TASK_ENABLED) {
+		/* set enable */
+		slpc_mem_set_param(data, enable_id, 1);
+		slpc_mem_set_param(data, disable_id, 0);
+	} else if (val == SLPC_PARAM_TASK_DISABLED) {
+		/* set disable */
+		slpc_mem_set_param(data, disable_id, 1);
+		slpc_mem_set_param(data, enable_id, 0);
+	}

maybe instead of SLPC_PARAM_TASK_* flags (that btw were confusing me earlier) you can define 3x small helpers:

static void slpc_mem_set_default(data, enable_id, disable_id); static void slpc_mem_set_enabled(data, enable_id, disable_id); static void slpc_mem_set_disabled(data, enable_id, disable_id);

Quoted 12 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c +5 -0
+}
+
 static int slpc_shared_data_init(struct intel_guc_slpc *slpc)
 {
 	struct intel_guc *guc = slpc_to_guc(slpc);
@@ -34,6 +89,128 @@ static int slpc_shared_data_init(struct intel_guc_slpc *slpc)
 	return err;
 }
 
+/*
+ * Send SLPC event to guc
+ *

drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c static int slpc_shared_data_init(struct intel_guc_slpc *slpc) · line 104

Quoted 10 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c +10 -0
+ */
+static int slpc_send(struct intel_guc_slpc *slpc,
+			struct slpc_event_input *input,
+			u32 in_len)
+{
+	struct intel_guc *guc = slpc_to_guc(slpc);
+	u32 *action;
+
+	action = (u32 *)input;
+	action[0] = INTEL_GUC_ACTION_SLPC_REQUEST;

why not just updating input->h2g_action_id ?

drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c static int slpc_shared_data_init(struct intel_guc_slpc *slpc) · line 116

Quoted 12 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c +12 -0
+
+	return intel_guc_send(guc, action, in_len);
+}
+
+static bool slpc_running(struct intel_guc_slpc *slpc)
+{
+	struct slpc_shared_data *data;
+	u32 slpc_global_state;
+
+	GEM_BUG_ON(!slpc->vma);
+
+	drm_clflush_virt_range(slpc->vaddr, sizeof(struct slpc_shared_data));

do you really need to flush all 8K of shared data? it looks that you only need single u32

Quoted 4 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c +4 -0
+	data = slpc->vaddr;
+
+	slpc_global_state = data->global_state;
+

drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c static int slpc_shared_data_init(struct intel_guc_slpc *slpc) · line 130

Quoted 10 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c +10 -0
+	return (data->global_state == SLPC_GLOBAL_STATE_RUNNING);
+}
+
+static int host2guc_slpc_query_task_state(struct intel_guc_slpc *slpc)
+{
+	struct intel_guc *guc = slpc_to_guc(slpc);
+	u32 shared_data_gtt_offset = intel_guc_ggtt_offset(guc, slpc->vma);
+	struct slpc_event_input data = {0};
+
+	data.header.value = SLPC_EVENT(SLPC_EVENT_QUERY_TASK_STATE, 2);

you defined header.num_args and header.event_id, don't want to use them?

drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c static int slpc_shared_data_init(struct intel_guc_slpc *slpc) · line 134

Quoted 4 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c +4 -0
+	data.args[0] = shared_data_gtt_offset;
+	data.args[1] = 0;
+
+	return slpc_send(slpc, &data, 4);

magic 4

drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c static int slpc_shared_data_init(struct intel_guc_slpc *slpc) · line 140

Quoted 6 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c +6 -0
+}
+
+static int slpc_read_task_state(struct intel_guc_slpc *slpc)
+{
+	return host2guc_slpc_query_task_state(slpc);
+}

hmm, all this looks complicated more than needed, why not just:

static int guc_action_slpc_query(struct intel_guc *guc, u32 offset)

{
	u32 request[] = {
		INTEL_GUC_ACTION_SLPC_REQUEST,
		SLPC_EVENT(SLPC_EVENT_QUERY_TASK_STATE, 2),
		offset,
		0,
	};
	int err;

	return intel_guc_send(guc, request, ARRAY_SIZE(request));
}

static int slpc_query_task_state(struct intel_guc_slpc *slpc)

{
	struct intel_guc *guc = slpc_to_guc(slpc);
	u32 offset = intel_guc_ggtt_offset(guc, slpc->vma);

	return guc_action_slpc_query(guc, offset);
}

btw, there is little magic in H2G data, as only event enums were defined in slpc_fwif.h (or slpc_abi.h) but it looks that len and format of args depends on the actual event used

Quoted 23 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c +23 -0
+
+static const char *slpc_state_stringify(enum slpc_global_state state)
+{
+	const char *str = NULL;
+
+	switch (state) {
+	case SLPC_GLOBAL_STATE_NOT_RUNNING:
+		str = "not running";
+		break;
+	case SLPC_GLOBAL_STATE_INITIALIZING:
+		str = "initializing";
+		break;
+	case SLPC_GLOBAL_STATE_RESETTING:
+		str = "resetting";
+		break;
+	case SLPC_GLOBAL_STATE_RUNNING:
+		str = "running";
+		break;
+	case SLPC_GLOBAL_STATE_SHUTTING_DOWN:
+		str = "shutting down";
+		break;
+	case SLPC_GLOBAL_STATE_ERROR:
+		str = "error";

drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c static int slpc_shared_data_init(struct intel_guc_slpc *slpc) · line 173

Quoted 10 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c +10 -0
+		break;
+	default:
+		str = "unknown";
+		break;
+	}
+
+	return str;
+}
+
+static const char *get_slpc_state(struct intel_guc_slpc *slpc)

lot of duplicated code with slpc_running()

maybe there should be:

	u32 slpc_get_state(slpc);
	bool slpc_is_running(slpc);
	const char *slpc_state_string(slpc);
Quoted 20 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c +20 -0
+{
+	struct slpc_shared_data *data;
+	u32 slpc_global_state;
+
+	GEM_BUG_ON(!slpc->vma);
+
+	drm_clflush_virt_range(slpc->vaddr, sizeof(struct slpc_shared_data));
+	data = slpc->vaddr;
+
+	slpc_global_state = data->global_state;
+
+	return slpc_state_stringify(slpc_global_state);
+}
+
+static int host2guc_slpc_reset(struct intel_guc_slpc *slpc)
+{
+	struct intel_guc *guc = slpc_to_guc(slpc);
+	u32 shared_data_gtt_offset = intel_guc_ggtt_offset(guc, slpc->vma);
+	struct slpc_event_input data = {0};
+	int ret;

drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c static int slpc_shared_data_init(struct intel_guc_slpc *slpc) · line 203

Quoted 10 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c +10 -0
+
+	data.header.value = SLPC_EVENT(SLPC_EVENT_RESET, 2);
+	data.args[0] = shared_data_gtt_offset;
+	data.args[1] = 0;
+
+	/* TODO: Hardcoded 4 needs define */
+	ret = slpc_send(slpc, &data, 4);
+
+	if (!ret) {
+		/* TODO: How long to Wait until SLPC is running */

do we know state transitions ?
maybe there is no point in waiting for RUNNING if it is in ERROR or SHUTTING_DOWN ?

drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c static int slpc_shared_data_init(struct intel_guc_slpc *slpc) · line 204

Quoted 1 line
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c +1 -0
+		if (wait_for(slpc_running(slpc), 5)) {

magic 5

drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c static int slpc_shared_data_init(struct intel_guc_slpc *slpc) · line 205

Quoted 1 line
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c +1 -0
+			DRM_ERROR("SLPC not enabled! State = %s\n",

use drm_err

Quoted 32 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c +25 -0
+				  get_slpc_state(slpc));
+			return -EIO;
+		}
+	}
+
+	return ret;
+}
+
 int intel_guc_slpc_init(struct intel_guc_slpc *slpc)
 {
 	GEM_BUG_ON(slpc->vma);
@@ -56,6 +233,50 @@ int intel_guc_slpc_init(struct intel_guc_slpc *slpc)
  */
 int intel_guc_slpc_enable(struct intel_guc_slpc *slpc)
 {
+	struct drm_i915_private *i915 = slpc_to_i915(slpc);
+	struct slpc_shared_data *data;
+	int ret;
+
+	GEM_BUG_ON(!slpc->vma);
+
+	memset(slpc->vaddr, 0, sizeof(struct slpc_shared_data));
+
+	data = slpc->vaddr;
+	data->shared_data_size = sizeof(struct slpc_shared_data);
+
+	/* Enable only GTPERF task, Disable others */
+	slpc_mem_task_control(data, SLPC_PARAM_TASK_ENABLED,
+				SLPC_PARAM_TASK_ENABLE_GTPERF,
+				SLPC_PARAM_TASK_DISABLE_GTPERF);
+
+	slpc_mem_task_control(data, SLPC_PARAM_TASK_DISABLED,

drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c int intel_guc_slpc_init(struct intel_guc_slpc *slpc) · line 262

Quoted 10 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c +10 -0
+				SLPC_PARAM_TASK_ENABLE_BALANCER,
+				SLPC_PARAM_TASK_DISABLE_BALANCER);
+
+	slpc_mem_task_control(data, SLPC_PARAM_TASK_DISABLED,
+				SLPC_PARAM_TASK_ENABLE_DCC,
+				SLPC_PARAM_TASK_DISABLE_DCC);
+
+	ret = host2guc_slpc_reset(slpc);
+	if (ret) {
+		drm_err(&i915->drm, "SLPC Reset event returned %d", ret);

you may want to print error as %pe
missing \n

drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c int intel_guc_slpc_init(struct intel_guc_slpc *slpc) · line 266

Quoted 4 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c +4 -0
+		return -EIO;
+	}
+
+	DRM_INFO("SLPC state: %s\n", get_slpc_state(slpc));

use drm_info

drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c int intel_guc_slpc_init(struct intel_guc_slpc *slpc) · line 269

Quoted 3 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c +3 -0
+
+	if (slpc_read_task_state(slpc))
+		drm_err(&i915->drm, "Unable to read task state data");

missing \n

drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c int intel_guc_slpc_init(struct intel_guc_slpc *slpc) · line 274

Quoted 5 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c +5 -0
+
+	drm_clflush_virt_range(slpc->vaddr, sizeof(struct slpc_shared_data));
+
+	/* min and max frequency limits being used by SLPC */
+	drm_info(&i915->drm, "SLPC min freq: %u Mhz, max is %u Mhz",

missing \n

drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c int intel_guc_slpc_init(struct intel_guc_slpc *slpc) · line 278

Quoted 4 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c +4 -0
+			DIV_ROUND_CLOSEST(data->task_state_data.min_unslice_freq *
+				GT_FREQUENCY_MULTIPLIER, GEN9_FREQ_SCALER),
+			DIV_ROUND_CLOSEST(data->task_state_data.max_unslice_freq *
+				GT_FREQUENCY_MULTIPLIER, GEN9_FREQ_SCALER));

this info/code seems to be duplicated in patch 10/16 maybe just call intel_guc_slpc_info() here once available ?

Quoted 9 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c +1 -0
+
 	return 0;
 }
 
drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c +0 -0
index e2644a05f298..3e76d4d5f7bb 100644

drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c void intel_guc_submission_enable(struct intel_guc *guc) · line 2326

Quoted 6 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c +0 -3
@@ -2321,10 +2321,6 @@ void intel_guc_submission_enable(struct intel_guc *guc)
 
 void intel_guc_submission_disable(struct intel_guc *guc)
 {
-	struct intel_gt *gt = guc_to_gt(guc);
-
-	GEM_BUG_ON(gt->awake); /* GT should be parked first */

if not mistake, can you explain why it was removed ?

Quoted 9 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c +0 -1
-
 	/* Note: By the time we're here, GuC may have already been reset */
 }
 
drivers/gpu/drm/i915/gt/uc/intel_uc.c +0 -0
index dca5f6d0641b..7b6c767d3eb0 100644

drivers/gpu/drm/i915/gt/uc/intel_uc.c static int __uc_init_hw(struct intel_uc *uc) · line 509

Quoted 9 lines
drivers/gpu/drm/i915/gt/uc/intel_uc.c +6 -0
@@ -501,6 +501,14 @@ static int __uc_init_hw(struct intel_uc *uc)
 	if (intel_uc_uses_guc_submission(uc))
 		intel_guc_submission_enable(guc);
 
+	if (intel_uc_uses_guc_slpc(uc)) {
+		ret = intel_guc_slpc_enable(&guc->slpc);
+		if (ret)
+			goto err_submission;
+		drm_info(&i915->drm, "GuC SLPC %s\n",
+			 enableddisabled(intel_uc_uses_guc_slpc(uc)));

move this drm_info after below GuC report and/or modify to have:

"GuC firmware path.bin version 1.0 loaded:yes" "GuC submission:enabled"
"GuC SLPC:enabled"
"HuC firmware path.bin version 1.0 authenticated:yes"

Michal

Quoted 15 lines
drivers/gpu/drm/i915/gt/uc/intel_uc.c +4 -0
+	}
+
 	drm_info(&i915->drm, "%s firmware %s version %u.%u %s:%s\n",
 		 intel_uc_fw_type_repr(INTEL_UC_FW_TYPE_GUC), guc->fw.path,
 		 guc->fw.major_ver_found, guc->fw.minor_ver_found,
@@ -521,6 +529,8 @@ static int __uc_init_hw(struct intel_uc *uc)
 	/*
 	 * We've failed to load the firmware :(
 	 */
+err_submission:
+	intel_guc_submission_disable(guc);
 err_log_capture:
 	__uc_capture_load_err_log(uc);
 err_out:
#18 lore raw

Re: [Intel-gfx] [PATCH 07/16] drm/i915/guc/slpc: Enable slpc and add related H2G events

Quoted 6 lines · Michal Wajdeczko
Quoted 2 lines · Vinay Belgaumkar

Add methods for interacting with guc for enabling SLPC. Enable SLPC after guc submission has been established. GuC load will

Quoted 7 lines

s/guc/GuC

Quoted 3 lines

fail if SLPC cannot be successfully initialized. Add various helper methods to set/unset the parameters for SLPC. They can be set using h2g calls or directly setting bits in the shared

/h2g/H2G

done.

Quoted 30 lines
Quoted 30 lines

data structure.

---
  drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c   | 221 ++++++++++++++++++
  .../gpu/drm/i915/gt/uc/intel_guc_submission.c |   4 -
  drivers/gpu/drm/i915/gt/uc/intel_uc.c         |  10 +
  3 files changed, 231 insertions(+), 4 deletions(-)
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c +11 -0
index 94e2f19951aa..e579408d1c19 100644
@@ -18,6 +18,61 @@ static inline struct intel_guc *slpc_to_guc(struct intel_guc_slpc *slpc)
  	return container_of(slpc, struct intel_guc, slpc);
  }
 
+static inline struct intel_gt *slpc_to_gt(struct intel_guc_slpc *slpc)
+{
+	return guc_to_gt(slpc_to_guc(slpc));
+}
+
+static inline struct drm_i915_private *slpc_to_i915(struct intel_guc_slpc *slpc)
+{
+	return (slpc_to_gt(slpc))->i915;
+}
+
+static void slpc_mem_set_param(struct slpc_shared_data *data,
Quoted 8 lines

drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c static inline struct intel_guc *slpc_to_guc(struct intel_guc_slpc *slpc) · line 36

Quoted 5 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c +5 -0
+				u32 id, u32 value)
+{
+	GEM_BUG_ON(id >= SLPC_MAX_OVERRIDE_PARAMETERS);
+	/* When the flag bit is set, corresponding value will be read
+	 * and applied by slpc.

fix format of multi-line comment
s/slpc/SLPC

Done.

Quoted 6 lines

drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c static inline struct intel_guc *slpc_to_guc(struct intel_guc_slpc *slpc) · line 38

Quoted 3 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c +2 -0
+	 */
+	data->override_params_set_bits[id >> 5] |= (1 << (id % 32));

use __set_bit instead

Quoted 13 lines

drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c static inline struct intel_guc *slpc_to_guc(struct intel_guc_slpc *slpc) · line 49

Quoted 11 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c +11 -0
+	data->override_params_values[id] = value;
+}
+
+static void slpc_mem_unset_param(struct slpc_shared_data *data,
+				 u32 id)
+{
+	GEM_BUG_ON(id >= SLPC_MAX_OVERRIDE_PARAMETERS);
+	/* When the flag bit is unset, corresponding value will not be
+	 * read by slpc.
+	 */
+	data->override_params_set_bits[id >> 5] &= (~(1 << (id % 32)));

same here

Done.

Quoted 35 lines

drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c static inline struct intel_guc *slpc_to_guc(struct intel_guc_slpc *slpc) · line 54

Quoted 6 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c +5 -0
+	data->override_params_values[id] = 0;
+}
+
+static void slpc_mem_task_control(struct slpc_shared_data *data,
+				 u64 val, u32 enable_id, u32 disable_id)

hmm, u64 to pass simple tri-state flag ?

drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c static inline struct intel_guc *slpc_to_guc(struct intel_guc_slpc *slpc) · line 59

Quoted 5 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c +5 -0
+{
+	/* Enabling a param involves setting the enable_id
+	 * to 1 and disable_id to 0. Setting it to default
+	 * will unset both enable and disable ids and let
+	 * slpc choose it's default values.

fix format + s/slpc/SLPC

Quoted 4 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c +4 -0
+	 */
+	if (val == SLPC_PARAM_TASK_DEFAULT) {
+		/* set default */
+		slpc_mem_unset_param(data, enable_id);

drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c static inline struct intel_guc *slpc_to_guc(struct intel_guc_slpc *slpc) · line 73

Quoted 10 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c +10 -0
+		slpc_mem_unset_param(data, disable_id);
+	} else if (val == SLPC_PARAM_TASK_ENABLED) {
+		/* set enable */
+		slpc_mem_set_param(data, enable_id, 1);
+		slpc_mem_set_param(data, disable_id, 0);
+	} else if (val == SLPC_PARAM_TASK_DISABLED) {
+		/* set disable */
+		slpc_mem_set_param(data, disable_id, 1);
+		slpc_mem_set_param(data, enable_id, 0);
+	}

maybe instead of SLPC_PARAM_TASK_* flags (that btw were confusing me earlier) you can define 3x small helpers:

Quoted 4 lines

static void slpc_mem_set_default(data, enable_id, disable_id); static void slpc_mem_set_enabled(data, enable_id, disable_id); static void slpc_mem_set_disabled(data, enable_id, disable_id);

Agree, done.

Quoted 10 lines
Quoted 10 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c +2 -0
+}
+
  static int slpc_shared_data_init(struct intel_guc_slpc *slpc)
  {
  	struct intel_guc *guc = slpc_to_guc(slpc);
@@ -34,6 +89,128 @@ static int slpc_shared_data_init(struct intel_guc_slpc *slpc)
  	return err;
  }
 
Quoted 15 lines

drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c static int slpc_shared_data_init(struct intel_guc_slpc *slpc) · line 104

Quoted 13 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c +13 -0
+/*
+ * Send SLPC event to guc
+ *
+ */
+static int slpc_send(struct intel_guc_slpc *slpc,
+			struct slpc_event_input *input,
+			u32 in_len)
+{
+	struct intel_guc *guc = slpc_to_guc(slpc);
+	u32 *action;
+
+	action = (u32 *)input;
+	action[0] = INTEL_GUC_ACTION_SLPC_REQUEST;

why not just updating input->h2g_action_id ?

Removed this, using your suggestion below instead.

Quoted 16 lines

drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c static int slpc_shared_data_init(struct intel_guc_slpc *slpc) · line 116

Quoted 13 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c +12 -0
+
+	return intel_guc_send(guc, action, in_len);
+}
+
+static bool slpc_running(struct intel_guc_slpc *slpc)
+{
+	struct slpc_shared_data *data;
+	u32 slpc_global_state;
+
+	GEM_BUG_ON(!slpc->vma);
+
+	drm_clflush_virt_range(slpc->vaddr, sizeof(struct slpc_shared_data));

do you really need to flush all 8K of shared data? it looks that you only need single u32

sure.

Quoted 47 lines
Quoted 5 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c +4 -0
+	data = slpc->vaddr;
+
+	slpc_global_state = data->global_state;
+

drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c static int slpc_shared_data_init(struct intel_guc_slpc *slpc) · line 130

Quoted 10 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c +10 -0
+	return (data->global_state == SLPC_GLOBAL_STATE_RUNNING);
+}
+
+static int host2guc_slpc_query_task_state(struct intel_guc_slpc *slpc)
+{
+	struct intel_guc *guc = slpc_to_guc(slpc);
+	u32 shared_data_gtt_offset = intel_guc_ggtt_offset(guc, slpc->vma);
+	struct slpc_event_input data = {0};
+
+	data.header.value = SLPC_EVENT(SLPC_EVENT_QUERY_TASK_STATE, 2);

you defined header.num_args and header.event_id, don't want to use them?

drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c static int slpc_shared_data_init(struct intel_guc_slpc *slpc) · line 134

Quoted 4 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c +4 -0
+	data.args[0] = shared_data_gtt_offset;
+	data.args[1] = 0;
+
+	return slpc_send(slpc, &data, 4);

magic 4

drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c static int slpc_shared_data_init(struct intel_guc_slpc *slpc) · line 140

Quoted 6 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c +6 -0
+}
+
+static int slpc_read_task_state(struct intel_guc_slpc *slpc)
+{
+	return host2guc_slpc_query_task_state(slpc);
+}

hmm, all this looks complicated more than needed, why not just:

static int guc_action_slpc_query(struct intel_guc *guc, u32 offset)

{
	u32 request[] = {
		INTEL_GUC_ACTION_SLPC_REQUEST,
		SLPC_EVENT(SLPC_EVENT_QUERY_TASK_STATE, 2),
		offset,
		0,
	};
	int err;

	return intel_guc_send(guc, request, ARRAY_SIZE(request));
}
Quoted 7 lines

static int slpc_query_task_state(struct intel_guc_slpc *slpc)

{
	struct intel_guc *guc = slpc_to_guc(slpc);
	u32 offset = intel_guc_ggtt_offset(guc, slpc->vma);

	return guc_action_slpc_query(guc, offset);
}

Using this now, definitely simpler.

Quoted 4 lines

btw, there is little magic in H2G data, as only event enums were defined in slpc_fwif.h (or slpc_abi.h) but it looks that len and format of args depends on the actual event used

yes, it also expects the action and num_args in the same word.

Quoted 37 lines
Quoted 24 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c +23 -0
+
+static const char *slpc_state_stringify(enum slpc_global_state state)
+{
+	const char *str = NULL;
+
+	switch (state) {
+	case SLPC_GLOBAL_STATE_NOT_RUNNING:
+		str = "not running";
+		break;
+	case SLPC_GLOBAL_STATE_INITIALIZING:
+		str = "initializing";
+		break;
+	case SLPC_GLOBAL_STATE_RESETTING:
+		str = "resetting";
+		break;
+	case SLPC_GLOBAL_STATE_RUNNING:
+		str = "running";
+		break;
+	case SLPC_GLOBAL_STATE_SHUTTING_DOWN:
+		str = "shutting down";
+		break;
+	case SLPC_GLOBAL_STATE_ERROR:
+		str = "error";

drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c static int slpc_shared_data_init(struct intel_guc_slpc *slpc) · line 173

Quoted 10 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c +10 -0
+		break;
+	default:
+		str = "unknown";
+		break;
+	}
+
+	return str;
+}
+
+static const char *get_slpc_state(struct intel_guc_slpc *slpc)

lot of duplicated code with slpc_running()

Quoted 4 lines

maybe there should be:

	u32 slpc_get_state(slpc);
	bool slpc_is_running(slpc);
	const char *slpc_state_string(slpc);

Ok, makes sense.

Quoted 28 lines
Quoted 28 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c +26 -0
+{
+	struct slpc_shared_data *data;
+	u32 slpc_global_state;
+
+	GEM_BUG_ON(!slpc->vma);
+
+	drm_clflush_virt_range(slpc->vaddr, sizeof(struct slpc_shared_data));
+	data = slpc->vaddr;
+
+	slpc_global_state = data->global_state;
+
+	return slpc_state_stringify(slpc_global_state);
+}
+
+static int host2guc_slpc_reset(struct intel_guc_slpc *slpc)
+{
+	struct intel_guc *guc = slpc_to_guc(slpc);
+	u32 shared_data_gtt_offset = intel_guc_ggtt_offset(guc, slpc->vma);
+	struct slpc_event_input data = {0};
+	int ret;
+
+	data.header.value = SLPC_EVENT(SLPC_EVENT_RESET, 2);
+	data.args[0] = shared_data_gtt_offset;
+	data.args[1] = 0;
+
+	/* TODO: Hardcoded 4 needs define */
Quoted 8 lines

drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c static int slpc_shared_data_init(struct intel_guc_slpc *slpc) · line 203

Quoted 4 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c +4 -0
+	ret = slpc_send(slpc, &data, 4);
+
+	if (!ret) {
+		/* TODO: How long to Wait until SLPC is running */

do we know state transitions ?
maybe there is no point in waiting for RUNNING if it is in ERROR or SHUTTING_DOWN ?

It goes from "resetting" to "running" apparently, but the transitions are too quick to bother trapping. Apparently it should transition within 1ms or so, so 5ms polling (at 10us interval) wait does not seem that bad.

Quoted 4 lines

drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c static int slpc_shared_data_init(struct intel_guc_slpc *slpc) · line 204

Quoted 2 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c +1 -0
+		if (wait_for(slpc_running(slpc), 5)) {

magic 5

ok.

Quoted 4 lines

drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c static int slpc_shared_data_init(struct intel_guc_slpc *slpc) · line 205

Quoted 2 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c +1 -0
+			DRM_ERROR("SLPC not enabled! State = %s\n",

use drm_err

ok.

Quoted 37 lines
Quoted 37 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c +29 -0
+				  get_slpc_state(slpc));
+			return -EIO;
+		}
+	}
+
+	return ret;
+}
+
  int intel_guc_slpc_init(struct intel_guc_slpc *slpc)
  {
  	GEM_BUG_ON(slpc->vma);
@@ -56,6 +233,50 @@ int intel_guc_slpc_init(struct intel_guc_slpc *slpc)
   */
  int intel_guc_slpc_enable(struct intel_guc_slpc *slpc)
  {
+	struct drm_i915_private *i915 = slpc_to_i915(slpc);
+	struct slpc_shared_data *data;
+	int ret;
+
+	GEM_BUG_ON(!slpc->vma);
+
+	memset(slpc->vaddr, 0, sizeof(struct slpc_shared_data));
+
+	data = slpc->vaddr;
+	data->shared_data_size = sizeof(struct slpc_shared_data);
+
+	/* Enable only GTPERF task, Disable others */
+	slpc_mem_task_control(data, SLPC_PARAM_TASK_ENABLED,
+				SLPC_PARAM_TASK_ENABLE_GTPERF,
+				SLPC_PARAM_TASK_DISABLE_GTPERF);
+
+	slpc_mem_task_control(data, SLPC_PARAM_TASK_DISABLED,
+				SLPC_PARAM_TASK_ENABLE_BALANCER,
+				SLPC_PARAM_TASK_DISABLE_BALANCER);
+
+	slpc_mem_task_control(data, SLPC_PARAM_TASK_DISABLED,
Quoted 8 lines

drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c int intel_guc_slpc_init(struct intel_guc_slpc *slpc) · line 262

Quoted 6 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c +6 -0
+				SLPC_PARAM_TASK_ENABLE_DCC,
+				SLPC_PARAM_TASK_DISABLE_DCC);
+
+	ret = host2guc_slpc_reset(slpc);
+	if (ret) {
+		drm_err(&i915->drm, "SLPC Reset event returned %d", ret);

you may want to print error as %pe

Not sure I understand why? I thought %pe was only for pointer errors?

Quoted 24 lines

missing \n

drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c int intel_guc_slpc_init(struct intel_guc_slpc *slpc) · line 266

Quoted 4 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c +4 -0
+		return -EIO;
+	}
+
+	DRM_INFO("SLPC state: %s\n", get_slpc_state(slpc));

use drm_info

drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c int intel_guc_slpc_init(struct intel_guc_slpc *slpc) · line 269

Quoted 3 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c +3 -0
+
+	if (slpc_read_task_state(slpc))
+		drm_err(&i915->drm, "Unable to read task state data");

missing \n

drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c int intel_guc_slpc_init(struct intel_guc_slpc *slpc) · line 274

Quoted 5 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c +5 -0
+
+	drm_clflush_virt_range(slpc->vaddr, sizeof(struct slpc_shared_data));
+
+	/* min and max frequency limits being used by SLPC */
+	drm_info(&i915->drm, "SLPC min freq: %u Mhz, max is %u Mhz",

missing \n

Quoted 7 lines

drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c int intel_guc_slpc_init(struct intel_guc_slpc *slpc) · line 278

Quoted 4 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c +4 -0
+			DIV_ROUND_CLOSEST(data->task_state_data.min_unslice_freq *
+				GT_FREQUENCY_MULTIPLIER, GEN9_FREQ_SCALER),
+			DIV_ROUND_CLOSEST(data->task_state_data.max_unslice_freq *
+				GT_FREQUENCY_MULTIPLIER, GEN9_FREQ_SCALER));

this info/code seems to be duplicated in patch 10/16 maybe just call intel_guc_slpc_info() here once available ?

intel_guc_slpc_info() prints a lot of other info, just need to print the frequencies here.

Quoted 11 lines
Quoted 11 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c +1 -0
+
  	return 0;
  }
 
drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c +0 -0
index e2644a05f298..3e76d4d5f7bb 100644
@@ -2321,10 +2321,6 @@ void intel_guc_submission_enable(struct intel_guc *guc)
 
Quoted 7 lines

drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c void intel_guc_submission_enable(struct intel_guc *guc) · line 2326

Quoted 5 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c +0 -3
  void intel_guc_submission_disable(struct intel_guc *guc)
  {
-	struct intel_gt *gt = guc_to_gt(guc);
-
-	GEM_BUG_ON(gt->awake); /* GT should be parked first */

if not mistake, can you explain why it was removed ?

This was part of a different commit. The BUG_ON in disable_guc_submission was added with an assumption that it will be called only during driver unload and not expected to hold any GT PM references. Since this needs to be called from an error scenario during slpc enable, remove the BUG_ON. Do we need this as a separate commit?

Quoted 13 lines
Quoted 13 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c +0 -1
-
  	/* Note: By the time we're here, GuC may have already been reset */
  }
 
drivers/gpu/drm/i915/gt/uc/intel_uc.c +0 -0
index dca5f6d0641b..7b6c767d3eb0 100644
@@ -501,6 +501,14 @@ static int __uc_init_hw(struct intel_uc *uc)
  	if (intel_uc_uses_guc_submission(uc))
  		intel_guc_submission_enable(guc);
 
Quoted 8 lines

drivers/gpu/drm/i915/gt/uc/intel_uc.c static int __uc_init_hw(struct intel_uc *uc) · line 509

Quoted 6 lines
drivers/gpu/drm/i915/gt/uc/intel_uc.c +6 -0
+	if (intel_uc_uses_guc_slpc(uc)) {
+		ret = intel_guc_slpc_enable(&guc->slpc);
+		if (ret)
+			goto err_submission;
+		drm_info(&i915->drm, "GuC SLPC %s\n",
+			 enableddisabled(intel_uc_uses_guc_slpc(uc)));

move this drm_info after below GuC report and/or modify to have:

yup, incorrect merge. Moved.

Thanks,
Vinay.

Quoted 8 lines

"GuC firmware path.bin version 1.0 loaded:yes" "GuC submission:enabled"
"GuC SLPC:enabled"
"HuC firmware path.bin version 1.0 authenticated:yes"

Michal

Quoted 15 lines
Quoted 7 lines
drivers/gpu/drm/i915/gt/uc/intel_uc.c +2 -0
+	}
+
  	drm_info(&i915->drm, "%s firmware %s version %u.%u %s:%s\n",
  		 intel_uc_fw_type_repr(INTEL_UC_FW_TYPE_GUC), guc->fw.path,
  		 guc->fw.major_ver_found, guc->fw.minor_ver_found,

drivers/gpu/drm/i915/gt/uc/intel_uc.c static int __uc_init_hw(struct intel_uc *uc) · line 536

Quoted 8 lines
drivers/gpu/drm/i915/gt/uc/intel_uc.c +2 -0
@@ -521,6 +529,8 @@ static int __uc_init_hw(struct intel_uc *uc)
  	/*
  	 * We've failed to load the firmware :(
  	 */
+err_submission:
+	intel_guc_submission_disable(guc);
  err_log_capture:
  	__uc_capture_load_err_log(uc);
  err_out:

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#19 lore raw

Re: [Intel-gfx] [PATCH 07/16] drm/i915/guc/slpc: Enable slpc and add related H2G events

Quoted 6 lines · Vinay
Quoted 3 lines · Michal Wajdeczko

On 10.07.2021 03:20, Vinay Belgaumkar wrote:

...

Quoted 15 lines
Quoted 6 lines
Quoted 6 lines

  diff --git a/drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c b/drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c index e2644a05f298..3e76d4d5f7bb 100644

drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c +0 -0
@@ -2321,10 +2321,6 @@ void intel_guc_submission_enable(struct
Quoted 8 lines

drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c void intel_guc_submission_enable(struct intel_guc *guc) · line 2326

Quoted 6 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c +0 -3
 intel_guc *guc)
     void intel_guc_submission_disable(struct intel_guc *guc)
   {
-    struct intel_gt *gt = guc_to_gt(guc);
-
-    GEM_BUG_ON(gt->awake); /* GT should be parked first */

if not mistake, can you explain why it was removed ?

Quoted 5 lines

This was part of a different commit. The BUG_ON in disable_guc_submission was added with an assumption that it will be called only during driver unload and not expected to hold any GT PM references. Since this needs to be called from an error scenario during slpc enable, remove the BUG_ON. Do we need this as a separate commit?

yes, please

Michal

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#20 lore raw

PATCH 8/16 drm/i915/guc/slpc: Add methods to set min/max frequency

In reply to Vinay Belgaumkar

Add param set h2g helpers to set the min and max frequencies for use by SLPC.

---
 drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c | 94 +++++++++++++++++++++
 drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.h |  2 +
 2 files changed, 96 insertions(+)
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c +94 -0
index e579408d1c19..19cb26479942 100644
@@ -106,6 +106,19 @@ static int slpc_send(struct intel_guc_slpc *slpc,
 	return intel_guc_send(guc, action, in_len);
 }
 
+static int host2guc_slpc_set_param(struct intel_guc_slpc *slpc,
+				   u32 id, u32 value)
+{
+	struct slpc_event_input data = {0};
+
+	data.header.value = SLPC_EVENT(SLPC_EVENT_PARAMETER_SET, 2);
+	data.args[0] = id;
+	data.args[1] = value;
+
+	return slpc_send(slpc, &data, 4);
+}
+
+
 static bool slpc_running(struct intel_guc_slpc *slpc)
 {
 	struct slpc_shared_data *data;
@@ -134,6 +147,19 @@ static int host2guc_slpc_query_task_state(struct intel_guc_slpc *slpc)
 	return slpc_send(slpc, &data, 4);
 }
 
+static int slpc_set_param(struct intel_guc_slpc *slpc, u32 id, u32 value)
+{
+	struct drm_i915_private *i915 = slpc_to_i915(slpc);
+	GEM_BUG_ON(id >= SLPC_MAX_PARAM);
+
+	if (host2guc_slpc_set_param(slpc, id, value)) {
+		drm_err(&i915->drm, "Unable to set param %x", id);
+		return -EIO;
+	}
+
+	return 0;
+}
+
 static int slpc_read_task_state(struct intel_guc_slpc *slpc)
 {
 	return host2guc_slpc_query_task_state(slpc);
@@ -218,6 +244,74 @@ int intel_guc_slpc_init(struct intel_guc_slpc *slpc)
 	return slpc_shared_data_init(slpc);
 }
 
+/**
+ * intel_guc_slpc_max_freq_set() - Set max frequency limit for SLPC.
+ * @slpc: pointer to intel_guc_slpc.
+ * @val: encoded frequency
+ *
+ * This function will invoke GuC SLPC action to update the max frequency
+ * limit for slice and unslice.
+ *
+ * Return: 0 on success, non-zero error code on failure.
+ */
+int intel_guc_slpc_set_max_freq(struct intel_guc_slpc *slpc, u32 val)
+{
+	int ret;
+	struct drm_i915_private *i915 = slpc_to_i915(slpc);
+	intel_wakeref_t wakeref;
+
+	wakeref = intel_runtime_pm_get(&i915->runtime_pm);
+
+	ret = slpc_set_param(slpc,
+		       SLPC_PARAM_GLOBAL_MAX_GT_UNSLICE_FREQ_MHZ,
+		       val);
+
+	if (ret) {
+		drm_err(&i915->drm,
+			"Set max frequency unslice returned %d", ret);
+		ret = -EIO;
+		goto done;
+	}
+
+done:
+	intel_runtime_pm_put(&i915->runtime_pm, wakeref);
+	return ret;
+}
+
+/**
+ * intel_guc_slpc_min_freq_set() - Set min frequency limit for SLPC.
+ * @slpc: pointer to intel_guc_slpc.
+ * @val: encoded frequency
+ *
+ * This function will invoke GuC SLPC action to update the min frequency
+ * limit.
+ *
+ * Return: 0 on success, non-zero error code on failure.
+ */
+int intel_guc_slpc_set_min_freq(struct intel_guc_slpc *slpc, u32 val)
+{
+	int ret;
+	struct intel_guc *guc = slpc_to_guc(slpc);
+	struct drm_i915_private *i915 = guc_to_gt(guc)->i915;
+	intel_wakeref_t wakeref;
+
+	wakeref = intel_runtime_pm_get(&i915->runtime_pm);
+
+	ret = slpc_set_param(slpc,
+		       SLPC_PARAM_GLOBAL_MIN_GT_UNSLICE_FREQ_MHZ,
+		       val);
+	if (ret) {
+		drm_err(&i915->drm,
+			"Set min frequency for unslice returned %d", ret);
+		ret = -EIO;
+		goto done;
+	}
+
+done:
+	intel_runtime_pm_put(&i915->runtime_pm, wakeref);
+	return ret;
+}
+
 /*
  * intel_guc_slpc_enable() - Start SLPC
  * @slpc: pointer to intel_guc_slpc.
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.h +2 -0
index a2643b904165..a473e1ea7c10 100644
@@ -34,5 +34,7 @@ struct intel_guc_slpc {
 int intel_guc_slpc_init(struct intel_guc_slpc *slpc);
 int intel_guc_slpc_enable(struct intel_guc_slpc *slpc);
 void intel_guc_slpc_fini(struct intel_guc_slpc *slpc);
+int intel_guc_slpc_set_max_freq(struct intel_guc_slpc *slpc, u32 val);
+int intel_guc_slpc_set_min_freq(struct intel_guc_slpc *slpc, u32 val);
 
 #endif
Signature · 6 lines
2.25.0

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#21 lore raw

Re: [PATCH 08/16] drm/i915/guc/slpc: Add methods to set min/max frequency

Thank you for the patch! Perhaps something to improve:

Hi Vinay,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on drm-tip/drm-tip]
[cannot apply to drm-intel/for-linux-next drm-exynos/exynos-drm-next tegra-drm/drm/tegra/for-next drm/drm-next v5.13 next-20210709] [If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Vinay-Belgaumkar/Enable-GuC-based-power-management-features/20210710-092520
base:   git://anongit.freedesktop.org/drm/drm-tip drm-tip
config: x86_64-allyesconfig (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce (this is a W=1 build):
        # https://github.com/0day-ci/linux/commit/ce93ba218ad070e0b1ae6f9823820fb4d2e14a8b
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Vinay-Belgaumkar/Enable-GuC-based-power-management-features/20210710-092520
        git checkout ce93ba218ad070e0b1ae6f9823820fb4d2e14a8b
        # save the attached .config to linux build tree
        mkdir build_dir
        make W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash drivers/gpu/drm/i915/

If you fix the issue, kindly add following tag as appropriate

All warnings (new ones prefixed by >>):

>> drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c:258: warning: expecting prototype for intel_guc_slpc_max_freq_set(). Prototype was for intel_guc_slpc_set_max_freq() instead
>> drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c:292: warning: expecting prototype for intel_guc_slpc_min_freq_set(). Prototype was for intel_guc_slpc_set_min_freq() instead

vim +258 drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c

246
247 /**
248 * intel_guc_slpc_max_freq_set() - Set max frequency limit for SLPC.
249 * @slpc: pointer to intel_guc_slpc.
250 * @val: encoded frequency
251 *
252 * This function will invoke GuC SLPC action to update the max frequency
253 * limit for slice and unslice.
254 *
255 * Return: 0 on success, non-zero error code on failure.
256 */
257 int intel_guc_slpc_set_max_freq(struct intel_guc_slpc *slpc, u32 val)

 > 258	{
   259		int ret;
   260		struct drm_i915_private *i915 = slpc_to_i915(slpc);
   261		intel_wakeref_t wakeref;
   262	
   263		wakeref = intel_runtime_pm_get(&i915->runtime_pm);
   264	
   265		ret = slpc_set_param(slpc,
   266			       SLPC_PARAM_GLOBAL_MAX_GT_UNSLICE_FREQ_MHZ,
   267			       val);
   268	
   269		if (ret) {
   270			drm_err(&i915->drm,
   271				"Set max frequency unslice returned %d", ret);
   272			ret = -EIO;
   273			goto done;
   274		}
   275	
   276	done:
   277		intel_runtime_pm_put(&i915->runtime_pm, wakeref);
   278		return ret;
   279	}
   280	
   281	/**
   282	 * intel_guc_slpc_min_freq_set() - Set min frequency limit for SLPC.
   283	 * @slpc: pointer to intel_guc_slpc.
   284	 * @val: encoded frequency
   285	 *
   286	 * This function will invoke GuC SLPC action to update the min frequency
   287	 * limit.
   288	 *
   289	 * Return: 0 on success, non-zero error code on failure.
   290	 */
   291	int intel_guc_slpc_set_min_freq(struct intel_guc_slpc *slpc, u32 val)
 > 292	{

293 int ret;
294 struct intel_guc *guc = slpc_to_guc(slpc);
295 struct drm_i915_private *i915 = guc_to_gt(guc)->i915;
296 intel_wakeref_t wakeref;
297
298 wakeref = intel_runtime_pm_get(&i915->runtime_pm);
299
300 ret = slpc_set_param(slpc,
301 SLPC_PARAM_GLOBAL_MIN_GT_UNSLICE_FREQ_MHZ,
302 val);
303 if (ret) {
304 drm_err(&i915->drm,
305 "Set min frequency for unslice returned %d", ret);
306 ret = -EIO;
307 goto done;
308 }
309
310 done:
311 intel_runtime_pm_put(&i915->runtime_pm, wakeref);
312 return ret;
313 }
314

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

#22 lore raw

Re: [PATCH 08/16] drm/i915/guc/slpc: Add methods to set min/max frequency

In reply to Vinay Belgaumkar
Thank you for the patch! Perhaps something to improve:

Hi Vinay,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on drm-tip/drm-tip]
[cannot apply to drm-intel/for-linux-next drm-exynos/exynos-drm-next tegra-drm/drm/tegra/for-next drm/drm-next v5.13 next-20210709] [If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Vinay-Belgaumkar/Enable-GuC-based-power-management-features/20210710-092520
base:   git://anongit.freedesktop.org/drm/drm-tip drm-tip
config: x86_64-randconfig-a014-20210709 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project 8d69635ed9ecf36fd0ca85906bfde17949671cbe)

reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# install x86_64 cross compiling tool for clang build
# apt-get install binutils-x86-64-linux-gnu
# https://github.com/0day-ci/linux/commit/ce93ba218ad070e0b1ae6f9823820fb4d2e14a8b
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Vinay-Belgaumkar/Enable-GuC-based-power-management-features/20210710-092520 git checkout ce93ba218ad070e0b1ae6f9823820fb4d2e14a8b
# save the attached .config to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross O=build_dir ARCH=x86_64 SHELL=/bin/bash drivers/gpu/drm/i915/

If you fix the issue, kindly add following tag as appropriate

All warnings (new ones prefixed by >>):

>> drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c:258: warning: expecting prototype for intel_guc_slpc_max_freq_set(). Prototype was for intel_guc_slpc_set_max_freq() instead
>> drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c:292: warning: expecting prototype for intel_guc_slpc_min_freq_set(). Prototype was for intel_guc_slpc_set_min_freq() instead

vim +258 drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c

246
247 /**
248 * intel_guc_slpc_max_freq_set() - Set max frequency limit for SLPC.
249 * @slpc: pointer to intel_guc_slpc.
250 * @val: encoded frequency
251 *
252 * This function will invoke GuC SLPC action to update the max frequency
253 * limit for slice and unslice.
254 *
255 * Return: 0 on success, non-zero error code on failure.
256 */
257 int intel_guc_slpc_set_max_freq(struct intel_guc_slpc *slpc, u32 val)

 > 258	{
   259		int ret;
   260		struct drm_i915_private *i915 = slpc_to_i915(slpc);
   261		intel_wakeref_t wakeref;
   262	
   263		wakeref = intel_runtime_pm_get(&i915->runtime_pm);
   264	
   265		ret = slpc_set_param(slpc,
   266			       SLPC_PARAM_GLOBAL_MAX_GT_UNSLICE_FREQ_MHZ,
   267			       val);
   268	
   269		if (ret) {
   270			drm_err(&i915->drm,
   271				"Set max frequency unslice returned %d", ret);
   272			ret = -EIO;
   273			goto done;
   274		}
   275	
   276	done:
   277		intel_runtime_pm_put(&i915->runtime_pm, wakeref);
   278		return ret;
   279	}
   280	
   281	/**
   282	 * intel_guc_slpc_min_freq_set() - Set min frequency limit for SLPC.
   283	 * @slpc: pointer to intel_guc_slpc.
   284	 * @val: encoded frequency
   285	 *
   286	 * This function will invoke GuC SLPC action to update the min frequency
   287	 * limit.
   288	 *
   289	 * Return: 0 on success, non-zero error code on failure.
   290	 */
   291	int intel_guc_slpc_set_min_freq(struct intel_guc_slpc *slpc, u32 val)
 > 292	{

293 int ret;
294 struct intel_guc *guc = slpc_to_guc(slpc);
295 struct drm_i915_private *i915 = guc_to_gt(guc)->i915;
296 intel_wakeref_t wakeref;
297
298 wakeref = intel_runtime_pm_get(&i915->runtime_pm);
299
300 ret = slpc_set_param(slpc,
301 SLPC_PARAM_GLOBAL_MIN_GT_UNSLICE_FREQ_MHZ,
302 val);
303 if (ret) {
304 drm_err(&i915->drm,
305 "Set min frequency for unslice returned %d", ret);
306 ret = -EIO;
307 goto done;
308 }
309
310 done:
311 intel_runtime_pm_put(&i915->runtime_pm, wakeref);
312 return ret;
313 }
314

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

#23 lore raw

Re: [PATCH 08/16] drm/i915/guc/slpc: Add methods to set min/max frequency

In reply to Vinay Belgaumkar
Quoted 18 lines · Vinay Belgaumkar

Add param set h2g helpers to set the min and max frequencies for use by SLPC.

---
 drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c | 94 +++++++++++++++++++++
 drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.h |  2 +
 2 files changed, 96 insertions(+)
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c +0 -0
index e579408d1c19..19cb26479942 100644
@@ -106,6 +106,19 @@ static int slpc_send(struct intel_guc_slpc *slpc,
 	return intel_guc_send(guc, action, in_len);
 }
 

drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c static int slpc_send(struct intel_guc_slpc *slpc, · line 118

Quoted 10 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c +10 -0
+static int host2guc_slpc_set_param(struct intel_guc_slpc *slpc,
+				   u32 id, u32 value)
+{
+	struct slpc_event_input data = {0};
+
+	data.header.value = SLPC_EVENT(SLPC_EVENT_PARAMETER_SET, 2);
+	data.args[0] = id;
+	data.args[1] = value;
+
+	return slpc_send(slpc, &data, 4);

as suggested before, use of explicit function like:

static int guc_action_slpc_param(guc, u32 id, u32 value)

{
	u32 request[] = {
		INTEL_GUC_ACTION_SLPC_REQUEST,
		SLPC_EVENT(SLPC_EVENT_PARAMETER_SET, 2),
		id,
		value,
	};

	return intel_guc_send(guc, request, ARRAY_SIZE(request));
}

will be simpler/cleaner

Quoted 7 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c +3 -0
+}
+
+
 static bool slpc_running(struct intel_guc_slpc *slpc)
 {
 	struct slpc_shared_data *data;

drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c static int host2guc_slpc_query_task_state(struct intel_guc_slpc *slpc) · line 156

Quoted 10 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c +7 -0
@@ -134,6 +147,19 @@ static int host2guc_slpc_query_task_state(struct intel_guc_slpc *slpc)
 	return slpc_send(slpc, &data, 4);
 }
 
+static int slpc_set_param(struct intel_guc_slpc *slpc, u32 id, u32 value)
+{
+	struct drm_i915_private *i915 = slpc_to_i915(slpc);
+	GEM_BUG_ON(id >= SLPC_MAX_PARAM);
+
+	if (host2guc_slpc_set_param(slpc, id, value)) {
+		drm_err(&i915->drm, "Unable to set param %x", id);

missing \n
what about printing value to be set ?
what about printing send error %pe ?

Quoted 10 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c +6 -0
+		return -EIO;
+	}
+
+	return 0;
+}
+
 static int slpc_read_task_state(struct intel_guc_slpc *slpc)
 {
 	return host2guc_slpc_query_task_state(slpc);

drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c int intel_guc_slpc_init(struct intel_guc_slpc *slpc) · line 250

Quoted 7 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c +4 -0
@@ -218,6 +244,74 @@ int intel_guc_slpc_init(struct intel_guc_slpc *slpc)
 	return slpc_shared_data_init(slpc);
 }
 
+/**
+ * intel_guc_slpc_max_freq_set() - Set max frequency limit for SLPC.
+ * @slpc: pointer to intel_guc_slpc.
+ * @val: encoded frequency

what's the encoding ?

drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c int intel_guc_slpc_init(struct intel_guc_slpc *slpc) · line 263

Quoted 13 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c +13 -0
+ *
+ * This function will invoke GuC SLPC action to update the max frequency
+ * limit for slice and unslice.
+ *
+ * Return: 0 on success, non-zero error code on failure.
+ */
+int intel_guc_slpc_set_max_freq(struct intel_guc_slpc *slpc, u32 val)
+{
+	int ret;
+	struct drm_i915_private *i915 = slpc_to_i915(slpc);
+	intel_wakeref_t wakeref;
+
+	wakeref = intel_runtime_pm_get(&i915->runtime_pm);

use can use with_intel_runtime_pm(rpm, wakeref)

drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c int intel_guc_slpc_init(struct intel_guc_slpc *slpc) · line 271

Quoted 8 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c +8 -0
+
+	ret = slpc_set_param(slpc,
+		       SLPC_PARAM_GLOBAL_MAX_GT_UNSLICE_FREQ_MHZ,
+		       val);
+
+	if (ret) {
+		drm_err(&i915->drm,
+			"Set max frequency unslice returned %d", ret);

missing \n
print error with %pe
but slpc_set_param returns only -EIO ;(

Quoted 24 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c +24 -0
+		ret = -EIO;
+		goto done;
+	}
+
+done:
+	intel_runtime_pm_put(&i915->runtime_pm, wakeref);
+	return ret;
+}
+
+/**
+ * intel_guc_slpc_min_freq_set() - Set min frequency limit for SLPC.
+ * @slpc: pointer to intel_guc_slpc.
+ * @val: encoded frequency
+ *
+ * This function will invoke GuC SLPC action to update the min frequency
+ * limit.
+ *
+ * Return: 0 on success, non-zero error code on failure.
+ */
+int intel_guc_slpc_set_min_freq(struct intel_guc_slpc *slpc, u32 val)
+{
+	int ret;
+	struct intel_guc *guc = slpc_to_guc(slpc);
+	struct drm_i915_private *i915 = guc_to_gt(guc)->i915;

drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c int intel_guc_slpc_init(struct intel_guc_slpc *slpc) · line 305

Quoted 10 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c +10 -0
+	intel_wakeref_t wakeref;
+
+	wakeref = intel_runtime_pm_get(&i915->runtime_pm);
+
+	ret = slpc_set_param(slpc,
+		       SLPC_PARAM_GLOBAL_MIN_GT_UNSLICE_FREQ_MHZ,
+		       val);
+	if (ret) {
+		drm_err(&i915->drm,
+			"Set min frequency for unslice returned %d", ret);

as above

Michal

Quoted 25 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c +9 -0
+		ret = -EIO;
+		goto done;
+	}
+
+done:
+	intel_runtime_pm_put(&i915->runtime_pm, wakeref);
+	return ret;
+}
+
 /*
  * intel_guc_slpc_enable() - Start SLPC
  * @slpc: pointer to intel_guc_slpc.
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.h +2 -0
index a2643b904165..a473e1ea7c10 100644
@@ -34,5 +34,7 @@ struct intel_guc_slpc {
 int intel_guc_slpc_init(struct intel_guc_slpc *slpc);
 int intel_guc_slpc_enable(struct intel_guc_slpc *slpc);
 void intel_guc_slpc_fini(struct intel_guc_slpc *slpc);
+int intel_guc_slpc_set_max_freq(struct intel_guc_slpc *slpc, u32 val);
+int intel_guc_slpc_set_min_freq(struct intel_guc_slpc *slpc, u32 val);
 
 #endif
#24 lore raw

Re: [PATCH 08/16] drm/i915/guc/slpc: Add methods to set min/max frequency

Quoted 46 lines · Michal Wajdeczko
Quoted 18 lines · Vinay Belgaumkar

Add param set h2g helpers to set the min and max frequencies for use by SLPC.

---
  drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c | 94 +++++++++++++++++++++
  drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.h |  2 +
  2 files changed, 96 insertions(+)
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c +0 -0
index e579408d1c19..19cb26479942 100644
@@ -106,6 +106,19 @@ static int slpc_send(struct intel_guc_slpc *slpc,
  	return intel_guc_send(guc, action, in_len);
  }
 

drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c static int slpc_send(struct intel_guc_slpc *slpc, · line 118

Quoted 10 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c +10 -0
+static int host2guc_slpc_set_param(struct intel_guc_slpc *slpc,
+				   u32 id, u32 value)
+{
+	struct slpc_event_input data = {0};
+
+	data.header.value = SLPC_EVENT(SLPC_EVENT_PARAMETER_SET, 2);
+	data.args[0] = id;
+	data.args[1] = value;
+
+	return slpc_send(slpc, &data, 4);

as suggested before, use of explicit function like:

static int guc_action_slpc_param(guc, u32 id, u32 value)

{
	u32 request[] = {
		INTEL_GUC_ACTION_SLPC_REQUEST,
		SLPC_EVENT(SLPC_EVENT_PARAMETER_SET, 2),
		id,
		value,
	};

	return intel_guc_send(guc, request, ARRAY_SIZE(request));
}
Quoted 1 line

will be simpler/cleaner

done.

Quoted 11 lines
Quoted 11 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c +3 -0
+}
+
+
  static bool slpc_running(struct intel_guc_slpc *slpc)
  {
  	struct slpc_shared_data *data;
@@ -134,6 +147,19 @@ static int host2guc_slpc_query_task_state(struct intel_guc_slpc *slpc)
  	return slpc_send(slpc, &data, 4);
  }
 
Quoted 11 lines

drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c static int host2guc_slpc_query_task_state(struct intel_guc_slpc *slpc) · line 156

Quoted 7 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c +7 -0
+static int slpc_set_param(struct intel_guc_slpc *slpc, u32 id, u32 value)
+{
+	struct drm_i915_private *i915 = slpc_to_i915(slpc);
+	GEM_BUG_ON(id >= SLPC_MAX_PARAM);
+
+	if (host2guc_slpc_set_param(slpc, id, value)) {
+		drm_err(&i915->drm, "Unable to set param %x", id);

missing \n
what about printing value to be set ?
what about printing send error %pe ?

done.

Quoted 14 lines
Quoted 14 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c +6 -0
+		return -EIO;
+	}
+
+	return 0;
+}
+
  static int slpc_read_task_state(struct intel_guc_slpc *slpc)
  {
  	return host2guc_slpc_query_task_state(slpc);
@@ -218,6 +244,74 @@ int intel_guc_slpc_init(struct intel_guc_slpc *slpc)
  	return slpc_shared_data_init(slpc);
  }
 
Quoted 6 lines

drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c int intel_guc_slpc_init(struct intel_guc_slpc *slpc) · line 250

Quoted 4 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c +4 -0
+/**
+ * intel_guc_slpc_max_freq_set() - Set max frequency limit for SLPC.
+ * @slpc: pointer to intel_guc_slpc.
+ * @val: encoded frequency

what's the encoding ?

It should just be frequency (MHz).

Quoted 16 lines
Quoted 4 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c +3 -0
+ *
+ * This function will invoke GuC SLPC action to update the max frequency
+ * limit for slice and unslice.

drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c int intel_guc_slpc_init(struct intel_guc_slpc *slpc) · line 263

Quoted 10 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c +10 -0
+ *
+ * Return: 0 on success, non-zero error code on failure.
+ */
+int intel_guc_slpc_set_max_freq(struct intel_guc_slpc *slpc, u32 val)
+{
+	int ret;
+	struct drm_i915_private *i915 = slpc_to_i915(slpc);
+	intel_wakeref_t wakeref;
+
+	wakeref = intel_runtime_pm_get(&i915->runtime_pm);

use can use with_intel_runtime_pm(rpm, wakeref)

Ok.

Quoted 13 lines

drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c int intel_guc_slpc_init(struct intel_guc_slpc *slpc) · line 271

Quoted 9 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c +8 -0
+
+	ret = slpc_set_param(slpc,
+		       SLPC_PARAM_GLOBAL_MAX_GT_UNSLICE_FREQ_MHZ,
+		       val);
+
+	if (ret) {
+		drm_err(&i915->drm,
+			"Set max frequency unslice returned %d", ret);

missing \n
print error with %pe
but slpc_set_param returns only -EIO ;(

I was done that way so the sysfs method that calls it gets a standard value. Will change that.

Quoted 29 lines
Quoted 29 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c +28 -0
+		ret = -EIO;
+		goto done;
+	}
+
+done:
+	intel_runtime_pm_put(&i915->runtime_pm, wakeref);
+	return ret;
+}
+
+/**
+ * intel_guc_slpc_min_freq_set() - Set min frequency limit for SLPC.
+ * @slpc: pointer to intel_guc_slpc.
+ * @val: encoded frequency
+ *
+ * This function will invoke GuC SLPC action to update the min frequency
+ * limit.
+ *
+ * Return: 0 on success, non-zero error code on failure.
+ */
+int intel_guc_slpc_set_min_freq(struct intel_guc_slpc *slpc, u32 val)
+{
+	int ret;
+	struct intel_guc *guc = slpc_to_guc(slpc);
+	struct drm_i915_private *i915 = guc_to_gt(guc)->i915;
+	intel_wakeref_t wakeref;
+
+	wakeref = intel_runtime_pm_get(&i915->runtime_pm);
+
Quoted 8 lines

drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c int intel_guc_slpc_init(struct intel_guc_slpc *slpc) · line 305

Quoted 6 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c +6 -0
+	ret = slpc_set_param(slpc,
+		       SLPC_PARAM_GLOBAL_MIN_GT_UNSLICE_FREQ_MHZ,
+		       val);
+	if (ret) {
+		drm_err(&i915->drm,
+			"Set min frequency for unslice returned %d", ret);

as above

done.
Thanks,

Vinay.

Quoted 26 lines

Michal

Quoted 23 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c +9 -0
+		ret = -EIO;
+		goto done;
+	}
+
+done:
+	intel_runtime_pm_put(&i915->runtime_pm, wakeref);
+	return ret;
+}
+
  /*
   * intel_guc_slpc_enable() - Start SLPC
   * @slpc: pointer to intel_guc_slpc.
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.h +2 -0
index a2643b904165..a473e1ea7c10 100644
@@ -34,5 +34,7 @@ struct intel_guc_slpc {
  int intel_guc_slpc_init(struct intel_guc_slpc *slpc);
  int intel_guc_slpc_enable(struct intel_guc_slpc *slpc);
  void intel_guc_slpc_fini(struct intel_guc_slpc *slpc);
+int intel_guc_slpc_set_max_freq(struct intel_guc_slpc *slpc, u32 val);
+int intel_guc_slpc_set_min_freq(struct intel_guc_slpc *slpc, u32 val);
 
Quoted 2 lines

drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.h struct intel_guc_slpc { · line 40

Quoted 2 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.h +0 -0
  #endif

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#25 lore raw

PATCH 9/16 drm/i915/guc/slpc: Add get max/min freq hooks

In reply to Vinay Belgaumkar

Add helpers to read the min/max frequency being used by SLPC. This is done by send a h2g command which forces SLPC to update the shared data struct which can then be read.

---
 drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c | 58 +++++++++++++++++++++
 drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.h |  2 +
 2 files changed, 60 insertions(+)
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c +58 -0
index 19cb26479942..98a283d31734 100644
@@ -278,6 +278,35 @@ int intel_guc_slpc_set_max_freq(struct intel_guc_slpc *slpc, u32 val)
 	return ret;
 }
 
+int intel_guc_slpc_get_max_freq(struct intel_guc_slpc *slpc, u32 *val)
+{
+	struct slpc_shared_data *data;
+	intel_wakeref_t wakeref;
+	struct drm_i915_private *i915 = guc_to_gt(slpc_to_guc(slpc))->i915;
+	int ret = 0;
+
+	wakeref = intel_runtime_pm_get(&i915->runtime_pm);
+
+	/* Force GuC to update task data */
+	if (slpc_read_task_state(slpc)) {
+		DRM_ERROR("Unable to update task data");
+		ret = -EIO;
+		goto done;
+	}
+
+	GEM_BUG_ON(!slpc->vma);
+
+	drm_clflush_virt_range(slpc->vaddr, sizeof(struct slpc_shared_data));
+	data = slpc->vaddr;
+
+	*val = DIV_ROUND_CLOSEST(data->task_state_data.max_unslice_freq *
+				GT_FREQUENCY_MULTIPLIER, GEN9_FREQ_SCALER);
+
+done:
+	intel_runtime_pm_put(&i915->runtime_pm, wakeref);
+	return ret;
+}
+
 /**
  * intel_guc_slpc_min_freq_set() - Set min frequency limit for SLPC.
  * @slpc: pointer to intel_guc_slpc.
@@ -312,6 +341,35 @@ int intel_guc_slpc_set_min_freq(struct intel_guc_slpc *slpc, u32 val)
 	return ret;
 }
 
+int intel_guc_slpc_get_min_freq(struct intel_guc_slpc *slpc, u32 *val)
+{
+	struct slpc_shared_data *data;
+	intel_wakeref_t wakeref;
+	struct drm_i915_private *i915 = guc_to_gt(slpc_to_guc(slpc))->i915;
+	int ret = 0;
+
+	wakeref = intel_runtime_pm_get(&i915->runtime_pm);
+
+	/* Force GuC to update task data */
+	if (slpc_read_task_state(slpc)) {
+		DRM_ERROR("Unable to update task data");
+		ret = -EIO;
+		goto done;
+	}
+
+	GEM_BUG_ON(!slpc->vma);
+
+	drm_clflush_virt_range(slpc->vaddr, sizeof(struct slpc_shared_data));
+	data = slpc->vaddr;
+
+	*val = DIV_ROUND_CLOSEST(data->task_state_data.min_unslice_freq *
+				GT_FREQUENCY_MULTIPLIER, GEN9_FREQ_SCALER);
+
+done:
+	intel_runtime_pm_put(&i915->runtime_pm, wakeref);
+	return ret;
+}
+
 /*
  * intel_guc_slpc_enable() - Start SLPC
  * @slpc: pointer to intel_guc_slpc.
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.h +2 -0
index a473e1ea7c10..2cb830cdacb5 100644
@@ -36,5 +36,7 @@ int intel_guc_slpc_enable(struct intel_guc_slpc *slpc);
 void intel_guc_slpc_fini(struct intel_guc_slpc *slpc);
 int intel_guc_slpc_set_max_freq(struct intel_guc_slpc *slpc, u32 val);
 int intel_guc_slpc_set_min_freq(struct intel_guc_slpc *slpc, u32 val);
+int intel_guc_slpc_get_max_freq(struct intel_guc_slpc *slpc, u32 *val);
+int intel_guc_slpc_get_min_freq(struct intel_guc_slpc *slpc, u32 *val);
 
 #endif
Signature · 1 line
2.25.0
#26 lore raw

Re: [PATCH 09/16] drm/i915/guc/slpc: Add get max/min freq hooks

Quoted 2 lines · Vinay Belgaumkar

Add helpers to read the min/max frequency being used by SLPC. This is done by send a h2g command which forces

s/h2g/H2G

Quoted 20 lines

SLPC to update the shared data struct which can then be read.

---
 drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c | 58 +++++++++++++++++++++
 drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.h |  2 +
 2 files changed, 60 insertions(+)
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c +2 -0
index 19cb26479942..98a283d31734 100644
@@ -278,6 +278,35 @@ int intel_guc_slpc_set_max_freq(struct intel_guc_slpc *slpc, u32 val)
 	return ret;
 }
 
+int intel_guc_slpc_get_max_freq(struct intel_guc_slpc *slpc, u32 *val)
+{

drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c int intel_guc_slpc_set_max_freq(struct intel_guc_slpc *slpc, u32 val) · line 292

Quoted 10 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c +10 -0
+	struct slpc_shared_data *data;
+	intel_wakeref_t wakeref;
+	struct drm_i915_private *i915 = guc_to_gt(slpc_to_guc(slpc))->i915;
+	int ret = 0;
+
+	wakeref = intel_runtime_pm_get(&i915->runtime_pm);
+
+	/* Force GuC to update task data */
+	if (slpc_read_task_state(slpc)) {
+		DRM_ERROR("Unable to update task data");

use drm_err
missing \n
maybe this message could be moved to slpc_read_task_state ?

drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c int intel_guc_slpc_set_max_freq(struct intel_guc_slpc *slpc, u32 val) · line 299

Quoted 7 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c +7 -0
+		ret = -EIO;
+		goto done;
+	}
+
+	GEM_BUG_ON(!slpc->vma);
+
+	drm_clflush_virt_range(slpc->vaddr, sizeof(struct slpc_shared_data));

maybe this can also be part of slpc_read_task_state ?

Quoted 14 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c +10 -0
+	data = slpc->vaddr;
+
+	*val = DIV_ROUND_CLOSEST(data->task_state_data.max_unslice_freq *
+				GT_FREQUENCY_MULTIPLIER, GEN9_FREQ_SCALER);
+
+done:
+	intel_runtime_pm_put(&i915->runtime_pm, wakeref);
+	return ret;
+}
+
 /**
  * intel_guc_slpc_min_freq_set() - Set min frequency limit for SLPC.
  * @slpc: pointer to intel_guc_slpc.

drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c int intel_guc_slpc_set_min_freq(struct intel_guc_slpc *slpc, u32 val) · line 344

Quoted 4 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c +1 -0
@@ -312,6 +341,35 @@ int intel_guc_slpc_set_min_freq(struct intel_guc_slpc *slpc, u32 val)
 	return ret;
 }
 
+int intel_guc_slpc_get_min_freq(struct intel_guc_slpc *slpc, u32 *val)

missing kernel-doc (above intel_guc_slpc_min_freq_set has one)

drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c int intel_guc_slpc_set_max_freq(struct intel_guc_slpc *slpc, u32 val) · line 292

Quoted 11 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c +11 -0
+{
+	struct slpc_shared_data *data;
+	intel_wakeref_t wakeref;
+	struct drm_i915_private *i915 = guc_to_gt(slpc_to_guc(slpc))->i915;
+	int ret = 0;
+
+	wakeref = intel_runtime_pm_get(&i915->runtime_pm);
+
+	/* Force GuC to update task data */
+	if (slpc_read_task_state(slpc)) {
+		DRM_ERROR("Unable to update task data");

see above

drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c int intel_guc_slpc_set_max_freq(struct intel_guc_slpc *slpc, u32 val) · line 299

Quoted 7 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c +7 -0
+		ret = -EIO;
+		goto done;
+	}
+
+	GEM_BUG_ON(!slpc->vma);
+
+	drm_clflush_virt_range(slpc->vaddr, sizeof(struct slpc_shared_data));

see above

Michal

Quoted 19 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c +10 -0
+	data = slpc->vaddr;
+
+	*val = DIV_ROUND_CLOSEST(data->task_state_data.min_unslice_freq *
+				GT_FREQUENCY_MULTIPLIER, GEN9_FREQ_SCALER);
+
+done:
+	intel_runtime_pm_put(&i915->runtime_pm, wakeref);
+	return ret;
+}
+
 /*
  * intel_guc_slpc_enable() - Start SLPC
  * @slpc: pointer to intel_guc_slpc.
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.h +0 -0
index a473e1ea7c10..2cb830cdacb5 100644

drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.h int intel_guc_slpc_enable(struct intel_guc_slpc *slpc); · line 42

Quoted 7 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.h +2 -0
@@ -36,5 +36,7 @@ int intel_guc_slpc_enable(struct intel_guc_slpc *slpc);
 void intel_guc_slpc_fini(struct intel_guc_slpc *slpc);
 int intel_guc_slpc_set_max_freq(struct intel_guc_slpc *slpc, u32 val);
 int intel_guc_slpc_set_min_freq(struct intel_guc_slpc *slpc, u32 val);
+int intel_guc_slpc_get_max_freq(struct intel_guc_slpc *slpc, u32 *val);
+int intel_guc_slpc_get_min_freq(struct intel_guc_slpc *slpc, u32 *val);
 
 #endif

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#27 lore raw

Re: [PATCH 09/16] drm/i915/guc/slpc: Add get max/min freq hooks

Quoted 7 lines · Michal Wajdeczko
Quoted 2 lines · Vinay Belgaumkar

Add helpers to read the min/max frequency being used by SLPC. This is done by send a h2g command which forces

s/h2g/H2G

done.

Quoted 19 lines
Quoted 19 lines

SLPC to update the shared data struct which can then be read.

---
  drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c | 58 +++++++++++++++++++++
  drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.h |  2 +
  2 files changed, 60 insertions(+)
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c +0 -0
index 19cb26479942..98a283d31734 100644
@@ -278,6 +278,35 @@ int intel_guc_slpc_set_max_freq(struct intel_guc_slpc *slpc, u32 val)
  	return ret;
  }
 
Quoted 16 lines

drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c int intel_guc_slpc_set_max_freq(struct intel_guc_slpc *slpc, u32 val) · line 292

Quoted 12 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c +12 -0
+int intel_guc_slpc_get_max_freq(struct intel_guc_slpc *slpc, u32 *val)
+{
+	struct slpc_shared_data *data;
+	intel_wakeref_t wakeref;
+	struct drm_i915_private *i915 = guc_to_gt(slpc_to_guc(slpc))->i915;
+	int ret = 0;
+
+	wakeref = intel_runtime_pm_get(&i915->runtime_pm);
+
+	/* Force GuC to update task data */
+	if (slpc_read_task_state(slpc)) {
+		DRM_ERROR("Unable to update task data");

use drm_err
missing \n
maybe this message could be moved to slpc_read_task_state ?

Done.

Quoted 10 lines

drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c int intel_guc_slpc_set_max_freq(struct intel_guc_slpc *slpc, u32 val) · line 299

Quoted 8 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c +7 -0
+		ret = -EIO;
+		goto done;
+	}
+
+	GEM_BUG_ON(!slpc->vma);
+
+	drm_clflush_virt_range(slpc->vaddr, sizeof(struct slpc_shared_data));

maybe this can also be part of slpc_read_task_state ?

Yup.

Quoted 18 lines
Quoted 18 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c +10 -0
+	data = slpc->vaddr;
+
+	*val = DIV_ROUND_CLOSEST(data->task_state_data.max_unslice_freq *
+				GT_FREQUENCY_MULTIPLIER, GEN9_FREQ_SCALER);
+
+done:
+	intel_runtime_pm_put(&i915->runtime_pm, wakeref);
+	return ret;
+}
+
  /**
   * intel_guc_slpc_min_freq_set() - Set min frequency limit for SLPC.
   * @slpc: pointer to intel_guc_slpc.
@@ -312,6 +341,35 @@ int intel_guc_slpc_set_min_freq(struct intel_guc_slpc *slpc, u32 val)
  	return ret;
  }
 
Quoted 3 lines

drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c int intel_guc_slpc_set_min_freq(struct intel_guc_slpc *slpc, u32 val) · line 344

Quoted 1 line
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c +1 -0
+int intel_guc_slpc_get_min_freq(struct intel_guc_slpc *slpc, u32 *val)

missing kernel-doc (above intel_guc_slpc_min_freq_set has one)

done.

Quoted 15 lines

drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c int intel_guc_slpc_set_max_freq(struct intel_guc_slpc *slpc, u32 val) · line 292

Quoted 12 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c +11 -0
+{
+	struct slpc_shared_data *data;
+	intel_wakeref_t wakeref;
+	struct drm_i915_private *i915 = guc_to_gt(slpc_to_guc(slpc))->i915;
+	int ret = 0;
+
+	wakeref = intel_runtime_pm_get(&i915->runtime_pm);
+
+	/* Force GuC to update task data */
+	if (slpc_read_task_state(slpc)) {
+		DRM_ERROR("Unable to update task data");

see above

Quoted 9 lines

drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c int intel_guc_slpc_set_max_freq(struct intel_guc_slpc *slpc, u32 val) · line 299

Quoted 7 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c +7 -0
+		ret = -EIO;
+		goto done;
+	}
+
+	GEM_BUG_ON(!slpc->vma);
+
+	drm_clflush_virt_range(slpc->vaddr, sizeof(struct slpc_shared_data));

see above

Done.

Thanks,
Vinay.

Quoted 29 lines

Michal

Quoted 26 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c +10 -0
+	data = slpc->vaddr;
+
+	*val = DIV_ROUND_CLOSEST(data->task_state_data.min_unslice_freq *
+				GT_FREQUENCY_MULTIPLIER, GEN9_FREQ_SCALER);
+
+done:
+	intel_runtime_pm_put(&i915->runtime_pm, wakeref);
+	return ret;
+}
+
  /*
   * intel_guc_slpc_enable() - Start SLPC
   * @slpc: pointer to intel_guc_slpc.
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.h +2 -0
index a473e1ea7c10..2cb830cdacb5 100644
@@ -36,5 +36,7 @@ int intel_guc_slpc_enable(struct intel_guc_slpc *slpc);
  void intel_guc_slpc_fini(struct intel_guc_slpc *slpc);
  int intel_guc_slpc_set_max_freq(struct intel_guc_slpc *slpc, u32 val);
  int intel_guc_slpc_set_min_freq(struct intel_guc_slpc *slpc, u32 val);
+int intel_guc_slpc_get_max_freq(struct intel_guc_slpc *slpc, u32 *val);
+int intel_guc_slpc_get_min_freq(struct intel_guc_slpc *slpc, u32 *val);
 
  #endif
#28 lore raw

PATCH 10/16 drm/i915/guc/slpc: Add debugfs for slpc info

In reply to Vinay Belgaumkar

This prints out relevant SLPC info from the SLPC shared structure.

We will send a h2g message which forces SLPC to update the shared data structure with latest information before reading it.

---
 .../gpu/drm/i915/gt/uc/intel_guc_debugfs.c    | 16 ++++++
 drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c   | 53 +++++++++++++++++++
 drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.h   |  3 ++
 3 files changed, 72 insertions(+)
drivers/gpu/drm/i915/gt/uc/intel_guc_debugfs.c +16 -0
index 9a03ff56e654..bef749e54601 100644
@@ -12,6 +12,7 @@
 #include "gt/uc/intel_guc_ct.h"
 #include "gt/uc/intel_guc_ads.h"
 #include "gt/uc/intel_guc_submission.h"
+#include "gt/uc/intel_guc_slpc.h"
 
 static int guc_info_show(struct seq_file *m, void *data)
 {
@@ -50,11 +51,26 @@ static int guc_registered_contexts_show(struct seq_file *m, void *data)
 }
 DEFINE_GT_DEBUGFS_ATTRIBUTE(guc_registered_contexts);
 
+static int guc_slpc_info_show(struct seq_file *m, void *unused)
+{
+	struct intel_guc *guc = m->private;
+	struct intel_guc_slpc *slpc = &guc->slpc;
+	struct drm_printer p = drm_seq_file_printer(m);
+
+	if (!intel_guc_slpc_is_used(guc))
+		return -ENODEV;
+
+	return intel_guc_slpc_info(slpc, &p);
+}
+
+DEFINE_GT_DEBUGFS_ATTRIBUTE(guc_slpc_info);
+
 void intel_guc_debugfs_register(struct intel_guc *guc, struct dentry *root)
 {
 	static const struct debugfs_gt_file files[] = {
 		{ "guc_info", &guc_info_fops, NULL },
 		{ "guc_registered_contexts", &guc_registered_contexts_fops, NULL },
+		{ "guc_slpc_info", &guc_slpc_info_fops, NULL},
 	};
 
 	if (!intel_guc_is_supported(guc))
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c +53 -0

59 lines not on this page · raw message

drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.h +3 -0
index 2cb830cdacb5..cd12c5f19f4b 100644
@@ -10,6 +10,8 @@
 #include <linux/mutex.h>
 #include "intel_guc_slpc_fwif.h"
 
+struct drm_printer;
+
 struct intel_guc_slpc {
 	/*Protects access to vma and SLPC actions */
 	struct i915_vma *vma;
@@ -38,5 +40,6 @@ int intel_guc_slpc_set_max_freq(struct intel_guc_slpc *slpc, u32 val);
 int intel_guc_slpc_set_min_freq(struct intel_guc_slpc *slpc, u32 val);
 int intel_guc_slpc_get_max_freq(struct intel_guc_slpc *slpc, u32 *val);
 int intel_guc_slpc_get_min_freq(struct intel_guc_slpc *slpc, u32 *val);
+int intel_guc_slpc_info(struct intel_guc_slpc *slpc, struct drm_printer *p);
 
 #endif
Signature · 6 lines
2.25.0

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#29 lore raw

Re: [PATCH 10/16] drm/i915/guc/slpc: Add debugfs for slpc info

Quoted 31 lines · Vinay Belgaumkar

This prints out relevant SLPC info from the SLPC shared structure.

We will send a h2g message which forces SLPC to update the shared data structure with latest information before reading it.

---
 .../gpu/drm/i915/gt/uc/intel_guc_debugfs.c    | 16 ++++++
 drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c   | 53 +++++++++++++++++++
 drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.h   |  3 ++
 3 files changed, 72 insertions(+)
drivers/gpu/drm/i915/gt/uc/intel_guc_debugfs.c +3 -0
index 9a03ff56e654..bef749e54601 100644
@@ -12,6 +12,7 @@
 #include "gt/uc/intel_guc_ct.h"
 #include "gt/uc/intel_guc_ads.h"
 #include "gt/uc/intel_guc_submission.h"
+#include "gt/uc/intel_guc_slpc.h"
 
 static int guc_info_show(struct seq_file *m, void *data)
 {
@@ -50,11 +51,26 @@ static int guc_registered_contexts_show(struct seq_file *m, void *data)
 }
 DEFINE_GT_DEBUGFS_ATTRIBUTE(guc_registered_contexts);
 
+static int guc_slpc_info_show(struct seq_file *m, void *unused)
+{

drivers/gpu/drm/i915/gt/uc/intel_guc_debugfs.c static int guc_registered_contexts_show(struct seq_file *m, void *data) · line 65

Quoted 10 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_debugfs.c +10 -0
+	struct intel_guc *guc = m->private;
+	struct intel_guc_slpc *slpc = &guc->slpc;
+	struct drm_printer p = drm_seq_file_printer(m);
+
+	if (!intel_guc_slpc_is_used(guc))
+		return -ENODEV;
+
+	return intel_guc_slpc_info(slpc, &p);
+}
+

other entries don't have empty line here

drivers/gpu/drm/i915/gt/uc/intel_guc_debugfs.c static int guc_registered_contexts_show(struct seq_file *m, void *data) · line 73

Quoted 8 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_debugfs.c +3 -0
+DEFINE_GT_DEBUGFS_ATTRIBUTE(guc_slpc_info);
+
 void intel_guc_debugfs_register(struct intel_guc *guc, struct dentry *root)
 {
 	static const struct debugfs_gt_file files[] = {
 		{ "guc_info", &guc_info_fops, NULL },
 		{ "guc_registered_contexts", &guc_registered_contexts_fops, NULL },
+		{ "guc_slpc_info", &guc_slpc_info_fops, NULL},

IIRC last field is "eval" where maybe you could add your own to check if intel_guc_slpc_is_used() to avoid exposing this info if N/A

Quoted 20 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_debugfs.c +0 -0
 	};
 
 	if (!intel_guc_is_supported(guc))
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c +9 -0
index 98a283d31734..d179ba14ece6 100644
@@ -432,6 +432,59 @@ int intel_guc_slpc_enable(struct intel_guc_slpc *slpc)
 	return 0;
 }
 
+int intel_guc_slpc_info(struct intel_guc_slpc *slpc, struct drm_printer *p)
+{
+	struct drm_i915_private *i915 = guc_to_gt(slpc_to_guc(slpc))->i915;
+	struct slpc_shared_data *data;
+	struct slpc_platform_info *platform_info;
+	struct slpc_task_state_data *task_state_data;
+	intel_wakeref_t wakeref;
+	int ret = 0;
+

drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c int intel_guc_slpc_enable(struct intel_guc_slpc *slpc) · line 453

Quoted 10 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c +10 -0
+	wakeref = intel_runtime_pm_get(&i915->runtime_pm);
+
+	if (slpc_read_task_state(slpc)) {
+		ret = -EIO;
+		goto done;
+	}
+
+	GEM_BUG_ON(!slpc->vma);
+
+	drm_clflush_virt_range(slpc->vaddr, sizeof(struct slpc_shared_data));

likely will go away if integrated into slpc_read_task_state

drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c int intel_guc_slpc_enable(struct intel_guc_slpc *slpc) · line 456

Quoted 3 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c +3 -0
+	data = slpc->vaddr;
+
+	platform_info = &data->platform_info;

is this used ?

drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c int intel_guc_slpc_enable(struct intel_guc_slpc *slpc) · line 457

Quoted 1 line
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c +1 -0
+	task_state_data = &data->task_state_data;

as it looks that you treat these sections separately, then maybe it would be cleaner to have:

static void print_global_data(*global_data, *p) {} static void print_platform_info(*platform_info, *p) {} static void print_task_state_data(*task_state_data, *p) {}

Quoted 14 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c +14 -0
+
+	drm_printf(p, "SLPC state: %s\n", slpc_state_stringify(data->global_state));
+	drm_printf(p, "\tgtperf task active: %d\n",
+			task_state_data->gtperf_task_active);
+	drm_printf(p, "\tdcc task active: %d\n",
+				task_state_data->dcc_task_active);
+	drm_printf(p, "\tin dcc: %d\n",
+				task_state_data->in_dcc);
+	drm_printf(p, "\tfreq switch active: %d\n",
+				task_state_data->freq_switch_active);
+	drm_printf(p, "\tibc enabled: %d\n",
+				task_state_data->ibc_enabled);
+	drm_printf(p, "\tibc active: %d\n",
+				task_state_data->ibc_active);

drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c int intel_guc_slpc_enable(struct intel_guc_slpc *slpc) · line 481

Quoted 10 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c +10 -0
+	drm_printf(p, "\tpg1 enabled: %s\n",
+				yesno(task_state_data->pg1_enabled));
+	drm_printf(p, "\tpg1 active: %s\n",
+				yesno(task_state_data->pg1_active));
+	drm_printf(p, "\tmax freq: %dMHz\n",
+				DIV_ROUND_CLOSEST(data->task_state_data.max_unslice_freq *
+				GT_FREQUENCY_MULTIPLIER, GEN9_FREQ_SCALER));
+	drm_printf(p, "\tmin freq: %dMHz\n",
+				DIV_ROUND_CLOSEST(data->task_state_data.min_unslice_freq *
+				GT_FREQUENCY_MULTIPLIER, GEN9_FREQ_SCALER));

you defined task_state_data but in above 2 you're accessing it from data

Michal

Quoted 30 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c +6 -0
+
+done:
+	intel_runtime_pm_put(&i915->runtime_pm, wakeref);
+	return ret;
+}
+
 void intel_guc_slpc_fini(struct intel_guc_slpc *slpc)
 {
 	if (!slpc->vma)
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.h +3 -0
index 2cb830cdacb5..cd12c5f19f4b 100644
@@ -10,6 +10,8 @@
 #include <linux/mutex.h>
 #include "intel_guc_slpc_fwif.h"
 
+struct drm_printer;
+
 struct intel_guc_slpc {
 	/*Protects access to vma and SLPC actions */
 	struct i915_vma *vma;
@@ -38,5 +40,6 @@ int intel_guc_slpc_set_max_freq(struct intel_guc_slpc *slpc, u32 val);
 int intel_guc_slpc_set_min_freq(struct intel_guc_slpc *slpc, u32 val);
 int intel_guc_slpc_get_max_freq(struct intel_guc_slpc *slpc, u32 *val);
 int intel_guc_slpc_get_min_freq(struct intel_guc_slpc *slpc, u32 *val);
+int intel_guc_slpc_info(struct intel_guc_slpc *slpc, struct drm_printer *p);
 
 #endif
#30 lore raw

Re: [PATCH 10/16] drm/i915/guc/slpc: Add debugfs for slpc info

Quoted 32 lines · Michal Wajdeczko
Quoted 29 lines · Vinay Belgaumkar

This prints out relevant SLPC info from the SLPC shared structure.

We will send a h2g message which forces SLPC to update the shared data structure with latest information before reading it.

---
  .../gpu/drm/i915/gt/uc/intel_guc_debugfs.c    | 16 ++++++
  drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c   | 53 +++++++++++++++++++
  drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.h   |  3 ++
  3 files changed, 72 insertions(+)
drivers/gpu/drm/i915/gt/uc/intel_guc_debugfs.c +1 -0
index 9a03ff56e654..bef749e54601 100644
@@ -12,6 +12,7 @@
  #include "gt/uc/intel_guc_ct.h"
  #include "gt/uc/intel_guc_ads.h"
  #include "gt/uc/intel_guc_submission.h"
+#include "gt/uc/intel_guc_slpc.h"
 
  static int guc_info_show(struct seq_file *m, void *data)
  {
@@ -50,11 +51,26 @@ static int guc_registered_contexts_show(struct seq_file *m, void *data)
  }
  DEFINE_GT_DEBUGFS_ATTRIBUTE(guc_registered_contexts);
 
Quoted 14 lines

drivers/gpu/drm/i915/gt/uc/intel_guc_debugfs.c static int guc_registered_contexts_show(struct seq_file *m, void *data) · line 65

Quoted 12 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_debugfs.c +12 -0
+static int guc_slpc_info_show(struct seq_file *m, void *unused)
+{
+	struct intel_guc *guc = m->private;
+	struct intel_guc_slpc *slpc = &guc->slpc;
+	struct drm_printer p = drm_seq_file_printer(m);
+
+	if (!intel_guc_slpc_is_used(guc))
+		return -ENODEV;
+
+	return intel_guc_slpc_info(slpc, &p);
+}
+

other entries don't have empty line here

Removed.

Quoted 12 lines

drivers/gpu/drm/i915/gt/uc/intel_guc_debugfs.c static int guc_registered_contexts_show(struct seq_file *m, void *data) · line 73

Quoted 9 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_debugfs.c +3 -0
+DEFINE_GT_DEBUGFS_ATTRIBUTE(guc_slpc_info);
+
  void intel_guc_debugfs_register(struct intel_guc *guc, struct dentry *root)
  {
  	static const struct debugfs_gt_file files[] = {
  		{ "guc_info", &guc_info_fops, NULL },
  		{ "guc_registered_contexts", &guc_registered_contexts_fops, NULL },
+		{ "guc_slpc_info", &guc_slpc_info_fops, NULL},

IIRC last field is "eval" where maybe you could add your own to check if intel_guc_slpc_is_used() to avoid exposing this info if N/A

ok, added.

Quoted 25 lines
Quoted 25 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_debugfs.c +0 -0
  	};
 
  	if (!intel_guc_is_supported(guc))
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c +13 -0
index 98a283d31734..d179ba14ece6 100644
@@ -432,6 +432,59 @@ int intel_guc_slpc_enable(struct intel_guc_slpc *slpc)
  	return 0;
  }
 
+int intel_guc_slpc_info(struct intel_guc_slpc *slpc, struct drm_printer *p)
+{
+	struct drm_i915_private *i915 = guc_to_gt(slpc_to_guc(slpc))->i915;
+	struct slpc_shared_data *data;
+	struct slpc_platform_info *platform_info;
+	struct slpc_task_state_data *task_state_data;
+	intel_wakeref_t wakeref;
+	int ret = 0;
+
+	wakeref = intel_runtime_pm_get(&i915->runtime_pm);
+
+	if (slpc_read_task_state(slpc)) {
+		ret = -EIO;
Quoted 8 lines

drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c int intel_guc_slpc_enable(struct intel_guc_slpc *slpc) · line 453

Quoted 6 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c +6 -0
+		goto done;
+	}
+
+	GEM_BUG_ON(!slpc->vma);
+
+	drm_clflush_virt_range(slpc->vaddr, sizeof(struct slpc_shared_data));

likely will go away if integrated into slpc_read_task_state

yup.

Quoted 6 lines

drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c int intel_guc_slpc_enable(struct intel_guc_slpc *slpc) · line 456

Quoted 4 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c +3 -0
+	data = slpc->vaddr;
+
+	platform_info = &data->platform_info;

is this used ?

no, removed.

Quoted 9 lines

drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c int intel_guc_slpc_enable(struct intel_guc_slpc *slpc) · line 457

Quoted 2 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c +1 -0
+	task_state_data = &data->task_state_data;

as it looks that you treat these sections separately, then maybe it would be cleaner to have:

static void print_global_data(*global_data, *p) {} static void print_platform_info(*platform_info, *p) {} static void print_task_state_data(*task_state_data, *p) {}

If we make these indivudal functions, we'll need to duplicate a lot of code - like getting wakeref and reading task state. Better to keep it all in one function instead. There is no other use case to print them except for debugfs.

Quoted 19 lines
Quoted 19 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c +18 -0
+
+	drm_printf(p, "SLPC state: %s\n", slpc_state_stringify(data->global_state));
+	drm_printf(p, "\tgtperf task active: %d\n",
+			task_state_data->gtperf_task_active);
+	drm_printf(p, "\tdcc task active: %d\n",
+				task_state_data->dcc_task_active);
+	drm_printf(p, "\tin dcc: %d\n",
+				task_state_data->in_dcc);
+	drm_printf(p, "\tfreq switch active: %d\n",
+				task_state_data->freq_switch_active);
+	drm_printf(p, "\tibc enabled: %d\n",
+				task_state_data->ibc_enabled);
+	drm_printf(p, "\tibc active: %d\n",
+				task_state_data->ibc_active);
+	drm_printf(p, "\tpg1 enabled: %s\n",
+				yesno(task_state_data->pg1_enabled));
+	drm_printf(p, "\tpg1 active: %s\n",
+				yesno(task_state_data->pg1_active));
Quoted 8 lines

drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c int intel_guc_slpc_enable(struct intel_guc_slpc *slpc) · line 481

Quoted 6 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c +6 -0
+	drm_printf(p, "\tmax freq: %dMHz\n",
+				DIV_ROUND_CLOSEST(data->task_state_data.max_unslice_freq *
+				GT_FREQUENCY_MULTIPLIER, GEN9_FREQ_SCALER));
+	drm_printf(p, "\tmin freq: %dMHz\n",
+				DIV_ROUND_CLOSEST(data->task_state_data.min_unslice_freq *
+				GT_FREQUENCY_MULTIPLIER, GEN9_FREQ_SCALER));

you defined task_state_data but in above 2 you're accessing it from data

Fixed.

Thanks,
Vinay.

Quoted 31 lines

Michal

Quoted 28 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c +6 -0
+
+done:
+	intel_runtime_pm_put(&i915->runtime_pm, wakeref);
+	return ret;
+}
+
  void intel_guc_slpc_fini(struct intel_guc_slpc *slpc)
  {
  	if (!slpc->vma)
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.h +3 -0
index 2cb830cdacb5..cd12c5f19f4b 100644
@@ -10,6 +10,8 @@
  #include <linux/mutex.h>
  #include "intel_guc_slpc_fwif.h"
 
+struct drm_printer;
+
  struct intel_guc_slpc {
  	/*Protects access to vma and SLPC actions */
  	struct i915_vma *vma;
@@ -38,5 +40,6 @@ int intel_guc_slpc_set_max_freq(struct intel_guc_slpc *slpc, u32 val);
  int intel_guc_slpc_set_min_freq(struct intel_guc_slpc *slpc, u32 val);
  int intel_guc_slpc_get_max_freq(struct intel_guc_slpc *slpc, u32 *val);
  int intel_guc_slpc_get_min_freq(struct intel_guc_slpc *slpc, u32 *val);
+int intel_guc_slpc_info(struct intel_guc_slpc *slpc, struct drm_printer *p);
 
Quoted 2 lines

drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.h int intel_guc_slpc_set_max_freq(struct intel_guc_slpc *slpc, u32 val); · line 45

Quoted 2 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.h +0 -0
  #endif

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#31 lore raw

PATCH 11/16 drm/i915/guc/slpc: Enable ARAT timer interrupt

In reply to Vinay Belgaumkar

This interrupt is enabled during RPS initialization, and now needs to be done by slpc code. It allows ARAT timer expiry interrupts to get forwarded to GuC.

---
 drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c | 16 ++++++++++++++++
 drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.h |  2 ++
 drivers/gpu/drm/i915/gt/uc/intel_uc.c       |  8 ++++++++
 3 files changed, 26 insertions(+)
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c +16 -0
index d179ba14ece6..d32274cd1db7 100644
@@ -370,6 +370,20 @@ int intel_guc_slpc_get_min_freq(struct intel_guc_slpc *slpc, u32 *val)
 	return ret;
 }
 
+void intel_guc_pm_intrmsk_enable(struct intel_gt *gt)
+{
+	u32 pm_intrmsk_mbz = 0;
+
+	/* Allow GuC to receive ARAT timer expiry event.
+	 * This interrupt register is setup by RPS code
+	 * when host based Turbo is enabled.
+	 */
+	pm_intrmsk_mbz |= ARAT_EXPIRED_INTRMSK;
+
+	intel_uncore_rmw(gt->uncore,
+			   GEN6_PMINTRMSK, pm_intrmsk_mbz, 0);
+}
+
 /*
  * intel_guc_slpc_enable() - Start SLPC
  * @slpc: pointer to intel_guc_slpc.
@@ -417,6 +431,8 @@ int intel_guc_slpc_enable(struct intel_guc_slpc *slpc)
 
 	DRM_INFO("SLPC state: %s\n", get_slpc_state(slpc));
 
+	intel_guc_pm_intrmsk_enable(&i915->gt);
+
 	if (slpc_read_task_state(slpc))
 		drm_err(&i915->drm, "Unable to read task state data");
 
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.h +2 -0
index cd12c5f19f4b..2af0c5eb8c9a 100644
@@ -10,6 +10,7 @@
 #include <linux/mutex.h>
 #include "intel_guc_slpc_fwif.h"
 
+struct intel_gt;
 struct drm_printer;
 
 struct intel_guc_slpc {
@@ -41,5 +42,6 @@ int intel_guc_slpc_set_min_freq(struct intel_guc_slpc *slpc, u32 val);
 int intel_guc_slpc_get_max_freq(struct intel_guc_slpc *slpc, u32 *val);
 int intel_guc_slpc_get_min_freq(struct intel_guc_slpc *slpc, u32 *val);
 int intel_guc_slpc_info(struct intel_guc_slpc *slpc, struct drm_printer *p);
+void intel_guc_pm_intrmsk_enable(struct intel_gt *gt);
 
 #endif
drivers/gpu/drm/i915/gt/uc/intel_uc.c +8 -0
index 7b6c767d3eb0..823f8d3d8df7 100644
@@ -655,6 +655,7 @@ void intel_uc_suspend(struct intel_uc *uc)
 static int __uc_resume(struct intel_uc *uc, bool enable_communication)
 {
 	struct intel_guc *guc = &uc->guc;
+	struct intel_gt *gt = guc_to_gt(guc);
 	int err;
 
 	if (!intel_guc_is_fw_running(guc))
@@ -666,6 +667,13 @@ static int __uc_resume(struct intel_uc *uc, bool enable_communication)
 	if (enable_communication)
 		guc_enable_communication(guc);
 
+	/* If we are only resuming GuC communication but not reloading
+	 * GuC, we need to ensure the ARAT timer interrupt is enabled
+	 * again. In case of GuC reload, it is enabled during slpc enable.
+	 */
+	if (enable_communication && intel_uc_uses_guc_slpc(uc))
+		intel_guc_pm_intrmsk_enable(gt);
+
 	err = intel_guc_resume(guc);
 	if (err) {
 		DRM_DEBUG_DRIVER("Failed to resume GuC, err=%d", err);
Signature · 1 line
2.25.0
#32 lore raw

PATCH 12/16 drm/i915/guc/slpc: Cache platform frequency limits for slpc

In reply to Vinay Belgaumkar

Cache rp0, rp1 and rpn platform limits into slpc structure for range checking while setting min/max frequencies.

Also add "soft" limits which keep track of frequency changes made from userland. These are initially set to platform min and max.

---
 drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c | 41 +++++++++++++++++++++
 1 file changed, 41 insertions(+)
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c +41 -0
index d32274cd1db7..6e978f27b7a6 100644
@@ -86,6 +86,9 @@ static int slpc_shared_data_init(struct intel_guc_slpc *slpc)
 		return err;
 	}
 
+	slpc->max_freq_softlimit = 0;
+	slpc->min_freq_softlimit = 0;
+
 	return err;
 }
 
@@ -384,6 +387,29 @@ void intel_guc_pm_intrmsk_enable(struct intel_gt *gt)
 			   GEN6_PMINTRMSK, pm_intrmsk_mbz, 0);
 }
 
+static int intel_guc_slpc_set_softlimits(struct intel_guc_slpc *slpc)
+{
+	int ret = 0;
+
+	/* Softlimits are initially equivalent to platform limits
+	 * unless they have deviated from defaults, in which case,
+	 * we retain the values and set min/max accordingly.
+	 */
+	if (!slpc->max_freq_softlimit)
+		slpc->max_freq_softlimit = slpc->rp0_freq;
+	else if (slpc->max_freq_softlimit != slpc->rp0_freq)
+		ret = intel_guc_slpc_set_max_freq(slpc,
+					slpc->max_freq_softlimit);
+
+	if (!slpc->min_freq_softlimit)
+		slpc->min_freq_softlimit = slpc->min_freq;
+	else if (slpc->min_freq_softlimit != slpc->min_freq)
+		ret = intel_guc_slpc_set_min_freq(slpc,
+					slpc->min_freq_softlimit);
+
+	return ret;
+}
+
 /*
  * intel_guc_slpc_enable() - Start SLPC
  * @slpc: pointer to intel_guc_slpc.
@@ -402,6 +428,7 @@ int intel_guc_slpc_enable(struct intel_guc_slpc *slpc)
 	struct drm_i915_private *i915 = slpc_to_i915(slpc);
 	struct slpc_shared_data *data;
 	int ret;
+	u32 rp_state_cap;
 
 	GEM_BUG_ON(!slpc->vma);
 
@@ -445,6 +472,20 @@ int intel_guc_slpc_enable(struct intel_guc_slpc *slpc)
 			DIV_ROUND_CLOSEST(data->task_state_data.max_unslice_freq *
 				GT_FREQUENCY_MULTIPLIER, GEN9_FREQ_SCALER));
 
+	rp_state_cap = intel_uncore_read(i915->gt.uncore, GEN6_RP_STATE_CAP);
+
+	slpc->rp0_freq = ((rp_state_cap >> 0) & 0xff) * GT_FREQUENCY_MULTIPLIER;
+	slpc->min_freq = ((rp_state_cap >> 16) & 0xff) * GT_FREQUENCY_MULTIPLIER;
+	slpc->rp1_freq = ((rp_state_cap >> 8) & 0xff) * GT_FREQUENCY_MULTIPLIER;
+
+	if (intel_guc_slpc_set_softlimits(slpc))
+		drm_err(&i915->drm, "Unable to set softlimits");
+
+	drm_info(&i915->drm,
+		 "Platform fused frequency values -  min: %u Mhz, max: %u Mhz",
+		 slpc->min_freq,
+		 slpc->rp0_freq);
+
 	return 0;
 }
 
Signature · 6 lines
2.25.0

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#33 lore raw

Re: [Intel-gfx] [PATCH 12/16] drm/i915/guc/slpc: Cache platform frequency limits for slpc

Quoted 17 lines · Vinay Belgaumkar

Cache rp0, rp1 and rpn platform limits into slpc structure for range checking while setting min/max frequencies.

Also add "soft" limits which keep track of frequency changes made from userland. These are initially set to platform min and max.

---
 drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c | 41 +++++++++++++++++++++
 1 file changed, 41 insertions(+)
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c +0 -0
index d32274cd1db7..6e978f27b7a6 100644

drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c static int slpc_shared_data_init(struct intel_guc_slpc *slpc) · line 90

Quoted 5 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c +2 -0
@@ -86,6 +86,9 @@ static int slpc_shared_data_init(struct intel_guc_slpc *slpc)
 		return err;
 	}
 
+	slpc->max_freq_softlimit = 0;
+	slpc->min_freq_softlimit = 0;

as mentioned earlier, now it is time to introduce these fields in .h

Quoted 35 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c +24 -0
+
 	return err;
 }
 
@@ -384,6 +387,29 @@ void intel_guc_pm_intrmsk_enable(struct intel_gt *gt)
 			   GEN6_PMINTRMSK, pm_intrmsk_mbz, 0);
 }
 
+static int intel_guc_slpc_set_softlimits(struct intel_guc_slpc *slpc)
+{
+	int ret = 0;
+
+	/* Softlimits are initially equivalent to platform limits
+	 * unless they have deviated from defaults, in which case,
+	 * we retain the values and set min/max accordingly.
+	 */
+	if (!slpc->max_freq_softlimit)
+		slpc->max_freq_softlimit = slpc->rp0_freq;
+	else if (slpc->max_freq_softlimit != slpc->rp0_freq)
+		ret = intel_guc_slpc_set_max_freq(slpc,
+					slpc->max_freq_softlimit);
+
+	if (!slpc->min_freq_softlimit)
+		slpc->min_freq_softlimit = slpc->min_freq;
+	else if (slpc->min_freq_softlimit != slpc->min_freq)
+		ret = intel_guc_slpc_set_min_freq(slpc,
+					slpc->min_freq_softlimit);
+
+	return ret;
+}
+
 /*
  * intel_guc_slpc_enable() - Start SLPC
  * @slpc: pointer to intel_guc_slpc.

drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c int intel_guc_slpc_enable(struct intel_guc_slpc *slpc) · line 431

Quoted 4 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c +1 -0
@@ -402,6 +428,7 @@ int intel_guc_slpc_enable(struct intel_guc_slpc *slpc)
 	struct drm_i915_private *i915 = slpc_to_i915(slpc);
 	struct slpc_shared_data *data;
 	int ret;
+	u32 rp_state_cap;

move up to keep "ret" last

drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c int intel_guc_slpc_enable(struct intel_guc_slpc *slpc) · line 479

Quoted 12 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c +5 -0
 	GEM_BUG_ON(!slpc->vma);
 
@@ -445,6 +472,20 @@ int intel_guc_slpc_enable(struct intel_guc_slpc *slpc)
 			DIV_ROUND_CLOSEST(data->task_state_data.max_unslice_freq *
 				GT_FREQUENCY_MULTIPLIER, GEN9_FREQ_SCALER));
 
+	rp_state_cap = intel_uncore_read(i915->gt.uncore, GEN6_RP_STATE_CAP);
+
+	slpc->rp0_freq = ((rp_state_cap >> 0) & 0xff) * GT_FREQUENCY_MULTIPLIER;
+	slpc->min_freq = ((rp_state_cap >> 16) & 0xff) * GT_FREQUENCY_MULTIPLIER;
+	slpc->rp1_freq = ((rp_state_cap >> 8) & 0xff) * GT_FREQUENCY_MULTIPLIER;

we should have definitions for these bits and then we should be able to use REG_FIELD_GET

drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c int intel_guc_slpc_enable(struct intel_guc_slpc *slpc) · line 482

Quoted 3 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c +3 -0
+
+	if (intel_guc_slpc_set_softlimits(slpc))
+		drm_err(&i915->drm, "Unable to set softlimits");

missing \n
maybe we can also print error ?

drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c int intel_guc_slpc_enable(struct intel_guc_slpc *slpc) · line 485

Quoted 3 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c +3 -0
+
+	drm_info(&i915->drm,
+		 "Platform fused frequency values -  min: %u Mhz, max: %u Mhz",

missing \n
double space before 'min'

Michal

drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c int intel_guc_slpc_enable(struct intel_guc_slpc *slpc) · line 491

Quoted 7 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c +3 -0
+		 slpc->min_freq,
+		 slpc->rp0_freq);
+
 	return 0;
 }
 

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#34 lore raw

Re: [Intel-gfx] [PATCH 12/16] drm/i915/guc/slpc: Cache platform frequency limits for slpc

Quoted 23 lines · Michal Wajdeczko
Quoted 20 lines · Vinay Belgaumkar

Cache rp0, rp1 and rpn platform limits into slpc structure for range checking while setting min/max frequencies.

Also add "soft" limits which keep track of frequency changes made from userland. These are initially set to platform min and max.

---
  drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c | 41 +++++++++++++++++++++
  1 file changed, 41 insertions(+)
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c +0 -0
index d32274cd1db7..6e978f27b7a6 100644
@@ -86,6 +86,9 @@ static int slpc_shared_data_init(struct intel_guc_slpc *slpc)
  		return err;
  	}
 
Quoted 4 lines

drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c static int slpc_shared_data_init(struct intel_guc_slpc *slpc) · line 90

Quoted 2 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c +2 -0
+	slpc->max_freq_softlimit = 0;
+	slpc->min_freq_softlimit = 0;

as mentioned earlier, now it is time to introduce these fields in .h

ok.

Quoted 34 lines
Quoted 34 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c +24 -0
+
  	return err;
  }
 
@@ -384,6 +387,29 @@ void intel_guc_pm_intrmsk_enable(struct intel_gt *gt)
  			   GEN6_PMINTRMSK, pm_intrmsk_mbz, 0);
  }
 
+static int intel_guc_slpc_set_softlimits(struct intel_guc_slpc *slpc)
+{
+	int ret = 0;
+
+	/* Softlimits are initially equivalent to platform limits
+	 * unless they have deviated from defaults, in which case,
+	 * we retain the values and set min/max accordingly.
+	 */
+	if (!slpc->max_freq_softlimit)
+		slpc->max_freq_softlimit = slpc->rp0_freq;
+	else if (slpc->max_freq_softlimit != slpc->rp0_freq)
+		ret = intel_guc_slpc_set_max_freq(slpc,
+					slpc->max_freq_softlimit);
+
+	if (!slpc->min_freq_softlimit)
+		slpc->min_freq_softlimit = slpc->min_freq;
+	else if (slpc->min_freq_softlimit != slpc->min_freq)
+		ret = intel_guc_slpc_set_min_freq(slpc,
+					slpc->min_freq_softlimit);
+
+	return ret;
+}
+
  /*
   * intel_guc_slpc_enable() - Start SLPC
Quoted 8 lines

drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c int intel_guc_slpc_enable(struct intel_guc_slpc *slpc) · line 431

Quoted 6 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c +1 -0
   * @slpc: pointer to intel_guc_slpc.
@@ -402,6 +428,7 @@ int intel_guc_slpc_enable(struct intel_guc_slpc *slpc)
  	struct drm_i915_private *i915 = slpc_to_i915(slpc);
  	struct slpc_shared_data *data;
  	int ret;
+	u32 rp_state_cap;

move up to keep "ret" last

done.

Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c +0 -0
  	GEM_BUG_ON(!slpc->vma);
 
@@ -445,6 +472,20 @@ int intel_guc_slpc_enable(struct intel_guc_slpc *slpc)
  			DIV_ROUND_CLOSEST(data->task_state_data.max_unslice_freq *
  				GT_FREQUENCY_MULTIPLIER, GEN9_FREQ_SCALER));
 
Quoted 8 lines

drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c int intel_guc_slpc_enable(struct intel_guc_slpc *slpc) · line 479

Quoted 5 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c +5 -0
+	rp_state_cap = intel_uncore_read(i915->gt.uncore, GEN6_RP_STATE_CAP);
+
+	slpc->rp0_freq = ((rp_state_cap >> 0) & 0xff) * GT_FREQUENCY_MULTIPLIER;
+	slpc->min_freq = ((rp_state_cap >> 16) & 0xff) * GT_FREQUENCY_MULTIPLIER;
+	slpc->rp1_freq = ((rp_state_cap >> 8) & 0xff) * GT_FREQUENCY_MULTIPLIER;

we should have definitions for these bits and then we should be able to use REG_FIELD_GET

ok.

Quoted 7 lines

drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c int intel_guc_slpc_enable(struct intel_guc_slpc *slpc) · line 482

Quoted 4 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c +3 -0
+
+	if (intel_guc_slpc_set_softlimits(slpc))
+		drm_err(&i915->drm, "Unable to set softlimits");

missing \n
maybe we can also print error ?

done.

Quoted 7 lines

drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c int intel_guc_slpc_enable(struct intel_guc_slpc *slpc) · line 485

Quoted 4 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c +3 -0
+
+	drm_info(&i915->drm,
+		 "Platform fused frequency values -  min: %u Mhz, max: %u Mhz",

missing \n
double space before 'min'

done.

Thanks,
Vinay.

Quoted 10 lines

Michal

drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c int intel_guc_slpc_enable(struct intel_guc_slpc *slpc) · line 491

Quoted 7 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c +3 -0
+		 slpc->min_freq,
+		 slpc->rp0_freq);
+
  	return 0;
  }
 

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#35 lore raw

Re: [Intel-gfx] [PATCH 12/16] drm/i915/guc/slpc: Cache platform frequency limits for slpc

In reply to Michal Wajdeczko
Quoted 23 lines · Michal Wajdeczko
Quoted 20 lines · Vinay Belgaumkar

Cache rp0, rp1 and rpn platform limits into slpc structure for range checking while setting min/max frequencies.

Also add "soft" limits which keep track of frequency changes made from userland. These are initially set to platform min and max.

---
  drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c | 41 +++++++++++++++++++++
  1 file changed, 41 insertions(+)
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c +0 -0
index d32274cd1db7..6e978f27b7a6 100644
@@ -86,6 +86,9 @@ static int slpc_shared_data_init(struct intel_guc_slpc *slpc)
  		return err;
  	}
 
Quoted 4 lines

drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c static int slpc_shared_data_init(struct intel_guc_slpc *slpc) · line 90

Quoted 2 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c +2 -0
+	slpc->max_freq_softlimit = 0;
+	slpc->min_freq_softlimit = 0;

as mentioned earlier, now it is time to introduce these fields in .h

done.

Quoted 34 lines
Quoted 34 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c +24 -0
+
  	return err;
  }
 
@@ -384,6 +387,29 @@ void intel_guc_pm_intrmsk_enable(struct intel_gt *gt)
  			   GEN6_PMINTRMSK, pm_intrmsk_mbz, 0);
  }
 
+static int intel_guc_slpc_set_softlimits(struct intel_guc_slpc *slpc)
+{
+	int ret = 0;
+
+	/* Softlimits are initially equivalent to platform limits
+	 * unless they have deviated from defaults, in which case,
+	 * we retain the values and set min/max accordingly.
+	 */
+	if (!slpc->max_freq_softlimit)
+		slpc->max_freq_softlimit = slpc->rp0_freq;
+	else if (slpc->max_freq_softlimit != slpc->rp0_freq)
+		ret = intel_guc_slpc_set_max_freq(slpc,
+					slpc->max_freq_softlimit);
+
+	if (!slpc->min_freq_softlimit)
+		slpc->min_freq_softlimit = slpc->min_freq;
+	else if (slpc->min_freq_softlimit != slpc->min_freq)
+		ret = intel_guc_slpc_set_min_freq(slpc,
+					slpc->min_freq_softlimit);
+
+	return ret;
+}
+
  /*
   * intel_guc_slpc_enable() - Start SLPC
Quoted 8 lines

drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c int intel_guc_slpc_enable(struct intel_guc_slpc *slpc) · line 431

Quoted 6 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c +1 -0
   * @slpc: pointer to intel_guc_slpc.
@@ -402,6 +428,7 @@ int intel_guc_slpc_enable(struct intel_guc_slpc *slpc)
  	struct drm_i915_private *i915 = slpc_to_i915(slpc);
  	struct slpc_shared_data *data;
  	int ret;
+	u32 rp_state_cap;

move up to keep "ret" last

Done.

Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c +0 -0
  	GEM_BUG_ON(!slpc->vma);
 
@@ -445,6 +472,20 @@ int intel_guc_slpc_enable(struct intel_guc_slpc *slpc)
  			DIV_ROUND_CLOSEST(data->task_state_data.max_unslice_freq *
  				GT_FREQUENCY_MULTIPLIER, GEN9_FREQ_SCALER));
 
Quoted 8 lines

drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c int intel_guc_slpc_enable(struct intel_guc_slpc *slpc) · line 479

Quoted 5 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c +5 -0
+	rp_state_cap = intel_uncore_read(i915->gt.uncore, GEN6_RP_STATE_CAP);
+
+	slpc->rp0_freq = ((rp_state_cap >> 0) & 0xff) * GT_FREQUENCY_MULTIPLIER;
+	slpc->min_freq = ((rp_state_cap >> 16) & 0xff) * GT_FREQUENCY_MULTIPLIER;
+	slpc->rp1_freq = ((rp_state_cap >> 8) & 0xff) * GT_FREQUENCY_MULTIPLIER;

we should have definitions for these bits and then we should be able to use REG_FIELD_GET

done.

Quoted 7 lines

drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c int intel_guc_slpc_enable(struct intel_guc_slpc *slpc) · line 482

Quoted 4 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c +3 -0
+
+	if (intel_guc_slpc_set_softlimits(slpc))
+		drm_err(&i915->drm, "Unable to set softlimits");

missing \n
maybe we can also print error ?

done.

Quoted 7 lines

drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c int intel_guc_slpc_enable(struct intel_guc_slpc *slpc) · line 485

Quoted 4 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c +3 -0
+
+	drm_info(&i915->drm,
+		 "Platform fused frequency values -  min: %u Mhz, max: %u Mhz",

missing \n
double space before 'min'

done.

Thanks,
Vinay.

Quoted 10 lines

Michal

Quoted 7 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c +3 -0
+		 slpc->min_freq,
+		 slpc->rp0_freq);
+
  	return 0;
  }
 
#36 lore raw

PATCH 13/16 drm/i915/guc/slpc: Update slpc to use platform min/max

In reply to Vinay Belgaumkar

SLPC requests efficient frequency by default instead of min. It provides a flag to turn this off. Set that flag to maintain original semantics so that tests do not fail. SLPC can also request frequency that is much higher than the platform max, update that as well for the same reason.

---
 drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c | 55 +++++++++++++++++++++
 1 file changed, 55 insertions(+)
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c +55 -0
index 6e978f27b7a6..db575443ffb2 100644
@@ -109,6 +109,17 @@ static int slpc_send(struct intel_guc_slpc *slpc,
 	return intel_guc_send(guc, action, in_len);
 }
 
+static int host2guc_slpc_unset_param(struct intel_guc_slpc *slpc,
+				   u32 id)
+{
+	struct slpc_event_input data = {0};
+
+	data.header.value = SLPC_EVENT(SLPC_EVENT_PARAMETER_UNSET, 1);
+	data.args[0] = id;
+
+	return slpc_send(slpc, &data, 4);
+}
+
 static int host2guc_slpc_set_param(struct intel_guc_slpc *slpc,
 				   u32 id, u32 value)
 {
@@ -150,6 +161,20 @@ static int host2guc_slpc_query_task_state(struct intel_guc_slpc *slpc)
 	return slpc_send(slpc, &data, 4);
 }
 
+static int slpc_unset_param(struct intel_guc_slpc *slpc, u32 id)
+{
+	struct drm_i915_private *i915 = slpc_to_i915(slpc);
+
+	GEM_BUG_ON(id >= SLPC_MAX_PARAM);
+
+	if (host2guc_slpc_unset_param(slpc, id)) {
+		drm_err(&i915->drm, "Unable to unset param %x", id);
+		return -EIO;
+	}
+
+	return 0;
+}
+
 static int slpc_set_param(struct intel_guc_slpc *slpc, u32 id, u32 value)
 {
 	struct drm_i915_private *i915 = slpc_to_i915(slpc);
@@ -410,6 +435,32 @@ static int intel_guc_slpc_set_softlimits(struct intel_guc_slpc *slpc)
 	return ret;
 }
 
+static void intel_guc_slpc_ignore_eff_freq(struct intel_guc_slpc *slpc, bool ignore)
+{
+	if (ignore) {
+		/* A failure here does not affect the algorithm in a fatal way */
+		slpc_set_param(slpc,
+		   SLPC_IGNORE_EFFICIENT_FREQUENCY,
+		   ignore);
+		slpc_set_param(slpc,
+		   SLPC_PARAM_GLOBAL_MIN_GT_UNSLICE_FREQ_MHZ,
+		   slpc->min_freq);
+	} else {
+		slpc_unset_param(slpc,
+		   SLPC_IGNORE_EFFICIENT_FREQUENCY);
+		slpc_unset_param(slpc,
+		   SLPC_PARAM_GLOBAL_MIN_GT_UNSLICE_FREQ_MHZ);
+	}
+}
+
+static void intel_guc_slpc_use_fused_rp0(struct intel_guc_slpc *slpc)
+{
+	/* Force slpc to used platform rp0 */
+	slpc_set_param(slpc,
+	   SLPC_PARAM_GLOBAL_MAX_GT_UNSLICE_FREQ_MHZ,
+	   slpc->rp0_freq);
+}
+
 /*
  * intel_guc_slpc_enable() - Start SLPC
  * @slpc: pointer to intel_guc_slpc.
@@ -478,6 +529,10 @@ int intel_guc_slpc_enable(struct intel_guc_slpc *slpc)
 	slpc->min_freq = ((rp_state_cap >> 16) & 0xff) * GT_FREQUENCY_MULTIPLIER;
 	slpc->rp1_freq = ((rp_state_cap >> 8) & 0xff) * GT_FREQUENCY_MULTIPLIER;
 
+	/* Ignore efficient freq and set min/max to platform min/max */
+	intel_guc_slpc_ignore_eff_freq(slpc, true);
+	intel_guc_slpc_use_fused_rp0(slpc);
+
 	if (intel_guc_slpc_set_softlimits(slpc))
 		drm_err(&i915->drm, "Unable to set softlimits");
 
Signature · 1 line
2.25.0
#37 lore raw

PATCH 14/16 drm/i915/guc/slpc: Sysfs hooks for slpc

In reply to Vinay Belgaumkar

Update the get/set min/max freq hooks to work for slpc case as well. Consolidate helpers for requested/min/max frequency get/set to intel_rps where the proper action can be taken depending on whether slpc is enabled.

---
 drivers/gpu/drm/i915/gt/intel_rps.c | 135 ++++++++++++++++++++++++++++
 drivers/gpu/drm/i915/gt/intel_rps.h |   5 ++
 drivers/gpu/drm/i915/i915_pmu.c     |   2 +-
 drivers/gpu/drm/i915/i915_reg.h     |   2 +
 drivers/gpu/drm/i915/i915_sysfs.c   |  71 +++------------
 5 files changed, 154 insertions(+), 61 deletions(-)
drivers/gpu/drm/i915/gt/intel_rps.c +135 -0
index e858eeb2c59d..88ffc5d90730 100644
@@ -37,6 +37,12 @@ static struct intel_uncore *rps_to_uncore(struct intel_rps *rps)
 	return rps_to_gt(rps)->uncore;
 }
 
+static struct intel_guc_slpc *rps_to_slpc(struct intel_rps *rps)
+{
+	struct intel_gt *gt = rps_to_gt(rps);
+	return &gt->uc.guc.slpc;
+}
+
 static bool rps_uses_slpc(struct intel_rps *rps)
 {
 	struct intel_gt *gt = rps_to_gt(rps);
@@ -1960,6 +1966,135 @@ u32 intel_rps_read_actual_frequency(struct intel_rps *rps)
 	return freq;
 }
 
+u32 intel_rps_read_punit_req(struct intel_rps *rps)
+{
+	struct intel_uncore *uncore = rps_to_uncore(rps);
+
+	u32 pureq = intel_uncore_read(uncore, GEN6_RPNSWREQ);
+
+	return pureq;
+}
+
+u32 intel_rps_get_req(struct intel_rps *rps, u32 pureq)
+{
+	u32 req = pureq >> GEN9_SW_REQ_UNSLICE_RATIO_SHIFT;
+
+	return req;
+}
+
+u32 intel_rps_read_punit_req_frequency(struct intel_rps *rps)
+{
+	u32 freq = intel_rps_get_req(rps, intel_rps_read_punit_req(rps));
+
+	return intel_gpu_freq(rps, freq);
+}
+
+u32 intel_rps_get_requested_frequency(struct intel_rps *rps)
+{
+	if (rps_uses_slpc(rps))
+		return intel_rps_read_punit_req_frequency(rps);
+	else
+		return intel_gpu_freq(rps, rps->cur_freq);
+}
+
+u32 intel_rps_get_max_frequency(struct intel_rps *rps)
+{
+	struct intel_guc_slpc *slpc = rps_to_slpc(rps);
+
+	if (rps_uses_slpc(rps))
+		return slpc->max_freq_softlimit;
+	else
+		return intel_gpu_freq(rps, rps->max_freq_softlimit);
+}
+
+int intel_rps_set_max_frequency(struct intel_rps *rps, u32 val)
+{
+	struct intel_guc_slpc *slpc = rps_to_slpc(rps);
+	int ret;
+
+	if (rps_uses_slpc(rps))
+		return intel_guc_slpc_set_max_freq(slpc, val);
+
+	mutex_lock(&rps->lock);
+
+	val = intel_freq_opcode(rps, val);
+	if (val < rps->min_freq ||
+	    val > rps->max_freq ||
+	    val < rps->min_freq_softlimit) {
+		ret = -EINVAL;
+		goto unlock;
+	}
+
+	if (val > rps->rp0_freq)
+		DRM_DEBUG("User requested overclocking to %d\n",
+			  intel_gpu_freq(rps, val));
+
+	rps->max_freq_softlimit = val;
+
+	val = clamp_t(int, rps->cur_freq,
+		      rps->min_freq_softlimit,
+		      rps->max_freq_softlimit);
+
+	/*
+	 * We still need *_set_rps to process the new max_delay and
+	 * update the interrupt limits and PMINTRMSK even though
+	 * frequency request may be unchanged.
+	 */
+	intel_rps_set(rps, val);
+
+unlock:
+	mutex_unlock(&rps->lock);
+
+	return ret;
+}
+
+u32 intel_rps_get_min_frequency(struct intel_rps *rps)
+{
+	struct intel_guc_slpc *slpc = rps_to_slpc(rps);
+
+	if (rps_uses_slpc(rps))
+		return slpc->min_freq_softlimit;
+	else
+		return intel_gpu_freq(rps, rps->min_freq_softlimit);
+}
+
+int intel_rps_set_min_frequency(struct intel_rps *rps, u32 val)
+{
+	struct intel_guc_slpc *slpc = rps_to_slpc(rps);
+	int ret;
+
+	if (rps_uses_slpc(rps))
+		return intel_guc_slpc_set_min_freq(slpc, val);
+
+	mutex_lock(&rps->lock);
+
+	val = intel_freq_opcode(rps, val);
+	if (val < rps->min_freq ||
+	    val > rps->max_freq ||
+	    val > rps->max_freq_softlimit) {
+		ret = -EINVAL;
+		goto unlock;
+	}
+
+	rps->min_freq_softlimit = val;
+
+	val = clamp_t(int, rps->cur_freq,
+		      rps->min_freq_softlimit,
+		      rps->max_freq_softlimit);
+
+	/*
+	 * We still need *_set_rps to process the new min_delay and
+	 * update the interrupt limits and PMINTRMSK even though
+	 * frequency request may be unchanged.
+	 */
+	intel_rps_set(rps, val);
+
+unlock:
+	mutex_unlock(&rps->lock);
+
+	return ret;
+}
+
 /* External interface for intel_ips.ko */
 
 static struct drm_i915_private __rcu *ips_mchdev;
drivers/gpu/drm/i915/gt/intel_rps.h +5 -0
index 1d2cfc98b510..9a09ff5ebf64 100644
@@ -31,6 +31,11 @@ int intel_gpu_freq(struct intel_rps *rps, int val);
 int intel_freq_opcode(struct intel_rps *rps, int val);
 u32 intel_rps_get_cagf(struct intel_rps *rps, u32 rpstat1);
 u32 intel_rps_read_actual_frequency(struct intel_rps *rps);
+u32 intel_rps_get_requested_frequency(struct intel_rps *rps);
+u32 intel_rps_get_min_frequency(struct intel_rps *rps);
+int intel_rps_set_min_frequency(struct intel_rps *rps, u32 val);
+u32 intel_rps_get_max_frequency(struct intel_rps *rps);
+int intel_rps_set_max_frequency(struct intel_rps *rps, u32 val);
 
 void gen5_rps_irq_handler(struct intel_rps *rps);
 void gen6_rps_irq_handler(struct intel_rps *rps, u32 pm_iir);
drivers/gpu/drm/i915/i915_pmu.c +1 -1
index 34d37d46a126..a896bec18255 100644
@@ -407,7 +407,7 @@ frequency_sample(struct intel_gt *gt, unsigned int period_ns)
 
 	if (pmu->enable & config_mask(I915_PMU_REQUESTED_FREQUENCY)) {
 		add_sample_mult(&pmu->sample[__I915_SAMPLE_FREQ_REQ],
-				intel_gpu_freq(rps, rps->cur_freq),
+				intel_rps_get_requested_frequency(rps),
 				period_ns / 1000);
 	}
 
drivers/gpu/drm/i915/i915_reg.h +2 -0
index 7d9e90aa3ec0..8ab3c2f8f8e4 100644
@@ -9195,6 +9195,8 @@ enum {
 #define   GEN9_FREQUENCY(x)			((x) << 23)
 #define   GEN6_OFFSET(x)			((x) << 19)
 #define   GEN6_AGGRESSIVE_TURBO			(0 << 15)
+#define   GEN9_SW_REQ_UNSLICE_RATIO_SHIFT 	23
+
 #define GEN6_RC_VIDEO_FREQ			_MMIO(0xA00C)
 #define GEN6_RC_CONTROL				_MMIO(0xA090)
 #define   GEN6_RC_CTL_RC6pp_ENABLE		(1 << 16)
drivers/gpu/drm/i915/i915_sysfs.c +11 -60

109 lines not on this page · raw message

Signature · 1 line
2.25.0
#38 lore raw

Re: [PATCH 14/16] drm/i915/guc/slpc: Sysfs hooks for slpc

Thank you for the patch! Perhaps something to improve:

Hi Vinay,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on drm-tip/drm-tip]
[cannot apply to drm-intel/for-linux-next drm-exynos/exynos-drm-next tegra-drm/drm/tegra/for-next drm/drm-next v5.13 next-20210709] [If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Vinay-Belgaumkar/Enable-GuC-based-power-management-features/20210710-092520
base:   git://anongit.freedesktop.org/drm/drm-tip drm-tip
config: x86_64-randconfig-a014-20210709 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project 8d69635ed9ecf36fd0ca85906bfde17949671cbe)

reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# install x86_64 cross compiling tool for clang build
# apt-get install binutils-x86-64-linux-gnu
# https://github.com/0day-ci/linux/commit/8388422991b4e0e4da460328634a7ec1d278de6a
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Vinay-Belgaumkar/Enable-GuC-based-power-management-features/20210710-092520 git checkout 8388422991b4e0e4da460328634a7ec1d278de6a
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64

If you fix the issue, kindly add following tag as appropriate

All warnings (new ones prefixed by >>):

>> drivers/gpu/drm/i915/gt/intel_rps.c:1969:5: warning: no previous prototype for function 'intel_rps_read_punit_req' [-Wmissing-prototypes]
   u32 intel_rps_read_punit_req(struct intel_rps *rps)
       ^
   drivers/gpu/drm/i915/gt/intel_rps.c:1969:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
   u32 intel_rps_read_punit_req(struct intel_rps *rps)
   ^
   static 
>> drivers/gpu/drm/i915/gt/intel_rps.c:1978:5: warning: no previous prototype for function 'intel_rps_get_req' [-Wmissing-prototypes]
   u32 intel_rps_get_req(struct intel_rps *rps, u32 pureq)
       ^
   drivers/gpu/drm/i915/gt/intel_rps.c:1978:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
   u32 intel_rps_get_req(struct intel_rps *rps, u32 pureq)
   ^
   static 
>> drivers/gpu/drm/i915/gt/intel_rps.c:1985:5: warning: no previous prototype for function 'intel_rps_read_punit_req_frequency' [-Wmissing-prototypes]
   u32 intel_rps_read_punit_req_frequency(struct intel_rps *rps)
       ^

drivers/gpu/drm/i915/gt/intel_rps.c:1985:1: note: declare 'static' if the function is not intended to be used outside of this translation unit u32 intel_rps_read_punit_req_frequency(struct intel_rps *rps)
^
static
3 warnings generated.

vim +/intel_rps_read_punit_req +1969 drivers/gpu/drm/i915/gt/intel_rps.c

1968

> 1969	u32 intel_rps_read_punit_req(struct intel_rps *rps)
  1970	{
  1971		struct intel_uncore *uncore = rps_to_uncore(rps);
  1972	
  1973		u32 pureq = intel_uncore_read(uncore, GEN6_RPNSWREQ);
  1974	
  1975		return pureq;
  1976	}
  1977	
> 1978	u32 intel_rps_get_req(struct intel_rps *rps, u32 pureq)
  1979	{
  1980		u32 req = pureq >> GEN9_SW_REQ_UNSLICE_RATIO_SHIFT;
  1981	
  1982		return req;
  1983	}
  1984	
> 1985	u32 intel_rps_read_punit_req_frequency(struct intel_rps *rps)

1986 {
1987 u32 freq = intel_rps_get_req(rps, intel_rps_read_punit_req(rps));
1988
1989 return intel_gpu_freq(rps, freq);
1990 }
1991

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

#39 lore raw

Re: [PATCH 14/16] drm/i915/guc/slpc: Sysfs hooks for slpc

In reply to Vinay Belgaumkar
Thank you for the patch! Perhaps something to improve:

Hi Vinay,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on drm-tip/drm-tip]
[cannot apply to drm-intel/for-linux-next drm-exynos/exynos-drm-next tegra-drm/drm/tegra/for-next drm/drm-next v5.13 next-20210709] [If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Vinay-Belgaumkar/Enable-GuC-based-power-management-features/20210710-092520
base:   git://anongit.freedesktop.org/drm/drm-tip drm-tip
config: x86_64-randconfig-s021-20210709 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce:
        # apt-get install sparse
        # sparse version: v0.6.3-341-g8af24329-dirty
        # https://github.com/0day-ci/linux/commit/8388422991b4e0e4da460328634a7ec1d278de6a
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Vinay-Belgaumkar/Enable-GuC-based-power-management-features/20210710-092520
        git checkout 8388422991b4e0e4da460328634a7ec1d278de6a
        # save the attached .config to linux build tree
        make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=x86_64 SHELL=/bin/bash drivers/gpu/drm/i915/

If you fix the issue, kindly add following tag as appropriate

sparse warnings: (new ones prefixed by >>)

>> drivers/gpu/drm/i915/gt/intel_rps.c:1978:5: sparse: sparse: symbol 'intel_rps_get_req' was not declared. Should it be static?

Please review and possibly fold the followup patch.

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

#40 lore raw

[RFC PATCH] drm/i915/guc/slpc: intel_rps_read_punit_req() can be static

In reply to Vinay Belgaumkar
drivers/gpu/drm/i915/gt/intel_rps.c:1969:5: warning: symbol 'intel_rps_read_punit_req' was not declared. Should it be static? drivers/gpu/drm/i915/gt/intel_rps.c:1978:5: warning: symbol…

drivers/gpu/drm/i915/gt/intel_rps.c:1969:5: warning: symbol 'intel_rps_read_punit_req' was not declared. Should it be static? drivers/gpu/drm/i915/gt/intel_rps.c:1978:5: warning: symbol 'intel_rps_get_req' was not declared. Should it be static?

---
 intel_rps.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/gt/intel_rps.c +2 -2
index 88ffc5d90730a..a78af6b0babea 100644
@@ -1966,7 +1966,7 @@ u32 intel_rps_read_actual_frequency(struct intel_rps *rps)
 	return freq;
 }
 
-u32 intel_rps_read_punit_req(struct intel_rps *rps)
+static u32 intel_rps_read_punit_req(struct intel_rps *rps)
 {
 	struct intel_uncore *uncore = rps_to_uncore(rps);
 
@@ -1975,7 +1975,7 @@ u32 intel_rps_read_punit_req(struct intel_rps *rps)
 	return pureq;
 }
 
-u32 intel_rps_get_req(struct intel_rps *rps, u32 pureq)
+static u32 intel_rps_get_req(struct intel_rps *rps, u32 pureq)
 {
 	u32 req = pureq >> GEN9_SW_REQ_UNSLICE_RATIO_SHIFT;
 
#41 lore raw

Re: [PATCH 14/16] drm/i915/guc/slpc: Sysfs hooks for slpc

In reply to Vinay Belgaumkar
Thank you for the patch! Perhaps something to improve:

Hi Vinay,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on drm-tip/drm-tip]
[cannot apply to drm-intel/for-linux-next drm-exynos/exynos-drm-next tegra-drm/drm/tegra/for-next drm/drm-next v5.13 next-20210709] [If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Vinay-Belgaumkar/Enable-GuC-based-power-management-features/20210710-092520
base:   git://anongit.freedesktop.org/drm/drm-tip drm-tip
config: x86_64-randconfig-a004-20210709 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce (this is a W=1 build):
        # https://github.com/0day-ci/linux/commit/8388422991b4e0e4da460328634a7ec1d278de6a
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Vinay-Belgaumkar/Enable-GuC-based-power-management-features/20210710-092520
        git checkout 8388422991b4e0e4da460328634a7ec1d278de6a
        # save the attached .config to linux build tree
        make W=1 ARCH=x86_64 

If you fix the issue, kindly add following tag as appropriate

All warnings (new ones prefixed by >>):

>> drivers/gpu/drm/i915/gt/intel_rps.c:1969:5: warning: no previous prototype for 'intel_rps_read_punit_req' [-Wmissing-prototypes]
    1969 | u32 intel_rps_read_punit_req(struct intel_rps *rps)
         |     ^~~~~~~~~~~~~~~~~~~~~~~~
>> drivers/gpu/drm/i915/gt/intel_rps.c:1978:5: warning: no previous prototype for 'intel_rps_get_req' [-Wmissing-prototypes]
    1978 | u32 intel_rps_get_req(struct intel_rps *rps, u32 pureq)
         |     ^~~~~~~~~~~~~~~~~
>> drivers/gpu/drm/i915/gt/intel_rps.c:1985:5: warning: no previous prototype for 'intel_rps_read_punit_req_frequency' [-Wmissing-prototypes]

1985 | u32 intel_rps_read_punit_req_frequency(struct intel_rps *rps)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

vim +/intel_rps_read_punit_req +1969 drivers/gpu/drm/i915/gt/intel_rps.c

1968

> 1969	u32 intel_rps_read_punit_req(struct intel_rps *rps)
  1970	{
  1971		struct intel_uncore *uncore = rps_to_uncore(rps);
  1972	
  1973		u32 pureq = intel_uncore_read(uncore, GEN6_RPNSWREQ);
  1974	
  1975		return pureq;
  1976	}
  1977	
> 1978	u32 intel_rps_get_req(struct intel_rps *rps, u32 pureq)
  1979	{
  1980		u32 req = pureq >> GEN9_SW_REQ_UNSLICE_RATIO_SHIFT;
  1981	
  1982		return req;
  1983	}
  1984	
> 1985	u32 intel_rps_read_punit_req_frequency(struct intel_rps *rps)

1986 {
1987 u32 freq = intel_rps_get_req(rps, intel_rps_read_punit_req(rps));
1988
1989 return intel_gpu_freq(rps, freq);
1990 }
1991

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

#42 lore raw

Re: [PATCH 14/16] drm/i915/guc/slpc: Sysfs hooks for slpc

In reply to Vinay Belgaumkar
Quoted 4 lines · Vinay Belgaumkar

Update the get/set min/max freq hooks to work for slpc case as well. Consolidate helpers for requested/min/max frequency get/set to intel_rps where the proper action can be taken depending on whether slpc is enabled.

2x s/slpc/SLPC

Quoted 17 lines
---
 drivers/gpu/drm/i915/gt/intel_rps.c | 135 ++++++++++++++++++++++++++++
 drivers/gpu/drm/i915/gt/intel_rps.h |   5 ++
 drivers/gpu/drm/i915/i915_pmu.c     |   2 +-
 drivers/gpu/drm/i915/i915_reg.h     |   2 +
 drivers/gpu/drm/i915/i915_sysfs.c   |  71 +++------------
 5 files changed, 154 insertions(+), 61 deletions(-)
drivers/gpu/drm/i915/gt/intel_rps.c +0 -0
index e858eeb2c59d..88ffc5d90730 100644

drivers/gpu/drm/i915/gt/intel_rps.c static struct intel_uncore *rps_to_uncore(struct intel_rps *rps) · line 43

Quoted 7 lines
drivers/gpu/drm/i915/gt/intel_rps.c +4 -0
@@ -37,6 +37,12 @@ static struct intel_uncore *rps_to_uncore(struct intel_rps *rps)
 	return rps_to_gt(rps)->uncore;
 }
 
+static struct intel_guc_slpc *rps_to_slpc(struct intel_rps *rps)
+{
+	struct intel_gt *gt = rps_to_gt(rps);
+	return &gt->uc.guc.slpc;

either add empty line between decl/code or make it one-liner

drivers/gpu/drm/i915/gt/intel_rps.c u32 intel_rps_read_actual_frequency(struct intel_rps *rps) · line 1972

Quoted 13 lines
drivers/gpu/drm/i915/gt/intel_rps.c +6 -0
+}
+
 static bool rps_uses_slpc(struct intel_rps *rps)
 {
 	struct intel_gt *gt = rps_to_gt(rps);
@@ -1960,6 +1966,135 @@ u32 intel_rps_read_actual_frequency(struct intel_rps *rps)
 	return freq;
 }
 
+u32 intel_rps_read_punit_req(struct intel_rps *rps)
+{
+	struct intel_uncore *uncore = rps_to_uncore(rps);
+

drop empty line

Quoted 47 lines
drivers/gpu/drm/i915/gt/intel_rps.c +47 -0
+	u32 pureq = intel_uncore_read(uncore, GEN6_RPNSWREQ);
+
+	return pureq;
+}
+
+u32 intel_rps_get_req(struct intel_rps *rps, u32 pureq)
+{
+	u32 req = pureq >> GEN9_SW_REQ_UNSLICE_RATIO_SHIFT;
+
+	return req;
+}
+
+u32 intel_rps_read_punit_req_frequency(struct intel_rps *rps)
+{
+	u32 freq = intel_rps_get_req(rps, intel_rps_read_punit_req(rps));
+
+	return intel_gpu_freq(rps, freq);
+}
+
+u32 intel_rps_get_requested_frequency(struct intel_rps *rps)
+{
+	if (rps_uses_slpc(rps))
+		return intel_rps_read_punit_req_frequency(rps);
+	else
+		return intel_gpu_freq(rps, rps->cur_freq);
+}
+
+u32 intel_rps_get_max_frequency(struct intel_rps *rps)
+{
+	struct intel_guc_slpc *slpc = rps_to_slpc(rps);
+
+	if (rps_uses_slpc(rps))
+		return slpc->max_freq_softlimit;
+	else
+		return intel_gpu_freq(rps, rps->max_freq_softlimit);
+}
+
+int intel_rps_set_max_frequency(struct intel_rps *rps, u32 val)
+{
+	struct intel_guc_slpc *slpc = rps_to_slpc(rps);
+	int ret;
+
+	if (rps_uses_slpc(rps))
+		return intel_guc_slpc_set_max_freq(slpc, val);
+
+	mutex_lock(&rps->lock);
+

drivers/gpu/drm/i915/gt/intel_rps.c u32 intel_rps_read_actual_frequency(struct intel_rps *rps) · line 2029

Quoted 10 lines
drivers/gpu/drm/i915/gt/intel_rps.c +10 -0
+	val = intel_freq_opcode(rps, val);
+	if (val < rps->min_freq ||
+	    val > rps->max_freq ||
+	    val < rps->min_freq_softlimit) {
+		ret = -EINVAL;
+		goto unlock;
+	}
+
+	if (val > rps->rp0_freq)
+		DRM_DEBUG("User requested overclocking to %d\n",

use drm_dbg

Michal

Quoted 223 lines
drivers/gpu/drm/i915/gt/intel_rps.c +68 -0
+			  intel_gpu_freq(rps, val));
+
+	rps->max_freq_softlimit = val;
+
+	val = clamp_t(int, rps->cur_freq,
+		      rps->min_freq_softlimit,
+		      rps->max_freq_softlimit);
+
+	/*
+	 * We still need *_set_rps to process the new max_delay and
+	 * update the interrupt limits and PMINTRMSK even though
+	 * frequency request may be unchanged.
+	 */
+	intel_rps_set(rps, val);
+
+unlock:
+	mutex_unlock(&rps->lock);
+
+	return ret;
+}
+
+u32 intel_rps_get_min_frequency(struct intel_rps *rps)
+{
+	struct intel_guc_slpc *slpc = rps_to_slpc(rps);
+
+	if (rps_uses_slpc(rps))
+		return slpc->min_freq_softlimit;
+	else
+		return intel_gpu_freq(rps, rps->min_freq_softlimit);
+}
+
+int intel_rps_set_min_frequency(struct intel_rps *rps, u32 val)
+{
+	struct intel_guc_slpc *slpc = rps_to_slpc(rps);
+	int ret;
+
+	if (rps_uses_slpc(rps))
+		return intel_guc_slpc_set_min_freq(slpc, val);
+
+	mutex_lock(&rps->lock);
+
+	val = intel_freq_opcode(rps, val);
+	if (val < rps->min_freq ||
+	    val > rps->max_freq ||
+	    val > rps->max_freq_softlimit) {
+		ret = -EINVAL;
+		goto unlock;
+	}
+
+	rps->min_freq_softlimit = val;
+
+	val = clamp_t(int, rps->cur_freq,
+		      rps->min_freq_softlimit,
+		      rps->max_freq_softlimit);
+
+	/*
+	 * We still need *_set_rps to process the new min_delay and
+	 * update the interrupt limits and PMINTRMSK even though
+	 * frequency request may be unchanged.
+	 */
+	intel_rps_set(rps, val);
+
+unlock:
+	mutex_unlock(&rps->lock);
+
+	return ret;
+}
+
 /* External interface for intel_ips.ko */
 
 static struct drm_i915_private __rcu *ips_mchdev;
drivers/gpu/drm/i915/gt/intel_rps.h +5 -0
index 1d2cfc98b510..9a09ff5ebf64 100644
@@ -31,6 +31,11 @@ int intel_gpu_freq(struct intel_rps *rps, int val);
 int intel_freq_opcode(struct intel_rps *rps, int val);
 u32 intel_rps_get_cagf(struct intel_rps *rps, u32 rpstat1);
 u32 intel_rps_read_actual_frequency(struct intel_rps *rps);
+u32 intel_rps_get_requested_frequency(struct intel_rps *rps);
+u32 intel_rps_get_min_frequency(struct intel_rps *rps);
+int intel_rps_set_min_frequency(struct intel_rps *rps, u32 val);
+u32 intel_rps_get_max_frequency(struct intel_rps *rps);
+int intel_rps_set_max_frequency(struct intel_rps *rps, u32 val);
 
 void gen5_rps_irq_handler(struct intel_rps *rps);
 void gen6_rps_irq_handler(struct intel_rps *rps, u32 pm_iir);
drivers/gpu/drm/i915/i915_pmu.c +1 -1
index 34d37d46a126..a896bec18255 100644
@@ -407,7 +407,7 @@ frequency_sample(struct intel_gt *gt, unsigned int period_ns)
 
 	if (pmu->enable & config_mask(I915_PMU_REQUESTED_FREQUENCY)) {
 		add_sample_mult(&pmu->sample[__I915_SAMPLE_FREQ_REQ],
-				intel_gpu_freq(rps, rps->cur_freq),
+				intel_rps_get_requested_frequency(rps),
 				period_ns / 1000);
 	}
 
drivers/gpu/drm/i915/i915_reg.h +2 -0
index 7d9e90aa3ec0..8ab3c2f8f8e4 100644
@@ -9195,6 +9195,8 @@ enum {
 #define   GEN9_FREQUENCY(x)			((x) << 23)
 #define   GEN6_OFFSET(x)			((x) << 19)
 #define   GEN6_AGGRESSIVE_TURBO			(0 << 15)
+#define   GEN9_SW_REQ_UNSLICE_RATIO_SHIFT 	23
+
 #define GEN6_RC_VIDEO_FREQ			_MMIO(0xA00C)
 #define GEN6_RC_CONTROL				_MMIO(0xA090)
 #define   GEN6_RC_CTL_RC6pp_ENABLE		(1 << 16)
drivers/gpu/drm/i915/i915_sysfs.c +10 -54
index 873bf996ceb5..f2eee8491b19 100644
@@ -272,7 +272,7 @@ static ssize_t gt_cur_freq_mhz_show(struct device *kdev,
 	struct drm_i915_private *i915 = kdev_minor_to_i915(kdev);
 	struct intel_rps *rps = &i915->gt.rps;
 
-	return sysfs_emit(buf, "%d\n", intel_gpu_freq(rps, rps->cur_freq));
+	return sysfs_emit(buf, "%d\n", intel_rps_get_requested_frequency(rps));
 }
 
 static ssize_t gt_boost_freq_mhz_show(struct device *kdev, struct device_attribute *attr, char *buf)
@@ -326,9 +326,10 @@ static ssize_t vlv_rpe_freq_mhz_show(struct device *kdev,
 static ssize_t gt_max_freq_mhz_show(struct device *kdev, struct device_attribute *attr, char *buf)
 {
 	struct drm_i915_private *dev_priv = kdev_minor_to_i915(kdev);
-	struct intel_rps *rps = &dev_priv->gt.rps;
+	struct intel_gt *gt = &dev_priv->gt;
+	struct intel_rps *rps = &gt->rps;
 
-	return sysfs_emit(buf, "%d\n", intel_gpu_freq(rps, rps->max_freq_softlimit));
+	return sysfs_emit(buf, "%d\n", intel_rps_get_max_frequency(rps));
 }
 
 static ssize_t gt_max_freq_mhz_store(struct device *kdev,
@@ -336,7 +337,8 @@ static ssize_t gt_max_freq_mhz_store(struct device *kdev,
 				     const char *buf, size_t count)
 {
 	struct drm_i915_private *dev_priv = kdev_minor_to_i915(kdev);
-	struct intel_rps *rps = &dev_priv->gt.rps;
+	struct intel_gt *gt = &dev_priv->gt;
+	struct intel_rps *rps = &gt->rps;
 	ssize_t ret;
 	u32 val;
 
@@ -344,35 +346,7 @@ static ssize_t gt_max_freq_mhz_store(struct device *kdev,
 	if (ret)
 		return ret;
 
-	mutex_lock(&rps->lock);
-
-	val = intel_freq_opcode(rps, val);
-	if (val < rps->min_freq ||
-	    val > rps->max_freq ||
-	    val < rps->min_freq_softlimit) {
-		ret = -EINVAL;
-		goto unlock;
-	}
-
-	if (val > rps->rp0_freq)
-		DRM_DEBUG("User requested overclocking to %d\n",
-			  intel_gpu_freq(rps, val));
-
-	rps->max_freq_softlimit = val;
-
-	val = clamp_t(int, rps->cur_freq,
-		      rps->min_freq_softlimit,
-		      rps->max_freq_softlimit);
-
-	/*
-	 * We still need *_set_rps to process the new max_delay and
-	 * update the interrupt limits and PMINTRMSK even though
-	 * frequency request may be unchanged.
-	 */
-	intel_rps_set(rps, val);
-
-unlock:
-	mutex_unlock(&rps->lock);
+	ret = intel_rps_set_max_frequency(rps, val);
 
 	return ret ?: count;
 }
@@ -380,9 +354,10 @@ static ssize_t gt_max_freq_mhz_store(struct device *kdev,
 static ssize_t gt_min_freq_mhz_show(struct device *kdev, struct device_attribute *attr, char *buf)
 {
 	struct drm_i915_private *dev_priv = kdev_minor_to_i915(kdev);
-	struct intel_rps *rps = &dev_priv->gt.rps;
+	struct intel_gt *gt = &dev_priv->gt;
+	struct intel_rps *rps = &gt->rps;
 
-	return sysfs_emit(buf, "%d\n", intel_gpu_freq(rps, rps->min_freq_softlimit));
+	return sysfs_emit(buf, "%d\n", intel_rps_get_min_frequency(rps));
 }
 
 static ssize_t gt_min_freq_mhz_store(struct device *kdev,
@@ -398,31 +373,7 @@ static ssize_t gt_min_freq_mhz_store(struct device *kdev,
 	if (ret)
 		return ret;
 
-	mutex_lock(&rps->lock);
-
-	val = intel_freq_opcode(rps, val);
-	if (val < rps->min_freq ||
-	    val > rps->max_freq ||
-	    val > rps->max_freq_softlimit) {
-		ret = -EINVAL;
-		goto unlock;
-	}
-
-	rps->min_freq_softlimit = val;
-
-	val = clamp_t(int, rps->cur_freq,
-		      rps->min_freq_softlimit,
-		      rps->max_freq_softlimit);
-
-	/*
-	 * We still need *_set_rps to process the new min_delay and
-	 * update the interrupt limits and PMINTRMSK even though

drivers/gpu/drm/i915/i915_sysfs.c static ssize_t gt_min_freq_mhz_store(struct device *kdev, · line 379

Quoted 10 lines
drivers/gpu/drm/i915/i915_sysfs.c +1 -6
-	 * frequency request may be unchanged.
-	 */
-	intel_rps_set(rps, val);
-
-unlock:
-	mutex_unlock(&rps->lock);
+	ret = intel_rps_set_min_frequency(rps, val);
 
 	return ret ?: count;
 }

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#43 lore raw

Re: [PATCH 14/16] drm/i915/guc/slpc: Sysfs hooks for slpc

Quoted 9 lines · Michal Wajdeczko
Quoted 4 lines · Vinay Belgaumkar

Update the get/set min/max freq hooks to work for slpc case as well. Consolidate helpers for requested/min/max frequency get/set to intel_rps where the proper action can be taken depending on whether slpc is enabled.

2x s/slpc/SLPC

done.

Quoted 21 lines
Quoted 21 lines
---
  drivers/gpu/drm/i915/gt/intel_rps.c | 135 ++++++++++++++++++++++++++++
  drivers/gpu/drm/i915/gt/intel_rps.h |   5 ++
  drivers/gpu/drm/i915/i915_pmu.c     |   2 +-
  drivers/gpu/drm/i915/i915_reg.h     |   2 +
  drivers/gpu/drm/i915/i915_sysfs.c   |  71 +++------------
  5 files changed, 154 insertions(+), 61 deletions(-)
drivers/gpu/drm/i915/gt/intel_rps.c +0 -0
index e858eeb2c59d..88ffc5d90730 100644
@@ -37,6 +37,12 @@ static struct intel_uncore *rps_to_uncore(struct intel_rps *rps)
  	return rps_to_gt(rps)->uncore;
  }
 
Quoted 6 lines

drivers/gpu/drm/i915/gt/intel_rps.c static struct intel_uncore *rps_to_uncore(struct intel_rps *rps) · line 43

Quoted 4 lines
drivers/gpu/drm/i915/gt/intel_rps.c +4 -0
+static struct intel_guc_slpc *rps_to_slpc(struct intel_rps *rps)
+{
+	struct intel_gt *gt = rps_to_gt(rps);
+	return &gt->uc.guc.slpc;

either add empty line between decl/code or make it one-liner

done.

Quoted 10 lines
Quoted 10 lines
drivers/gpu/drm/i915/gt/intel_rps.c +2 -0
+}
+
  static bool rps_uses_slpc(struct intel_rps *rps)
  {
  	struct intel_gt *gt = rps_to_gt(rps);
@@ -1960,6 +1966,135 @@ u32 intel_rps_read_actual_frequency(struct intel_rps *rps)
  	return freq;
  }
 
Quoted 6 lines

drivers/gpu/drm/i915/gt/intel_rps.c u32 intel_rps_read_actual_frequency(struct intel_rps *rps) · line 1972

Quoted 4 lines
drivers/gpu/drm/i915/gt/intel_rps.c +4 -0
+u32 intel_rps_read_punit_req(struct intel_rps *rps)
+{
+	struct intel_uncore *uncore = rps_to_uncore(rps);
+

drop empty line

done.

Quoted 52 lines
Quoted 52 lines
drivers/gpu/drm/i915/gt/intel_rps.c +51 -0
+	u32 pureq = intel_uncore_read(uncore, GEN6_RPNSWREQ);
+
+	return pureq;
+}
+
+u32 intel_rps_get_req(struct intel_rps *rps, u32 pureq)
+{
+	u32 req = pureq >> GEN9_SW_REQ_UNSLICE_RATIO_SHIFT;
+
+	return req;
+}
+
+u32 intel_rps_read_punit_req_frequency(struct intel_rps *rps)
+{
+	u32 freq = intel_rps_get_req(rps, intel_rps_read_punit_req(rps));
+
+	return intel_gpu_freq(rps, freq);
+}
+
+u32 intel_rps_get_requested_frequency(struct intel_rps *rps)
+{
+	if (rps_uses_slpc(rps))
+		return intel_rps_read_punit_req_frequency(rps);
+	else
+		return intel_gpu_freq(rps, rps->cur_freq);
+}
+
+u32 intel_rps_get_max_frequency(struct intel_rps *rps)
+{
+	struct intel_guc_slpc *slpc = rps_to_slpc(rps);
+
+	if (rps_uses_slpc(rps))
+		return slpc->max_freq_softlimit;
+	else
+		return intel_gpu_freq(rps, rps->max_freq_softlimit);
+}
+
+int intel_rps_set_max_frequency(struct intel_rps *rps, u32 val)
+{
+	struct intel_guc_slpc *slpc = rps_to_slpc(rps);
+	int ret;
+
+	if (rps_uses_slpc(rps))
+		return intel_guc_slpc_set_max_freq(slpc, val);
+
+	mutex_lock(&rps->lock);
+
+	val = intel_freq_opcode(rps, val);
+	if (val < rps->min_freq ||
+	    val > rps->max_freq ||
+	    val < rps->min_freq_softlimit) {
Quoted 8 lines

drivers/gpu/drm/i915/gt/intel_rps.c u32 intel_rps_read_actual_frequency(struct intel_rps *rps) · line 2029

Quoted 6 lines
drivers/gpu/drm/i915/gt/intel_rps.c +6 -0
+		ret = -EINVAL;
+		goto unlock;
+	}
+
+	if (val > rps->rp0_freq)
+		DRM_DEBUG("User requested overclocking to %d\n",

use drm_dbg

Done.

Thanks,
Vinay.

Quoted 236 lines

Michal

Quoted 233 lines
drivers/gpu/drm/i915/gt/intel_rps.c +68 -0
+			  intel_gpu_freq(rps, val));
+
+	rps->max_freq_softlimit = val;
+
+	val = clamp_t(int, rps->cur_freq,
+		      rps->min_freq_softlimit,
+		      rps->max_freq_softlimit);
+
+	/*
+	 * We still need *_set_rps to process the new max_delay and
+	 * update the interrupt limits and PMINTRMSK even though
+	 * frequency request may be unchanged.
+	 */
+	intel_rps_set(rps, val);
+
+unlock:
+	mutex_unlock(&rps->lock);
+
+	return ret;
+}
+
+u32 intel_rps_get_min_frequency(struct intel_rps *rps)
+{
+	struct intel_guc_slpc *slpc = rps_to_slpc(rps);
+
+	if (rps_uses_slpc(rps))
+		return slpc->min_freq_softlimit;
+	else
+		return intel_gpu_freq(rps, rps->min_freq_softlimit);
+}
+
+int intel_rps_set_min_frequency(struct intel_rps *rps, u32 val)
+{
+	struct intel_guc_slpc *slpc = rps_to_slpc(rps);
+	int ret;
+
+	if (rps_uses_slpc(rps))
+		return intel_guc_slpc_set_min_freq(slpc, val);
+
+	mutex_lock(&rps->lock);
+
+	val = intel_freq_opcode(rps, val);
+	if (val < rps->min_freq ||
+	    val > rps->max_freq ||
+	    val > rps->max_freq_softlimit) {
+		ret = -EINVAL;
+		goto unlock;
+	}
+
+	rps->min_freq_softlimit = val;
+
+	val = clamp_t(int, rps->cur_freq,
+		      rps->min_freq_softlimit,
+		      rps->max_freq_softlimit);
+
+	/*
+	 * We still need *_set_rps to process the new min_delay and
+	 * update the interrupt limits and PMINTRMSK even though
+	 * frequency request may be unchanged.
+	 */
+	intel_rps_set(rps, val);
+
+unlock:
+	mutex_unlock(&rps->lock);
+
+	return ret;
+}
+
  /* External interface for intel_ips.ko */
 
  static struct drm_i915_private __rcu *ips_mchdev;
drivers/gpu/drm/i915/gt/intel_rps.h +5 -0
index 1d2cfc98b510..9a09ff5ebf64 100644
@@ -31,6 +31,11 @@ int intel_gpu_freq(struct intel_rps *rps, int val);
  int intel_freq_opcode(struct intel_rps *rps, int val);
  u32 intel_rps_get_cagf(struct intel_rps *rps, u32 rpstat1);
  u32 intel_rps_read_actual_frequency(struct intel_rps *rps);
+u32 intel_rps_get_requested_frequency(struct intel_rps *rps);
+u32 intel_rps_get_min_frequency(struct intel_rps *rps);
+int intel_rps_set_min_frequency(struct intel_rps *rps, u32 val);
+u32 intel_rps_get_max_frequency(struct intel_rps *rps);
+int intel_rps_set_max_frequency(struct intel_rps *rps, u32 val);
 
  void gen5_rps_irq_handler(struct intel_rps *rps);
  void gen6_rps_irq_handler(struct intel_rps *rps, u32 pm_iir);
drivers/gpu/drm/i915/i915_pmu.c +1 -1
index 34d37d46a126..a896bec18255 100644
@@ -407,7 +407,7 @@ frequency_sample(struct intel_gt *gt, unsigned int period_ns)
 
  	if (pmu->enable & config_mask(I915_PMU_REQUESTED_FREQUENCY)) {
  		add_sample_mult(&pmu->sample[__I915_SAMPLE_FREQ_REQ],
-				intel_gpu_freq(rps, rps->cur_freq),
+				intel_rps_get_requested_frequency(rps),
  				period_ns / 1000);
  	}
 
drivers/gpu/drm/i915/i915_reg.h +2 -0
index 7d9e90aa3ec0..8ab3c2f8f8e4 100644
@@ -9195,6 +9195,8 @@ enum {
  #define   GEN9_FREQUENCY(x)			((x) << 23)
  #define   GEN6_OFFSET(x)			((x) << 19)
  #define   GEN6_AGGRESSIVE_TURBO			(0 << 15)
+#define   GEN9_SW_REQ_UNSLICE_RATIO_SHIFT 	23
+
  #define GEN6_RC_VIDEO_FREQ			_MMIO(0xA00C)
  #define GEN6_RC_CONTROL				_MMIO(0xA090)
  #define   GEN6_RC_CTL_RC6pp_ENABLE		(1 << 16)
drivers/gpu/drm/i915/i915_sysfs.c +11 -60
index 873bf996ceb5..f2eee8491b19 100644
@@ -272,7 +272,7 @@ static ssize_t gt_cur_freq_mhz_show(struct device *kdev,
  	struct drm_i915_private *i915 = kdev_minor_to_i915(kdev);
  	struct intel_rps *rps = &i915->gt.rps;
 
-	return sysfs_emit(buf, "%d\n", intel_gpu_freq(rps, rps->cur_freq));
+	return sysfs_emit(buf, "%d\n", intel_rps_get_requested_frequency(rps));
  }
 
  static ssize_t gt_boost_freq_mhz_show(struct device *kdev, struct device_attribute *attr, char *buf)
@@ -326,9 +326,10 @@ static ssize_t vlv_rpe_freq_mhz_show(struct device *kdev,
  static ssize_t gt_max_freq_mhz_show(struct device *kdev, struct device_attribute *attr, char *buf)
  {
  	struct drm_i915_private *dev_priv = kdev_minor_to_i915(kdev);
-	struct intel_rps *rps = &dev_priv->gt.rps;
+	struct intel_gt *gt = &dev_priv->gt;
+	struct intel_rps *rps = &gt->rps;
 
-	return sysfs_emit(buf, "%d\n", intel_gpu_freq(rps, rps->max_freq_softlimit));
+	return sysfs_emit(buf, "%d\n", intel_rps_get_max_frequency(rps));
  }
 
  static ssize_t gt_max_freq_mhz_store(struct device *kdev,
@@ -336,7 +337,8 @@ static ssize_t gt_max_freq_mhz_store(struct device *kdev,
  				     const char *buf, size_t count)
  {
  	struct drm_i915_private *dev_priv = kdev_minor_to_i915(kdev);
-	struct intel_rps *rps = &dev_priv->gt.rps;
+	struct intel_gt *gt = &dev_priv->gt;
+	struct intel_rps *rps = &gt->rps;
  	ssize_t ret;
  	u32 val;
 
@@ -344,35 +346,7 @@ static ssize_t gt_max_freq_mhz_store(struct device *kdev,
  	if (ret)
  		return ret;
 
-	mutex_lock(&rps->lock);
-
-	val = intel_freq_opcode(rps, val);
-	if (val < rps->min_freq ||
-	    val > rps->max_freq ||
-	    val < rps->min_freq_softlimit) {
-		ret = -EINVAL;
-		goto unlock;
-	}
-
-	if (val > rps->rp0_freq)
-		DRM_DEBUG("User requested overclocking to %d\n",
-			  intel_gpu_freq(rps, val));
-
-	rps->max_freq_softlimit = val;
-
-	val = clamp_t(int, rps->cur_freq,
-		      rps->min_freq_softlimit,
-		      rps->max_freq_softlimit);
-
-	/*
-	 * We still need *_set_rps to process the new max_delay and
-	 * update the interrupt limits and PMINTRMSK even though
-	 * frequency request may be unchanged.
-	 */
-	intel_rps_set(rps, val);
-
-unlock:
-	mutex_unlock(&rps->lock);
+	ret = intel_rps_set_max_frequency(rps, val);
 
  	return ret ?: count;
  }
@@ -380,9 +354,10 @@ static ssize_t gt_max_freq_mhz_store(struct device *kdev,
  static ssize_t gt_min_freq_mhz_show(struct device *kdev, struct device_attribute *attr, char *buf)
  {
  	struct drm_i915_private *dev_priv = kdev_minor_to_i915(kdev);
-	struct intel_rps *rps = &dev_priv->gt.rps;
+	struct intel_gt *gt = &dev_priv->gt;
+	struct intel_rps *rps = &gt->rps;
 
-	return sysfs_emit(buf, "%d\n", intel_gpu_freq(rps, rps->min_freq_softlimit));
+	return sysfs_emit(buf, "%d\n", intel_rps_get_min_frequency(rps));
  }
 
  static ssize_t gt_min_freq_mhz_store(struct device *kdev,
@@ -398,31 +373,7 @@ static ssize_t gt_min_freq_mhz_store(struct device *kdev,
  	if (ret)
  		return ret;
 
-	mutex_lock(&rps->lock);
-
-	val = intel_freq_opcode(rps, val);
-	if (val < rps->min_freq ||
-	    val > rps->max_freq ||
-	    val > rps->max_freq_softlimit) {
-		ret = -EINVAL;
-		goto unlock;
-	}
-
-	rps->min_freq_softlimit = val;
-
-	val = clamp_t(int, rps->cur_freq,
-		      rps->min_freq_softlimit,
-		      rps->max_freq_softlimit);
-
-	/*
-	 * We still need *_set_rps to process the new min_delay and
-	 * update the interrupt limits and PMINTRMSK even though
-	 * frequency request may be unchanged.
-	 */
-	intel_rps_set(rps, val);
-
-unlock:
-	mutex_unlock(&rps->lock);
+	ret = intel_rps_set_min_frequency(rps, val);
 
  	return ret ?: count;
  }
#44 lore raw

PATCH 15/16 drm/i915/guc/slpc: slpc selftest

In reply to Vinay Belgaumkar

Tests that exercise the slpc get/set frequency interfaces.

Clamp_max will set max frequency to multiple levels and check that slpc requests frequency lower than or equal to it.

Clamp_min will set min frequency to different levels and check if slpc requests are higher or equal to those levels.

---
 drivers/gpu/drm/i915/gt/intel_rps.c           |   1 +
 drivers/gpu/drm/i915/gt/selftest_slpc.c       | 333 ++++++++++++++++++
 drivers/gpu/drm/i915/gt/selftest_slpc.h       |  12 +
 .../drm/i915/selftests/i915_live_selftests.h  |   1 +
 4 files changed, 347 insertions(+)
 create mode 100644 drivers/gpu/drm/i915/gt/selftest_slpc.c
 create mode 100644 drivers/gpu/drm/i915/gt/selftest_slpc.h
drivers/gpu/drm/i915/gt/intel_rps.c +1 -0
index 88ffc5d90730..16ac2e840881 100644
@@ -2288,4 +2288,5 @@ EXPORT_SYMBOL_GPL(i915_gpu_turbo_disable);
 
 #if IS_ENABLED(CONFIG_DRM_I915_SELFTEST)
 #include "selftest_rps.c"
+#include "selftest_slpc.c"
 #endif
drivers/gpu/drm/i915/gt/selftest_slpc.c new file +333 -0

333 lines not on this page · raw message

drivers/gpu/drm/i915/gt/selftest_slpc.h new file +12 -0
new file mode 100644
index 000000000000..8dfb40916a8c
@@ -0,0 +1,12 @@
+/* SPDX-License-Identifier: MIT */
+/*
+ * Copyright © 2020 Intel Corporation
+ */
+
+#ifndef SELFTEST_SLPC_H
+#define SELFTEST_SLPC_H
+
+int live_slpc_clamp_max(void *arg);
+int live_slpc_clamp_min(void *arg);
+
+#endif /* SELFTEST_SLPC_H */
drivers/gpu/drm/i915/selftests/i915_live_selftests.h +1 -0
index e2fd1b61af71..1746a56dda06 100644
@@ -47,5 +47,6 @@ selftest(hangcheck, intel_hangcheck_live_selftests)
 selftest(execlists, intel_execlists_live_selftests)
 selftest(ring_submission, intel_ring_submission_live_selftests)
 selftest(perf, i915_perf_live_selftests)
+selftest(slpc, intel_slpc_live_selftests)
 /* Here be dragons: keep last to run last! */
 selftest(late_gt_pm, intel_gt_pm_late_selftests)
Signature · 1 line
2.25.0
#45 lore raw

Re: [PATCH 15/16] drm/i915/guc/slpc: slpc selftest

Quoted 7 lines · Vinay Belgaumkar

Tests that exercise the slpc get/set frequency interfaces.

Clamp_max will set max frequency to multiple levels and check that slpc requests frequency lower than or equal to it.

Clamp_min will set min frequency to different levels and check if slpc requests are higher or equal to those levels.

2x s/slpc/SLPC

Quoted 27 lines
---
 drivers/gpu/drm/i915/gt/intel_rps.c           |   1 +
 drivers/gpu/drm/i915/gt/selftest_slpc.c       | 333 ++++++++++++++++++
 drivers/gpu/drm/i915/gt/selftest_slpc.h       |  12 +
 .../drm/i915/selftests/i915_live_selftests.h  |   1 +
 4 files changed, 347 insertions(+)
 create mode 100644 drivers/gpu/drm/i915/gt/selftest_slpc.c
 create mode 100644 drivers/gpu/drm/i915/gt/selftest_slpc.h
drivers/gpu/drm/i915/gt/intel_rps.c +1 -0
index 88ffc5d90730..16ac2e840881 100644
@@ -2288,4 +2288,5 @@ EXPORT_SYMBOL_GPL(i915_gpu_turbo_disable);
 
 #if IS_ENABLED(CONFIG_DRM_I915_SELFTEST)
 #include "selftest_rps.c"
+#include "selftest_slpc.c"
 #endif
drivers/gpu/drm/i915/gt/selftest_slpc.c new file +0 -0
new file mode 100644
index 000000000000..f440c1cb2afa

drivers/gpu/drm/i915/gt/selftest_slpc.c line 3

Quoted 3 lines
drivers/gpu/drm/i915/gt/selftest_slpc.c new file +3 -0
@@ -0,0 +1,333 @@
+// SPDX-License-Identifier: MIT
+/*
+ * Copyright © 2020 Intel Corporation

2021

drivers/gpu/drm/i915/gt/selftest_slpc.c line 9

Quoted 6 lines
drivers/gpu/drm/i915/gt/selftest_slpc.c new file +6 -0
+ */
+#include "selftest_slpc.h"
+#include "selftest_rps.h"
+
+#include <linux/pm_qos.h>
+#include <linux/sort.h>

system headers should go first

drivers/gpu/drm/i915/gt/selftest_slpc.c line 20

Quoted 11 lines
drivers/gpu/drm/i915/gt/selftest_slpc.c new file +11 -0
+
+#include "intel_engine_heartbeat.h"
+#include "intel_engine_pm.h"
+#include "intel_gpu_commands.h"
+#include "intel_gt_clock_utils.h"
+#include "intel_gt_pm.h"
+#include "intel_rc6.h"
+#include "selftest_engine_heartbeat.h"
+#include "intel_rps.h"
+#include "selftests/igt_flush_test.h"
+#include "selftests/igt_spinner.h"

wrong order ?

drivers/gpu/drm/i915/gt/selftest_slpc.c line 28

Quoted 8 lines
drivers/gpu/drm/i915/gt/selftest_slpc.c new file +8 -0
+
+#define NUM_STEPS 5
+#define H2G_DELAY 50000
+#define delay_for_h2g() usleep_range(H2G_DELAY, H2G_DELAY + 10000)
+
+static int set_min_freq(struct intel_guc_slpc *slpc, int freq)
+{
+	int ret;

add empty line

Quoted 5 lines
drivers/gpu/drm/i915/gt/selftest_slpc.c new file +5 -0
+	ret = intel_guc_slpc_set_min_freq(slpc, freq);
+	if (ret) {
+		pr_err("Could not set min frequency to [%d]\n", freq);
+		return ret;
+	} else {

drivers/gpu/drm/i915/gt/selftest_slpc.c line 43

Quoted 10 lines
drivers/gpu/drm/i915/gt/selftest_slpc.c new file +10 -0
+		/* Delay to ensure h2g completes */
+		delay_for_h2g();
+	}
+
+	return ret;
+}
+
+static int set_max_freq(struct intel_guc_slpc *slpc, int freq)
+{
+	int ret;

add empty line

Quoted 13 lines
drivers/gpu/drm/i915/gt/selftest_slpc.c new file +13 -0
+	ret = intel_guc_slpc_set_max_freq(slpc, freq);
+	if (ret) {
+		pr_err("Could not set maximum frequency [%d]\n",
+			freq);
+		return ret;
+	} else {
+		/* Delay to ensure h2g completes */
+		delay_for_h2g();
+	}
+
+	return ret;
+}
+

drivers/gpu/drm/i915/gt/selftest_slpc.c line 66

Quoted 10 lines
drivers/gpu/drm/i915/gt/selftest_slpc.c new file +10 -0
+int live_slpc_clamp_min(void *arg)
+{
+	struct drm_i915_private *i915 = arg;
+	struct intel_gt *gt = &i915->gt;
+	struct intel_guc_slpc *slpc;
+	struct intel_rps *rps;
+	struct intel_engine_cs *engine;
+	enum intel_engine_id id;
+	struct igt_spinner spin;
+	int err = 0;

usually "err" is last decl

drivers/gpu/drm/i915/gt/selftest_slpc.c line 69

Quoted 3 lines
drivers/gpu/drm/i915/gt/selftest_slpc.c new file +3 -0
+	u32 slpc_min_freq, slpc_max_freq;
+
+

too many empty lines

drivers/gpu/drm/i915/gt/selftest_slpc.c line 71

Quoted 2 lines
drivers/gpu/drm/i915/gt/selftest_slpc.c new file +2 -0
+	slpc = &gt->uc.guc.slpc;
+	rps = &gt->rps;

could be initialized in decl above

Quoted 11 lines
drivers/gpu/drm/i915/gt/selftest_slpc.c new file +11 -0
+
+	if (!intel_uc_uses_guc_slpc(&gt->uc))
+		return 0;
+
+	if (igt_spinner_init(&spin, gt))
+		return -ENOMEM;
+
+	if (intel_guc_slpc_get_max_freq(slpc, &slpc_max_freq)) {
+		pr_err("Could not get SLPC max freq");
+		return -EIO;
+	}

drivers/gpu/drm/i915/gt/selftest_slpc.c line 92

Quoted 10 lines
drivers/gpu/drm/i915/gt/selftest_slpc.c new file +10 -0
+
+	if (intel_guc_slpc_get_min_freq(slpc, &slpc_min_freq)) {
+		pr_err("Could not get SLPC min freq");
+		return -EIO;
+	}
+
+	if (slpc_min_freq == slpc_max_freq) {
+		pr_err("Min/Max are fused to the same value");
+		return -EINVAL;
+	}

3x missing \n

drivers/gpu/drm/i915/gt/selftest_slpc.c line 105

Quoted 13 lines
drivers/gpu/drm/i915/gt/selftest_slpc.c new file +13 -0
+
+	intel_gt_pm_wait_for_idle(gt);
+	intel_gt_pm_get(gt);
+	for_each_engine(engine, gt, id) {
+		struct i915_request *rq;
+		u32 step, min_freq, req_freq;
+		u32 act_freq, max_act_freq;
+
+		if (!intel_engine_can_store_dword(engine))
+			continue;
+
+		/* Go from min to max in 5 steps */
+		step = (slpc_max_freq - slpc_min_freq)/NUM_STEPS;

add spaces ") / NUM"

drivers/gpu/drm/i915/gt/selftest_slpc.c line 107

Quoted 2 lines
drivers/gpu/drm/i915/gt/selftest_slpc.c new file +2 -0
+		max_act_freq = slpc_min_freq;
+		for (min_freq = slpc_min_freq; min_freq < slpc_max_freq; min_freq+=step)

add spaces " += "

drivers/gpu/drm/i915/gt/selftest_slpc.c line 115

Quoted 8 lines
drivers/gpu/drm/i915/gt/selftest_slpc.c new file +8 -0
+		{
+			err = set_min_freq(slpc, min_freq);
+			if (err)
+				break;
+
+			st_engine_heartbeat_disable(engine);
+
+

keep only one empty line

Quoted 43 lines
drivers/gpu/drm/i915/gt/selftest_slpc.c new file +43 -0
+			rq = igt_spinner_create_request(&spin,
+					engine->kernel_context,
+					MI_NOOP);
+			if (IS_ERR(rq)) {
+				err = PTR_ERR(rq);
+				st_engine_heartbeat_enable(engine);
+				break;
+			}
+
+			i915_request_add(rq);
+
+			if (!igt_wait_for_spinner(&spin, rq)) {
+				pr_err("%s: Spinner did not start\n",
+					engine->name);
+				igt_spinner_end(&spin);
+				st_engine_heartbeat_enable(engine);
+				intel_gt_set_wedged(engine->gt);
+				err = -EIO;
+				break;
+			}
+
+			/* Wait for GuC to detect business and raise
+			 * requested frequency if necessary */
+			delay_for_h2g();
+
+			req_freq = intel_rps_read_punit_req_frequency(rps);
+
+			/* GuC requests freq in multiples of 50/3 MHz */
+			if (req_freq < (min_freq - 50/3)) {
+				pr_err("SWReq is %d, should be at least %d", req_freq,
+					min_freq - 50/3);
+				igt_spinner_end(&spin);
+				st_engine_heartbeat_enable(engine);
+				err = -EINVAL;
+				break;
+			}
+
+			act_freq =  intel_rps_read_actual_frequency(rps);
+			if (act_freq > max_act_freq)
+				max_act_freq = act_freq;
+
+			igt_spinner_end(&spin);
+			st_engine_heartbeat_enable(engine);

drivers/gpu/drm/i915/gt/selftest_slpc.c line 168

Quoted 10 lines
drivers/gpu/drm/i915/gt/selftest_slpc.c new file +10 -0
+		}
+
+		pr_info("Max actual frequency for %s was %d",
+				engine->name, max_act_freq);
+
+		/* Actual frequency should rise above min */
+		if (max_act_freq == slpc_min_freq) {
+			pr_err("Actual freq did not rise above min");
+			err = -EINVAL;
+		}

2x missing \n

and few more below

Quoted 171 lines
drivers/gpu/drm/i915/gt/selftest_slpc.c new file +165 -0
+
+		if (err)
+			break;
+	}
+
+	/* Restore min/max frequencies */
+	set_max_freq(slpc, slpc_max_freq);
+	set_min_freq(slpc, slpc_min_freq);
+
+	if (igt_flush_test(gt->i915))
+		err = -EIO;
+
+	intel_gt_pm_put(gt);
+	igt_spinner_fini(&spin);
+	intel_gt_pm_wait_for_idle(gt);
+
+	return err;
+}
+
+int live_slpc_clamp_max(void *arg)
+{
+	struct drm_i915_private *i915 = arg;
+	struct intel_gt *gt = &i915->gt;
+	struct intel_guc_slpc *slpc;
+	struct intel_rps *rps;
+	struct intel_engine_cs *engine;
+	enum intel_engine_id id;
+	struct igt_spinner spin;
+	int err = 0;
+	u32 slpc_min_freq, slpc_max_freq;
+
+	slpc = &gt->uc.guc.slpc;
+	rps = &gt->rps;
+
+	if (!intel_uc_uses_guc_slpc(&gt->uc))
+		return 0;
+
+	if (igt_spinner_init(&spin, gt))
+		return -ENOMEM;
+
+	if (intel_guc_slpc_get_max_freq(slpc, &slpc_max_freq)) {
+		pr_err("Could not get SLPC max freq");
+		return -EIO;
+	}
+
+	if (intel_guc_slpc_get_min_freq(slpc, &slpc_min_freq)) {
+		pr_err("Could not get SLPC min freq");
+		return -EIO;
+	}
+
+	if (slpc_min_freq == slpc_max_freq) {
+		pr_err("Min/Max are fused to the same value");
+		return -EINVAL;
+	}
+
+	intel_gt_pm_wait_for_idle(gt);
+	intel_gt_pm_get(gt);
+	for_each_engine(engine, gt, id) {
+		struct i915_request *rq;
+		u32 max_freq, req_freq;
+		u32 act_freq, max_act_freq;
+		u32 step;
+
+		if (!intel_engine_can_store_dword(engine))
+			continue;
+
+		/* Go from max to min in 5 steps */
+		step = (slpc_max_freq - slpc_min_freq)/NUM_STEPS;
+		max_act_freq = slpc_min_freq;
+		for (max_freq = slpc_max_freq; max_freq > slpc_min_freq; max_freq-=step)
+		{
+			err = set_max_freq(slpc, max_freq);
+			if (err)
+				break;
+
+			st_engine_heartbeat_disable(engine);
+
+			rq = igt_spinner_create_request(&spin,
+						engine->kernel_context,
+						MI_NOOP);
+			if (IS_ERR(rq)) {
+				st_engine_heartbeat_enable(engine);
+				err = PTR_ERR(rq);
+				break;
+			}
+
+			i915_request_add(rq);
+
+			if (!igt_wait_for_spinner(&spin, rq)) {
+				pr_err("%s: SLPC spinner did not start\n",
+				       engine->name);
+				igt_spinner_end(&spin);
+				st_engine_heartbeat_enable(engine);
+				intel_gt_set_wedged(engine->gt);
+				err = -EIO;
+				break;
+			}
+
+			delay_for_h2g();
+
+			/* Verify that SWREQ indeed was set to specific value */
+			req_freq = intel_rps_read_punit_req_frequency(rps);
+
+			/* GuC requests freq in multiples of 50/3 MHz */
+			if (req_freq > (max_freq + 50/3)) {
+				pr_err("SWReq is %d, should be at most %d", req_freq,
+					max_freq + 50/3);
+				igt_spinner_end(&spin);
+				st_engine_heartbeat_enable(engine);
+				err = -EINVAL;
+				break;
+			}
+
+			act_freq =  intel_rps_read_actual_frequency(rps);
+			if (act_freq > max_act_freq)
+				max_act_freq = act_freq;
+
+			st_engine_heartbeat_enable(engine);
+			igt_spinner_end(&spin);
+
+			if (err)
+				break;
+		}
+
+		pr_info("Max actual frequency for %s was %d",
+				engine->name, max_act_freq);
+
+		/* Actual frequency should rise above min */
+		if (max_act_freq == slpc_min_freq) {
+			pr_err("Actual freq did not rise above min");
+			err = -EINVAL;
+		}
+
+		if (igt_flush_test(gt->i915)) {
+			err = -EIO;
+			break;
+		}
+
+		if (err)
+			break;
+	}
+
+	/* Restore min/max freq */
+	set_max_freq(slpc, slpc_max_freq);
+	set_min_freq(slpc, slpc_min_freq);
+
+	intel_gt_pm_put(gt);
+	igt_spinner_fini(&spin);
+	intel_gt_pm_wait_for_idle(gt);
+
+	return err;
+}
+
+int intel_slpc_live_selftests(struct drm_i915_private *i915)
+{
+	static const struct i915_subtest tests[] = {
+		SUBTEST(live_slpc_clamp_max),
+		SUBTEST(live_slpc_clamp_min),
+	};
+
+	if (intel_gt_is_wedged(&i915->gt))
+		return 0;
+
+	return i915_live_subtests(tests, i915);
+}
drivers/gpu/drm/i915/gt/selftest_slpc.h new file +0 -0
new file mode 100644
index 000000000000..8dfb40916a8c

drivers/gpu/drm/i915/gt/selftest_slpc.h line 3

Quoted 3 lines
drivers/gpu/drm/i915/gt/selftest_slpc.h new file +3 -0
@@ -0,0 +1,12 @@
+/* SPDX-License-Identifier: MIT */
+/*
+ * Copyright © 2020 Intel Corporation

2021

Michal

Quoted 15 lines
drivers/gpu/drm/i915/gt/selftest_slpc.h new file +9 -0
+ */
+
+#ifndef SELFTEST_SLPC_H
+#define SELFTEST_SLPC_H
+
+int live_slpc_clamp_max(void *arg);
+int live_slpc_clamp_min(void *arg);
+
+#endif /* SELFTEST_SLPC_H */
drivers/gpu/drm/i915/selftests/i915_live_selftests.h +0 -0
index e2fd1b61af71..1746a56dda06 100644

drivers/gpu/drm/i915/selftests/i915_live_selftests.h selftest(hangcheck, intel_hangcheck_live_selftests) · line 52

Quoted 6 lines
drivers/gpu/drm/i915/selftests/i915_live_selftests.h +1 -0
@@ -47,5 +47,6 @@ selftest(hangcheck, intel_hangcheck_live_selftests)
 selftest(execlists, intel_execlists_live_selftests)
 selftest(ring_submission, intel_ring_submission_live_selftests)
 selftest(perf, i915_perf_live_selftests)
+selftest(slpc, intel_slpc_live_selftests)
 /* Here be dragons: keep last to run last! */
 selftest(late_gt_pm, intel_gt_pm_late_selftests)

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#46 lore raw

Re: [PATCH 15/16] drm/i915/guc/slpc: slpc selftest

Quoted 5 lines · Michal Wajdeczko
Quoted 2 lines · Vinay Belgaumkar

Tests that exercise the slpc get/set frequency interfaces.

Quoted 7 lines
Quoted 5 lines

Clamp_max will set max frequency to multiple levels and check that slpc requests frequency lower than or equal to it.

Clamp_min will set min frequency to different levels and check if slpc requests are higher or equal to those levels.

2x s/slpc/SLPC

Done.

Quoted 18 lines
Quoted 18 lines
---
  drivers/gpu/drm/i915/gt/intel_rps.c           |   1 +
  drivers/gpu/drm/i915/gt/selftest_slpc.c       | 333 ++++++++++++++++++
  drivers/gpu/drm/i915/gt/selftest_slpc.h       |  12 +
  .../drm/i915/selftests/i915_live_selftests.h  |   1 +
  4 files changed, 347 insertions(+)

create mode 100644 drivers/gpu/drm/i915/gt/selftest_slpc.c create mode 100644 drivers/gpu/drm/i915/gt/selftest_slpc.h

drivers/gpu/drm/i915/gt/intel_rps.c +0 -0
index 88ffc5d90730..16ac2e840881 100644
@@ -2288,4 +2288,5 @@ EXPORT_SYMBOL_GPL(i915_gpu_turbo_disable);
 
Quoted 15 lines

drivers/gpu/drm/i915/gt/selftest_slpc.c line 3

Quoted 13 lines
drivers/gpu/drm/i915/gt/intel_rps.c +1 -0
  #if IS_ENABLED(CONFIG_DRM_I915_SELFTEST)
  #include "selftest_rps.c"
+#include "selftest_slpc.c"
  #endif
drivers/gpu/drm/i915/gt/selftest_slpc.c new file +3 -0
new file mode 100644
index 000000000000..f440c1cb2afa
@@ -0,0 +1,333 @@
+// SPDX-License-Identifier: MIT
+/*
+ * Copyright © 2020 Intel Corporation

2021

Done.

Quoted 9 lines

drivers/gpu/drm/i915/gt/selftest_slpc.c line 9

Quoted 7 lines
drivers/gpu/drm/i915/gt/selftest_slpc.c new file +6 -0
+ */
+#include "selftest_slpc.h"
+#include "selftest_rps.h"
+
+#include <linux/pm_qos.h>
+#include <linux/sort.h>

system headers should go first

Cleaned up and removed the unwanted headers.

Quoted 14 lines

drivers/gpu/drm/i915/gt/selftest_slpc.c line 20

Quoted 12 lines
drivers/gpu/drm/i915/gt/selftest_slpc.c new file +11 -0
+
+#include "intel_engine_heartbeat.h"
+#include "intel_engine_pm.h"
+#include "intel_gpu_commands.h"
+#include "intel_gt_clock_utils.h"
+#include "intel_gt_pm.h"
+#include "intel_rc6.h"
+#include "selftest_engine_heartbeat.h"
+#include "intel_rps.h"
+#include "selftests/igt_flush_test.h"
+#include "selftests/igt_spinner.h"

wrong order ?

Removed all includes, since these are already included in selftest_rps.c. This gets included in intel_rps.c while compiling the slpc selftest.

Quoted 11 lines

drivers/gpu/drm/i915/gt/selftest_slpc.c line 28

Quoted 9 lines
drivers/gpu/drm/i915/gt/selftest_slpc.c new file +8 -0
+
+#define NUM_STEPS 5
+#define H2G_DELAY 50000
+#define delay_for_h2g() usleep_range(H2G_DELAY, H2G_DELAY + 10000)
+
+static int set_min_freq(struct intel_guc_slpc *slpc, int freq)
+{
+	int ret;

add empty line

done.

Quoted 10 lines
Quoted 10 lines
drivers/gpu/drm/i915/gt/selftest_slpc.c new file +9 -0
+	ret = intel_guc_slpc_set_min_freq(slpc, freq);
+	if (ret) {
+		pr_err("Could not set min frequency to [%d]\n", freq);
+		return ret;
+	} else {
+		/* Delay to ensure h2g completes */
+		delay_for_h2g();
+	}
+
Quoted 8 lines

drivers/gpu/drm/i915/gt/selftest_slpc.c line 43

Quoted 6 lines
drivers/gpu/drm/i915/gt/selftest_slpc.c new file +6 -0
+	return ret;
+}
+
+static int set_max_freq(struct intel_guc_slpc *slpc, int freq)
+{
+	int ret;

add empty line

done.

Quoted 18 lines
Quoted 18 lines
drivers/gpu/drm/i915/gt/selftest_slpc.c new file +17 -0
+	ret = intel_guc_slpc_set_max_freq(slpc, freq);
+	if (ret) {
+		pr_err("Could not set maximum frequency [%d]\n",
+			freq);
+		return ret;
+	} else {
+		/* Delay to ensure h2g completes */
+		delay_for_h2g();
+	}
+
+	return ret;
+}
+
+int live_slpc_clamp_min(void *arg)
+{
+	struct drm_i915_private *i915 = arg;
+	struct intel_gt *gt = &i915->gt;
Quoted 8 lines

drivers/gpu/drm/i915/gt/selftest_slpc.c line 66

Quoted 6 lines
drivers/gpu/drm/i915/gt/selftest_slpc.c new file +6 -0
+	struct intel_guc_slpc *slpc;
+	struct intel_rps *rps;
+	struct intel_engine_cs *engine;
+	enum intel_engine_id id;
+	struct igt_spinner spin;
+	int err = 0;

usually "err" is last decl

ok.

Quoted 6 lines

drivers/gpu/drm/i915/gt/selftest_slpc.c line 69

Quoted 4 lines
drivers/gpu/drm/i915/gt/selftest_slpc.c new file +3 -0
+	u32 slpc_min_freq, slpc_max_freq;
+
+

too many empty lines

removed.

Quoted 5 lines

drivers/gpu/drm/i915/gt/selftest_slpc.c line 71

Quoted 3 lines
drivers/gpu/drm/i915/gt/selftest_slpc.c new file +2 -0
+	slpc = &gt->uc.guc.slpc;
+	rps = &gt->rps;

could be initialized in decl above

ok.

Quoted 16 lines
Quoted 16 lines
drivers/gpu/drm/i915/gt/selftest_slpc.c new file +15 -0
+
+	if (!intel_uc_uses_guc_slpc(&gt->uc))
+		return 0;
+
+	if (igt_spinner_init(&spin, gt))
+		return -ENOMEM;
+
+	if (intel_guc_slpc_get_max_freq(slpc, &slpc_max_freq)) {
+		pr_err("Could not get SLPC max freq");
+		return -EIO;
+	}
+
+	if (intel_guc_slpc_get_min_freq(slpc, &slpc_min_freq)) {
+		pr_err("Could not get SLPC min freq");
+		return -EIO;
Quoted 8 lines

drivers/gpu/drm/i915/gt/selftest_slpc.c line 92

Quoted 6 lines
drivers/gpu/drm/i915/gt/selftest_slpc.c new file +6 -0
+	}
+
+	if (slpc_min_freq == slpc_max_freq) {
+		pr_err("Min/Max are fused to the same value");
+		return -EINVAL;
+	}

3x missing \n

done.

Quoted 16 lines
Quoted 4 lines
drivers/gpu/drm/i915/gt/selftest_slpc.c new file +3 -0
+
+	intel_gt_pm_wait_for_idle(gt);
+	intel_gt_pm_get(gt);

drivers/gpu/drm/i915/gt/selftest_slpc.c line 105

Quoted 10 lines
drivers/gpu/drm/i915/gt/selftest_slpc.c new file +10 -0
+	for_each_engine(engine, gt, id) {
+		struct i915_request *rq;
+		u32 step, min_freq, req_freq;
+		u32 act_freq, max_act_freq;
+
+		if (!intel_engine_can_store_dword(engine))
+			continue;
+
+		/* Go from min to max in 5 steps */
+		step = (slpc_max_freq - slpc_min_freq)/NUM_STEPS;

add spaces ") / NUM"

ok.

Quoted 5 lines

drivers/gpu/drm/i915/gt/selftest_slpc.c line 107

Quoted 3 lines
drivers/gpu/drm/i915/gt/selftest_slpc.c new file +2 -0
+		max_act_freq = slpc_min_freq;
+		for (min_freq = slpc_min_freq; min_freq < slpc_max_freq; min_freq+=step)

add spaces " += "

ok.

Quoted 11 lines

drivers/gpu/drm/i915/gt/selftest_slpc.c line 115

Quoted 9 lines
drivers/gpu/drm/i915/gt/selftest_slpc.c new file +8 -0
+		{
+			err = set_min_freq(slpc, min_freq);
+			if (err)
+				break;
+
+			st_engine_heartbeat_disable(engine);
+
+

keep only one empty line

ok.

Quoted 57 lines
Quoted 44 lines
drivers/gpu/drm/i915/gt/selftest_slpc.c new file +43 -0
+			rq = igt_spinner_create_request(&spin,
+					engine->kernel_context,
+					MI_NOOP);
+			if (IS_ERR(rq)) {
+				err = PTR_ERR(rq);
+				st_engine_heartbeat_enable(engine);
+				break;
+			}
+
+			i915_request_add(rq);
+
+			if (!igt_wait_for_spinner(&spin, rq)) {
+				pr_err("%s: Spinner did not start\n",
+					engine->name);
+				igt_spinner_end(&spin);
+				st_engine_heartbeat_enable(engine);
+				intel_gt_set_wedged(engine->gt);
+				err = -EIO;
+				break;
+			}
+
+			/* Wait for GuC to detect business and raise
+			 * requested frequency if necessary */
+			delay_for_h2g();
+
+			req_freq = intel_rps_read_punit_req_frequency(rps);
+
+			/* GuC requests freq in multiples of 50/3 MHz */
+			if (req_freq < (min_freq - 50/3)) {
+				pr_err("SWReq is %d, should be at least %d", req_freq,
+					min_freq - 50/3);
+				igt_spinner_end(&spin);
+				st_engine_heartbeat_enable(engine);
+				err = -EINVAL;
+				break;
+			}
+
+			act_freq =  intel_rps_read_actual_frequency(rps);
+			if (act_freq > max_act_freq)
+				max_act_freq = act_freq;
+
+			igt_spinner_end(&spin);
+			st_engine_heartbeat_enable(engine);

drivers/gpu/drm/i915/gt/selftest_slpc.c line 168

Quoted 10 lines
drivers/gpu/drm/i915/gt/selftest_slpc.c new file +10 -0
+		}
+
+		pr_info("Max actual frequency for %s was %d",
+				engine->name, max_act_freq);
+
+		/* Actual frequency should rise above min */
+		if (max_act_freq == slpc_min_freq) {
+			pr_err("Actual freq did not rise above min");
+			err = -EINVAL;
+		}

2x missing \n

Quoted 1 line

and few more below

added.

Quoted 169 lines
Quoted 169 lines
drivers/gpu/drm/i915/gt/selftest_slpc.c new file +165 -0
+
+		if (err)
+			break;
+	}
+
+	/* Restore min/max frequencies */
+	set_max_freq(slpc, slpc_max_freq);
+	set_min_freq(slpc, slpc_min_freq);
+
+	if (igt_flush_test(gt->i915))
+		err = -EIO;
+
+	intel_gt_pm_put(gt);
+	igt_spinner_fini(&spin);
+	intel_gt_pm_wait_for_idle(gt);
+
+	return err;
+}
+
+int live_slpc_clamp_max(void *arg)
+{
+	struct drm_i915_private *i915 = arg;
+	struct intel_gt *gt = &i915->gt;
+	struct intel_guc_slpc *slpc;
+	struct intel_rps *rps;
+	struct intel_engine_cs *engine;
+	enum intel_engine_id id;
+	struct igt_spinner spin;
+	int err = 0;
+	u32 slpc_min_freq, slpc_max_freq;
+
+	slpc = &gt->uc.guc.slpc;
+	rps = &gt->rps;
+
+	if (!intel_uc_uses_guc_slpc(&gt->uc))
+		return 0;
+
+	if (igt_spinner_init(&spin, gt))
+		return -ENOMEM;
+
+	if (intel_guc_slpc_get_max_freq(slpc, &slpc_max_freq)) {
+		pr_err("Could not get SLPC max freq");
+		return -EIO;
+	}
+
+	if (intel_guc_slpc_get_min_freq(slpc, &slpc_min_freq)) {
+		pr_err("Could not get SLPC min freq");
+		return -EIO;
+	}
+
+	if (slpc_min_freq == slpc_max_freq) {
+		pr_err("Min/Max are fused to the same value");
+		return -EINVAL;
+	}
+
+	intel_gt_pm_wait_for_idle(gt);
+	intel_gt_pm_get(gt);
+	for_each_engine(engine, gt, id) {
+		struct i915_request *rq;
+		u32 max_freq, req_freq;
+		u32 act_freq, max_act_freq;
+		u32 step;
+
+		if (!intel_engine_can_store_dword(engine))
+			continue;
+
+		/* Go from max to min in 5 steps */
+		step = (slpc_max_freq - slpc_min_freq)/NUM_STEPS;
+		max_act_freq = slpc_min_freq;
+		for (max_freq = slpc_max_freq; max_freq > slpc_min_freq; max_freq-=step)
+		{
+			err = set_max_freq(slpc, max_freq);
+			if (err)
+				break;
+
+			st_engine_heartbeat_disable(engine);
+
+			rq = igt_spinner_create_request(&spin,
+						engine->kernel_context,
+						MI_NOOP);
+			if (IS_ERR(rq)) {
+				st_engine_heartbeat_enable(engine);
+				err = PTR_ERR(rq);
+				break;
+			}
+
+			i915_request_add(rq);
+
+			if (!igt_wait_for_spinner(&spin, rq)) {
+				pr_err("%s: SLPC spinner did not start\n",
+				       engine->name);
+				igt_spinner_end(&spin);
+				st_engine_heartbeat_enable(engine);
+				intel_gt_set_wedged(engine->gt);
+				err = -EIO;
+				break;
+			}
+
+			delay_for_h2g();
+
+			/* Verify that SWREQ indeed was set to specific value */
+			req_freq = intel_rps_read_punit_req_frequency(rps);
+
+			/* GuC requests freq in multiples of 50/3 MHz */
+			if (req_freq > (max_freq + 50/3)) {
+				pr_err("SWReq is %d, should be at most %d", req_freq,
+					max_freq + 50/3);
+				igt_spinner_end(&spin);
+				st_engine_heartbeat_enable(engine);
+				err = -EINVAL;
+				break;
+			}
+
+			act_freq =  intel_rps_read_actual_frequency(rps);
+			if (act_freq > max_act_freq)
+				max_act_freq = act_freq;
+
+			st_engine_heartbeat_enable(engine);
+			igt_spinner_end(&spin);
+
+			if (err)
+				break;
+		}
+
+		pr_info("Max actual frequency for %s was %d",
+				engine->name, max_act_freq);
+
+		/* Actual frequency should rise above min */
+		if (max_act_freq == slpc_min_freq) {
+			pr_err("Actual freq did not rise above min");
+			err = -EINVAL;
+		}
+
+		if (igt_flush_test(gt->i915)) {
+			err = -EIO;
+			break;
+		}
+
+		if (err)
+			break;
+	}
+
+	/* Restore min/max freq */
+	set_max_freq(slpc, slpc_max_freq);
+	set_min_freq(slpc, slpc_min_freq);
+
+	intel_gt_pm_put(gt);
+	igt_spinner_fini(&spin);
+	intel_gt_pm_wait_for_idle(gt);
+
+	return err;
+}
+
+int intel_slpc_live_selftests(struct drm_i915_private *i915)
+{
+	static const struct i915_subtest tests[] = {
+		SUBTEST(live_slpc_clamp_max),
+		SUBTEST(live_slpc_clamp_min),
+	};
+
+	if (intel_gt_is_wedged(&i915->gt))
+		return 0;
+
+	return i915_live_subtests(tests, i915);
+}
drivers/gpu/drm/i915/gt/selftest_slpc.h new file +0 -0
new file mode 100644
index 000000000000..8dfb40916a8c
Quoted 8 lines

drivers/gpu/drm/i915/gt/selftest_slpc.h line 3

Quoted 6 lines
drivers/gpu/drm/i915/gt/selftest_slpc.h new file +3 -0
@@ -0,0 +1,12 @@
+/* SPDX-License-Identifier: MIT */
+/*
+ * Copyright © 2020 Intel Corporation

2021

done.
Thanks,
Vinay.

Quoted 24 lines

Michal

Quoted 21 lines
drivers/gpu/drm/i915/gt/selftest_slpc.h new file +9 -0
+ */
+
+#ifndef SELFTEST_SLPC_H
+#define SELFTEST_SLPC_H
+
+int live_slpc_clamp_max(void *arg);
+int live_slpc_clamp_min(void *arg);
+
+#endif /* SELFTEST_SLPC_H */
drivers/gpu/drm/i915/selftests/i915_live_selftests.h +1 -0
index e2fd1b61af71..1746a56dda06 100644
@@ -47,5 +47,6 @@ selftest(hangcheck, intel_hangcheck_live_selftests)
  selftest(execlists, intel_execlists_live_selftests)
  selftest(ring_submission, intel_ring_submission_live_selftests)
  selftest(perf, i915_perf_live_selftests)
+selftest(slpc, intel_slpc_live_selftests)
  /* Here be dragons: keep last to run last! */
  selftest(late_gt_pm, intel_gt_pm_late_selftests)
#47 lore raw

PATCH 16/16 drm/i915/guc/rc: Setup and enable GUCRC feature

In reply to Vinay Belgaumkar

This feature hands over the control of HW RC6 to the GUC. GUC decides when to put HW into RC6 based on it's internal busyness algorithms.

GUCRC needs GUC submission to be enabled, and only supported on Gen12+ for now.

When GUCRC is enabled, do not set HW RC6. Use a H2G message to tell guc to enable GUCRC. When disabling RC6, tell guc to revert RC6 control back to KMD.

---
 drivers/gpu/drm/i915/Makefile                 |  1 +
 drivers/gpu/drm/i915/gt/intel_rc6.c           | 22 ++++--
 .../gpu/drm/i915/gt/uc/abi/guc_actions_abi.h  |  6 ++
 drivers/gpu/drm/i915/gt/uc/intel_guc.c        |  1 +
 drivers/gpu/drm/i915/gt/uc/intel_guc.h        |  2 +
 drivers/gpu/drm/i915/gt/uc/intel_guc_rc.c     | 79 +++++++++++++++++++
 drivers/gpu/drm/i915/gt/uc/intel_guc_rc.h     | 32 ++++++++
 drivers/gpu/drm/i915/gt/uc/intel_uc.h         |  2 +
 8 files changed, 140 insertions(+), 5 deletions(-)
 create mode 100644 drivers/gpu/drm/i915/gt/uc/intel_guc_rc.c
 create mode 100644 drivers/gpu/drm/i915/gt/uc/intel_guc_rc.h
drivers/gpu/drm/i915/Makefile +1 -0
index d8eac4468df9..3fc17f20d88e 100644
@@ -186,6 +186,7 @@ i915-y += gt/uc/intel_uc.o \
 	  gt/uc/intel_guc_fw.o \
 	  gt/uc/intel_guc_log.o \
 	  gt/uc/intel_guc_log_debugfs.o \
+	  gt/uc/intel_guc_rc.o \
 	  gt/uc/intel_guc_slpc.o \
 	  gt/uc/intel_guc_submission.o \
 	  gt/uc/intel_huc.o \
drivers/gpu/drm/i915/gt/intel_rc6.c +17 -5
index 259d7eb4e165..299fcf10b04b 100644
@@ -98,11 +98,19 @@ static void gen11_rc6_enable(struct intel_rc6 *rc6)
 	set(uncore, GEN9_MEDIA_PG_IDLE_HYSTERESIS, 60);
 	set(uncore, GEN9_RENDER_PG_IDLE_HYSTERESIS, 60);
 
-	/* 3a: Enable RC6 */
-	rc6->ctl_enable =
-		GEN6_RC_CTL_HW_ENABLE |
-		GEN6_RC_CTL_RC6_ENABLE |
-		GEN6_RC_CTL_EI_MODE(1);
+	/* 3a: Enable RC6
+	 *
+	 * With GUCRC, we do not enable bit 31 of RC_CTL,
+	 * thus allowing GuC to control RC6 entry/exit fully instead.
+	 * We will not set the HW ENABLE and EI bits
+	 */
+	if (!intel_guc_rc_enable(&gt->uc.guc))
+		rc6->ctl_enable = GEN6_RC_CTL_RC6_ENABLE;
+	else
+		rc6->ctl_enable =
+			GEN6_RC_CTL_HW_ENABLE |
+			GEN6_RC_CTL_RC6_ENABLE |
+			GEN6_RC_CTL_EI_MODE(1);
 
 	pg_enable =
 		GEN9_RENDER_PG_ENABLE |
@@ -513,6 +521,10 @@ static void __intel_rc6_disable(struct intel_rc6 *rc6)
 {
 	struct drm_i915_private *i915 = rc6_to_i915(rc6);
 	struct intel_uncore *uncore = rc6_to_uncore(rc6);
+	struct intel_gt *gt = rc6_to_gt(rc6);
+
+	/* Take control of RC6 back from GuC */
+	intel_guc_rc_disable(&gt->uc.guc);
 
 	intel_uncore_forcewake_get(uncore, FORCEWAKE_ALL);
 	if (GRAPHICS_VER(i915) >= 9)
drivers/gpu/drm/i915/gt/uc/abi/guc_actions_abi.h +6 -0
index 596cf4b818e5..2ddb9cdc0a59 100644
@@ -136,6 +136,7 @@ enum intel_guc_action {
 	INTEL_GUC_ACTION_CONTEXT_RESET_NOTIFICATION = 0x1008,
 	INTEL_GUC_ACTION_ENGINE_FAILURE_NOTIFICATION = 0x1009,
 	INTEL_GUC_ACTION_SLPC_REQUEST = 0x3003,
+	INTEL_GUC_ACTION_SETUP_PC_GUCRC = 0x3004,
 	INTEL_GUC_ACTION_AUTHENTICATE_HUC = 0x4000,
 	INTEL_GUC_ACTION_REGISTER_CONTEXT = 0x4502,
 	INTEL_GUC_ACTION_DEREGISTER_CONTEXT = 0x4503,
@@ -146,6 +147,11 @@ enum intel_guc_action {
 	INTEL_GUC_ACTION_LIMIT
 };
 
+enum intel_guc_rc_options {
+	INTEL_GUCRC_HOST_CONTROL,
+	INTEL_GUCRC_FIRMWARE_CONTROL,
+};
+
 enum intel_guc_preempt_options {
 	INTEL_GUC_PREEMPT_OPTION_DROP_WORK_Q = 0x4,
 	INTEL_GUC_PREEMPT_OPTION_DROP_SUBMIT_Q = 0x8,
drivers/gpu/drm/i915/gt/uc/intel_guc.c +1 -0
index 82863a9bc8e8..0d55b24f7c67 100644
@@ -158,6 +158,7 @@ void intel_guc_init_early(struct intel_guc *guc)
 	intel_guc_log_init_early(&guc->log);
 	intel_guc_submission_init_early(guc);
 	intel_guc_slpc_init_early(guc);
+	intel_guc_rc_init_early(guc);
 
 	mutex_init(&guc->send_mutex);
 	spin_lock_init(&guc->irq_lock);
drivers/gpu/drm/i915/gt/uc/intel_guc.h +2 -0
index 0dbbd9cf553f..592d52e5e93c 100644
@@ -59,6 +59,8 @@ struct intel_guc {
 
 	bool submission_supported;
 	bool submission_selected;
+	bool rc_supported;
+	bool rc_selected;
 	bool slpc_supported;
 	bool slpc_selected;
 
drivers/gpu/drm/i915/gt/uc/intel_guc_rc.c new file +79 -0

79 lines not on this page · raw message

drivers/gpu/drm/i915/gt/uc/intel_guc_rc.h new file +32 -0
new file mode 100644
index 000000000000..169e60726e5b
@@ -0,0 +1,32 @@
+/* SPDX-License-Identifier: MIT */
+/*
+ * Copyright © 2020 Intel Corporation
+ */
+
+#ifndef _INTEL_GUC_RC_H_
+#define _INTEL_GUC_RC_H_
+
+#include <linux/types.h>
+#include "intel_guc_submission.h"
+
+void intel_guc_rc_init_early(struct intel_guc *guc);
+
+static inline bool intel_guc_rc_is_supported(struct intel_guc *guc)
+{
+	return guc->rc_supported;
+}
+
+static inline bool intel_guc_rc_is_wanted(struct intel_guc *guc)
+{
+	return guc->submission_selected && intel_guc_rc_is_supported(guc);
+}
+
+static inline bool intel_guc_rc_is_used(struct intel_guc *guc)
+{
+	return intel_guc_submission_is_used(guc) && intel_guc_rc_is_wanted(guc);
+}
+
+int intel_guc_rc_enable(struct intel_guc *guc);
+int intel_guc_rc_disable(struct intel_guc *guc);
+
+#endif
drivers/gpu/drm/i915/gt/uc/intel_uc.h +2 -0
index 38e465fd8a0c..29d8ad6d9087 100644
@@ -7,6 +7,7 @@
 #define _INTEL_UC_H_
 
 #include "intel_guc.h"
+#include "intel_guc_rc.h"
 #include "intel_guc_submission.h"
 #include "intel_huc.h"
 #include "i915_params.h"
@@ -84,6 +85,7 @@ uc_state_checkers(guc, guc);
 uc_state_checkers(huc, huc);
 uc_state_checkers(guc, guc_submission);
 uc_state_checkers(guc, guc_slpc);
+uc_state_checkers(guc, guc_rc);
 
 #undef uc_state_checkers
 #undef __uc_state_checker
Signature · 6 lines
2.25.0

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#48 lore raw

Re: [Intel-gfx] [PATCH 16/16] drm/i915/guc/rc: Setup and enable GUCRC feature

Quoted 9 lines · Vinay Belgaumkar

This feature hands over the control of HW RC6 to the GUC. GUC decides when to put HW into RC6 based on it's internal busyness algorithms.

GUCRC needs GUC submission to be enabled, and only supported on Gen12+ for now.

When GUCRC is enabled, do not set HW RC6. Use a H2G message to tell guc to enable GUCRC. When disabling RC6, tell guc to

s/GUC/GuC
s/guc/GuC

Quoted 123 lines

revert RC6 control back to KMD.

---
 drivers/gpu/drm/i915/Makefile                 |  1 +
 drivers/gpu/drm/i915/gt/intel_rc6.c           | 22 ++++--
 .../gpu/drm/i915/gt/uc/abi/guc_actions_abi.h  |  6 ++
 drivers/gpu/drm/i915/gt/uc/intel_guc.c        |  1 +
 drivers/gpu/drm/i915/gt/uc/intel_guc.h        |  2 +
 drivers/gpu/drm/i915/gt/uc/intel_guc_rc.c     | 79 +++++++++++++++++++
 drivers/gpu/drm/i915/gt/uc/intel_guc_rc.h     | 32 ++++++++
 drivers/gpu/drm/i915/gt/uc/intel_uc.h         |  2 +
 8 files changed, 140 insertions(+), 5 deletions(-)
 create mode 100644 drivers/gpu/drm/i915/gt/uc/intel_guc_rc.c
 create mode 100644 drivers/gpu/drm/i915/gt/uc/intel_guc_rc.h
drivers/gpu/drm/i915/Makefile +1 -0
index d8eac4468df9..3fc17f20d88e 100644
@@ -186,6 +186,7 @@ i915-y += gt/uc/intel_uc.o \
 	  gt/uc/intel_guc_fw.o \
 	  gt/uc/intel_guc_log.o \
 	  gt/uc/intel_guc_log_debugfs.o \
+	  gt/uc/intel_guc_rc.o \
 	  gt/uc/intel_guc_slpc.o \
 	  gt/uc/intel_guc_submission.o \
 	  gt/uc/intel_huc.o \
drivers/gpu/drm/i915/gt/intel_rc6.c +17 -5
index 259d7eb4e165..299fcf10b04b 100644
@@ -98,11 +98,19 @@ static void gen11_rc6_enable(struct intel_rc6 *rc6)
 	set(uncore, GEN9_MEDIA_PG_IDLE_HYSTERESIS, 60);
 	set(uncore, GEN9_RENDER_PG_IDLE_HYSTERESIS, 60);
 
-	/* 3a: Enable RC6 */
-	rc6->ctl_enable =
-		GEN6_RC_CTL_HW_ENABLE |
-		GEN6_RC_CTL_RC6_ENABLE |
-		GEN6_RC_CTL_EI_MODE(1);
+	/* 3a: Enable RC6
+	 *
+	 * With GUCRC, we do not enable bit 31 of RC_CTL,
+	 * thus allowing GuC to control RC6 entry/exit fully instead.
+	 * We will not set the HW ENABLE and EI bits
+	 */
+	if (!intel_guc_rc_enable(&gt->uc.guc))
+		rc6->ctl_enable = GEN6_RC_CTL_RC6_ENABLE;
+	else
+		rc6->ctl_enable =
+			GEN6_RC_CTL_HW_ENABLE |
+			GEN6_RC_CTL_RC6_ENABLE |
+			GEN6_RC_CTL_EI_MODE(1);
 
 	pg_enable =
 		GEN9_RENDER_PG_ENABLE |
@@ -513,6 +521,10 @@ static void __intel_rc6_disable(struct intel_rc6 *rc6)
 {
 	struct drm_i915_private *i915 = rc6_to_i915(rc6);
 	struct intel_uncore *uncore = rc6_to_uncore(rc6);
+	struct intel_gt *gt = rc6_to_gt(rc6);
+
+	/* Take control of RC6 back from GuC */
+	intel_guc_rc_disable(&gt->uc.guc);
 
 	intel_uncore_forcewake_get(uncore, FORCEWAKE_ALL);
 	if (GRAPHICS_VER(i915) >= 9)
drivers/gpu/drm/i915/gt/uc/abi/guc_actions_abi.h +6 -0
index 596cf4b818e5..2ddb9cdc0a59 100644
@@ -136,6 +136,7 @@ enum intel_guc_action {
 	INTEL_GUC_ACTION_CONTEXT_RESET_NOTIFICATION = 0x1008,
 	INTEL_GUC_ACTION_ENGINE_FAILURE_NOTIFICATION = 0x1009,
 	INTEL_GUC_ACTION_SLPC_REQUEST = 0x3003,
+	INTEL_GUC_ACTION_SETUP_PC_GUCRC = 0x3004,
 	INTEL_GUC_ACTION_AUTHENTICATE_HUC = 0x4000,
 	INTEL_GUC_ACTION_REGISTER_CONTEXT = 0x4502,
 	INTEL_GUC_ACTION_DEREGISTER_CONTEXT = 0x4503,
@@ -146,6 +147,11 @@ enum intel_guc_action {
 	INTEL_GUC_ACTION_LIMIT
 };
 
+enum intel_guc_rc_options {
+	INTEL_GUCRC_HOST_CONTROL,
+	INTEL_GUCRC_FIRMWARE_CONTROL,
+};
+
 enum intel_guc_preempt_options {
 	INTEL_GUC_PREEMPT_OPTION_DROP_WORK_Q = 0x4,
 	INTEL_GUC_PREEMPT_OPTION_DROP_SUBMIT_Q = 0x8,
drivers/gpu/drm/i915/gt/uc/intel_guc.c +1 -0
index 82863a9bc8e8..0d55b24f7c67 100644
@@ -158,6 +158,7 @@ void intel_guc_init_early(struct intel_guc *guc)
 	intel_guc_log_init_early(&guc->log);
 	intel_guc_submission_init_early(guc);
 	intel_guc_slpc_init_early(guc);
+	intel_guc_rc_init_early(guc);
 
 	mutex_init(&guc->send_mutex);
 	spin_lock_init(&guc->irq_lock);
drivers/gpu/drm/i915/gt/uc/intel_guc.h +2 -0
index 0dbbd9cf553f..592d52e5e93c 100644
@@ -59,6 +59,8 @@ struct intel_guc {
 
 	bool submission_supported;
 	bool submission_selected;
+	bool rc_supported;
+	bool rc_selected;
 	bool slpc_supported;
 	bool slpc_selected;
 
drivers/gpu/drm/i915/gt/uc/intel_guc_rc.c new file +0 -0
new file mode 100644
index 000000000000..45b61432c56d

drivers/gpu/drm/i915/gt/uc/intel_guc_rc.c line 3

Quoted 3 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_rc.c new file +3 -0
@@ -0,0 +1,79 @@
+// SPDX-License-Identifier: MIT
+/*
+ * Copyright © 2020 Intel Corporation

2021

drivers/gpu/drm/i915/gt/uc/intel_guc_rc.c line 4

Quoted 1 line
drivers/gpu/drm/i915/gt/uc/intel_guc_rc.c new file +1 -0
+*/

unaligned *

Quoted 29 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_rc.c new file +29 -0
+
+#include "intel_guc_rc.h"
+#include "gt/intel_gt.h"
+#include "i915_drv.h"
+
+static bool __guc_rc_supported(struct intel_guc *guc)
+{
+	/* GuC RC is unavailable for pre-Gen12 */
+	return guc->submission_supported &&
+		GRAPHICS_VER(guc_to_gt(guc)->i915) >= 12;
+}
+
+static bool __guc_rc_selected(struct intel_guc *guc)
+{
+	if (!intel_guc_rc_is_supported(guc))
+		return false;
+
+	return guc->submission_selected;
+}
+
+void intel_guc_rc_init_early(struct intel_guc *guc)
+{
+	guc->rc_supported = __guc_rc_supported(guc);
+	guc->rc_selected = __guc_rc_selected(guc);
+}
+
+static int guc_action_control_gucrc(struct intel_guc *guc, bool enable)
+{
+	struct drm_device *drm = &guc_to_gt(guc)->i915->drm;

drivers/gpu/drm/i915/gt/uc/intel_guc_rc.c line 43

Quoted 10 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_rc.c new file +10 -0
+	u32 rc_mode = enable ? INTEL_GUCRC_FIRMWARE_CONTROL :
+				INTEL_GUCRC_HOST_CONTROL;
+	u32 action[] = {
+		INTEL_GUC_ACTION_SETUP_PC_GUCRC,
+		rc_mode
+	};
+	int ret;
+
+	ret = intel_guc_send(guc, action, ARRAY_SIZE(action));
+	if (ret)

since intel_guc_send() may return non-zero value from data0 RESPONSE field, assuming that this action expects there MBZ this should be:

	ret = ret > 0 ? -EPROTO : ret;

otherwise some static code analyzers might complain

drivers/gpu/drm/i915/gt/uc/intel_guc_rc.c line 44

Quoted 1 line
drivers/gpu/drm/i915/gt/uc/intel_guc_rc.c new file +1 -0
+		drm_err(drm, "Failed to set GUCRC mode(%d), err=%d\n",

you may want to print error with %pe
and move this message to __guc_rc_control because of the above

Quoted 8 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_rc.c new file +8 -0
+			rc_mode, ret);
+
+	return ret;
+}
+
+static int __guc_rc_control(struct intel_guc *guc, bool enable)
+{
+	struct intel_gt *gt = guc_to_gt(guc);

drivers/gpu/drm/i915/gt/uc/intel_guc_rc.c line 62

Quoted 10 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_rc.c new file +10 -0
+	int ret;
+
+	if (!intel_uc_uses_guc_rc(&gt->uc))
+		return -ENOTSUPP;
+
+	if (!intel_guc_is_ready(guc))
+		return -EINVAL;
+
+	ret = guc_action_control_gucrc(guc, enable);
+	if (unlikely(ret))
	drm_err(drm, "Failed to %s GuC RC mode (%pe)\n",
		enabledisable(enable), ERR_PTR(ret));
Quoted 23 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_rc.c new file +17 -0
+		return ret;
+
+	drm_info(&gt->i915->drm, "GuC RC %s\n",
+	         enableddisabled(enable));
+
+	return 0;
+}
+
+int intel_guc_rc_enable(struct intel_guc *guc)
+{
+	return __guc_rc_control(guc, true);
+}
+
+int intel_guc_rc_disable(struct intel_guc *guc)
+{
+	return __guc_rc_control(guc, false);
+}
drivers/gpu/drm/i915/gt/uc/intel_guc_rc.h new file +0 -0
new file mode 100644
index 000000000000..169e60726e5b

drivers/gpu/drm/i915/gt/uc/intel_guc_rc.h line 3

Quoted 3 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_rc.h new file +3 -0
@@ -0,0 +1,32 @@
+/* SPDX-License-Identifier: MIT */
+/*
+ * Copyright © 2020 Intel Corporation

2021

drivers/gpu/drm/i915/gt/uc/intel_guc_rc.h line 9

Quoted 6 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_rc.h new file +6 -0
+ */
+
+#ifndef _INTEL_GUC_RC_H_
+#define _INTEL_GUC_RC_H_
+
+#include <linux/types.h>

do you need this include here ?

Michal

Quoted 37 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_rc.h new file +23 -0
+#include "intel_guc_submission.h"
+
+void intel_guc_rc_init_early(struct intel_guc *guc);
+
+static inline bool intel_guc_rc_is_supported(struct intel_guc *guc)
+{
+	return guc->rc_supported;
+}
+
+static inline bool intel_guc_rc_is_wanted(struct intel_guc *guc)
+{
+	return guc->submission_selected && intel_guc_rc_is_supported(guc);
+}
+
+static inline bool intel_guc_rc_is_used(struct intel_guc *guc)
+{
+	return intel_guc_submission_is_used(guc) && intel_guc_rc_is_wanted(guc);
+}
+
+int intel_guc_rc_enable(struct intel_guc *guc);
+int intel_guc_rc_disable(struct intel_guc *guc);
+
+#endif
drivers/gpu/drm/i915/gt/uc/intel_uc.h +1 -0
index 38e465fd8a0c..29d8ad6d9087 100644
@@ -7,6 +7,7 @@
 #define _INTEL_UC_H_
 
 #include "intel_guc.h"
+#include "intel_guc_rc.h"
 #include "intel_guc_submission.h"
 #include "intel_huc.h"
 #include "i915_params.h"

drivers/gpu/drm/i915/gt/uc/intel_uc.h uc_state_checkers(guc, guc); · line 91

Quoted 7 lines
drivers/gpu/drm/i915/gt/uc/intel_uc.h +1 -0
@@ -84,6 +85,7 @@ uc_state_checkers(guc, guc);
 uc_state_checkers(huc, huc);
 uc_state_checkers(guc, guc_submission);
 uc_state_checkers(guc, guc_slpc);
+uc_state_checkers(guc, guc_rc);
 
 #undef uc_state_checkers
 #undef __uc_state_checker

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#49 lore raw

Re: [Intel-gfx] [PATCH 16/16] drm/i915/guc/rc: Setup and enable GUCRC feature

Quoted 7 lines · Michal Wajdeczko
Quoted 4 lines · Vinay Belgaumkar

This feature hands over the control of HW RC6 to the GUC. GUC decides when to put HW into RC6 based on it's internal busyness algorithms.

Quoted 8 lines
Quoted 5 lines

GUCRC needs GUC submission to be enabled, and only supported on Gen12+ for now.

When GUCRC is enabled, do not set HW RC6. Use a H2G message to tell guc to enable GUCRC. When disabling RC6, tell guc to

s/GUC/GuC
s/guc/GuC

Done.

Quoted 118 lines
Quoted 118 lines

revert RC6 control back to KMD.

---
  drivers/gpu/drm/i915/Makefile                 |  1 +
  drivers/gpu/drm/i915/gt/intel_rc6.c           | 22 ++++--
  .../gpu/drm/i915/gt/uc/abi/guc_actions_abi.h  |  6 ++
  drivers/gpu/drm/i915/gt/uc/intel_guc.c        |  1 +
  drivers/gpu/drm/i915/gt/uc/intel_guc.h        |  2 +
  drivers/gpu/drm/i915/gt/uc/intel_guc_rc.c     | 79 +++++++++++++++++++
  drivers/gpu/drm/i915/gt/uc/intel_guc_rc.h     | 32 ++++++++
  drivers/gpu/drm/i915/gt/uc/intel_uc.h         |  2 +
  8 files changed, 140 insertions(+), 5 deletions(-)

create mode 100644 drivers/gpu/drm/i915/gt/uc/intel_guc_rc.c create mode 100644 drivers/gpu/drm/i915/gt/uc/intel_guc_rc.h

drivers/gpu/drm/i915/Makefile +1 -0
index d8eac4468df9..3fc17f20d88e 100644
@@ -186,6 +186,7 @@ i915-y += gt/uc/intel_uc.o \
  	  gt/uc/intel_guc_fw.o \
  	  gt/uc/intel_guc_log.o \
  	  gt/uc/intel_guc_log_debugfs.o \
+	  gt/uc/intel_guc_rc.o \
  	  gt/uc/intel_guc_slpc.o \
  	  gt/uc/intel_guc_submission.o \
  	  gt/uc/intel_huc.o \
drivers/gpu/drm/i915/gt/intel_rc6.c +17 -5
index 259d7eb4e165..299fcf10b04b 100644
@@ -98,11 +98,19 @@ static void gen11_rc6_enable(struct intel_rc6 *rc6)
  	set(uncore, GEN9_MEDIA_PG_IDLE_HYSTERESIS, 60);
  	set(uncore, GEN9_RENDER_PG_IDLE_HYSTERESIS, 60);
 
-	/* 3a: Enable RC6 */
-	rc6->ctl_enable =
-		GEN6_RC_CTL_HW_ENABLE |
-		GEN6_RC_CTL_RC6_ENABLE |
-		GEN6_RC_CTL_EI_MODE(1);
+	/* 3a: Enable RC6
+	 *
+	 * With GUCRC, we do not enable bit 31 of RC_CTL,
+	 * thus allowing GuC to control RC6 entry/exit fully instead.
+	 * We will not set the HW ENABLE and EI bits
+	 */
+	if (!intel_guc_rc_enable(&gt->uc.guc))
+		rc6->ctl_enable = GEN6_RC_CTL_RC6_ENABLE;
+	else
+		rc6->ctl_enable =
+			GEN6_RC_CTL_HW_ENABLE |
+			GEN6_RC_CTL_RC6_ENABLE |
+			GEN6_RC_CTL_EI_MODE(1);
 
  	pg_enable =
  		GEN9_RENDER_PG_ENABLE |
@@ -513,6 +521,10 @@ static void __intel_rc6_disable(struct intel_rc6 *rc6)
  {
  	struct drm_i915_private *i915 = rc6_to_i915(rc6);
  	struct intel_uncore *uncore = rc6_to_uncore(rc6);
+	struct intel_gt *gt = rc6_to_gt(rc6);
+
+	/* Take control of RC6 back from GuC */
+	intel_guc_rc_disable(&gt->uc.guc);
 
  	intel_uncore_forcewake_get(uncore, FORCEWAKE_ALL);
  	if (GRAPHICS_VER(i915) >= 9)
drivers/gpu/drm/i915/gt/uc/abi/guc_actions_abi.h +6 -0
index 596cf4b818e5..2ddb9cdc0a59 100644
@@ -136,6 +136,7 @@ enum intel_guc_action {
  	INTEL_GUC_ACTION_CONTEXT_RESET_NOTIFICATION = 0x1008,
  	INTEL_GUC_ACTION_ENGINE_FAILURE_NOTIFICATION = 0x1009,
  	INTEL_GUC_ACTION_SLPC_REQUEST = 0x3003,
+	INTEL_GUC_ACTION_SETUP_PC_GUCRC = 0x3004,
  	INTEL_GUC_ACTION_AUTHENTICATE_HUC = 0x4000,
  	INTEL_GUC_ACTION_REGISTER_CONTEXT = 0x4502,
  	INTEL_GUC_ACTION_DEREGISTER_CONTEXT = 0x4503,
@@ -146,6 +147,11 @@ enum intel_guc_action {
  	INTEL_GUC_ACTION_LIMIT
  };
 
+enum intel_guc_rc_options {
+	INTEL_GUCRC_HOST_CONTROL,
+	INTEL_GUCRC_FIRMWARE_CONTROL,
+};
+
  enum intel_guc_preempt_options {
  	INTEL_GUC_PREEMPT_OPTION_DROP_WORK_Q = 0x4,
  	INTEL_GUC_PREEMPT_OPTION_DROP_SUBMIT_Q = 0x8,
drivers/gpu/drm/i915/gt/uc/intel_guc.c +1 -0
index 82863a9bc8e8..0d55b24f7c67 100644
@@ -158,6 +158,7 @@ void intel_guc_init_early(struct intel_guc *guc)
  	intel_guc_log_init_early(&guc->log);
  	intel_guc_submission_init_early(guc);
  	intel_guc_slpc_init_early(guc);
+	intel_guc_rc_init_early(guc);
 
  	mutex_init(&guc->send_mutex);
  	spin_lock_init(&guc->irq_lock);
drivers/gpu/drm/i915/gt/uc/intel_guc.h +2 -0
index 0dbbd9cf553f..592d52e5e93c 100644
@@ -59,6 +59,8 @@ struct intel_guc {
 
  	bool submission_supported;
  	bool submission_selected;
+	bool rc_supported;
+	bool rc_selected;
  	bool slpc_supported;
  	bool slpc_selected;
 
Quoted 11 lines

drivers/gpu/drm/i915/gt/uc/intel_guc_rc.c line 3

Quoted 9 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_rc.c new file +3 -0
new file mode 100644
index 000000000000..45b61432c56d
@@ -0,0 +1,79 @@
+// SPDX-License-Identifier: MIT
+/*
+ * Copyright © 2020 Intel Corporation

2021

Done.

Quoted 4 lines

drivers/gpu/drm/i915/gt/uc/intel_guc_rc.c line 4

Quoted 2 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_rc.c new file +1 -0
+*/

unaligned *

done.

Quoted 44 lines
Quoted 30 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_rc.c new file +29 -0
+
+#include "intel_guc_rc.h"
+#include "gt/intel_gt.h"
+#include "i915_drv.h"
+
+static bool __guc_rc_supported(struct intel_guc *guc)
+{
+	/* GuC RC is unavailable for pre-Gen12 */
+	return guc->submission_supported &&
+		GRAPHICS_VER(guc_to_gt(guc)->i915) >= 12;
+}
+
+static bool __guc_rc_selected(struct intel_guc *guc)
+{
+	if (!intel_guc_rc_is_supported(guc))
+		return false;
+
+	return guc->submission_selected;
+}
+
+void intel_guc_rc_init_early(struct intel_guc *guc)
+{
+	guc->rc_supported = __guc_rc_supported(guc);
+	guc->rc_selected = __guc_rc_selected(guc);
+}
+
+static int guc_action_control_gucrc(struct intel_guc *guc, bool enable)
+{
+	struct drm_device *drm = &guc_to_gt(guc)->i915->drm;

drivers/gpu/drm/i915/gt/uc/intel_guc_rc.c line 43

Quoted 10 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_rc.c new file +10 -0
+	u32 rc_mode = enable ? INTEL_GUCRC_FIRMWARE_CONTROL :
+				INTEL_GUCRC_HOST_CONTROL;
+	u32 action[] = {
+		INTEL_GUC_ACTION_SETUP_PC_GUCRC,
+		rc_mode
+	};
+	int ret;
+
+	ret = intel_guc_send(guc, action, ARRAY_SIZE(action));
+	if (ret)

since intel_guc_send() may return non-zero value from data0 RESPONSE field, assuming that this action expects there MBZ this should be:

Quoted 8 lines
	ret = ret > 0 ? -EPROTO : ret;

otherwise some static code analyzers might complain

drivers/gpu/drm/i915/gt/uc/intel_guc_rc.c line 44

Quoted 1 line
drivers/gpu/drm/i915/gt/uc/intel_guc_rc.c new file +1 -0
+		drm_err(drm, "Failed to set GUCRC mode(%d), err=%d\n",

you may want to print error with %pe
and move this message to __guc_rc_control because of the above

Ok, done.

Quoted 43 lines
Quoted 9 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_rc.c new file +8 -0
+			rc_mode, ret);
+
+	return ret;
+}
+
+static int __guc_rc_control(struct intel_guc *guc, bool enable)
+{
+	struct intel_gt *gt = guc_to_gt(guc);

drivers/gpu/drm/i915/gt/uc/intel_guc_rc.c line 62

Quoted 10 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_rc.c new file +10 -0
+	int ret;
+
+	if (!intel_uc_uses_guc_rc(&gt->uc))
+		return -ENOTSUPP;
+
+	if (!intel_guc_is_ready(guc))
+		return -EINVAL;
+
+	ret = guc_action_control_gucrc(guc, enable);
+	if (unlikely(ret))
	drm_err(drm, "Failed to %s GuC RC mode (%pe)\n",
		enabledisable(enable), ERR_PTR(ret));
Quoted 20 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_rc.c new file +17 -0
+		return ret;
+
+	drm_info(&gt->i915->drm, "GuC RC %s\n",
+	         enableddisabled(enable));
+
+	return 0;
+}
+
+int intel_guc_rc_enable(struct intel_guc *guc)
+{
+	return __guc_rc_control(guc, true);
+}
+
+int intel_guc_rc_disable(struct intel_guc *guc)
+{
+	return __guc_rc_control(guc, false);
+}
drivers/gpu/drm/i915/gt/uc/intel_guc_rc.h new file +0 -0
new file mode 100644
index 000000000000..169e60726e5b
Quoted 8 lines

drivers/gpu/drm/i915/gt/uc/intel_guc_rc.h line 3

Quoted 6 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_rc.h new file +3 -0
@@ -0,0 +1,32 @@
+/* SPDX-License-Identifier: MIT */
+/*
+ * Copyright © 2020 Intel Corporation

2021

Done.

Quoted 9 lines

drivers/gpu/drm/i915/gt/uc/intel_guc_rc.h line 9

Quoted 7 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_rc.h new file +6 -0
+ */
+
+#ifndef _INTEL_GUC_RC_H_
+#define _INTEL_GUC_RC_H_
+
+#include <linux/types.h>

do you need this include here ?

guess not.

Thanks,
Vinay.

Quoted 44 lines

Michal

Quoted 41 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_rc.h new file +23 -0
+#include "intel_guc_submission.h"
+
+void intel_guc_rc_init_early(struct intel_guc *guc);
+
+static inline bool intel_guc_rc_is_supported(struct intel_guc *guc)
+{
+	return guc->rc_supported;
+}
+
+static inline bool intel_guc_rc_is_wanted(struct intel_guc *guc)
+{
+	return guc->submission_selected && intel_guc_rc_is_supported(guc);
+}
+
+static inline bool intel_guc_rc_is_used(struct intel_guc *guc)
+{
+	return intel_guc_submission_is_used(guc) && intel_guc_rc_is_wanted(guc);
+}
+
+int intel_guc_rc_enable(struct intel_guc *guc);
+int intel_guc_rc_disable(struct intel_guc *guc);
+
+#endif
drivers/gpu/drm/i915/gt/uc/intel_uc.h +2 -0
index 38e465fd8a0c..29d8ad6d9087 100644
@@ -7,6 +7,7 @@
  #define _INTEL_UC_H_
 
  #include "intel_guc.h"
+#include "intel_guc_rc.h"
  #include "intel_guc_submission.h"
  #include "intel_huc.h"
  #include "i915_params.h"
@@ -84,6 +85,7 @@ uc_state_checkers(guc, guc);
  uc_state_checkers(huc, huc);
  uc_state_checkers(guc, guc_submission);
  uc_state_checkers(guc, guc_slpc);
+uc_state_checkers(guc, guc_rc);
 
Quoted 3 lines

drivers/gpu/drm/i915/gt/uc/intel_uc.h uc_state_checkers(guc, guc); · line 91

Quoted 3 lines
drivers/gpu/drm/i915/gt/uc/intel_uc.h +0 -0
  #undef uc_state_checkers
  #undef __uc_state_checker

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

CI Reviewed-by Michal Wajdeczko Reviewed-by John Harrison Reviewed-by Michal Wajdeczko Reviewed-by Michal Wajdeczko Reviewed-by John Harrison Reviewed-by John Harrison Reviewed-by John Harrison Reviewed-by John Harrison Reviewed-by Matthew Brost Reviewed-by Matthew Brost on the v1 series
#50 lore raw

[Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for Enable GuC based power management features

In reply to Vinay Belgaumkar
== Series Details ==

== Series Details ==

Series: Enable GuC based power management features
URL : https://patchwork.freedesktop.org/series/92391/
State : warning

== Summary ==

$ dim checkpatch origin/drm-tip
d9063ce26607 drm/i915/guc: Squashed patch - DO NOT REVIEW
-:21: WARNING:BAD_SIGN_OFF: Duplicate signature
#21: 
Signed-off-by: Matthew Brost <[email protected]>

-:32: WARNING:BAD_SIGN_OFF: Duplicate signature
#32:

-:33: WARNING:BAD_SIGN_OFF: Duplicate signature
#33:

-:63: WARNING:BAD_SIGN_OFF: Duplicate signature
#63:

-:82: WARNING:BAD_SIGN_OFF: Duplicate signature
#82:

-:84: WARNING:BAD_SIGN_OFF: Duplicate signature
#84:

-:85: WARNING:BAD_SIGN_OFF: Duplicate signature
#85:

-:113: WARNING:BAD_SIGN_OFF: Duplicate signature
#113:

-:114: WARNING:BAD_SIGN_OFF: Duplicate signature
#114:

-:115: WARNING:BAD_SIGN_OFF: Duplicate signature
#115:

-:122: WARNING:BAD_SIGN_OFF: Duplicate signature
#122:

-:123: WARNING:BAD_SIGN_OFF: Duplicate signature
#123:

-:124: WARNING:BAD_SIGN_OFF: Duplicate signature
#124:

-:131: WARNING:BAD_SIGN_OFF: Duplicate signature
#131:
Cc: John Harrison <[email protected]>

-:132: WARNING:BAD_SIGN_OFF: Duplicate signature
#132:

-:133: WARNING:BAD_SIGN_OFF: Duplicate signature
#133:

-:144: WARNING:BAD_SIGN_OFF: Duplicate signature
#144:
Cc: John Harrison <[email protected]>

-:145: WARNING:BAD_SIGN_OFF: Duplicate signature
#145:

-:146: WARNING:BAD_SIGN_OFF: Duplicate signature
#146:

-:161: WARNING:BAD_SIGN_OFF: Duplicate signature
#161:
Cc: John Harrison <[email protected]>

-:162: WARNING:BAD_SIGN_OFF: Duplicate signature
#162:

-:163: WARNING:BAD_SIGN_OFF: Duplicate signature
#163:

-:182: WARNING:BAD_SIGN_OFF: Duplicate signature
#182:
Cc: John Harrison <[email protected]>

-:183: WARNING:BAD_SIGN_OFF: Duplicate signature
#183:

-:190: WARNING:BAD_SIGN_OFF: Duplicate signature
#190:

-:191: WARNING:BAD_SIGN_OFF: Duplicate signature
#191:

-:204: WARNING:BAD_SIGN_OFF: Duplicate signature
#204:

-:205: WARNING:BAD_SIGN_OFF: Duplicate signature
#205:

-:216: WARNING:BAD_SIGN_OFF: Duplicate signature
#216:
Cc: John Harrison <[email protected]>

-:217: WARNING:BAD_SIGN_OFF: Duplicate signature
#217:

-:231: WARNING:BAD_SIGN_OFF: Duplicate signature
#231:
Cc: John Harrison <[email protected]>

-:232: WARNING:BAD_SIGN_OFF: Duplicate signature
#232:

-:242: WARNING:BAD_SIGN_OFF: Duplicate signature
#242:
Cc: John Harrison <[email protected]>

-:243: WARNING:BAD_SIGN_OFF: Duplicate signature
#243:

-:244: WARNING:BAD_SIGN_OFF: Duplicate signature
#244:

-:251: WARNING:BAD_SIGN_OFF: Duplicate signature
#251:
Cc: John Harrison <[email protected]>

-:252: WARNING:BAD_SIGN_OFF: Duplicate signature
#252:

-:259: WARNING:BAD_SIGN_OFF: Duplicate signature
#259:
Cc: John Harrison <[email protected]>

-:260: WARNING:BAD_SIGN_OFF: Duplicate signature
#260:

-:271: WARNING:BAD_SIGN_OFF: Duplicate signature
#271:

-:272: WARNING:BAD_SIGN_OFF: Duplicate signature
#272:

-:284: WARNING:BAD_SIGN_OFF: Duplicate signature
#284:
Cc: John Harrison <[email protected]>

-:285: WARNING:BAD_SIGN_OFF: Duplicate signature
#285:

-:300: WARNING:BAD_SIGN_OFF: Duplicate signature
#300:

-:301: WARNING:BAD_SIGN_OFF: Duplicate signature
#301:

-:312: WARNING:BAD_SIGN_OFF: Duplicate signature
#312:
Cc: John Harrison <[email protected]>

-:313: WARNING:BAD_SIGN_OFF: Duplicate signature
#313:

-:319: WARNING:BAD_SIGN_OFF: Duplicate signature
#319:

-:320: WARNING:BAD_SIGN_OFF: Duplicate signature
#320:

-:328: WARNING:BAD_SIGN_OFF: Duplicate signature
#328:
Cc: John Harrison <[email protected]>

-:329: WARNING:BAD_SIGN_OFF: Duplicate signature
#329:

-:337: WARNING:BAD_SIGN_OFF: Duplicate signature
#337:
Cc: John Harrison <[email protected]>

-:338: WARNING:BAD_SIGN_OFF: Duplicate signature
#338:

-:350: WARNING:BAD_SIGN_OFF: Duplicate signature
#350:

-:369: WARNING:BAD_SIGN_OFF: Duplicate signature
#369:

-:370: WARNING:BAD_SIGN_OFF: Duplicate signature
#370:

-:384: WARNING:BAD_SIGN_OFF: Duplicate signature
#384:

-:392: WARNING:BAD_SIGN_OFF: Duplicate signature
#392:

-:402: WARNING:BAD_SIGN_OFF: Duplicate signature
#402:

-:403: WARNING:BAD_SIGN_OFF: Duplicate signature
#403:
CC: John Harrison <[email protected]>

-:410: WARNING:BAD_SIGN_OFF: Duplicate signature
#410:

-:428: WARNING:BAD_SIGN_OFF: Duplicate signature
#428:
Cc: John Harrison <[email protected]>

-:429: WARNING:BAD_SIGN_OFF: Duplicate signature
#429:

-:437: WARNING:BAD_SIGN_OFF: Duplicate signature
#437:

-:445: WARNING:BAD_SIGN_OFF: Duplicate signature
#445:

-:446: ERROR:BAD_SIGN_OFF: Unrecognized email address: 'Daniele Ceraolo Spurio <[email protected]' #446:
Cc: Daniele Ceraolo Spurio <[email protected]

-:463: WARNING:BAD_SIGN_OFF: Duplicate signature
#463:
Cc: John Harrison <[email protected]>

-:464: WARNING:BAD_SIGN_OFF: Duplicate signature
#464:

-:475: WARNING:BAD_SIGN_OFF: Duplicate signature
#475:
Cc: John Harrison <[email protected]>

-:476: WARNING:BAD_SIGN_OFF: Duplicate signature
#476:

-:484: WARNING:BAD_SIGN_OFF: Duplicate signature
#484:

-:492: WARNING:BAD_SIGN_OFF: Duplicate signature
#492:

-:493: WARNING:BAD_SIGN_OFF: Duplicate signature
#493:
CC: John Harrison <[email protected]>

-:507: WARNING:BAD_SIGN_OFF: Duplicate signature
#507:

-:508: WARNING:BAD_SIGN_OFF: Duplicate signature
#508:

-:509: WARNING:BAD_SIGN_OFF: Duplicate signature
#509:

-:510: WARNING:BAD_SIGN_OFF: Duplicate signature #510:
Cc: Daniele Ceraolo Spurio <[email protected]>

-:521: WARNING:BAD_SIGN_OFF: Duplicate signature
#521:

-:522: WARNING:BAD_SIGN_OFF: Duplicate signature
#522:

-:530: WARNING:BAD_SIGN_OFF: Duplicate signature
#530:

-:531: WARNING:BAD_SIGN_OFF: Duplicate signature
#531:

-:532: WARNING:BAD_SIGN_OFF: Duplicate signature
#532:

-:546: WARNING:BAD_SIGN_OFF: Duplicate signature
#546:

-:563: WARNING:BAD_SIGN_OFF: Duplicate signature
#563:

-:564: WARNING:BAD_SIGN_OFF: Duplicate signature
#564:

-:571: WARNING:BAD_SIGN_OFF: Duplicate signature
#571:

-:572: WARNING:BAD_SIGN_OFF: Duplicate signature
#572:

-:590: WARNING:BAD_SIGN_OFF: Duplicate signature
#590:

-:591: WARNING:BAD_SIGN_OFF: Duplicate signature
#591:

-:598: WARNING:BAD_SIGN_OFF: Duplicate signature
#598:

-:599: WARNING:BAD_SIGN_OFF: Duplicate signature
#599:

-:600: WARNING:BAD_SIGN_OFF: Duplicate signature
#600:

-:608: WARNING:BAD_SIGN_OFF: Duplicate signature
#608:

-:609: WARNING:BAD_SIGN_OFF: Duplicate signature
#609:

-:616: WARNING:BAD_SIGN_OFF: Duplicate signature
#616:
Cc: John Harrison <[email protected]>

-:617: WARNING:BAD_SIGN_OFF: Duplicate signature
#617:

-:624: WARNING:BAD_SIGN_OFF: Duplicate signature
#624:

-:625: WARNING:BAD_SIGN_OFF: Duplicate signature
#625:
Cc: Tvrtko Ursulin <[email protected]>

-:633: WARNING:BAD_SIGN_OFF: Duplicate signature
#633:

-:634: WARNING:BAD_SIGN_OFF: Duplicate signature #634:
Cc: Daniele Ceraolo Spurio <[email protected]>

-:643: WARNING:BAD_SIGN_OFF: Duplicate signature
#643:

-:644: WARNING:BAD_SIGN_OFF: Duplicate signature #644:
Cc: Daniele Ceraolo Spurio <[email protected]>

-:645: WARNING:BAD_SIGN_OFF: Duplicate signature
#645:
Cc: Matthew Brost <[email protected]>

-:653: WARNING:BAD_SIGN_OFF: Duplicate signature
#653:

-:654: WARNING:BAD_SIGN_OFF: Duplicate signature
#654:

-:655: WARNING:BAD_SIGN_OFF: Duplicate signature #655:
Cc: Daniele Ceraolo Spurio <[email protected]>

-:656: WARNING:BAD_SIGN_OFF: Duplicate signature
#656:
Cc: Matthew Brost <[email protected]>

-:663: WARNING:BAD_SIGN_OFF: Duplicate signature
#663:

-:688: WARNING:BAD_SIGN_OFF: Duplicate signature
#688:

-:689: WARNING:BAD_SIGN_OFF: Duplicate signature #689:
Cc: Daniele Ceraolo Spurio <[email protected]>

-:690: WARNING:BAD_SIGN_OFF: Duplicate signature
#690:
Cc: Matthew Brost <[email protected]>

-:710: WARNING:BAD_SIGN_OFF: Duplicate signature
#710:

-:711: WARNING:BAD_SIGN_OFF: Duplicate signature #711:
Cc: Daniele Ceraolo Spurio <[email protected]>

-:717: WARNING:BAD_SIGN_OFF: Duplicate signature
#717:

-:718: WARNING:BAD_SIGN_OFF: Duplicate signature
#718:

-:719: WARNING:BAD_SIGN_OFF: Duplicate signature
#719:

-:1381: WARNING:UNNECESSARY_ELSE: else is not generally useful after a break or return #1381: FILE: drivers/gpu/drm/i915/gt/intel_engine.h:291:
+ return intel_guc_virtual_engine_has_heartbeat(engine);
+ else

-:1558: CHECK:BRACES: braces {} should be used on all arms of this statement #1558: FILE: drivers/gpu/drm/i915/gt/intel_engine_cs.c:1702:
+ if (guc) {
[...]
+ } else
[...]

-:1562: CHECK:BRACES: Unbalanced braces around else statement #1562: FILE: drivers/gpu/drm/i915/gt/intel_engine_cs.c:1706:
+ } else

-:1761: CHECK:BRACES: Blank lines aren't necessary before a close brace '}' #1761: FILE: drivers/gpu/drm/i915/gt/intel_engine_heartbeat.c:231:
+
+}

-:2671: CHECK:LINE_SPACING: Please don't use multiple blank lines #2671: FILE: drivers/gpu/drm/i915/gt/mock_engine.c:266:
+
+

-:2874: WARNING:LONG_LINE: line length of 103 exceeds 100 columns #2874: FILE: drivers/gpu/drm/i915/gt/selftest_hangcheck.c:393:
+ pr_err("[%s] Create request failed: %d!\n", engine->name, err);

-:2986: WARNING:LONG_LINE: line length of 108 exceeds 100 columns #2986: FILE: drivers/gpu/drm/i915/gt/selftest_hangcheck.c:754:
+ pr_err("[%s] Create hang request failed: %d!\n", engine->name, err);

-:3020: WARNING:LONG_LINE: line length of 123 exceeds 100 columns #3020: FILE: drivers/gpu/drm/i915/gt/selftest_hangcheck.c:789:
+ engine->name, rq->fence.context, rq->fence.seqno, rq->context->guc_id, err);

-:3167: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #3167: FILE: drivers/gpu/drm/i915/gt/selftest_hangcheck.c:1049:
+ err = intel_selftest_modify_policy(engine, &saved,
+ SELFTEST_SCHEDULER_MODIFY_FAST_RESET);

-:3178: WARNING:LONG_LINE: line length of 108 exceeds 100 columns #3178: FILE: drivers/gpu/drm/i915/gt/selftest_hangcheck.c:1059:
+ pr_err("[%s] Create hang request failed: %d!\n", engine->name, err);

-:3213: WARNING:LONG_LINE: line length of 123 exceeds 100 columns #3213: FILE: drivers/gpu/drm/i915/gt/selftest_hangcheck.c:1096:
+ engine->name, rq->fence.context, rq->fence.seqno, rq->context->guc_id, err);

-:3434: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #3434: FILE: drivers/gpu/drm/i915/gt/selftest_hangcheck.c:1660:
+ err = intel_selftest_modify_policy(engine, &saved,
+ SELFTEST_SCHEDULER_MODIFY_NO_HANGCHECK);

-:3513: WARNING:LINE_SPACING: Missing a blank line after declarations #3513: FILE: drivers/gpu/drm/i915/gt/selftest_hangcheck.c:1775:
+ int err2 = intel_selftest_restore_policy(engine, &saved);
+ if (err2)

-:3514: WARNING:LONG_LINE: line length of 123 exceeds 100 columns #3514: FILE: drivers/gpu/drm/i915/gt/selftest_hangcheck.c:1776:
+ pr_err("%s:%d> [%s] Restore policy failed: %d!\n", __func__, __LINE__, engine->name, err2);

-:3769: WARNING:LONG_LINE: line length of 105 exceeds 100 columns #3769: FILE: drivers/gpu/drm/i915/gt/selftest_workarounds.c:814:
+ SELFTEST_SCHEDULER_MODIFY_FAST_RESET);

-:3770: ERROR:SPACING: space required before the open parenthesis '(' #3770: FILE: drivers/gpu/drm/i915/gt/selftest_workarounds.c:815:
+ if(err)

-:3780: CHECK:BRACES: Unbalanced braces around else statement #3780: FILE: drivers/gpu/drm/i915/gt/selftest_workarounds.c:825:
+ } else

-:3803: CHECK:LINE_SPACING: Please don't use multiple blank lines #3803: FILE: drivers/gpu/drm/i915/gt/selftest_workarounds.c:1277:
+
+

-:4142: ERROR:POINTER_LOCATION: "foo* bar" should be "foo *bar" #4142: FILE: drivers/gpu/drm/i915/gt/uc/intel_guc.h:119:
+static inline int intel_guc_send_busy_loop(struct intel_guc* guc,

-:4150: ERROR:IN_ATOMIC: do not use in_atomic in drivers #4150: FILE: drivers/gpu/drm/i915/gt/uc/intel_guc.h:127:
+ bool not_atomic = !in_atomic() && !irqs_disabled();

-:4372: WARNING:ENOTSUPP: ENOTSUPP is not a SUSV4 error code, prefer EOPNOTSUPP #4372: FILE: drivers/gpu/drm/i915/gt/uc/intel_guc_ads.c:147:
+ return -ENOTSUPP;

-:4500: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #4500: FILE: drivers/gpu/drm/i915/gt/uc/intel_guc_ads.c:285:
+ temp_set.registers = kmalloc_array(temp_set.size,
+ sizeof(*temp_set.registers),

-:4529: CHECK:SPACING: No space is necessary after a cast #4529: FILE: drivers/gpu/drm/i915/gt/uc/intel_guc_ads.c:314:
+ temp_set.registers = (struct guc_mmio_reg *) (((u8 *) blob) + offset);

-:4678: CHECK:SPACING: No space is necessary after a cast #4678: FILE: drivers/gpu/drm/i915/gt/uc/intel_guc_ads.c:453:
+ ptr = ((u8 *) blob) + offset;

-:4704: WARNING:LONG_LINE: line length of 106 exceeds 100 columns #4704: FILE: drivers/gpu/drm/i915/gt/uc/intel_guc_ads.c:470:
+ drm_err(&gt->i915->drm, "No engine state recorded for class %d!\n", engine_class);

-:5165: ERROR:COMPLEX_MACRO: Macros with complex values should be enclosed in parentheses #5165: FILE: drivers/gpu/drm/i915/gt/uc/intel_guc_ct.c:620:
+#define G2H_LEN_DW(f) \
+ FIELD_GET(INTEL_GUC_CT_SEND_G2H_DW_MASK, f) ? \
+ FIELD_GET(INTEL_GUC_CT_SEND_G2H_DW_MASK, f) + GUC_CTB_HXG_MSG_MIN_LEN : 0

-:5165: CHECK:MACRO_ARG_REUSE: Macro argument reuse 'f' - possible side-effects? #5165: FILE: drivers/gpu/drm/i915/gt/uc/intel_guc_ct.c:620:
+#define G2H_LEN_DW(f) \
+ FIELD_GET(INTEL_GUC_CT_SEND_G2H_DW_MASK, f) ? \
+ FIELD_GET(INTEL_GUC_CT_SEND_G2H_DW_MASK, f) + GUC_CTB_HXG_MSG_MIN_LEN : 0

-:5511: CHECK:MACRO_ARG_REUSE: Macro argument reuse 'len' - possible side-effects? #5511: FILE: drivers/gpu/drm/i915/gt/uc/intel_guc_ct.h:109:
+#define MAKE_SEND_FLAGS(len) \
+ ({GEM_BUG_ON(!FIELD_FIT(INTEL_GUC_CT_SEND_G2H_DW_MASK, len)); \
+ (FIELD_PREP(INTEL_GUC_CT_SEND_G2H_DW_MASK, len) | INTEL_GUC_CT_SEND_NB);})

-:5513: ERROR:SPACING: space required after that ';' (ctx:VxV) #5513: FILE: drivers/gpu/drm/i915/gt/uc/intel_guc_ct.h:111:
+ (FIELD_PREP(INTEL_GUC_CT_SEND_G2H_DW_MASK, len) | INTEL_GUC_CT_SEND_NB);})
^

-:5687: WARNING:BLOCK_COMMENT_STYLE: Block comments use a trailing */ on a separate line #5687: FILE: drivers/gpu/drm/i915/gt/uc/intel_guc_fwif.h:214:
+ * reset. (in micro seconds). */

-:6002: CHECK:COMPARISON_TO_NULL: Comparison to NULL could be written "guc->lrc_desc_pool_vaddr" #6002: FILE: drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c:295:
+ return guc->lrc_desc_pool_vaddr != NULL;

-:6048: ERROR:POINTER_LOCATION: "foo* bar" should be "foo *bar" #6048: FILE: drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c:335:
+static int guc_submission_busy_loop(struct intel_guc* guc,

-:6273: CHECK:BRACES: braces {} should be used on all arms of this statement #6273: FILE: drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c:522:
+ if (unlikely(ret == -EPIPE))
[...]
+ else if (ret == -EBUSY) {
[...]

-:6368: ERROR:SPACING: spaces required around that '||' (ctx:VxW) #6368: FILE: drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c:603:
+ if (pending_enable|| deregister)
^

-:6424: WARNING:MEMORY_BARRIER: memory barrier without comment #6424: FILE: drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c:652:
+ wmb();

-:6478: ERROR:CODE_INDENT: code indent should use tabs where possible #6478: FILE: drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c:695:
+ ^I */$

-:6478: WARNING:SPACE_BEFORE_TAB: please, no space before tabs #6478: FILE: drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c:695:
+ ^I */$

-:7079: WARNING:REPEATED_WORD: Possible repeated word: 'from' #7079: FILE: drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c:1287:
+ * could be regisgered either the guc_id has been stole from from

-:7113: CHECK:BRACES: braces {} should be used on all arms of this statement #7113: FILE: drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c:1321:
+ if (unlikely(ret == -EBUSY)) {
[...]
+ } else if (unlikely(ret == -ENODEV))
[...]

-:7336: ERROR:BRACKET_SPACE: space prohibited before open square bracket '[' #7336: FILE: drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c:1544:
+ u32 action [] = {

-:7359: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #7359: FILE: drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c:1567:
+ if (submission_disabled(guc) || (!context_enabled(ce) &&
+ !context_pending_disable(ce))) {

-:7708: WARNING:ONE_SEMICOLON: Statements terminations use 1 semicolon #7708: FILE: drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c:1893:
+ return ret;;

-:7864: ERROR:CODE_INDENT: code indent should use tabs where possible #7864: FILE: drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c:2032:
+ * In GuC submission mode we do not know which physical engine a request$

-:7865: ERROR:CODE_INDENT: code indent should use tabs where possible #7865: FILE: drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c:2033:
+ * will be scheduled on, this creates a problem because the breadcrumb$

-:7866: ERROR:CODE_INDENT: code indent should use tabs where possible #7866: FILE: drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c:2034:
+ * interrupt is per physical engine. To work around this we attach$

-:7867: ERROR:CODE_INDENT: code indent should use tabs where possible #7867: FILE: drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c:2035:
+ * requests and direct all breadcrumb interrupts to the first instance$

-:7868: ERROR:CODE_INDENT: code indent should use tabs where possible #7868: FILE: drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c:2036:
+ * of an engine per class. In addition all breadcrumb interrupts are$

-:7870: ERROR:CODE_INDENT: code indent should use tabs where possible #7870: FILE: drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c:2038:
+ */$

-:8532: CHECK:LINE_SPACING: Please don't use multiple blank lines #8532: FILE: drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c:2796:
+
+

-:8837: WARNING:LONG_LINE: line length of 107 exceeds 100 columns #8837: FILE: drivers/gpu/drm/i915/i915_debugfs_params.c:14:
+#define MATCH_DEBUGFS_NODE_NAME(_file, _name) (strcmp((_file)->f_path.dentry->d_name.name, (_name)) == 0)

-:8839: CHECK:MACRO_ARG_REUSE: Macro argument reuse 'i915' - possible side-effects? #8839: FILE: drivers/gpu/drm/i915/i915_debugfs_params.c:16:
+#define GET_I915(i915, name, ptr) \
+ do { \
+ struct i915_params *params; \
+ params = container_of(((void *) (ptr)), typeof(*params), name); \
+ (i915) = container_of(params, typeof(*(i915)), params); \
+ } while(0)

-:8842: CHECK:SPACING: No space is necessary after a cast #8842: FILE: drivers/gpu/drm/i915/i915_debugfs_params.c:19:
+ params = container_of(((void *) (ptr)), typeof(*params), name); \

-:8844: ERROR:SPACING: space required before the open parenthesis '(' #8844: FILE: drivers/gpu/drm/i915/i915_debugfs_params.c:21:
+ } while(0)

-:9213: WARNING:LONG_LINE: line length of 101 exceeds 100 columns #9213: FILE: drivers/gpu/drm/i915/i915_request.c:1596:
+ if ((!uses_guc && is_power_of_2(READ_ONCE(prev->engine)->mask | rq->engine->mask)) ||

-:9292: ERROR:OPEN_BRACE: open brace '{' following enum go on the same line #9292: FILE: drivers/gpu/drm/i915/i915_request.h:653:
+enum i915_request_state
+{

-:9455: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #9455: FILE: drivers/gpu/drm/i915/i915_trace.h:909:
+DECLARE_EVENT_CLASS(intel_context,
+ TP_PROTO(struct intel_context *ce),

-:9458: CHECK:OPEN_ENDED_LINE: Lines should not end with a '(' #9458: FILE: drivers/gpu/drm/i915/i915_trace.h:912:
+ TP_STRUCT__entry(

-:9465: CHECK:OPEN_ENDED_LINE: Lines should not end with a '(' #9465: FILE: drivers/gpu/drm/i915/i915_trace.h:919:
+ TP_fast_assign(

-:9694: WARNING:FILE_PATH_CHANGES: added, moved or deleted file(s), does MAINTAINERS need updating? #9694:
new file mode 100644

-:9699: WARNING:SPDX_LICENSE_TAG: Missing or malformed SPDX-License-Identifier tag in line 1 #9699: FILE: drivers/gpu/drm/i915/selftests/intel_scheduler_helpers.c:1:
+/*

-:9700: WARNING:SPDX_LICENSE_TAG: Misplaced SPDX-License-Identifier tag - use line 1 instead #9700: FILE: drivers/gpu/drm/i915/selftests/intel_scheduler_helpers.c:2:
+ * SPDX-License-Identifier: MIT

-:9808: ERROR:OPEN_BRACE: open brace '{' following struct go on the same line #9808: FILE: drivers/gpu/drm/i915/selftests/intel_scheduler_helpers.h:15:
+struct intel_selftest_saved_policy
+{

-:9816: ERROR:OPEN_BRACE: open brace '{' following enum go on the same line #9816: FILE: drivers/gpu/drm/i915/selftests/intel_scheduler_helpers.h:23:
+enum selftest_scheduler_modify
+{

-:9826: ERROR:SPACING: space prohibited after that open parenthesis '(' #9826: FILE: drivers/gpu/drm/i915/selftests/intel_scheduler_helpers.h:33:
+int intel_selftest_wait_for_rq( struct i915_request *rq);

total: 21 errors, 136 warnings, 23 checks, 8531 lines checked
25589f2d8bfd drm/i915/guc/slpc: Initial definitions for slpc
2790990fc2e6 drm/i915/guc/slpc: Gate Host RPS when slpc is enabled
980d855c5c5a drm/i915/guc/slpc: Lay out slpc init/enable/disable/fini
-:45: WARNING:FILE_PATH_CHANGES: added, moved or deleted file(s), does MAINTAINERS need updating? #45:
new file mode 100644

-:50: WARNING:SPDX_LICENSE_TAG: Missing or malformed SPDX-License-Identifier tag in line 1 #50: FILE: drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c:1:
+/*

-:51: WARNING:SPDX_LICENSE_TAG: Misplaced SPDX-License-Identifier tag - use line 1 instead #51: FILE: drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c:2:
+ * SPDX-License-Identifier: MIT

-:90: WARNING:SPDX_LICENSE_TAG: Missing or malformed SPDX-License-Identifier tag in line 1 #90: FILE: drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.h:1:
+/*

-:91: WARNING:SPDX_LICENSE_TAG: Misplaced SPDX-License-Identifier tag - use line 1 instead #91: FILE: drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.h:2:
+ * SPDX-License-Identifier: MIT

total: 0 errors, 5 warnings, 0 checks, 71 lines checked
b076b1d0bbf4 drm/i915/guc/slpc: Adding slpc communication interfaces
-:60: WARNING:FILE_PATH_CHANGES: added, moved or deleted file(s), does MAINTAINERS need updating? #60:
new file mode 100644

-:65: WARNING:SPDX_LICENSE_TAG: Missing or malformed SPDX-License-Identifier tag in line 1 #65: FILE: drivers/gpu/drm/i915/gt/uc/intel_guc_slpc_fwif.h:1:
+/*

-:66: WARNING:SPDX_LICENSE_TAG: Misplaced SPDX-License-Identifier tag - use line 1 instead #66: FILE: drivers/gpu/drm/i915/gt/uc/intel_guc_slpc_fwif.h:2:
+ * SPDX-License-Identifier: MIT

-:106: WARNING:LONG_LINE: line length of 104 exceeds 100 columns #106: FILE: drivers/gpu/drm/i915/gt/uc/intel_guc_slpc_fwif.h:42:
+ + (SLPC_CACHELINE_SIZE_BYTES-1)) / SLPC_CACHELINE_SIZE_BYTES)*SLPC_CACHELINE_SIZE_BYTES)

-:106: CHECK:SPACING: spaces preferred around that '-' (ctx:VxV) #106: FILE: drivers/gpu/drm/i915/gt/uc/intel_guc_slpc_fwif.h:42:
+ + (SLPC_CACHELINE_SIZE_BYTES-1)) / SLPC_CACHELINE_SIZE_BYTES)*SLPC_CACHELINE_SIZE_BYTES)
^

-:106: CHECK:SPACING: spaces preferred around that '*' (ctx:VxV) #106: FILE: drivers/gpu/drm/i915/gt/uc/intel_guc_slpc_fwif.h:42:
+ + (SLPC_CACHELINE_SIZE_BYTES-1)) / SLPC_CACHELINE_SIZE_BYTES)*SLPC_CACHELINE_SIZE_BYTES)
^

-:221: ERROR:CODE_INDENT: code indent should use tabs where possible #221: FILE: drivers/gpu/drm/i915/gt/uc/intel_guc_slpc_fwif.h:157:
+ union$

-:221: WARNING:LEADING_SPACE: please, no spaces at the start of a line #221: FILE: drivers/gpu/drm/i915/gt/uc/intel_guc_slpc_fwif.h:157:
+ union$

-:222: ERROR:OPEN_BRACE: open brace '{' following union go on the same line #222: FILE: drivers/gpu/drm/i915/gt/uc/intel_guc_slpc_fwif.h:158:
+ union
+ {

total: 2 errors, 5 warnings, 2 checks, 286 lines checked f3e07ff23e21 drm/i915/guc/slpc: Allocate, initialize and release slpc 675158b5dd9c drm/i915/guc/slpc: Enable slpc and add related H2G events -:35: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #35: FILE: drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c:32:
+static void slpc_mem_set_param(struct slpc_shared_data *data,
+ u32 id, u32 value)

-:57: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #57: FILE: drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c:54:
+static void slpc_mem_task_control(struct slpc_shared_data *data,
+ u64 val, u32 enable_id, u32 disable_id)

-:91: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #91: FILE: drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c:97:
+static int slpc_send(struct intel_guc_slpc *slpc,
+ struct slpc_event_input *input,

-:228: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #228: FILE: drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c:249:
+ slpc_mem_task_control(data, SLPC_PARAM_TASK_ENABLED,
+ SLPC_PARAM_TASK_ENABLE_GTPERF,

-:232: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #232: FILE: drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c:253:
+ slpc_mem_task_control(data, SLPC_PARAM_TASK_DISABLED,
+ SLPC_PARAM_TASK_ENABLE_BALANCER,

-:236: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #236: FILE: drivers/gpu/drm/i915/

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#51 lore raw

[Intel-gfx] ✗ Fi.CI.SPARSE: warning for Enable GuC based power management features

In reply to Vinay Belgaumkar
== Series Details ==

== Series Details ==

Series: Enable GuC based power management features
URL : https://patchwork.freedesktop.org/series/92391/
State : warning

== Summary ==

$ dim sparse --fast origin/drm-tip
Sparse version: v0.6.2
Fast mode used, each commit won't be checked separately.
+drivers/gpu/drm/i915/gt/intel_rps.c:1969:5: warning: symbol 'intel_rps_read_punit_req' was not declared. Should it be static?
+drivers/gpu/drm/i915/gt/intel_rps.c:1978:5: warning: symbol 'intel_rps_get_req' was not declared. Should it be static?
+drivers/gpu/drm/i915/gt/intel_rps.c:1985:5: warning: symbol 'intel_rps_read_punit_req_frequency' was not declared. Should it be static?
+drivers/gpu/drm/i915/selftests/i915_syncmap.c:80:54: warning: dubious: x | !y
+./include/linux/stddef.h:17:9: this was the original definition
+./include/linux/stddef.h:17:9: this was the original definition
+./include/linux/stddef.h:17:9: this was the original definition
+./include/linux/stddef.h:17:9: this was the original definition
+./include/linux/stddef.h:17:9: this was the original definition
+./include/linux/stddef.h:17:9: this was the original definition
+./include/linux/stddef.h:17:9: this was the original definition
+./include/linux/stddef.h:17:9: this was the original definition
+./include/linux/stddef.h:17:9: this was the original definition
+./include/linux/stddef.h:17:9: this was the original definition
+./include/linux/stddef.h:17:9: this was the original definition
+./include/linux/stddef.h:17:9: this was the original definition
+./include/linux/stddef.h:17:9: this was the original definition
+./include/linux/stddef.h:17:9: this was the original definition
+./include/linux/stddef.h:17:9: this was the original definition
+./include/linux/stddef.h:17:9: this was the original definition
+./include/linux/stddef.h:17:9: this was the original definition
+./include/linux/stddef.h:17:9: this was the original definition
+./include/linux/stddef.h:17:9: this was the original definition
+./include/linux/stddef.h:17:9: this was the original definition
+./include/linux/stddef.h:17:9: this was the original definition
+./include/linux/stddef.h:17:9: this was the original definition
+/usr/lib/gcc/x86_64-linux-gnu/8/include/stddef.h:417:9: warning: preprocessor token offsetof redefined
+/usr/lib/gcc/x86_64-linux-gnu/8/include/stddef.h:417:9: warning: preprocessor token offsetof redefined
+/usr/lib/gcc/x86_64-linux-gnu/8/include/stddef.h:417:9: warning: preprocessor token offsetof redefined
+/usr/lib/gcc/x86_64-linux-gnu/8/include/stddef.h:417:9: warning: preprocessor token offsetof redefined
+/usr/lib/gcc/x86_64-linux-gnu/8/include/stddef.h:417:9: warning: preprocessor token offsetof redefined
+/usr/lib/gcc/x86_64-linux-gnu/8/include/stddef.h:417:9: warning: preprocessor token offsetof redefined
+/usr/lib/gcc/x86_64-linux-gnu/8/include/stddef.h:417:9: warning: preprocessor token offsetof redefined
+/usr/lib/gcc/x86_64-linux-gnu/8/include/stddef.h:417:9: warning: preprocessor token offsetof redefined
+/usr/lib/gcc/x86_64-linux-gnu/8/include/stddef.h:417:9: warning: preprocessor token offsetof redefined
+/usr/lib/gcc/x86_64-linux-gnu/8/include/stddef.h:417:9: warning: preprocessor token offsetof redefined
+/usr/lib/gcc/x86_64-linux-gnu/8/include/stddef.h:417:9: warning: preprocessor token offsetof redefined
+/usr/lib/gcc/x86_64-linux-gnu/8/include/stddef.h:417:9: warning: preprocessor token offsetof redefined
+/usr/lib/gcc/x86_64-linux-gnu/8/include/stddef.h:417:9: warning: preprocessor token offsetof redefined
+/usr/lib/gcc/x86_64-linux-gnu/8/include/stddef.h:417:9: warning: preprocessor token offsetof redefined
+/usr/lib/gcc/x86_64-linux-gnu/8/include/stddef.h:417:9: warning: preprocessor token offsetof redefined
+/usr/lib/gcc/x86_64-linux-gnu/8/include/stddef.h:417:9: warning: preprocessor token offsetof redefined
+/usr/lib/gcc/x86_64-linux-gnu/8/include/stddef.h:417:9: warning: preprocessor token offsetof redefined
+/usr/lib/gcc/x86_64-linux-gnu/8/include/stddef.h:417:9: warning: preprocessor token offsetof redefined
+/usr/lib/gcc/x86_64-linux-gnu/8/include/stddef.h:417:9: warning: preprocessor token offsetof redefined
+/usr/lib/gcc/x86_64-linux-gnu/8/include/stddef.h:417:9: warning: preprocessor token offsetof redefined
+/usr/lib/gcc/x86_64-linux-gnu/8/include/stddef.h:417:9: warning: preprocessor token offsetof redefined
+/usr/lib/gcc/x86_64-linux-gnu/8/include/stddef.h:417:9: warning: preprocessor token offsetof redefined

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#52 lore raw

[Intel-gfx] ✗ Fi.CI.BAT: failure for Enable GuC based power management features

In reply to Vinay Belgaumkar
== Series Details ==

== Series Details ==

Series: Enable GuC based power management features
URL : https://patchwork.freedesktop.org/series/92391/
State : failure

== Summary ==

CI Bug Log - changes from CI_DRM_10329 -> Patchwork_20567
====================================================

Summary
-------

**FAILURE**

Serious unknown changes coming with Patchwork_20567 absolutely need to be verified manually.

If you think the reported changes have nothing to do with the changes introduced in Patchwork_20567, please notify your bug team to allow them to document this new failure mode, which will reduce false positives in CI.

External URL: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20567/index.html

Possible new issues
-------------------

Here are the unknown changes that may have been introduced in Patchwork_20567:

### IGT changes ###

#### Possible regressions ####

* igt@i915_pm_rps@basic-api:
- fi-kbl-guc: [PASS][1] -> [FAIL][2]
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10329/fi-kbl-guc/igt@[email protected]
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20567/fi-kbl-guc/igt@[email protected]
- fi-cfl-8109u: [PASS][3] -> [FAIL][4]
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10329/fi-cfl-8109u/igt@[email protected]
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20567/fi-cfl-8109u/igt@[email protected]
- fi-bsw-nick: [PASS][5] -> [FAIL][6]
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10329/fi-bsw-nick/igt@[email protected]
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20567/fi-bsw-nick/igt@[email protected]
- fi-kbl-7500u: [PASS][7] -> [FAIL][8]
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10329/fi-kbl-7500u/igt@[email protected]
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20567/fi-kbl-7500u/igt@[email protected]
- fi-kbl-8809g: [PASS][9] -> [FAIL][10]
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10329/fi-kbl-8809g/igt@[email protected]
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20567/fi-kbl-8809g/igt@[email protected]
- fi-kbl-r: [PASS][11] -> [FAIL][12]
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10329/fi-kbl-r/igt@[email protected]
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20567/fi-kbl-r/igt@[email protected]
- fi-bsw-kefka: [PASS][13] -> [FAIL][14]
[13]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10329/fi-bsw-kefka/igt@[email protected]
[14]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20567/fi-bsw-kefka/igt@[email protected]
- fi-glk-dsi: [PASS][15] -> [FAIL][16]
[15]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10329/fi-glk-dsi/igt@[email protected]
[16]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20567/fi-glk-dsi/igt@[email protected]
- fi-kbl-soraka: [PASS][17] -> [FAIL][18]
[17]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10329/fi-kbl-soraka/igt@[email protected]
[18]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20567/fi-kbl-soraka/igt@[email protected]
- fi-kbl-x1275: [PASS][19] -> [FAIL][20]
[19]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10329/fi-kbl-x1275/igt@[email protected]
[20]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20567/fi-kbl-x1275/igt@[email protected]
- fi-cml-s: [PASS][21] -> [FAIL][22]
[21]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10329/fi-cml-s/igt@[email protected]
[22]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20567/fi-cml-s/igt@[email protected]
- fi-tgl-y: [PASS][23] -> [FAIL][24]
[23]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10329/fi-tgl-y/igt@[email protected]
[24]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20567/fi-tgl-y/igt@[email protected]
- fi-cfl-guc: [PASS][25] -> [FAIL][26]
[25]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10329/fi-cfl-guc/igt@[email protected]
[26]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20567/fi-cfl-guc/igt@[email protected]
- fi-ivb-3770: [PASS][27] -> [FAIL][28]
[27]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10329/fi-ivb-3770/igt@[email protected]
[28]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20567/fi-ivb-3770/igt@[email protected]
- fi-cml-u2: [PASS][29] -> [FAIL][30]
[29]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10329/fi-cml-u2/igt@[email protected]
[30]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20567/fi-cml-u2/igt@[email protected]
- fi-skl-6700k2: [PASS][31] -> [FAIL][32]
[31]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10329/fi-skl-6700k2/igt@[email protected]
[32]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20567/fi-skl-6700k2/igt@[email protected]
- fi-bxt-dsi: [PASS][33] -> [FAIL][34]
[33]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10329/fi-bxt-dsi/igt@[email protected]
[34]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20567/fi-bxt-dsi/igt@[email protected]
- fi-cfl-8700k: [PASS][35] -> [FAIL][36]
[35]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10329/fi-cfl-8700k/igt@[email protected]
[36]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20567/fi-cfl-8700k/igt@[email protected]
- fi-hsw-4770: [PASS][37] -> [FAIL][38]
[37]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10329/fi-hsw-4770/igt@[email protected]
[38]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20567/fi-hsw-4770/igt@[email protected]
- fi-snb-2520m: [PASS][39] -> [FAIL][40]
[39]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10329/fi-snb-2520m/igt@[email protected]
[40]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20567/fi-snb-2520m/igt@[email protected]
- fi-kbl-7567u: [PASS][41] -> [FAIL][42]
[41]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10329/fi-kbl-7567u/igt@[email protected]
[42]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20567/fi-kbl-7567u/igt@[email protected]
- fi-bdw-5557u: [PASS][43] -> [FAIL][44]
[43]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10329/fi-bdw-5557u/igt@[email protected]
[44]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20567/fi-bdw-5557u/igt@[email protected]
- fi-skl-6600u: [PASS][45] -> [FAIL][46]
[45]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10329/fi-skl-6600u/igt@[email protected]
[46]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20567/fi-skl-6600u/igt@[email protected]
- fi-skl-guc: [PASS][47] -> [FAIL][48]
[47]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10329/fi-skl-guc/igt@[email protected]
[48]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20567/fi-skl-guc/igt@[email protected]
- fi-icl-y: [PASS][49] -> [FAIL][50]
[49]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10329/fi-icl-y/igt@[email protected]
[50]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20567/fi-icl-y/igt@[email protected]

#### Suppressed ####

The following results come from untrusted machines, tests, or statuses. They do not affect the overall result.

* igt@i915_pm_rps@basic-api:
- {fi-ehl-2}: [PASS][51] -> [FAIL][52]
[51]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10329/fi-ehl-2/igt@[email protected]
[52]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20567/fi-ehl-2/igt@[email protected]
- {fi-jsl-1}: [PASS][53] -> [FAIL][54]
[53]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10329/fi-jsl-1/igt@[email protected]
[54]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20567/fi-jsl-1/igt@[email protected]
- {fi-tgl-dsi}: [PASS][55] -> [FAIL][56]
[55]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10329/fi-tgl-dsi/igt@[email protected]
[56]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20567/fi-tgl-dsi/igt@[email protected]
- {fi-tgl-1115g4}: [PASS][57] -> [FAIL][58]
[57]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10329/fi-tgl-1115g4/igt@[email protected]
[58]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20567/fi-tgl-1115g4/igt@[email protected]
- {fi-hsw-gt1}: [PASS][59] -> [FAIL][60]
[59]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10329/fi-hsw-gt1/igt@[email protected]
[60]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20567/fi-hsw-gt1/igt@[email protected]

Known issues
------------

Here are the changes found in Patchwork_20567 that come from known issues:

### IGT changes ###

#### Possible fixes ####

* igt@kms_chamelium@dp-crc-fast:
- fi-kbl-7500u: [FAIL][61] ([i915#1372]) -> [PASS][62]
[61]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10329/fi-kbl-7500u/igt@[email protected]
[62]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20567/fi-kbl-7500u/igt@[email protected]

{name}: This element is suppressed. This means it is ignored when computing
the status of the difference (SUCCESS, WARNING, or FAILURE).

[i915#1372]: https://gitlab.freedesktop.org/drm/intel/issues/1372
[i915#3717]: https://gitlab.freedesktop.org/drm/intel/issues/3717

Participating hosts (41 -> 39)
------------------------------

Missing (2): fi-bsw-cyan fi-bdw-samus

Build changes
-------------

* Linux: CI_DRM_10329 -> Patchwork_20567

CI-20190529: 20190529
CI_DRM_10329: 2c76b98f510f1e4284285813024bc4cbba6a776e @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_6134: cd63c83e23789eb194d38b8d272247a88122f2f6 @ https://gitlab.freedesktop.org/drm/igt-gpu-tools.git
Patchwork_20567: 8feb96ac300e385894f02a4da095bd03f3e84b7b @ git://anongit.freedesktop.org/gfx-ci/linux

== Linux commits ==

8feb96ac300e drm/i915/guc/rc: Setup and enable GUCRC feature 83e32fc3791c drm/i915/guc/slpc: slpc selftest
7ec83710bc2a drm/i915/guc/slpc: Sysfs hooks for slpc 3d77883e3ca5 drm/i915/guc/slpc: Update slpc to use platform min/max 3d4115c88dc4 drm/i915/guc/slpc: Cache platform frequency limits for slpc de179acc62c1 drm/i915/guc/slpc: Enable ARAT timer interrupt 439492c0d769 drm/i915/guc/slpc: Add debugfs for slpc info 62ae9d2a357a drm/i915/guc/slpc: Add get max/min freq hooks 08a6776bb7fb drm/i915/guc/slpc: Add methods to set min/max frequency 675158b5dd9c drm/i915/guc/slpc: Enable slpc and add related H2G events f3e07ff23e21 drm/i915/guc/slpc: Allocate, initialize and release slpc b076b1d0bbf4 drm/i915/guc/slpc: Adding slpc communication interfaces 980d855c5c5a drm/i915/guc/slpc: Lay out slpc init/enable/disable/fini 2790990fc2e6 drm/i915/guc/slpc: Gate Host RPS when slpc is enabled 25589f2d8bfd drm/i915/guc/slpc: Initial definitions for slpc d9063ce26607 drm/i915/guc: Squashed patch - DO NOT REVIEW

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20567/index.html

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx