Skip to content

[Intel-SIG] [Meteor Lake] Enable DRM feature with Intel MTL platform#65

Merged
matrix-wsk merged 82 commits intodeepin-community:linux-6.6.yfrom
junxiaoc:sandbox/junxiaoc/mtl_drm_0129
Jan 30, 2024
Merged

[Intel-SIG] [Meteor Lake] Enable DRM feature with Intel MTL platform#65
matrix-wsk merged 82 commits intodeepin-community:linux-6.6.yfrom
junxiaoc:sandbox/junxiaoc/mtl_drm_0129

Conversation

@junxiaoc
Copy link
Contributor

@junxiaoc junxiaoc commented Jan 29, 2024

All patches in this PR have been upstreamed. These commits in PR have been tested with Deepin, MTLp hardware and related Linux firmwares. It works as expected.

Summary by Sourcery

Enable and stabilize Meteor Lake (MTL) support in the Intel i915 DRM driver by upstreaming and consolidating MTL‐specific feature enablement, workarounds, and refactorings. Add DSC helper routines, unify IP version checks, introduce GGTT bind contexts, and apply platform workarounds across display, power management, and fbdev subsystems.

New Features:

  • Implement MTL display stream compression PPS write/read helpers to support multiple VDSC units per pipe
  • Add separate GGTT bind context for platforms requiring hardware‐assisted PTE updates
  • Expose a common display workaround hook to apply per‐platform WA sequences

Bug Fixes:

  • Work around ATS/IOMMU issues on MTL by forcing WC mapping for PPGTT page table updates
  • Ensure bind context readiness is toggled during GT suspend/resume to avoid races

Enhancements:

  • Replace ad‐hoc MTL stepping macros with generic IP range/IP step checks
  • Refactor DSC configuration to consolidate PPS register handling into helper functions
  • Unify DDI voltage‐level, chicken‐register, and CDCLK selection across generations
  • Simplify runtime PM and wakeref get/put logic for robust error handling
  • Factor fbdev framebuffer creation into a standalone module

Chores:

  • Add new files for display workarounds and fbdev framebuffer support and update Makefile
  • Remove obsolete MTL subplatform enums and deprecated link_bit_rate fields
  • Clean up stale code paths and redundant platform‐specific conditionals

mattrope and others added 30 commits January 29, 2024 16:57
commit eaeb4b3 ("drm/i915/dg2: Drop pre-production GT workarounds") upstream.

DG2 first production steppings were C0 (for DG2-G10), B1 (for DG2-G11),
and A1 (for DG2-G12).  Several workarounds that apply onto to
pre-production hardware can be dropped.  Furthermore, several
workarounds that apply to all production steppings can have their
conditions simplified to no longer check the GT stepping.

v2:
 - Keep Wa_16011777198 in place for now; it will be removed separately
   in a follow-up patch to keep review easier.

deepin-Intel-SIG: commit eaeb4b3 ("drm/i915/dg2: Drop pre-production GT workarounds").

Bspec: 44477
Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
Acked-by: Jani Nikula <jani.nikula@intel.com>
Reviewed-by: Matt Atwood <matthew.s.atwood@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230816214201.534095-10-matthew.d.roper@intel.com
[ Junxiao Chang: amend commit log ]
Signed-off-by: Junxiao Chang <junxiao.chang@intel.com>
commit c951778 ("drm/i915/dg2: Drop Wa_16011777198") upstream.

Wa_16011777198 only applies to pre-production steppings of DG2, which
we're no longer supporting.  Remove the workaround and override_gucrc
handling, which is no longer needed.  Since this was the final use of
IS_DG2_GRAPHICS_STEP, that macro can also be removed now.

v2:
 - Include the promised removal of override_gucrc handling.

deepin-Intel-SIG: commit c951778 ("drm/i915/dg2: Drop Wa_16011777198").

Cc: Ashutosh Dixit <ashutosh.dixit@intel.com>
Cc: Vinay Belgaumkar <vinay.belgaumkar@intel.com>
Cc: Umesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com>
Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
Reviewed-by: Ashutosh Dixit <ashutosh.dixit@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230816214824.548575-2-matthew.d.roper@intel.com
[ Junxiao Chang: amend commit log ]
Signed-off-by: Junxiao Chang <junxiao.chang@intel.com>
commit f1c8057 ("drm/i915: Tidy workaround definitions") upstream.

Removal of the DG2 pre-production workarounds has left duplicate
condition blocks in a couple places, as well as some inconsistent
platform ordering.  Reshuffle and consolidate some of the workarounds to
reduce the number of condition blocks and to more consistently follow
the "newest platform first" convention.  Code movement only; no
functional change.

deepin-Intel-SIG: commit f1c8057 ("drm/i915: Tidy workaround definitions").

Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
Acked-by: Jani Nikula <jani.nikula@intel.com>
Reviewed-by: Matt Atwood <matthew.s.atwood@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230816214201.534095-11-matthew.d.roper@intel.com
[ Junxiao Chang: amend commit log ]
Signed-off-by: Junxiao Chang <junxiao.chang@intel.com>
commit 28c46fe ("drm/i915: Consolidate condition for Wa_22011802037") upstream.

The workaround bounds for Wa_22011802037 are somewhat complex and are
replicated in several places throughout the code.  Pull the condition
out to a helper function to prevent mistakes if this condition needs to
change again in the future.

deepin-Intel-SIG: commit 28c46fe ("drm/i915: Consolidate condition for Wa_22011802037").

Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
Reviewed-by: Gustavo Sousa <gustavo.sousa@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230821180619.650007-12-matthew.d.roper@intel.com
[ Junxiao Chang: amend commit log ]
Signed-off-by: Junxiao Chang <junxiao.chang@intel.com>
commit ea2f155 ("drm/i915/xelpmp: Don't assume workarounds extend to future platforms") upstream.

The currently implemented Xe_LPM+ workarounds are specific to media
version 13.00.  When new IP versions show up in the future, they'll need
their own workaround lists.

deepin-Intel-SIG: commit ea2f155 ("drm/i915/xelpmp: Don't assume workarounds extend to future platforms").

Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
Reviewed-by: Andi Shyti <andi.shyti@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230821180619.650007-13-matthew.d.roper@intel.com
[ Junxiao Chang: amend commit log ]
Signed-off-by: Junxiao Chang <junxiao.chang@intel.com>
commit f7696de ("drm/i915/xelpg: Call Xe_LPG workaround functions based on IP version") upstream.

Although some of our Xe_LPG workarounds were already being applied based
on IP version correctly, others were matching on MTL as a base platform,
which is incorrect.  Although MTL is the only platform right now that
uses Xe_LPG IP, this may not always be the case.  If a future platform
re-uses this graphics IP, the same workarounds should be applied, even
if it isn't a "MTL" platform.

We were also incorrectly applying Xe_LPG workarounds/tuning to the
Xe_LPM+ media IP in one or two places; we should make sure that we don't
try to apply graphics workarounds to the media GT and vice versa where
they don't belong.  A new helper macro IS_GT_IP_RANGE() is added to help
ensure this is handled properly -- it checks that the GT matches the IP
type being tested as well as the IP version falling in the proper range.

Note that many of the stepping-based workarounds are still incorrectly
checking for a MTL base platform; that will be remedied in a later
patch.

v2:
 - Rework macro into a slightly more generic IS_GT_IP_RANGE() that can
   be used for either GFX or MEDIA checks.

v3:
 - Switch back to separate macros for gfx and media.  (Jani)
 - Move macro to intel_gt.h.  (Andi)

deepin-Intel-SIG: commit f7696de ("drm/i915/xelpg: Call Xe_LPG workaround functions based on IP version").

Cc: Gustavo Sousa <gustavo.sousa@intel.com>
Cc: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
Cc: Jani Nikula <jani.nikula@linux.intel.com>
Cc: Andi Shyti <andi.shyti@linux.intel.com>
Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
Reviewed-by: Andi Shyti <andi.shyti@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230821180619.650007-14-matthew.d.roper@intel.com
[ Junxiao Chang: amend commit log ]
Signed-off-by: Junxiao Chang <junxiao.chang@intel.com>
commit 5a21308 ("drm/i915: Eliminate IS_MTL_GRAPHICS_STEP") upstream.

Several workarounds are guarded by IS_MTL_GRAPHICS_STEP.  However none
of these workarounds are actually tied to MTL as a platform; they only
relate to the Xe_LPG graphics IP, regardless of what platform it appears
in.  At the moment MTL is the only platform that uses Xe_LPG with IP
versions 12.70 and 12.71, but we can't count on this being true in the
future.  Switch these to use a new IS_GFX_GT_IP_STEP() macro instead
that is purely based on IP version.  IS_GFX_GT_IP_STEP() is also
GT-based rather than device-based, which will help prevent mistakes
where we accidentally try to apply Xe_LPG graphics workarounds to the
Xe_LPM+ media GT and vice-versa.

v2:
 - Switch to a more generic and shorter IS_GT_IP_STEP macro that can be
   used for both graphics and media IP (and any other kind of GTs that
   show up in the future).
v3:
 - Switch back to long-form IS_GFX_GT_IP_STEP macro.  (Jani)
 - Move macro to intel_gt.h.  (Andi)
v4:
 - Build IS_GFX_GT_IP_STEP on top of IS_GFX_GT_IP_RANGE and
   IS_GRAPHICS_STEP building blocks and name the parameters from/until
   rather than begin/fixed.  (Jani)
 - Fix usage examples in comment.
v5:
 - Tweak comment on macro.  (Gustavo)

deepin-Intel-SIG: commit 5a21308 ("drm/i915: Eliminate IS_MTL_GRAPHICS_STEP").

Cc: Gustavo Sousa <gustavo.sousa@intel.com>
Cc: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
Cc: Andi Shyti <andi.shyti@linux.intel.com>
Cc: Jani Nikula <jani.nikula@linux.intel.com>
Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
Reviewed-by: Gustavo Sousa <gustavo.sousa@intel.com>
Reviewed-by: Andi Shyti <andi.shyti@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230821180619.650007-15-matthew.d.roper@intel.com
[ Junxiao Chang: amend commit log ]
Signed-off-by: Junxiao Chang <junxiao.chang@intel.com>
commit 81af8ab ("drm/i915: Eliminate IS_MTL_MEDIA_STEP") upstream.

Stepping-specific media behavior shouldn't be tied to MTL as a platform,
but rather specifically to the Xe_LPM+ IP.  Future non-MTL platforms may
re-use this IP and will need to follow the exact same logic and apply
the same workarounds.  IS_MTL_MEDIA_STEP() is dropped in favor of
IS_MEDIA_GT_IP_STEP, which checks the media IP version associated with a
specific IP and also ensures that we're operating on the media GT, not
the primary GT.

v2:
 - Switch to the IS_GT_IP_STEP macro.
v3:
 - Switch back to long-form IS_MEDIA_GT_IP_STEP.  (Jani)
v4:
 - Build IS_MEDIA_GT_IP_STEP on top of IS_MEDIA_GT_IP_RANGE and
   IS_MEDIA_STEP building blocks and name the parameters from/until
   rather than begin/fixed..  (Jani)
v5:
 - Tweak macro comment wording.  (Gustavo)
 - Add a check to catch NULL gt in IS_MEDIA_GT_IP_RANGE; this allows it
   to be used safely on i915->media_gt, which may be NULL on some
   platforms.  (Gustavo)

deepin-Intel-SIG: commit 81af8ab ("drm/i915: Eliminate IS_MTL_MEDIA_STEP").

Cc: Jani Nikula <jani.nikula@linux.intel.com>
Cc: Gustavo Sousa <gustavo.sousa@intel.com>
Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
Reviewed-by: Gustavo Sousa <gustavo.sousa@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230821180619.650007-16-matthew.d.roper@intel.com
[ Junxiao Chang: amend commit log ]
Signed-off-by: Junxiao Chang <junxiao.chang@intel.com>
commit 213454b ("drm/i915: Eliminate IS_MTL_DISPLAY_STEP") upstream.

Stepping-specific display behavior shouldn't be tied to MTL as a
platform, but rather specifically to the Xe_LPD+ IP.  Future non-MTL
platforms may re-use this IP and will need to follow the exact same
logic and apply the same workarounds.  IS_MTL_DISPLAY_STEP() is dropped
in favor of a new macro IS_DISPLAY_IP_STEP() that only checks the
display IP version.

v2:
 - Rename macro to IS_DISPLAY_IP_STEP for consistency with the
   corresponding GT macro and handle steppings the same way.
v3:
 - Drop the automatic "STEP_" pasting.
v4:
 - Implement IS_DISPLAY_IP_STEP on top of IS_DISPLAY_IP_RANGE /
   IS_DISPLAY_STEP building blocks and make the parameters from/until
   instead of begin/fixed.  (Jani)
 - Fix usage details in comment.
v5:
 - Tweak macro comment.  (Gustavo)

deepin-Intel-SIG: commit 213454b ("drm/i915: Eliminate IS_MTL_DISPLAY_STEP").

Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
Reviewed-by: Gustavo Sousa <gustavo.sousa@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230821180619.650007-17-matthew.d.roper@intel.com
[ Junxiao Chang: amend commit log ]
Signed-off-by: Junxiao Chang <junxiao.chang@intel.com>
commit 2e3c369 ("drm/i915/mtl: Eliminate subplatforms") upstream.

Now that we properly match the Xe_LPG IP versions associated with
various workarounds, there's no longer any need to define separate MTL
subplatform in the driver.  Nothing in the code is conditional on MTL-M
or MTL-P base platforms.  Furthermore, I'm not sure the "M" and "P"
designations are even an accurate representation of which specific
platforms would have which IP versions; those were mostly just
placeholders from a long time ago.  The reality is that the IP version
present on a platform gets read from a fuse register at driver init; we
shouldn't be trying to guess which IP is present based on PCI ID
anymore.

deepin-Intel-SIG: commit 2e3c369 ("drm/i915/mtl: Eliminate subplatforms").

Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
Reviewed-by: Nemesa Garg <nemesa.garg@intel.com>
Reviewed-by: Gustavo Sousa <gustavo.sousa@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230821180619.650007-18-matthew.d.roper@intel.com
[ Junxiao Chang: amend commit log ]
Signed-off-by: Junxiao Chang <junxiao.chang@intel.com>
commit e388ae9 ("drm/i915/display: Eliminate IS_METEORLAKE checks") upstream.

Most of the IS_METEORLAKE checks in the display code shouldn't actually
be tied to MTL as a platform, but rather to the Xe_LPD+ display IP
(which is used in MTL, but may show up again in future platforms).  In
cases where we're trying to match that specific IP, use a version check
against IP_VER(14, 0).  For cases where we're just handling new behavior
introduced by this IP (but which may also be inherited by future IP as
well), use a ver >= 14 check.

The one exception here is the stolen memory workaround Wa_13010847436
(which is mislabelled as "Wa_22018444074" in the code).  That's truly a
MTL-specific issue rather than being tied to any of the IP blocks, so
leaving the condition as IS_METEORLAKE is correct there.

v2:
 - cdclk check should be >=, not >.  (Gustavo)

deepin-Intel-SIG: commit e388ae9 ("drm/i915/display: Eliminate IS_METEORLAKE checks").

Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
Reviewed-by: Gustavo Sousa <gustavo.sousa@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230821180619.650007-19-matthew.d.roper@intel.com
[ Junxiao Chang: amend commit log ]
Signed-off-by: Junxiao Chang <junxiao.chang@intel.com>
commit 14128d6 ("drm/i915: Replace several IS_METEORLAKE with proper IP version checks") upstream.

Many of the IS_METEORLAKE conditions throughout the driver are supposed
to be checks for Xe_LPG and/or Xe_LPM+ IP, not for the MTL platform
specifically.  Update those checks to ensure that the code will still
operate properly if/when these IP versions show up on future platforms.

v2:
 - Update two more conditions (one for pg_enable, one for MTL HuC
   compatibility).
v3:
 - Don't change GuC/HuC compatibility check, which sounds like it truly
   is specific to the MTL platform.  (Gustavo)
 - Drop a non-lineage workaround number for the OA timestamp frequency
   workaround.  (Gustavo)

deepin-Intel-SIG: commit 14128d6 ("drm/i915: Replace several IS_METEORLAKE with proper IP version checks").

Cc: Gustavo Sousa <gustavo.sousa@intel.com>
Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
Reviewed-by: Gustavo Sousa <gustavo.sousa@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230821180619.650007-20-matthew.d.roper@intel.com
[ Junxiao Chang: amend commit log ]
Signed-off-by: Junxiao Chang <junxiao.chang@intel.com>
commit ac765b7 ("drm/i915/pxp/mtl: intel_pxp_init_hw needs runtime-pm inside pm-complete") upstream.

In the case of failed suspend flow or cases where the kernel does not go
into full suspend but goes from suspend_prepare back to resume_complete,
we get called for a pm_complete but without runtime_pm guaranteed.

Thus, ensure we take the runtime_pm when calling intel_pxp_init_hw
from within intel_pxp_resume_complete.

v2: resume_complete and runtime_resume should abstract a common
    helper with different wakeref requirements. (Daniele)

deepin-Intel-SIG: commit ac765b7 ("drm/i915/pxp/mtl: intel_pxp_init_hw needs runtime-pm inside pm-complete").

Signed-off-by: Alan Previn <alan.previn.teres.alexis@intel.com>
Reviewed-by: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
Signed-off-by: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230802190611.1639371-1-alan.previn.teres.alexis@intel.com
[ Junxiao Chang: amend commit log ]
Signed-off-by: Junxiao Chang <junxiao.chang@intel.com>
commit 76342fc ("drm/i915/vdsc: Refactor dsc register field macro") upstream.

This patch refactors dsc register related macros that prepares
the values to be written in the register. The current bit shifting
looks bad and going forward will not serve our purpose to readout
dsc register field values the change was suggested by Jani Nikula.

deepin-Intel-SIG: commit 76342fc ("drm/i915/vdsc: Refactor dsc register field macro").

Cc: Jani Nikula <jani.nikula@linux.intel.com>
Signed-off-by: Suraj Kandpal <suraj.kandpal@intel.com>
Reviewed-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
Signed-off-by: Animesh Manna <animesh.manna@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230828054300.560559-2-suraj.kandpal@intel.com
[ Junxiao Chang: amend commit log ]
Signed-off-by: Junxiao Chang <junxiao.chang@intel.com>
commit 611977c ("drm/i915/vdsc: Add a check for dsc split cases") upstream.

In intel_vdsc_get_config we only read the primary dsc engine register
and not take into account if the other dsc engine is in use and if
both registers have the same value or not this patche fixes that by
adding a check.

--v3
-Remove superfluos new line [Jani]
-Fix register naming [Jani]

--v5
-pps_temp0/pps_temp1 can be assigned where they are used [Ankit]

deepin-Intel-SIG: commit 611977c ("drm/i915/vdsc: Add a check for dsc split cases").

Signed-off-by: Suraj Kandpal <suraj.kandpal@intel.com>
Reviewed-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
Signed-off-by: Animesh Manna <animesh.manna@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230828054300.560559-3-suraj.kandpal@intel.com
[ Junxiao Chang: amend commit log ]
Signed-off-by: Junxiao Chang <junxiao.chang@intel.com>
commit d03b64c ("drm/i915/vdsc: Add func to get no. of vdsc instances per pipe") upstream.

We have a function that gets us the total of the vdsc engines being
used but not the no. of vdsc instances being used by each pipe.

--v6
-Change function to static

--v7
-Shorten name to intel_dsc_get_vdsc_per_pipe

deepin-Intel-SIG: commit d03b64c ("drm/i915/vdsc: Add func to get no. of vdsc instances per pipe").

Signed-off-by: Suraj Kandpal <suraj.kandpal@intel.com>
Reviewed-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
Signed-off-by: Animesh Manna <animesh.manna@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230828054300.560559-4-suraj.kandpal@intel.com
[ Junxiao Chang: amend commit log ]
Signed-off-by: Junxiao Chang <junxiao.chang@intel.com>
commit bd07725 ("drm/i915/vdsc: Add function to read any PPS register") upstream.

Add function to read any PPS register based on the
intel_dsc_pps enum provided. Add a function which will call the
new pps read function and place it in crtc state. Only PPS0 and
PPS1 are readout the rest of the registers will be read in upcoming
patches.

--v2
-Changes in read function as PPS enum is removed
-Initialize pps_val as 0 in pps_read func itself [Jani]
-Create a function that gets the required register and call that
in the common read function [Jani]
-Move the drm_WARN_ON one abstraction layer above [Jani]

--v3
-Send both reg values regardless of dsc engine no [Jani]
-Don't use num_vdsc_instances stick to dsc_split field [Ankit]

--v4
-Manipulate the reg values instead of creating MACRO to change
name of pps [Ankit]

--v5
-Read dsc reg values using array rather than individual variables
[Ankit]
-Loop the verification of all dsc engine reads to future proof it
[Ankit]
-Keep the fix me comment in this patch and remove it in later one
where we add other readouts [Ankit]
-Add switch statement that fills in the required registers based on
no of vdsc engines per pipe.

--v7
-Pass no of vdsc instances from read_reg function [Ankit]
-Fix issue where arrays do not get freed on return for read_and_verify
func [Ankit]

--v8
-Simplify reading and verifying of register and remove dynamically
allocated arrays [Jani]
-Remove no_ from no_vdsc_per_pipe and wherever else it applies [Ankit]

--v9
-change variable name to dsc_reg_size rather than vdsc_per_pipe [Ankit]

--v10
-remove switch case as we never enter case1 [Ankit]

--v11
-Add _ prefix for register that are not supposed to be used directly
[Jani]
-Remove REG suffix from register macros [Jani]
-Do not duplicate register read [Jani]

--v12
-Use vdsc_per_pipe rather than array size of dsc_reg [Jani]

deepin-Intel-SIG: commit bd07725 ("drm/i915/vdsc: Add function to read any PPS register").

Signed-off-by: Suraj Kandpal <suraj.kandpal@intel.com>
Reviewed-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
Signed-off-by: Animesh Manna <animesh.manna@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230828054300.560559-5-suraj.kandpal@intel.com
[ Junxiao Chang: amend commit log ]
Signed-off-by: Junxiao Chang <junxiao.chang@intel.com>
commit 265bb1c ("drm/i915/vdsc: Add function to write in PPS register") upstream.

Now that we have a function that reads any PPS register based
on intel_dsc_pps enum provided lets create a function that can
write on any PPS.

--v2
-Changes need as PPS enum was dropped
-Remove duplicated code in intel_dsc_write_pps_reg [Jani]

--v3
-Use dsc_split instead of num_vdsc_instances [Ankit]

--v5
-Changes to implement the new dsc_reg array variable passing
[Ankit]

--v7
-Pass no of vdsc instances to get_pps_reg [Ankit]

--v8
-No need for dsc_reg dynamic allocation [Jani]
-Change function to void as no return needs to be sent back

--v9
-Send ARRAY_SIZE(dsc_reg) instead of vdsc_per_pipe [Ankit]

deepin-Intel-SIG: commit 265bb1c ("drm/i915/vdsc: Add function to write in PPS register").

Signed-off-by: Suraj Kandpal <suraj.kandpal@intel.com>
Reviewed-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
Signed-off-by: Animesh Manna <animesh.manna@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230828054300.560559-6-suraj.kandpal@intel.com
[ Junxiao Chang: amend commit log ]
Signed-off-by: Junxiao Chang <junxiao.chang@intel.com>
commit 961e11a ("drm/i915/vdsc: Remove unused dsc registers") upstream.

Now that we have macros that can fetch dsc register values based
on pipe and pps parameters we can go ahead and remove all the
unused register.

deepin-Intel-SIG: commit 961e11a ("drm/i915/vdsc: Remove unused dsc registers").

Signed-off-by: Suraj Kandpal <suraj.kandpal@intel.com>
Reviewed-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
Signed-off-by: Animesh Manna <animesh.manna@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230828054300.560559-7-suraj.kandpal@intel.com
[ Junxiao Chang: amend commit log ]
Signed-off-by: Junxiao Chang <junxiao.chang@intel.com>
commit 8b70b56 ("drm/i915/vdsc: Fill the intel_dsc_get_pps_config function") upstream.

We have setup both the read and write functions so we can
move ahead and fill in all the readout state from PPS register
into the crtc_state so we can send it for comparision.

--v2
-Shorten comment to just PPSX rather than having the whole
"Readout PPSX register" [Jani]
-Remove pps_temp reinitialization as its being initialized in
the read function [Jani]
-Use REG_FIELD_GET to readout certain fields of dsc registers
[Jani]

--v9
-Place the masks at a more appropriate place [Ankit]

deepin-Intel-SIG: commit 8b70b56 ("drm/i915/vdsc: Fill the intel_dsc_get_pps_config function").

Signed-off-by: Suraj Kandpal <suraj.kandpal@intel.com>
Reviewed-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
Signed-off-by: Animesh Manna <animesh.manna@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230828054300.560559-8-suraj.kandpal@intel.com
[ Junxiao Chang: amend commit log ]
Signed-off-by: Junxiao Chang <junxiao.chang@intel.com>
commit fe21299 ("drm/i915/display: Compare the readout dsc pps params") upstream.

With the dsc config being readout and filled in crtc_state add
macros and use them to compare current and previous PPS param in
DSC.

--v2
-Remove version check [Jani]
-Remove dupe macro for dsc pipe compare and use the existing ones
[Jani]

deepin-Intel-SIG: commit fe21299 ("drm/i915/display: Compare the readout dsc pps params").

Signed-off-by: Suraj Kandpal <suraj.kandpal@intel.com>
Reviewed-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
Signed-off-by: Animesh Manna <animesh.manna@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230828054300.560559-9-suraj.kandpal@intel.com
[ Junxiao Chang: amend commit log ]
Signed-off-by: Junxiao Chang <junxiao.chang@intel.com>
commit 7467e1d ("drm/i915/mtl: Update workaround 14016712196") upstream.

Now this workaround is permanent workaround on MTL and DG2,
earlier we used to apply on MTL A0 step only.
VLK-45480

deepin-Intel-SIG: commit 7467e1d ("drm/i915/mtl: Update workaround 14016712196").

Fixes: d922b80 ("drm/i915/gt: Add workaround 14016712196")
Signed-off-by: Tejas Upadhyay <tejas.upadhyay@intel.com>
Acked-by: Nirmoy Das <nirmoy.das@intel.com>
Reviewed-by: Andi Shyti <andi.shyti@linux.intel.com>
Signed-off-by: Andi Shyti <andi.shyti@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230828063450.2642748-1-tejas.upadhyay@intel.com
[ Junxiao Chang: amend commit log ]
Signed-off-by: Junxiao Chang <junxiao.chang@intel.com>
commit 7ce8ac4 ("drm/i915/mtl: Add TC port lockdep assert to AUX power well enabling") upstream.

Similarly to earlier platforms, assert in the MTL AUX power well
enabling handler for TC AUX CH power wells that the TC port using the
AUX CH is locked.

deepin-Intel-SIG: commit 7ce8ac4 ("drm/i915/mtl: Add TC port lockdep assert to AUX power well enabling").

Signed-off-by: Imre Deak <imre.deak@intel.com>
Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230830140421.2031111-2-imre.deak@intel.com
[ Junxiao Chang: amend commit log ]
Signed-off-by: Junxiao Chang <junxiao.chang@intel.com>
commit 98090e0 ("drm/i915/tc: rename mtl_tc_port_get_pin_assignment_mask()") upstream.

This function doesn't really return the pin assignment mask, but the
max lane count derived from that.  So rename the function to
mtl_tc_port_get_max_lane_count() to better reflect what it really does.

deepin-Intel-SIG: commit 98090e0 ("drm/i915/tc: rename mtl_tc_port_get_pin_assignment_mask()").

Reviewed-by: Lucas De Marchi <lucas.demarchi@intel.com>
Reviewed-by: Suraj Kandpal <suraj.kandpal@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230825081638.275795-2-luciano.coelho@intel.com
[ Junxiao Chang: amend commit log ]
Signed-off-by: Junxiao Chang <junxiao.chang@intel.com>
commit 6a96c1c ("drm/i915/tc: move legacy code out of the main _max_lane_count() func") upstream.

This makes the code a bit more symmetric and readable, especially when
we start adding more display version-specific alternatives.

deepin-Intel-SIG: commit 6a96c1c ("drm/i915/tc: move legacy code out of the main _max_lane_count() func").

Reviewed-by: Suraj Kandpal <suraj.kandpal@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230825081638.275795-4-luciano.coelho@intel.com
[ Junxiao Chang: amend commit log ]
Signed-off-by: Junxiao Chang <junxiao.chang@intel.com>
commit 7ed888f ("drm/i915: Stop forcing clock gating init for future platforms") upstream.

In the early days of i915, pretty much every platform needed to
initialize _something_ in the clock gating init functions.  In some
cases the items initialized were inside the GT (and really should have
been initialized through the GT workaround infrastructure instead).
In other cases they were display programming (sometimes not even related
to "clock gating" at all!) which probably needs to move inside the
display-specific code.  The number of initialization tasks that are
truly "clock gating" and don't fall within the GT or display domains is
relatively limited.  Let's stop forcing future platforms to always
define a clock gating init hook.

deepin-Intel-SIG: commit 7ed888f ("drm/i915: Stop forcing clock gating init for future platforms").

Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
Reviewed-by: Lucas De Marchi <lucas.demarchi@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230906234732.3728630-7-matthew.d.roper@intel.com
[ Junxiao Chang: amend commit log ]
Signed-off-by: Junxiao Chang <junxiao.chang@intel.com>
commit 3d0a168 ("drm/i915/adlp: Stop calling gen12lp_init_clock_gating()") upstream.

The only programming that happens in gen12lp_init_clock_gating is for
display workarounds that are specific to display version 12 and are not
relevant to ADL-P's display version 13.

deepin-Intel-SIG: commit 3d0a168 ("drm/i915/adlp: Stop calling gen12lp_init_clock_gating()").

Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
Reviewed-by: Lucas De Marchi <lucas.demarchi@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230906234732.3728630-8-matthew.d.roper@intel.com
[ Junxiao Chang: amend commit log ]
Signed-off-by: Junxiao Chang <junxiao.chang@intel.com>
commit 53dd7b1 ("drm/i915/display: Extract display workarounds from clock gating init") upstream.

Several of the register updates that are currently done in the clock
gating init functions are actually display workarounds that should move
into the display-specific part of the code.  Furthermore, some of the
registers being programmed don't even have anything to do with clock
gating at all.

Extract the display workarounds for gen11 and later platforms to a
dedicated display/intel_display_wa.c file to keep these separate from
the SOC / sgunit clock gating that we need on some platforms.  The gen11
cutoff here is selected somewhat arbitrarily; this is the point where
workarounds were first assigned dedicated lineage numbers that can be
easily looked up and confirmed in the modern workaround database.  It
also avoids any confusion on older platforms where the exact boundaries
between display/GT/other IP blocks wasn't as well-defined as it is
today.

deepin-Intel-SIG: commit 53dd7b1 ("drm/i915/display: Extract display workarounds from clock gating init").

Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
Reviewed-by: Lucas De Marchi <lucas.demarchi@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230907001009.3732474-2-matthew.d.roper@intel.com
[ Junxiao Chang: amend commit log ]
Signed-off-by: Junxiao Chang <junxiao.chang@intel.com>
commit da1bc5c ("drm/i915/display: Apply workarounds during display init") upstream.

Rather than applying display workarounds as part of
intel_clock_gating_init() (which in turn is confusingly called from
i915_gem_init during device probe), handle them at the point we're
actually initializing the display hardware.  This will also ensure that
these workarounds are properly applied during display initialization on
the Xe driver, which re-uses i915's display code, but does not call
i915's gem init.

deepin-Intel-SIG: commit da1bc5c ("drm/i915/display: Apply workarounds during display init").

Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
Reviewed-by: Lucas De Marchi <lucas.demarchi@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230906234732.3728630-10-matthew.d.roper@intel.com
[ Junxiao Chang: amend commit log ]
Signed-off-by: Junxiao Chang <junxiao.chang@intel.com>
commit 8940da9 ("drm/i915/mtl: Adding DeviceID for Arrowlake-S under MTL") upstream.

Arrowlake-S graphics is similar enough to Meteorlake
that we can treat them as the same platform

deepin-Intel-SIG: commit 8940da9 ("drm/i915/mtl: Adding DeviceID for Arrowlake-S under MTL").

Signed-off-by: Nemesa Garg <nemesa.garg@intel.com>
Reviewed-by: Matt Roper <matthew.d.roper@intel.com>
Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230822172743.2113377-1-nemesa.garg@intel.com
[ Junxiao Chang: amend commit log ]
Signed-off-by: Junxiao Chang <junxiao.chang@intel.com>
vsyrjala and others added 14 commits January 29, 2024 16:58
commit cf6e116 ("drm/i915/dsi: Remove dead GLK checks") upstream.

GLK has its own glk_dsi_clear_device_ready() so remove
the dead GLK checks from vlv_dsi_clear_device_ready().
Sadly BXT still uses vlv_dsi_clear_device_ready() so the
code still looks like a mess due to the difference in VLV/CHV
vs. BXT port A/C shenanigans.

deepin-Intel-SIG: commit cf6e116 ("drm/i915/dsi: Remove dead GLK checks").

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20231101114212.9345-5-ville.syrjala@linux.intel.com
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
[ Junxiao Chang: amend commit log ]
Signed-off-by: Junxiao Chang <junxiao.chang@intel.com>
commit bda4a7a ("drm/i915/dsi: Extract port_ctrl_reg()") upstream.

The code to determine the pre-ICL DSI port control register is
repeated several times. Consolidate.

vlv_dsi_clear_device_ready() is left with the open-coded version
due to the weirdness with port A vs. C on VLV/CHV.

deepin-Intel-SIG: commit bda4a7a ("drm/i915/dsi: Extract port_ctrl_reg()").

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20231101114212.9345-6-ville.syrjala@linux.intel.com
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
[ Junxiao Chang: amend commit log ]
Signed-off-by: Junxiao Chang <junxiao.chang@intel.com>
commit 949113d ("drm/i915/mtl: Apply notify_guc to all GTs") upstream.

Handle platforms with multiple GTs by iterate over all GTs.
Add a Fixes commit so this gets propagated for MTL support.

deepin-Intel-SIG: commit 949113d ("drm/i915/mtl: Apply notify_guc to all GTs").

Fixes: 213c436 ("drm/i915/mtl: Remove the 'force_probe' requirement for Meteor Lake")
Suggested-by: John Harrison <john.c.harrison@intel.com>
Cc: Jani Nikula <jani.nikula@linux.intel.com>
Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
Cc: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
Cc: Andi Shyti <andi.shyti@linux.intel.com>
Cc: Andrzej Hajda <andrzej.hajda@intel.com>
Signed-off-by: Nirmoy Das <nirmoy.das@intel.com>
Reviewed-by: Andi Shyti <andi.shyti@linux.intel.com>
Reviewed-by: Andrzej Hajda <andrzej.hajda@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20231025102826.16955-1-nirmoy.das@intel.com
(cherry picked from commit 949113d)
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
[ Junxiao Chang: amend commit log ]
Signed-off-by: Junxiao Chang <junxiao.chang@intel.com>
commit 34df0a0 ("drm/i915/gt: Temporarily disable CPU caching into DMA for MTL") upstream.

FIXME: It is suspected that some Address Translation Service (ATS)
issue on IOMMU is causing CAT errors to occur on some MTL workloads.
Applying a write barrier to the ppgtt set entry functions appeared
to have no effect, so we must temporarily use I915_MAP_WC in the
map_pt_dma class of functions on MTL until a proper ATS solution is
found.

deepin-Intel-SIG: commit 34df0a0 ("drm/i915/gt: Temporarily disable CPU caching into DMA for MTL").

Signed-off-by: Jonathan Cavitt <jonathan.cavitt@intel.com>
CC: Chris Wilson <chris.p.wilson@linux.intel.com>
Reviewed-by: Radhakrishna Sripada <radhakrishna.sripada@intel.com>
Acked-by: Andi Shyti <andi.shyti@linux.intel.com>
Signed-off-by: Andi Shyti <andi.shyti@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20231102175831.872763-1-jonathan.cavitt@intel.com
[ Junxiao Chang: amend commit log ]
Signed-off-by: Junxiao Chang <junxiao.chang@intel.com>
commit deac453 ("drm/i915: Fix glk+ degamma LUT conversions") upstream.

The current implementation of change_lut_val_precision() is just
a convoluted way of shifting by 8. Implement the proper rounding
by just using drm_color_lut_extract() and intel_color_lut_pack()
like everyone else does.

And as the uapi can't handle >=1.0 values but the hardware
can we need to clamp the results appropriately in the readout
path.

deepin-Intel-SIG: commit deac453 ("drm/i915: Fix glk+ degamma LUT conversions").

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20231013131402.24072-5-ville.syrjala@linux.intel.com
Reviewed-by: Chaitanya Kumar Borah <chaitanya.kumar.borah@intel.com>
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
[ Junxiao Chang: amend commit log ]
Signed-off-by: Junxiao Chang <junxiao.chang@intel.com>
commit 80d20fd ("drm/i915/display: split i915 specific code from intel_fbdev") upstream.

Split out code from intel_fbdev that can not be share between i915 and
xe. Create new i915 specific source/header file intel_fbdev_fb.[ch] which
contains this code.

deepin-Intel-SIG: commit 80d20fd ("drm/i915/display: split i915 specific code from intel_fbdev").

Signed-off-by: Jouni Högander <jouni.hogander@intel.com>
Reviewed-by: Vinod Govindapillai <vinod.govindapillai@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20231115090719.3210079-2-jouni.hogander@intel.com
[ Junxiao Chang: amend commit log ]
Signed-off-by: Junxiao Chang <junxiao.chang@intel.com>
commit d3715a6 ("drm/i915/huc: Stop printing about unsupported HuC on MTL") upstream.

On MTL, the HuC is only supported on the media GT, so our validation
check on the module parameter detects an inconsistency on the root GT
(the modparams asks to enable HuC, but the support is not there) and
prints the following info message:

[drm] GT0: Incompatible option enable_guc=3 - HuC is not supported!

This can be confusing to the user and make them think that something is
wrong when it isn't, so we need to silence it.
Given that any platform that supports HuC also supports GuC, if a user
tries to enable HuC on a platform that really doesn't support it they'll
already see a message about GuC not being supported, so instead of just
silencing the HuC message on newer platforms we can just get rid of it
entirely.

deepin-Intel-SIG: commit d3715a6 ("drm/i915/huc: Stop printing about unsupported HuC on MTL").

Signed-off-by: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
Cc: John Harrison <john.c.harrison@intel.com>
Reviewed-by: John Harrison <John.C.Harrison@Intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20231109235436.2349963-1-daniele.ceraolospurio@intel.com
[ Junxiao Chang: amend commit log ]
Signed-off-by: Junxiao Chang <junxiao.chang@intel.com>
commit 877fd09 ("drm/i915/mtl: Use port clock compatible numbers for C20 phy") upstream.

In C20 pll_state link_bit_rate and clock fields are bit redundant. Since
many of the helpers assume the clock values, which are different from
link_bit_rate for dp2.0, convert the helpers to use the numbers that
are compatible with link_bit_rate.

Currently link_bit_rate is compatible with crtc_state->port_clock. The
function intel_c20pll_calc_port_clock returns the number which is
compatible with crtc_state->port_clock. In order to avoid extra
conversions b/ween clock and link_bit_rate, remove "clock" field from the
C20 pll_state and then rename "link_bit_rate" as "clock".

While at it rely on crtc_state->port_clock during C20 Pll programming.

deepin-Intel-SIG: commit 877fd09 ("drm/i915/mtl: Use port clock compatible numbers for C20 phy").

Cc: Clint Taylor <clinton.a.taylor@intel.com>
Cc: Mika Kahola <mika.kahola@intel.com>
Signed-off-by: Radhakrishna Sripada <radhakrishna.sripada@intel.com>
Reviewed-by: Mika Kahola <mika.kahola@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20231207221025.2032207-2-radhakrishna.sripada@intel.com
[ Junxiao Chang: amend commit log ]
Signed-off-by: Junxiao Chang <junxiao.chang@intel.com>
commit 1103672 ("drm/i915/mtl: Remove misleading "clock" field from C20 pll_state") upstream.

The field link_bit_rate serves as the actual clock value for the C20
pll_state structure. Remove the misleading clock field. The subsequent
patch would rename the link_bit_rate as the clock field.

deepin-Intel-SIG: commit 1103672 ("drm/i915/mtl: Remove misleading "clock" field from C20 pll_state").

Cc: Clint Taylor <clinton.a.taylor@intel.com>
Cc: Mika Kahola <mika.kahola@intel.com>
Signed-off-by: Radhakrishna Sripada <radhakrishna.sripada@intel.com>
Reviewed-by: Mika Kahola <mika.kahola@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20231207221025.2032207-3-radhakrishna.sripada@intel.com
[ Junxiao Chang: amend commit log ]
Signed-off-by: Junxiao Chang <junxiao.chang@intel.com>
commit 872ee9c ("drm/i915/mtl: Rename the link_bit_rate to clock in C20 pll_state") upstream.

With the cleanup of the misleading clock value to avoid extra
calculations to convert between link_bit_rate and clock, use
one standard "clock" field for the c20 pll which works with
crtc_state->port_clock field.

deepin-Intel-SIG: commit 872ee9c ("drm/i915/mtl: Rename the link_bit_rate to clock in C20 pll_state").

Cc: Clint Taylor <clinton.a.taylor@intel.com>
Cc: Mika Kahola <mika.kahola@intel.com>
Signed-off-by: Radhakrishna Sripada <radhakrishna.sripada@intel.com>
Reviewed-by: Mika Kahola <mika.kahola@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20231207221025.2032207-4-radhakrishna.sripada@intel.com
[ Junxiao Chang: amend commit log ]
Signed-off-by: Junxiao Chang <junxiao.chang@intel.com>
commit 15d0311 ("drm/i915/display: do not use cursor size reduction on MTL") upstream.

Cursor size reduction is not supported since MTL.

deepin-Intel-SIG: commit 15d0311 ("drm/i915/display: do not use cursor size reduction on MTL").

Signed-off-by: Andrzej Hajda <andrzej.hajda@intel.com>
Reviewed-by: Andi Shyti <andi.shyti@linux.intel.com>
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20231124-cur_size_reduction-v1-1-30495dba475f@intel.com
[ Junxiao Chang: amend commit log ]
Signed-off-by: Junxiao Chang <junxiao.chang@intel.com>
commit 273361f ("drm/i915/mtl: Fix voltage_level for cdclk==480MHz") upstream.

Allow MTL to use voltage level 1 for 480MHz cdclk,
instead of the voltage level 2 that it's currently using.

deepin-Intel-SIG: commit 273361f ("drm/i915/mtl: Fix voltage_level for cdclk==480MHz").

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20231128115138.13238-6-ville.syrjala@linux.intel.com
Reviewed-by: Gustavo Sousa <gustavo.sousa@intel.com>
[ Junxiao Chang: amend commit log ]
Signed-off-by: Junxiao Chang <junxiao.chang@intel.com>
…ariants

commit 46bdb77 ("drm/i915: Split intel_ddi_compute_min_voltage_level() into platform variants") upstream.

The mess inside intel_ddi_compute_min_voltage_level() is illegible.
Clean it up a bit by splitting the internals into per-platform
functions.

TODO: make it a vfunc?

deepin-Intel-SIG: commit 46bdb77 ("drm/i915: Split intel_ddi_compute_min_voltage_level() into platform variants").

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20231128115138.13238-7-ville.syrjala@linux.intel.com
Reviewed-by: Gustavo Sousa <gustavo.sousa@intel.com>
[ Junxiao Chang: amend commit log ]
Signed-off-by: Junxiao Chang <junxiao.chang@intel.com>
commit 0656afa ("drm/i915/mtl: Calculate the correct voltage level from port_clock") upstream.

On MTL we need to bump the voltage level to only 1 (not 2)
when port clock exceeds 594MHz. Make it so.

deepin-Intel-SIG: commit 0656afa ("drm/i915/mtl: Calculate the correct voltage level from port_clock").

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20231128115138.13238-8-ville.syrjala@linux.intel.com
Reviewed-by: Gustavo Sousa <gustavo.sousa@intel.com>
[ Junxiao Chang: amend commit log ]
Signed-off-by: Junxiao Chang <junxiao.chang@intel.com>
@deepin-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign hudeng-go for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@deepin-ci-robot
Copy link

Hi @junxiaoc. Thanks for your PR. 😃

@deepin-ci-robot
Copy link

Hi @junxiaoc. Thanks for your PR.

I'm waiting for a deepin-community member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@matrix-wsk matrix-wsk merged commit 6352cde into deepin-community:linux-6.6.y Jan 30, 2024
opsiff pushed a commit that referenced this pull request Dec 7, 2024
[ Upstream commit ea4c990 ]

When the qp is in error state, the status of WQEs in the queue should be
set to error. Or else the following will appear.

[  920.617269] WARNING: CPU: 1 PID: 21 at drivers/infiniband/sw/rxe/rxe_comp.c:756 rxe_completer+0x989/0xcc0 [rdma_rxe]
[  920.617744] Modules linked in: rnbd_client(O) rtrs_client(O) rtrs_core(O) rdma_ucm rdma_cm iw_cm ib_cm crc32_generic rdma_rxe ip6_udp_tunnel udp_tunnel ib_uverbs ib_core loop brd null_blk ipv6
[  920.618516] CPU: 1 PID: 21 Comm: ksoftirqd/1 Tainted: G           O       6.1.113-storage+ #65
[  920.618986] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.15.0-1 04/01/2014
[  920.619396] RIP: 0010:rxe_completer+0x989/0xcc0 [rdma_rxe]
[  920.619658] Code: 0f b6 84 24 3a 02 00 00 41 89 84 24 44 04 00 00 e9 2a f7 ff ff 39 ca bb 03 00 00 00 b8 0e 00 00 00 48 0f 45 d8 e9 15 f7 ff ff <0f> 0b e9 cb f8 ff ff 41 bf f5 ff ff ff e9 08 f8 ff ff 49 8d bc 24
[  920.620482] RSP: 0018:ffff97b7c00bbc38 EFLAGS: 00010246
[  920.620817] RAX: 0000000000000000 RBX: 000000000000000c RCX: 0000000000000008
[  920.621183] RDX: ffff960dc396ebc0 RSI: 0000000000005400 RDI: ffff960dc4e2fbac
[  920.621548] RBP: 0000000000000000 R08: 0000000000000001 R09: ffffffffac406450
[  920.621884] R10: ffffffffac4060c0 R11: 0000000000000001 R12: ffff960dc4e2f800
[  920.622254] R13: ffff960dc4e2f928 R14: ffff97b7c029c580 R15: 0000000000000000
[  920.622609] FS:  0000000000000000(0000) GS:ffff960ef7d00000(0000) knlGS:0000000000000000
[  920.622979] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[  920.623245] CR2: 00007fa056965e90 CR3: 00000001107f1000 CR4: 00000000000006e0
[  920.623680] Call Trace:
[  920.623815]  <TASK>
[  920.623933]  ? __warn+0x79/0xc0
[  920.624116]  ? rxe_completer+0x989/0xcc0 [rdma_rxe]
[  920.624356]  ? report_bug+0xfb/0x150
[  920.624594]  ? handle_bug+0x3c/0x60
[  920.624796]  ? exc_invalid_op+0x14/0x70
[  920.624976]  ? asm_exc_invalid_op+0x16/0x20
[  920.625203]  ? rxe_completer+0x989/0xcc0 [rdma_rxe]
[  920.625474]  ? rxe_completer+0x329/0xcc0 [rdma_rxe]
[  920.625749]  rxe_do_task+0x80/0x110 [rdma_rxe]
[  920.626037]  rxe_requester+0x625/0xde0 [rdma_rxe]
[  920.626310]  ? rxe_cq_post+0xe2/0x180 [rdma_rxe]
[  920.626583]  ? do_complete+0x18d/0x220 [rdma_rxe]
[  920.626812]  ? rxe_completer+0x1a3/0xcc0 [rdma_rxe]
[  920.627050]  rxe_do_task+0x80/0x110 [rdma_rxe]
[  920.627285]  tasklet_action_common.constprop.0+0xa4/0x120
[  920.627522]  handle_softirqs+0xc2/0x250
[  920.627728]  ? sort_range+0x20/0x20
[  920.627942]  run_ksoftirqd+0x1f/0x30
[  920.628158]  smpboot_thread_fn+0xc7/0x1b0
[  920.628334]  kthread+0xd6/0x100
[  920.628504]  ? kthread_complete_and_exit+0x20/0x20
[  920.628709]  ret_from_fork+0x1f/0x30
[  920.628892]  </TASK>

Fixes: ae720bd ("RDMA/rxe: Generate error completion for error requester QP state")
Signed-off-by: Zhu Yanjun <yanjun.zhu@linux.dev>
Link: https://patch.msgid.link/20241025152036.121417-1-yanjun.zhu@linux.dev
Signed-off-by: Leon Romanovsky <leon@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit 44d4587786eba5e2b1b3ddf7ec628f97a6b599b4)
opsiff pushed a commit that referenced this pull request Dec 9, 2024
[ Upstream commit ea4c990 ]

When the qp is in error state, the status of WQEs in the queue should be
set to error. Or else the following will appear.

[  920.617269] WARNING: CPU: 1 PID: 21 at drivers/infiniband/sw/rxe/rxe_comp.c:756 rxe_completer+0x989/0xcc0 [rdma_rxe]
[  920.617744] Modules linked in: rnbd_client(O) rtrs_client(O) rtrs_core(O) rdma_ucm rdma_cm iw_cm ib_cm crc32_generic rdma_rxe ip6_udp_tunnel udp_tunnel ib_uverbs ib_core loop brd null_blk ipv6
[  920.618516] CPU: 1 PID: 21 Comm: ksoftirqd/1 Tainted: G           O       6.1.113-storage+ #65
[  920.618986] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.15.0-1 04/01/2014
[  920.619396] RIP: 0010:rxe_completer+0x989/0xcc0 [rdma_rxe]
[  920.619658] Code: 0f b6 84 24 3a 02 00 00 41 89 84 24 44 04 00 00 e9 2a f7 ff ff 39 ca bb 03 00 00 00 b8 0e 00 00 00 48 0f 45 d8 e9 15 f7 ff ff <0f> 0b e9 cb f8 ff ff 41 bf f5 ff ff ff e9 08 f8 ff ff 49 8d bc 24
[  920.620482] RSP: 0018:ffff97b7c00bbc38 EFLAGS: 00010246
[  920.620817] RAX: 0000000000000000 RBX: 000000000000000c RCX: 0000000000000008
[  920.621183] RDX: ffff960dc396ebc0 RSI: 0000000000005400 RDI: ffff960dc4e2fbac
[  920.621548] RBP: 0000000000000000 R08: 0000000000000001 R09: ffffffffac406450
[  920.621884] R10: ffffffffac4060c0 R11: 0000000000000001 R12: ffff960dc4e2f800
[  920.622254] R13: ffff960dc4e2f928 R14: ffff97b7c029c580 R15: 0000000000000000
[  920.622609] FS:  0000000000000000(0000) GS:ffff960ef7d00000(0000) knlGS:0000000000000000
[  920.622979] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[  920.623245] CR2: 00007fa056965e90 CR3: 00000001107f1000 CR4: 00000000000006e0
[  920.623680] Call Trace:
[  920.623815]  <TASK>
[  920.623933]  ? __warn+0x79/0xc0
[  920.624116]  ? rxe_completer+0x989/0xcc0 [rdma_rxe]
[  920.624356]  ? report_bug+0xfb/0x150
[  920.624594]  ? handle_bug+0x3c/0x60
[  920.624796]  ? exc_invalid_op+0x14/0x70
[  920.624976]  ? asm_exc_invalid_op+0x16/0x20
[  920.625203]  ? rxe_completer+0x989/0xcc0 [rdma_rxe]
[  920.625474]  ? rxe_completer+0x329/0xcc0 [rdma_rxe]
[  920.625749]  rxe_do_task+0x80/0x110 [rdma_rxe]
[  920.626037]  rxe_requester+0x625/0xde0 [rdma_rxe]
[  920.626310]  ? rxe_cq_post+0xe2/0x180 [rdma_rxe]
[  920.626583]  ? do_complete+0x18d/0x220 [rdma_rxe]
[  920.626812]  ? rxe_completer+0x1a3/0xcc0 [rdma_rxe]
[  920.627050]  rxe_do_task+0x80/0x110 [rdma_rxe]
[  920.627285]  tasklet_action_common.constprop.0+0xa4/0x120
[  920.627522]  handle_softirqs+0xc2/0x250
[  920.627728]  ? sort_range+0x20/0x20
[  920.627942]  run_ksoftirqd+0x1f/0x30
[  920.628158]  smpboot_thread_fn+0xc7/0x1b0
[  920.628334]  kthread+0xd6/0x100
[  920.628504]  ? kthread_complete_and_exit+0x20/0x20
[  920.628709]  ret_from_fork+0x1f/0x30
[  920.628892]  </TASK>

Fixes: ae720bd ("RDMA/rxe: Generate error completion for error requester QP state")
Signed-off-by: Zhu Yanjun <yanjun.zhu@linux.dev>
Link: https://patch.msgid.link/20241025152036.121417-1-yanjun.zhu@linux.dev
Signed-off-by: Leon Romanovsky <leon@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit 31978d5)
opsiff pushed a commit that referenced this pull request Dec 9, 2024
[ Upstream commit ea4c990 ]

When the qp is in error state, the status of WQEs in the queue should be
set to error. Or else the following will appear.

[  920.617269] WARNING: CPU: 1 PID: 21 at drivers/infiniband/sw/rxe/rxe_comp.c:756 rxe_completer+0x989/0xcc0 [rdma_rxe]
[  920.617744] Modules linked in: rnbd_client(O) rtrs_client(O) rtrs_core(O) rdma_ucm rdma_cm iw_cm ib_cm crc32_generic rdma_rxe ip6_udp_tunnel udp_tunnel ib_uverbs ib_core loop brd null_blk ipv6
[  920.618516] CPU: 1 PID: 21 Comm: ksoftirqd/1 Tainted: G           O       6.1.113-storage+ #65
[  920.618986] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.15.0-1 04/01/2014
[  920.619396] RIP: 0010:rxe_completer+0x989/0xcc0 [rdma_rxe]
[  920.619658] Code: 0f b6 84 24 3a 02 00 00 41 89 84 24 44 04 00 00 e9 2a f7 ff ff 39 ca bb 03 00 00 00 b8 0e 00 00 00 48 0f 45 d8 e9 15 f7 ff ff <0f> 0b e9 cb f8 ff ff 41 bf f5 ff ff ff e9 08 f8 ff ff 49 8d bc 24
[  920.620482] RSP: 0018:ffff97b7c00bbc38 EFLAGS: 00010246
[  920.620817] RAX: 0000000000000000 RBX: 000000000000000c RCX: 0000000000000008
[  920.621183] RDX: ffff960dc396ebc0 RSI: 0000000000005400 RDI: ffff960dc4e2fbac
[  920.621548] RBP: 0000000000000000 R08: 0000000000000001 R09: ffffffffac406450
[  920.621884] R10: ffffffffac4060c0 R11: 0000000000000001 R12: ffff960dc4e2f800
[  920.622254] R13: ffff960dc4e2f928 R14: ffff97b7c029c580 R15: 0000000000000000
[  920.622609] FS:  0000000000000000(0000) GS:ffff960ef7d00000(0000) knlGS:0000000000000000
[  920.622979] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[  920.623245] CR2: 00007fa056965e90 CR3: 00000001107f1000 CR4: 00000000000006e0
[  920.623680] Call Trace:
[  920.623815]  <TASK>
[  920.623933]  ? __warn+0x79/0xc0
[  920.624116]  ? rxe_completer+0x989/0xcc0 [rdma_rxe]
[  920.624356]  ? report_bug+0xfb/0x150
[  920.624594]  ? handle_bug+0x3c/0x60
[  920.624796]  ? exc_invalid_op+0x14/0x70
[  920.624976]  ? asm_exc_invalid_op+0x16/0x20
[  920.625203]  ? rxe_completer+0x989/0xcc0 [rdma_rxe]
[  920.625474]  ? rxe_completer+0x329/0xcc0 [rdma_rxe]
[  920.625749]  rxe_do_task+0x80/0x110 [rdma_rxe]
[  920.626037]  rxe_requester+0x625/0xde0 [rdma_rxe]
[  920.626310]  ? rxe_cq_post+0xe2/0x180 [rdma_rxe]
[  920.626583]  ? do_complete+0x18d/0x220 [rdma_rxe]
[  920.626812]  ? rxe_completer+0x1a3/0xcc0 [rdma_rxe]
[  920.627050]  rxe_do_task+0x80/0x110 [rdma_rxe]
[  920.627285]  tasklet_action_common.constprop.0+0xa4/0x120
[  920.627522]  handle_softirqs+0xc2/0x250
[  920.627728]  ? sort_range+0x20/0x20
[  920.627942]  run_ksoftirqd+0x1f/0x30
[  920.628158]  smpboot_thread_fn+0xc7/0x1b0
[  920.628334]  kthread+0xd6/0x100
[  920.628504]  ? kthread_complete_and_exit+0x20/0x20
[  920.628709]  ret_from_fork+0x1f/0x30
[  920.628892]  </TASK>

Fixes: ae720bd ("RDMA/rxe: Generate error completion for error requester QP state")
Signed-off-by: Zhu Yanjun <yanjun.zhu@linux.dev>
Link: https://patch.msgid.link/20241025152036.121417-1-yanjun.zhu@linux.dev
Signed-off-by: Leon Romanovsky <leon@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit 31978d5)
@Avenger-285714
Copy link
Member

@sourcery-ai review

@sourcery-ai
Copy link

sourcery-ai bot commented Jul 10, 2025

Reviewer's Guide

This PR extends DRM support to Intel Meteor Lake by refactoring DSC picture-parameter-set handling into generic per-pipe write/read routines, unifying platform/stepping checks via new macros, introducing a GPU-bound context for GGTT updates on MTL, centralizing display workarounds, and modularizing fbdev allocation.

Class diagram for refactored DSC PPS handling

classDiagram
    class intel_crtc_state {
        +dsc: dsc_state
        +bigjoiner_pipes
        +cpu_transcoder
        +uapi
        +compressed_bpp
        +compression_enable
        +dsc_split
    }
    class dsc_state {
        +dsc_split
        +config: drm_dsc_config
    }
    class drm_dsc_config {
        +bits_per_component
        +line_buf_depth
        +block_pred_enable
        +convert_rgb
        +simple_422
        +native_422
        +native_420
        +vbr_enable
        +bits_per_pixel
        +pic_width
        +pic_height
        +slice_width
        +slice_height
        +initial_dec_delay
        +initial_xmit_delay
        +scale_decrement_interval
        +scale_increment_interval
        +initial_scale_value
        +first_line_bpg_offset
        +flatness_min_qp
        +flatness_max_qp
        +nfl_bpg_offset
        +slice_bpg_offset
        +initial_offset
        +final_offset
        +rc_model_size
        +rc_quant_incr_limit0
        +rc_quant_incr_limit1
        +slice_chunk_size
        +second_line_bpg_offset
        +nsl_bpg_offset
        +second_line_offset_adj
    }
    intel_crtc_state --> dsc_state
    dsc_state --> drm_dsc_config

    class intel_vdsc {
        +intel_dsc_get_vdsc_per_pipe()
        +intel_dsc_get_num_vdsc_instances()
        +intel_dsc_get_pps_reg()
        +intel_dsc_pps_write()
        +intel_dsc_pps_read()
        +intel_dsc_pps_read_and_verify()
        +intel_dsc_get_pps_config()
        +intel_dsc_pps_configure()
        +intel_dsc_enable()
        +intel_dsc_disable()
        +intel_dsc_get_config()
    }
Loading

Class diagram for unified platform/stepping macros

classDiagram
    class intel_gt {
        +type
        +i915
    }
    class drm_i915_private {
    }
    intel_gt --> drm_i915_private

    class PlatformMacros {
        +IS_GFX_GT_IP_RANGE(gt, from, until)
        +IS_MEDIA_GT_IP_RANGE(gt, from, until)
        +IS_GFX_GT_IP_STEP(gt, ipver, from, until)
        +IS_MEDIA_GT_IP_STEP(gt, ipver, from, until)
    }
Loading

File-Level Changes

Change Details Files
Refactor and generalize Display Stream Compression PPS handling
  • Extract per-pipe instance count into intel_dsc_get_vdsc_per_pipe
  • Introduce intel_dsc_get_pps_reg and intel_dsc_pps_write for register writes
  • Add intel_dsc_pps_read/_verify and intel_dsc_get_pps_config for state readback
  • Replace repetitive direct writes with a loop over PPS indices
drivers/gpu/drm/i915/display/intel_vdsc.c
drivers/gpu/drm/i915/display/intel_vdsc_regs.h
Unify stepping and platform checks with new IP‐range macros
  • Add IS_GFX_GT_IP_RANGE, IS_GFX_GT_IP_STEP, IS_MEDIA_GT_IP_RANGE, IS_DISPLAY_IP_STEP macros
  • Replace scattered IS_METEORLAKE/IS_MTL_… usages with unified checks
  • Remove old subplatform id tables and M/T/P variants
drivers/gpu/drm/i915/gt/intel_gt.h
drivers/gpu/drm/i915/i915_drv.h
drivers/gpu/drm/i915/intel_device_info.c
Implement GPU‐bound context for GGTT updates on Meteor Lake
  • Add create_ggtt_bind_context and bind_context field on BCS0 engine
  • Introduce i915_ggtt_require_binder to gate bind submission
  • Implement gen8_ggtt_bind_ptes and bind versions of insert_page/entries/scratch
drivers/gpu/drm/i915/gt/intel_engine_cs.c
drivers/gpu/drm/i915/display/intel_ggtt.c
drivers/gpu/drm/i915/gt/intel_gtt.h
Centralize display hardware workarounds into intel_display_wa.c
  • Move display chicken‐bit and DPFC WA into dedicated file
  • Add intel_display_wa_apply and call it in init_hw
  • Group per‐platform display WA routines under one entrypoint
drivers/gpu/drm/i915/display/intel_display_wa.c
drivers/gpu/drm/i915/display/intel_display_driver.c
Modularize fbdev allocation and setup
  • Add intel_fbdev_fb_alloc and intel_fbdev_fb_fill_info helpers
  • Split fbdev allocation logic into intel_fbdev_fb.c/.h
  • Update intel_fbdev.c to call new abstraction
drivers/gpu/drm/i915/display/intel_fbdev.c
drivers/gpu/drm/i915/display/intel_fbdev_fb.c

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @junxiaoc - I've reviewed your changes - here's some feedback:

  • The new intel_gt_mcr_lock_sanitize() helper is never called—add it to your GT init or resume path to ensure the hardware semaphore is in a known good state after firmware load.
  • The bind_context_ready flag for the GGTT bind context must be set and cleared consistently across suspend/resume and engine teardown to avoid using an invalid context.
  • There are still scattered uses of legacy IS_METEORLAKE/DISPLAY_VER checks in new MTL-specific code—consolidate to the new IS_GFX_GT_IP_* or IS_DISPLAY_IP_STEP macros for uniform stepping logic.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The new `intel_gt_mcr_lock_sanitize()` helper is never called—add it to your GT init or resume path to ensure the hardware semaphore is in a known good state after firmware load.
- The `bind_context_ready` flag for the GGTT bind context must be set and cleared consistently across suspend/resume and engine teardown to avoid using an invalid context.
- There are still scattered uses of legacy `IS_METEORLAKE`/`DISPLAY_VER` checks in new MTL-specific code—consolidate to the new `IS_GFX_GT_IP_*` or `IS_DISPLAY_IP_STEP` macros for uniform stepping logic.

## Individual Comments

### Comment 1
<location> `drivers/gpu/drm/i915/gt/intel_engine_cs.c:1421` </location>
<code_context>
 	intel_context_put(ce);
 }

+static struct intel_context *
+create_ggtt_bind_context(struct intel_engine_cs *engine)
+{
</code_context>

<issue_to_address>
The create_ggtt_bind_context function is only used for BCS0, but this is not enforced in the function itself.

Add an assertion or comment in create_ggtt_bind_context to clarify it should only be used with BCS0, preventing misuse with other engines.

Suggested implementation:

```c
static struct intel_context *
create_ggtt_bind_context(struct intel_engine_cs *engine)
{
	static struct lock_class_key kernel;

	/*
	 * This function is intended to be used only with the BCS0 engine.
	 * Assert to prevent misuse with other engines.
	 */
	GEM_BUG_ON(engine->class != RENDER_CLASS && engine->class != COPY_ENGINE_CLASS);
	GEM_BUG_ON(engine->instance != 0); /* Only BCS0 */

	/*
	 * MI_UPDATE_GTT can insert up to 511 PTE entries and there could be multiple
	 * bind requets at a time so get a bigger ring.
	 */
	return intel_engine_create_pinned_context(engine, engine->gt->vm, SZ_512K,
						  I915_GEM_HWS_GGTT_BIND_ADDR,
						  &kernel, "ggtt_bind_context");
}

```

- If `GEM_BUG_ON` or the engine class/instance macros are not available, you may need to adjust the assertion to match your codebase's conventions.
- If BCS0 is defined by a specific macro or constant (e.g., `BCS0`), use that instead of checking class/instance directly.
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

intel_context_put(ce);
}

static struct intel_context *
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: The create_ggtt_bind_context function is only used for BCS0, but this is not enforced in the function itself.

Add an assertion or comment in create_ggtt_bind_context to clarify it should only be used with BCS0, preventing misuse with other engines.

Suggested implementation:

static struct intel_context *
create_ggtt_bind_context(struct intel_engine_cs *engine)
{
	static struct lock_class_key kernel;

	/*
	 * This function is intended to be used only with the BCS0 engine.
	 * Assert to prevent misuse with other engines.
	 */
	GEM_BUG_ON(engine->class != RENDER_CLASS && engine->class != COPY_ENGINE_CLASS);
	GEM_BUG_ON(engine->instance != 0); /* Only BCS0 */

	/*
	 * MI_UPDATE_GTT can insert up to 511 PTE entries and there could be multiple
	 * bind requets at a time so get a bigger ring.
	 */
	return intel_engine_create_pinned_context(engine, engine->gt->vm, SZ_512K,
						  I915_GEM_HWS_GGTT_BIND_ADDR,
						  &kernel, "ggtt_bind_context");
}
  • If GEM_BUG_ON or the engine class/instance macros are not available, you may need to adjust the assertion to match your codebase's conventions.
  • If BCS0 is defined by a specific macro or constant (e.g., BCS0), use that instead of checking class/instance directly.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds and refactors support for the Meteor Lake (Xe_LPG) platform across multiple DRM and GPU driver subsystems, replacing bespoke Meteor Lake checks with generic IP range/step macros, and introducing binder-based GGTT updates alongside cleanup of legacy MTL subplatform code.

  • Consolidate Intel Meteor Lake PCI IDs and device info flags
  • Refactor platform-specific workaround checks to use new IS_GFX_GT_IP_RANGE/STEP and IS_MEDIA_GT_IP_RANGE/STEP macros
  • Introduce a dedicated GGTT binder context for PTE updates and extend PXP, GSC HECI, wakeref, MCHBAR, and reset WA handling

Reviewed Changes

Copilot reviewed 81 out of 81 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
include/drm/i915_pciids.h Consolidate MTL PCI ID macros
drivers/gpu/drm/i915/soc/intel_gmch.c Factor out MCHBAR reg helper
drivers/gpu/drm/i915/pxp/intel_pxp_pm.h Add runtime resume prototype
drivers/gpu/drm/i915/pxp/intel_pxp_pm.c Refactor resume logic with wakeref
drivers/gpu/drm/i915/pxp/intel_pxp_gsccs.h Update GSCFW latency calculation
drivers/gpu/drm/i915/pxp/intel_pxp_gsccs.c Use new reply latency define
drivers/gpu/drm/i915/pxp/intel_pxp_cmd_interface_43.h Adjust HECI packet size macro
drivers/gpu/drm/i915/intel_wakeref.c Extend wakeref get/put logic
drivers/gpu/drm/i915/intel_device_info.h Remove MTL subplatform defines
drivers/gpu/drm/i915/intel_device_info.c Eliminate subplatform ID init
drivers/gpu/drm/i915/intel_clock_gating.c Remove obsolete clock gating hooks
drivers/gpu/drm/i915/i915_scatterlist.h Add iterator for daddr stepping
drivers/gpu/drm/i915/i915_perf_types.h Remove unused override_gucrc field
drivers/gpu/drm/i915/i915_perf.c Simplify OA stream logic
drivers/gpu/drm/i915/i915_pci.c Add has_guc_tlb_invalidation flag
drivers/gpu/drm/i915/i915_gpu_error.c Adjust ring fault read for media GT
drivers/gpu/drm/i915/i915_drv.h Introduce DISPLAY_VER_FULL macro
drivers/gpu/drm/i915/i915_debugfs_params.c Loop over GTs in notify_guc
drivers/gpu/drm/i915/i915_debugfs.c Use IP range macro for cache levels
drivers/gpu/drm/i915/gt/uc/intel_uc_fw.c Update GuC firmware definitions
drivers/gpu/drm/i915/gt/uc/intel_uc.c Remove redundant HuC support check
drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c Replace MTL step WA with helper
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.h Remove unset/override GUCRC prototypes
drivers/gpu/drm/i915/gt/uc/intel_guc_slpc.c Remove gucrc override implementations
drivers/gpu/drm/i915/gt/uc/intel_guc_fwif.h Add TSC check WA bit
drivers/gpu/drm/i915/gt/uc/intel_guc.h Define GUC_FIRMWARE_VER helper
drivers/gpu/drm/i915/gt/uc/intel_guc.c Introduce GUC WA flags for MTL
drivers/gpu/drm/i915/gt/uc/intel_gsc_uc_heci_cmd_submit.h Define GSC_HECI_REPLY_LATENCY_MS
drivers/gpu/drm/i915/gt/uc/intel_gsc_uc_heci_cmd_submit.c Add delay handling in submit
drivers/gpu/drm/i915/gt/intel_workarounds.c Remove MTL-specific workaround code
drivers/gpu/drm/i915/gt/intel_rps.c Use IP version check for RPS caps
drivers/gpu/drm/i915/gt/intel_reset.h Declare reset WA helper function
drivers/gpu/drm/i915/gt/intel_reset.c Implement engine reset WA helper
drivers/gpu/drm/i915/gt/intel_rc6.c Simplify power gating conditions
drivers/gpu/drm/i915/gt/intel_mocs.c Use IP range macro in MOCS table
drivers/gpu/drm/i915/gt/intel_lrc.c Add run-alone mode for protected contexts
drivers/gpu/drm/i915/gt/intel_gtt.h Introduce bind iterator macro
drivers/gpu/drm/i915/gt/intel_gtt.c Add binder context support for GGTT
drivers/gpu/drm/i915/gt/intel_gt_regs.h Fix MTL CC mask bit range
drivers/gpu/drm/i915/gt/intel_gt_pm_debugfs.c Remove incorrect missing_case macro
drivers/gpu/drm/i915/gt/intel_gt_pm.c Add bind_context_set_ready calls
drivers/gpu/drm/i915/gt/intel_gt_mcr.h Declare mcr lock sanitize function
drivers/gpu/drm/i915/gt/intel_gt_mcr.c Implement lock sanitize for MTL
drivers/gpu/drm/i915/gt/intel_gt.h Introduce IP range/step macros
drivers/gpu/drm/i915/gt/intel_gt.c Handle media GT ring fault correctly
drivers/gpu/drm/i915/gt/intel_ggtt.c Add GGTT bind page update path
drivers/gpu/drm/i915/gt/intel_execlists_submission.c Use reset WA helper for reset prep
drivers/gpu/drm/i915/gt/intel_engine_types.h Add bind_context field to engine
drivers/gpu/drm/i915/gt/intel_engine_regs.h Introduce RUNALONE_MODE bit
drivers/gpu/drm/i915/gt/intel_engine_pm.c Change idle message enable condition
drivers/gpu/drm/i915/gt/intel_engine_cs.c Add ggtt_bind_context creation
drivers/gpu/drm/i915/gt/intel_engine.h Define GGTT_BIND status page index
drivers/gpu/drm/i915/gt/gen8_engine_cs.c Use IP range check for dummy PIPE_CONTROL
drivers/gpu/drm/i915/gem/i915_gem_stolen.c Reserve DSM region for media workloads
drivers/gpu/drm/i915/gem/i915_gem_create.c Restrict PAT extension to Xe_LPG
drivers/gpu/drm/i915/display/vlv_dsi.c Consolidate DSI port ctrl regs
drivers/gpu/drm/i915/display/skl_universal_plane.c Remove MTL plane workaround
drivers/gpu/drm/i915/display/intel_vdsc_regs.h Refactor DSC PPS register macros

bool i915_ggtt_require_binder(struct drm_i915_private *i915)
{
/* Wa_13010847436 & Wa_14019519902 */
return MEDIA_VER_FULL(i915) == IP_VER(13, 0);
Copy link

Copilot AI Jul 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i915_ggtt_require_binder() currently only returns true for MEDIA_VER_FULL == IP_VER(13,0), but GGTT binder support is needed for the Xe_LPG graphics GT (IP_VER 12,70+). Consider using IS_GFX_GT_IP_RANGE(gt, IP_VER(12,70), IP_VER(12,71)) or similar to detect the correct graphics GT platforms.

Suggested change
return MEDIA_VER_FULL(i915) == IP_VER(13, 0);
return MEDIA_VER_FULL(i915) == IP_VER(13, 0) ||
IS_GFX_GT_IP_RANGE(i915->gt, IP_VER(12, 70), IP_VER(12, 71));

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.