]> git.ipfire.org Git - thirdparty/kernel/linux.git/log
thirdparty/kernel/linux.git
2 months agodrm/i915/vrr: Readout framestart_delay earlier
Ville Syrjälä [Wed, 17 Sep 2025 20:34:43 +0000 (23:34 +0300)] 
drm/i915/vrr: Readout framestart_delay earlier

In order to pretend that ICL/TGL VRR hardware has a similar guardband
as on ADL+ we'll need access to framestart_delay already during
intel_vrr_get_config(). Hoist the framestart_delay to an earlier point
to make that possible.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20250917203446.14374-3-ville.syrjala@linux.intel.com
Reviewed-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
2 months agodrm/i915/vrr: Extract helpers to convert between guardband and pipeline_full values
Ville Syrjälä [Wed, 17 Sep 2025 20:34:42 +0000 (23:34 +0300)] 
drm/i915/vrr: Extract helpers to convert between guardband and pipeline_full values

I'd like to move towards a world where we can't more or less
pretend that the ICl/TGL VRR hardware works the same way as
ADL+. To that end extract some helpers to convert between
the guardband and pipeline_full representations.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20250917203446.14374-2-ville.syrjala@linux.intel.com
Reviewed-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
2 months agodrm/i915: Defeature DRRS on LNL+
Ville Syrjälä [Fri, 12 Sep 2025 13:59:26 +0000 (16:59 +0300)] 
drm/i915: Defeature DRRS on LNL+

DRRS has been defeatured on LNL+. Adjust HAS_DOUBLE_BUFFERED_M_N()
to match.

Note that the M/N registers still appear to be double buffered under
the hood but the double buffer update point is now documented to be
just the last register write to the M/N registers, so it no longer
happens synchronously with the vblank/MSA transmission. We should
perhaps rename HAS_DOUBLE_BUFFERED_M_N() to more accurately reflect
reality, but couldn't come up with a decent name right now...

Bspec: 68917
HSD: 14016007525
Cc: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20250912135926.18910-1-ville.syrjala@linux.intel.com
Reviewed-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
2 months agodrm/i915/gvt: Fix intel_vgpu_gpa_to_mmio_offset kernel docs
Jonathan Cavitt [Tue, 16 Sep 2025 17:43:20 +0000 (17:43 +0000)] 
drm/i915/gvt: Fix intel_vgpu_gpa_to_mmio_offset kernel docs

intel_vgpu_gpa_to_mmio_offset states that it returns
'Zero on success, negative error code if failed'
in the kernel docs.

This is false.  The function actually returns
'The MMIO offset of the given GPA'.
Correct the docs.

Signed-off-by: Jonathan Cavitt <jonathan.cavitt@intel.com>
Reviewed-by: Andi Shyti <andi.shyti@linux.intel.com>
Reviewed-by: Zhenyu Wang <zhenyuw.linux@gmail.com>
Signed-off-by: Andi Shyti <andi.shyti@linux.intel.com>
Link: https://lore.kernel.org/r/20250916174317.76521-6-jonathan.cavitt@intel.com
2 months agodrm/i915/gvt: Remove unnecessary check in reg_is_mmio
Jonathan Cavitt [Tue, 16 Sep 2025 17:43:19 +0000 (17:43 +0000)] 
drm/i915/gvt: Remove unnecessary check in reg_is_mmio

The reg >= 0 check in reg_is_mmio is unnecessary because reg is always
greater than zero in all current use cases.  This is obvious when
checking 'offset' by itself (as offset is defined as an unsigned
integer), but it's also true for the offset + bytes - 1 use case in
intel_vgpu_emulate_mmio_read because bytes > 0.

Signed-off-by: Jonathan Cavitt <jonathan.cavitt@intel.com>
Reviewed-by: Andi Shyti <andi.shyti@linux.intel.com>
Reviewed-by: Zhenyu Wang <zhenyuw.linux@gmail.com>
Signed-off-by: Andi Shyti <andi.shyti@linux.intel.com>
Link: https://lore.kernel.org/r/20250916174317.76521-5-jonathan.cavitt@intel.com
2 months agodrm/i915: add note on VLV/CHV hpll_freq and czclk_freq caching
Jani Nikula [Wed, 17 Sep 2025 13:52:00 +0000 (16:52 +0300)] 
drm/i915: add note on VLV/CHV hpll_freq and czclk_freq caching

The caching at the initial read is a bit fragile in case, say, a further
refactoring starts reading the frequencies at a time where it's not
possible. Add a note about it.

Suggested-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://lore.kernel.org/r/20250917135200.1932903-1-jani.nikula@intel.com
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
2 months agodrm/i915/alpm: Remove error handling from get_lfps_cycle_min_max_time
Jouni Högander [Fri, 12 Sep 2025 06:40:35 +0000 (09:40 +0300)] 
drm/i915/alpm: Remove error handling from get_lfps_cycle_min_max_time

Getter for LFPS cycle min/max times is unnecessarily checking faulty port
clock value. This doesn't make sense as erroneous port clock value would
have been noticed already at this point. Remove this check and use 140/800
ns always when port clock > 540000.

Signed-off-by: Jouni Högander <jouni.hogander@intel.com>
Reviewed-by: Mika Kahola <mika.kahola@intel.com>
Link: https://lore.kernel.org/r/20250912064035.335329-1-jouni.hogander@intel.com
2 months agodrm/i915: split out vlv_clock.[ch]
Jani Nikula [Fri, 12 Sep 2025 14:48:54 +0000 (17:48 +0300)] 
drm/i915: split out vlv_clock.[ch]

Move the VLV clock related functions to their own file.

v2: Rebase

Reviewed-by: Michał Grzelak <michal.grzelak@intel.com> # v1
Acked-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://lore.kernel.org/r/0bc4a930f3e364c4fc37479f56bf07ccee854fcc.1757688216.git.jani.nikula@intel.com
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
2 months agodrm/i915: move hpll and czclk caching under display
Jani Nikula [Fri, 12 Sep 2025 14:48:53 +0000 (17:48 +0300)] 
drm/i915: move hpll and czclk caching under display

Perhaps not the ideal place, but better than having to have the fields
in both struct drm_i915_private and struct xe_device.

v2: Rebase

Reviewed-by: Michał Grzelak <michal.grzelak@intel.com> # v1
Acked-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://lore.kernel.org/r/cbca9b13f2235a624a21bf7617ffe763e25c848c.1757688216.git.jani.nikula@intel.com
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
2 months agodrm/i915: log HPLL frequency similar to CZCLK
Jani Nikula [Fri, 12 Sep 2025 14:48:52 +0000 (17:48 +0300)] 
drm/i915: log HPLL frequency similar to CZCLK

With vlv_clock_get_czclk() logging the CZ clock rate when first cached,
do the same for HPLL VCO.

v2: Rebase

Reviewed-by: Michał Grzelak <michal.grzelak@intel.com>
Acked-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://lore.kernel.org/r/bfc3082f90cf9f74aa40308e10f20da824b1db55.1757688216.git.jani.nikula@intel.com
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
2 months agodrm/i915: remove intel_update_czclk() as unnecessary
Jani Nikula [Fri, 12 Sep 2025 14:48:51 +0000 (17:48 +0300)] 
drm/i915: remove intel_update_czclk() as unnecessary

With vlv_clock_get_czclk() caching the result on first use, we no longer
need a separate initializer. Remove intel_update_czclk() as
unnecessary. Log the CZCLK in vlv_clock_get_czclk() instead.

v2: Rebase

Reviewed-by: Michał Grzelak <michal.grzelak@intel.com> # v1
Acked-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://lore.kernel.org/r/3f90b5e67258f485db09b6f48381682cbd96153f.1757688216.git.jani.nikula@intel.com
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
2 months agodrm/i915: remove vlv_get_cck_clock_hpll()
Jani Nikula [Fri, 12 Sep 2025 14:48:50 +0000 (17:48 +0300)] 
drm/i915: remove vlv_get_cck_clock_hpll()

The function has become so trivial it's no longer necessary. Inline it
at the call sites.

Reviewed-by: Michał Grzelak <michal.grzelak@intel.com> # v1
Acked-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://lore.kernel.org/r/1e5ef7a14cdf42048a03719cff380fee6c3016e0.1757688216.git.jani.nikula@intel.com
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
2 months agodrm/i915: cache the results in vlv_clock_get_hpll_vco() and use it more
Jani Nikula [Fri, 12 Sep 2025 14:48:49 +0000 (17:48 +0300)] 
drm/i915: cache the results in vlv_clock_get_hpll_vco() and use it more

Use vlv_clock_get_hpll_vco() helper more to avoid looking at
i915->hpll_freq directly. Cache and return the cached results to avoid
repeated lookups.

v2: Rebase

Reviewed-by: Michał Grzelak <michal.grzelak@intel.com> # v1
Acked-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://lore.kernel.org/r/14695618682d8d8fad1adc485de7a122c8e1494a.1757688216.git.jani.nikula@intel.com
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
2 months agodrm/i915: rename vlv_get_hpll_vco() to vlv_clock_get_hpll_vco()
Jani Nikula [Fri, 12 Sep 2025 14:48:48 +0000 (17:48 +0300)] 
drm/i915: rename vlv_get_hpll_vco() to vlv_clock_get_hpll_vco()

Follow the new vlv_clock_*() naming pattern for all the related VLV
clock functions.

v2: Rebase

Reviewed-by: Michał Grzelak <michal.grzelak@intel.com>
Acked-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://lore.kernel.org/r/75ac6b1cda2cb0afe3171250c4d5ba1ff81df877.1757688216.git.jani.nikula@intel.com
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
2 months agodrm/i915: make vlv_get_cck_clock() static
Jani Nikula [Fri, 12 Sep 2025 14:48:47 +0000 (17:48 +0300)] 
drm/i915: make vlv_get_cck_clock() static

vlv_get_cck_clock() is no longer used outside of intel_display.c, make
it static.

Reviewed-by: Michał Grzelak <michal.grzelak@intel.com>
Acked-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://lore.kernel.org/r/bac1fe98d9d458ef30e973f680342b69a6cde4d6.1757688216.git.jani.nikula@intel.com
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
2 months agodrm/i915: add vlv_clock_get_cdclk()
Jani Nikula [Fri, 12 Sep 2025 14:48:46 +0000 (17:48 +0300)] 
drm/i915: add vlv_clock_get_cdclk()

Add vlv_clock_get_cdclk() helper to hide the details from the callers.

For now, this means running vlv_get_hpll_vco() twice in vlv_get_cdclk(),
but this will be improved later.

v2: Rebase

Reviewed-by: Michał Grzelak <michal.grzelak@intel.com>
Acked-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://lore.kernel.org/r/fc93ccf998300048432d18ce7e8690bd54e1e18d.1757688216.git.jani.nikula@intel.com
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
2 months agodrm/i915: make vlv_get_cck_clock_hpll() static
Jani Nikula [Fri, 12 Sep 2025 14:48:45 +0000 (17:48 +0300)] 
drm/i915: make vlv_get_cck_clock_hpll() static

vlv_get_cck_clock_hpll() is no longer used outside of intel_display.c,
make it static.

Reviewed-by: Michał Grzelak <michal.grzelak@intel.com>
Acked-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://lore.kernel.org/r/0a778d82e2be112b0cd37cd3329103a764967a1d.1757688216.git.jani.nikula@intel.com
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
2 months agodrm/i915: add vlv_clock_get_hrawclk()
Jani Nikula [Fri, 12 Sep 2025 14:48:44 +0000 (17:48 +0300)] 
drm/i915: add vlv_clock_get_hrawclk()

Add vlv_clock_get_hrawclk() helper to hide the details from the callers.

Reviewed-by: Michał Grzelak <michal.grzelak@intel.com>
Acked-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://lore.kernel.org/r/ad3c3d0baf16eb0ef3a0ac3edfbab327c564e743.1757688216.git.jani.nikula@intel.com
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
2 months agodrm/i915: add vlv_clock_get_czclk()
Jani Nikula [Fri, 12 Sep 2025 14:48:43 +0000 (17:48 +0300)] 
drm/i915: add vlv_clock_get_czclk()

Add vlv_clock_get_czclk() helper to avoid looking at i915->czclk_freq
directly.

Reviewed-by: Mika Kahola <mika.kahola@intel.com>
Reviewed-by: Michał Grzelak <michal.grzelak@intel.com>
Acked-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://lore.kernel.org/r/4885f6e486a31c773a3bfebd6936670234e57bd0.1757688216.git.jani.nikula@intel.com
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
2 months agodrm/i915: add vlv_clock_get_gpll()
Jani Nikula [Fri, 12 Sep 2025 14:48:42 +0000 (17:48 +0300)] 
drm/i915: add vlv_clock_get_gpll()

Add a vlv_clock_get_gpll() helper to hide the details from the callers.

Reviewed-by: Mika Kahola <mika.kahola@intel.com>
Reviewed-by: Michał Grzelak <michal.grzelak@intel.com>
Acked-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://lore.kernel.org/r/2589396fa14388d7709d2b01f1d32f9f38dab11a.1757688216.git.jani.nikula@intel.com
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
2 months agodrm/i915: do cck get/put inside vlv_get_cck_clock()
Jani Nikula [Fri, 12 Sep 2025 14:48:41 +0000 (17:48 +0300)] 
drm/i915: do cck get/put inside vlv_get_cck_clock()

Move towards VLV/CHV clock interfaces that handle sideband get/put
inside them instead of at the caller.

With this, we can switch to the simpler vlv_punit_get()/vlv_punit_put()
in vlv_get_cdclk().

We'll need to move vlv_init_gpll_ref_freq() outside of the existing
get/put in vlv_rps_init() and chv_rps_init().

Suggested-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Acked-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://lore.kernel.org/r/480b654b6c736a03343dfd17eb130c39fd82c637.1757688216.git.jani.nikula@intel.com
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
2 months agodrm/i915: do cck get/put inside vlv_get_hpll_vco()
Jani Nikula [Fri, 12 Sep 2025 14:48:40 +0000 (17:48 +0300)] 
drm/i915: do cck get/put inside vlv_get_hpll_vco()

Move towards VLV/CHV clock interfaces that handle sideband get/put
inside them instead of at the caller.

We'll need to move the calls outside of existing get/put.

Suggested-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Acked-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://lore.kernel.org/r/1a6553f54619275aa05512421e19115a71cd3eb0.1757688216.git.jani.nikula@intel.com
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
2 months agodrm/i915/display: Use DISPLAY_VER over GRAPHICS_VER
Matt Atwood [Wed, 3 Sep 2025 17:08:21 +0000 (10:08 -0700)] 
drm/i915/display: Use DISPLAY_VER over GRAPHICS_VER

The checks in plane_has_modifier() should check against display version
instead of graphics version.

Bspec: 67165, 70815

Signed-off-by: Matt Atwood <matthew.s.atwood@intel.com>
Reviewed-by: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
Link: https://lore.kernel.org/r/20250903170821.310143-1-matthew.s.atwood@intel.com
Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
2 months agodrm/i915: split out i915_wait_util.h
Jani Nikula [Thu, 11 Sep 2025 09:17:40 +0000 (12:17 +0300)] 
drm/i915: split out i915_wait_util.h

Move waiting related utilities from i915_utils.h to separate new file
i915_wait_util.h. Clean up related includes.

Note: Many of the various wait macro usages could likely be refactored
to use poll_timeout_us().

Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Link: https://lore.kernel.org/r/431396ac8cdb3e2f4ff053a8933290289a66ce42.1757582214.git.jani.nikula@intel.com
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
2 months agodrm/i915: split out i915_list_util.h
Jani Nikula [Thu, 11 Sep 2025 09:17:39 +0000 (12:17 +0300)] 
drm/i915: split out i915_list_util.h

Move list related utilities from i915_utils.h to separate new file
i915_list_util.h. Clean up related includes.

Note: Arguably none of this should exist in i915 in the first place. At
least isolate it better.

Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Link: https://lore.kernel.org/r/d7526809735194137116682f37cfa126a6a87ec9.1757582214.git.jani.nikula@intel.com
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
2 months agodrm/i915: split out i915_timer_util.[ch]
Jani Nikula [Thu, 11 Sep 2025 09:17:38 +0000 (12:17 +0300)] 
drm/i915: split out i915_timer_util.[ch]

Move timer related utilities from i915_utils.[ch] to separate new files
i915_timer_util.[ch]. Clean up related includes.

Note: Arguably none of this should exist in i915 in the first place. At
least isolate it better.

Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Link: https://lore.kernel.org/r/0a83d9489626121dcefcd4c1a05317399b5708f3.1757582214.git.jani.nikula@intel.com
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
2 months agodrm/i915: split out i915_ptr_util.h
Jani Nikula [Thu, 11 Sep 2025 09:17:37 +0000 (12:17 +0300)] 
drm/i915: split out i915_ptr_util.h

Move pointer related utilities from i915_utils.h to a separate new
i915_ptr_util.h header. Clean up related includes.

Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Link: https://lore.kernel.org/r/3cd06aa2483e68f19401292e9d4c28bf2977fce5.1757582214.git.jani.nikula@intel.com
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
2 months agodrm/i915/backlight: Honor VESA eDP backlight luminance control capability
Aaron Ma [Sat, 23 Aug 2025 12:16:47 +0000 (20:16 +0800)] 
drm/i915/backlight: Honor VESA eDP backlight luminance control capability

The VESA AUX backlight fails to be enable luminance based backlight
mainpulation becaused luminance_set is false by default.
Fix it by using luminance support control capabitliy.

Fixes: e13af5166a359 ("drm/i915/backlight: Use drm helper to initialize edp backlight")
Signed-off-by: Aaron Ma <aaron.ma@canonical.com>
Reviewed-by: Suraj Kandpal <suraj.kandpal@intel.com>
Signed-off-by: Suraj Kandpal <suraj.kandpal@intel.com>
Link: https://lore.kernel.org/r/20250823121647.275834-1-aaron.ma@canonical.com
2 months agoMerge drm/drm-next into drm-intel-next
Rodrigo Vivi [Wed, 10 Sep 2025 12:01:42 +0000 (08:01 -0400)] 
Merge drm/drm-next into drm-intel-next

Catching up with some display dependencies.

Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
2 months agodrm/i915: Remove todo and comments about struct_mutex
Luiz Otavio Mello [Mon, 8 Sep 2025 13:15:17 +0000 (09:15 -0400)] 
drm/i915: Remove todo and comments about struct_mutex

This patch completes the removal of struct_mutex from the driver.

Remove the related TODO item, as the transition away from struct_mutex
is now complete.

Also clean up references to struct_mutex in i915.rst to avoid outdated
documentation.

Signed-off-by: Luiz Otavio Mello <luiz.mello@estudante.ufscar.br>
Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Link: https://lore.kernel.org/r/20250908131518.36625-10-luiz.mello@estudante.ufscar.br
Acked-by: Thomas Zimmermann <tzimmermann@suse.de>
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
2 months agodrm/i915: Drop unused struct_mutex from drm_i915_private
Luiz Otavio Mello [Mon, 8 Sep 2025 13:15:16 +0000 (09:15 -0400)] 
drm/i915: Drop unused struct_mutex from drm_i915_private

The struct_mutex field in drm_i915_private is no longer used anywhere in
the driver. This patch removes it completely to clean up unused code and
avoid confusion.

Signed-off-by: Luiz Otavio Mello <luiz.mello@estudante.ufscar.br>
Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Link: https://lore.kernel.org/r/20250908131518.36625-9-luiz.mello@estudante.ufscar.br
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
2 months agodrm/i915: Clean-up outdated struct_mutex comments
Luiz Otavio Mello [Mon, 8 Sep 2025 13:15:15 +0000 (09:15 -0400)] 
drm/i915: Clean-up outdated struct_mutex comments

The struct_mutex will be removed from the DRM subsystem, as it was a
legacy BKL that was only used by i915 driver. After review, it was
concluded that its usage was no longer necessary

This patch updates various comments in the i915 codebase to
either remove or clarify references to struct_mutex, in order to
prevent future misunderstandings.

* i915_drv.h: Removed the statement that stolen_lock is the inner lock
  when overlaps with struct_mutex, since struct_mutex is no longer used
  in the driver.
* i915_gem.c: Removed parentheses suggesting usage of struct_mutex, which
  which is no longer used.

Signed-off-by: Luiz Otavio Mello <luiz.mello@estudante.ufscar.br>
Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Link: https://lore.kernel.org/r/20250908131518.36625-8-luiz.mello@estudante.ufscar.br
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
2 months agodrm/i915/display: Remove outdated struct_mutex comments
Luiz Otavio Mello [Mon, 8 Sep 2025 13:15:14 +0000 (09:15 -0400)] 
drm/i915/display: Remove outdated struct_mutex comments

The struct_mutex will be removed from the DRM subsystem, as it was a
legacy BKL that was only used by i915 driver. After review, it was
concluded that its usage was no longer necessary

This patch update a comment about struct_mutex in i915/display, in order
to prevent future misunderstandings.

* intel_fbc.c: Removed the statement that intel_fbc->lock is the inner
  lock when overlapping with struct_mutex, since struct_mutex is no
  longer used anywhere in the driver.

Signed-off-by: Luiz Otavio Mello <luiz.mello@estudante.ufscar.br>
Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Link: https://lore.kernel.org/r/20250908131518.36625-7-luiz.mello@estudante.ufscar.br
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
2 months agodrm/i915/gem: Clean-up outdated struct_mutex comments
Luiz Otavio Mello [Mon, 8 Sep 2025 13:15:13 +0000 (09:15 -0400)] 
drm/i915/gem: Clean-up outdated struct_mutex comments

The struct_mutex will be removed from the DRM subsystem, as it was a
legacy BKL that was only used by i915 driver. After review, it was
concluded that its usage was no longer necessary

This patch updates various comments in the i915/gem and i915/gt
codebase to either remove or clarify references to struct_mutex, in
order to prevent future misunderstandings.

* i915_gem_execbuffer.c: Replace reference to struct_mutex with
  vm->mutex, as noted in the eb_reserve() function, which states that
  vm->mutex handles deadlocks.
* i915_gem_object.c: Change struct_mutex by
  drm_i915_gem_object->vma.lock. i915_gem_object_unbind() in i915_gem.c
  states that this lock is who actually protects the unbind.
* i915_gem_shrinker.c: The correct lock is actually i915->mm.obj, as
  already documented in its declaration.
* i915_gem_wait.c: The existing comment already mentioned that
  struct_mutex was no longer necessary. Updated to refer to a generic
  global lock instead.
* intel_reset_types.h: Cleaned up the comment text. Updated to refer to
  a generic global lock instead.

Signed-off-by: Luiz Otavio Mello <luiz.mello@estudante.ufscar.br>
Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Link: https://lore.kernel.org/r/20250908131518.36625-6-luiz.mello@estudante.ufscar.br
Acked-by: Tvrtko Ursulin <tursulin@ursulin.net>
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
2 months agodrm/i915: Replace struct_mutex in intel_guc_log
Luiz Otavio Mello [Mon, 8 Sep 2025 13:15:12 +0000 (09:15 -0400)] 
drm/i915: Replace struct_mutex in intel_guc_log

Remove the use of struct_mutex from intel_guc_log.c and replace it with
a dedicated lock, guc_lock, defined within the intel_guc_log struct.
    
The struct_mutex was previously used to protect concurrent access and
modification of intel_guc_log->level in intel_guc_log_set_level().
However, it was suggested that the lock should reside within the
intel_guc_log struct itself.
    
Initialize the new guc_lock in intel_guc_log_init_early(), alongside the
existing relay.lock. The lock is initialized using drmm_mutex_init(),
which also ensures it is properly destroyed when the driver is unloaded.

Signed-off-by: Luiz Otavio Mello <luiz.mello@estudante.ufscar.br>
Suggested-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Link: https://lore.kernel.org/r/20250908131518.36625-5-luiz.mello@estudante.ufscar.br
Acked-by: Tvrtko Ursulin <tursulin@ursulin.net>
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
2 months agodrm/i915: Change mutex initialization in intel_guc_log
Luiz Otavio Mello [Mon, 8 Sep 2025 13:15:11 +0000 (09:15 -0400)] 
drm/i915: Change mutex initialization in intel_guc_log

The intel_guc_log->relay.lock is currently initialized in
intel_guc_log_init_early(), but it lacks a corresponding destructor,
which can lead to a memory leak.

This patch replaces the use of mutex_init() with drmm_mutex_init(),
which ensures the lock is properly destroyed when the driver is
unloaded.

Signed-off-by: Luiz Otavio Mello <luiz.mello@estudante.ufscar.br>
Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Link: https://lore.kernel.org/r/20250908131518.36625-4-luiz.mello@estudante.ufscar.br
Acked-by: Tvrtko Ursulin <tursulin@ursulin.net>
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
2 months agodrm/i915: Remove struct_mutex in i915_irq.c
Luiz Otavio Mello [Mon, 8 Sep 2025 13:15:10 +0000 (09:15 -0400)] 
drm/i915: Remove struct_mutex in i915_irq.c

Remove struct_mutex from ivb_parity_work() function.

The ivb_parity_work runs in a workqueue so it cannot race with itself.

Also, it is not protecting anything with the other remaining usage of
struct_mutex.

Signed-off-by: Luiz Otavio Mello <luiz.mello@estudante.ufscar.br>
Suggested-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Link: https://lore.kernel.org/r/20250908131518.36625-3-luiz.mello@estudante.ufscar.br
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
2 months agodrm/i915: Move struct_mutex to drm_i915_private
Luiz Otavio Mello [Mon, 8 Sep 2025 13:15:09 +0000 (09:15 -0400)] 
drm/i915: Move struct_mutex to drm_i915_private

Move legacy BKL struct_mutex from drm_device to drm_i915_private, which
is the last remaining user.

Signed-off-by: Luiz Otavio Mello <luiz.mello@estudante.ufscar.br>
Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Link: https://lore.kernel.org/r/20250908131518.36625-2-luiz.mello@estudante.ufscar.br
Acked-by: Thomas Zimmermann <tzimmermann@suse.de>
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
2 months agodrm/i915/display: add intel_display_device_present()
Jani Nikula [Wed, 3 Sep 2025 09:04:08 +0000 (12:04 +0300)] 
drm/i915/display: add intel_display_device_present()

Add a proper function for display && HAS_DISPLAY(display) to hide
indirect struct intel_display access via the macro from a number of
places outside of display. This makes struct intel_display * an opaque
pointer in these places. All HAS_DISPLAY() usage is now constrained
within display.

Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://lore.kernel.org/r/20250903090408.3492875-1-jani.nikula@intel.com
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
2 months agodrm/i915/backlight: Disable backlight when using luminance control
Suraj Kandpal [Thu, 4 Sep 2025 04:48:04 +0000 (10:18 +0530)] 
drm/i915/backlight: Disable backlight when using luminance control

We just return when using luminance control instead we should be
calling the disable helper to get everything cleaned up properly
by default.

Signed-off-by: Suraj Kandpal <suraj.kandpal@intel.com>
Reviewed-by: Arun R Murthy <arun.r.murthy@intel.com>
Link: https://lore.kernel.org/r/20250904044804.948391-1-suraj.kandpal@intel.com
2 months agooverflow: add range_overflows() and range_end_overflows()
Jani Nikula [Fri, 29 Aug 2025 17:46:01 +0000 (20:46 +0300)] 
overflow: add range_overflows() and range_end_overflows()

Move the range_overflows() and range_end_overflows() along with the _t
variants over from drm/i915 and drm/buddy to overflow.h.

Cc: Kees Cook <kees@kernel.org>
Cc: "Gustavo A. R. Silva" <gustavoars@kernel.org>
Cc: linux-hardening@vger.kernel.org
Reviewed-by: Kees Cook <kees@kernel.org>
Reviewed-by: Jouni Högander <jouni.hogander@intel.com>
Acked-by: Thomas Zimmermann <tzimmermann@suse.de>
Link: https://lore.kernel.org/r/20250829174601.2163064-3-jani.nikula@intel.com
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
2 months agodrm/i915: document range_overflows() and range_end_overflows() macros
Jani Nikula [Fri, 29 Aug 2025 17:46:00 +0000 (20:46 +0300)] 
drm/i915: document range_overflows() and range_end_overflows() macros

Document the macros in preparation for making them more generally
available.

Cc: Kees Cook <kees@kernel.org>
Cc: "Gustavo A. R. Silva" <gustavoars@kernel.org>
Cc: linux-hardening@vger.kernel.org
Reviewed-by: Jouni Högander <jouni.hogander@intel.com>
Link: https://lore.kernel.org/r/20250829174601.2163064-2-jani.nikula@intel.com
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
2 months agodrm/i915: rename range_overflows_end() to range_end_overflows()
Jani Nikula [Fri, 29 Aug 2025 17:45:59 +0000 (20:45 +0300)] 
drm/i915: rename range_overflows_end() to range_end_overflows()

Rename range_overflows_end() to range_end_overflows(), along with the _t
variant.

It's all rather subjective, but I think range_end_overflows() reads
better.

Cc: Kees Cook <kees@kernel.org>
Cc: "Gustavo A. R. Silva" <gustavoars@kernel.org>
Cc: linux-hardening@vger.kernel.org
Reviewed-by: Jouni Högander <jouni.hogander@intel.com>
Link: https://lore.kernel.org/r/20250829174601.2163064-1-jani.nikula@intel.com
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
2 months agodrm/{i915,xe}/panic: pass struct intel_panic to intel_panic_setup()
Jani Nikula [Tue, 2 Sep 2025 17:51:54 +0000 (20:51 +0300)] 
drm/{i915,xe}/panic: pass struct intel_panic to intel_panic_setup()

Reduce the struct intel_framebuffer usage within the panic
implementation.

Cc: Jocelyn Falempe <jfalempe@redhat.com>
Cc: Maarten Lankhorst <dev@lankhorst.se>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Reviewed-by: Jocelyn Falempe <jfalempe@redhat.com>
Link: https://lore.kernel.org/r/2a016167b1f6f0b432aed0a630f9dbcd07fadb7b.1756835342.git.jani.nikula@intel.com
2 months agodrm/{i915,xe}/panic: convert intel_panic_finish() to struct intel_panic
Jani Nikula [Tue, 2 Sep 2025 17:51:53 +0000 (20:51 +0300)] 
drm/{i915,xe}/panic: convert intel_panic_finish() to struct intel_panic

The intel_panic_finish() function really needs the struct intel_panic
pointer, not struct intel_framebuffer. Make it so.

Cc: Jocelyn Falempe <jfalempe@redhat.com>
Cc: Maarten Lankhorst <dev@lankhorst.se>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Reviewed-by: Jocelyn Falempe <jfalempe@redhat.com>
Link: https://lore.kernel.org/r/3fdbcbe17e0e90c4a590f2a2486a9ec79a90cf62.1756835342.git.jani.nikula@intel.com
2 months agodrm/{i915,xe}/panic: move framebuffer allocation where it belongs
Jani Nikula [Tue, 2 Sep 2025 17:51:52 +0000 (20:51 +0300)] 
drm/{i915,xe}/panic: move framebuffer allocation where it belongs

The struct intel_framebuffer allocation naturally belongs in intel_fb.c,
not hidden inside panic implementation. Separate the panic
allocation. Drop the unnecessary struct i915_framebuffer and struct
xe_framebuffer types.

Cc: Jocelyn Falempe <jfalempe@redhat.com>
Cc: Maarten Lankhorst <dev@lankhorst.se>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Reviewed-by: Jocelyn Falempe <jfalempe@redhat.com>
Link: https://lore.kernel.org/r/d29f63e0118d002fc8edd368caea7e8185418e17.1756835342.git.jani.nikula@intel.com
2 months agodrm/{i915,xe}/panic: rename struct {i915,xe}_panic_data to struct intel_panic
Jani Nikula [Tue, 2 Sep 2025 17:51:51 +0000 (20:51 +0300)] 
drm/{i915,xe}/panic: rename struct {i915,xe}_panic_data to struct intel_panic

Prepare for better shared interfaces between panic implementations. The
struct intel_panic remains an opaque data type, with unique
implementations in i915 and xe.

This allows us to change the panic data pointer from void * to struct
intel_panic *, helping type safety.

Cc: Jocelyn Falempe <jfalempe@redhat.com>
Cc: Maarten Lankhorst <dev@lankhorst.se>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Reviewed-by: Jocelyn Falempe <jfalempe@redhat.com>
Link: https://lore.kernel.org/r/884ffc80c8b5fef1b92956e644a4e559560cc2ba.1756835342.git.jani.nikula@intel.com
2 months agodrm/{i915,xe}/fb: add panic pointer member to struct intel_framebuffer
Jani Nikula [Tue, 2 Sep 2025 17:51:50 +0000 (20:51 +0300)] 
drm/{i915,xe}/fb: add panic pointer member to struct intel_framebuffer

Add a panic data pointer member in struct intel_framebuffer in
preparation for breaking the artificial subclassing between
intel_framebuffer and panic structures.

Cc: Jocelyn Falempe <jfalempe@redhat.com>
Cc: Maarten Lankhorst <dev@lankhorst.se>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Reviewed-by: Jocelyn Falempe <jfalempe@redhat.com>
Link: https://lore.kernel.org/r/41f42e1de8545409274d54854aa12e0fb390e394.1756835342.git.jani.nikula@intel.com
2 months agodrm/{i915,xe}/panic: rename intel_bo_panic_*() to intel_panic_*()
Jani Nikula [Tue, 2 Sep 2025 17:51:49 +0000 (20:51 +0300)] 
drm/{i915,xe}/panic: rename intel_bo_panic_*() to intel_panic_*()

Rename the intel_bo_panic_*() functions according to the functionality,
dropping the misleading intel_bo reference.

Keep intel_bo_alloc_framebuffer() for now; it'll be refactored later.

Cc: Jocelyn Falempe <jfalempe@redhat.com>
Cc: Maarten Lankhorst <dev@lankhorst.se>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Reviewed-by: Jocelyn Falempe <jfalempe@redhat.com>
Link: https://lore.kernel.org/r/a3be8f8b5e7dd208027a1131e89452d9a214054f.1756835342.git.jani.nikula@intel.com
2 months agodrm/{i915,xe}/panic: split out intel_panic.[ch]
Jani Nikula [Tue, 2 Sep 2025 17:51:48 +0000 (20:51 +0300)] 
drm/{i915,xe}/panic: split out intel_panic.[ch]

intel_bo.[ch] is not the appropriate location for the panic
functionality. Split out intel_panic.[ch] and xe_panic.c in i915 and
xe. Keep the function names for now.

Cc: Jocelyn Falempe <jfalempe@redhat.com>
Cc: Maarten Lankhorst <dev@lankhorst.se>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Reviewed-by: Jocelyn Falempe <jfalempe@redhat.com>
Link: https://lore.kernel.org/r/d98b831a011a028ffd33ce99b0ba62be061ee235.1756835342.git.jani.nikula@intel.com
2 months agodrm/i915/fb: add intel_framebuffer_alloc()
Jani Nikula [Tue, 2 Sep 2025 17:51:47 +0000 (20:51 +0300)] 
drm/i915/fb: add intel_framebuffer_alloc()

Add intel_framebuffer_alloc() to hide intel_bo_alloc_framebuffer(), as
that doesn't feel like the correct abstraction.

Cc: Jocelyn Falempe <jfalempe@redhat.com>
Cc: Maarten Lankhorst <dev@lankhorst.se>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Reviewed-by: Jocelyn Falempe <jfalempe@redhat.com>
Link: https://lore.kernel.org/r/379c306c692c50f6af3b6f2488c213f12627954f.1756835342.git.jani.nikula@intel.com
2 months agodrm/i915/display: Remove FBC modulo 4 restriction for ADL-P+
Uma Shankar [Thu, 4 Sep 2025 09:53:38 +0000 (15:23 +0530)] 
drm/i915/display: Remove FBC modulo 4 restriction for ADL-P+

WA:22010751166 does not apply past display version 12.  Or, in
other words, the FBC restriction where FBC is disabled for
non-modulo 4 plane sizes (including plane size + yoffset) is fixed
from display version 13 and onwards. Relax the restriction for the same.

v4: Dropped redundant commit message

v3: Update comments for clarity (Jonathan Cavitt)

v2: Update the macro for display version check (Vinod)

Suggested-by: Vidya Srinivas <vidya.srinivas@intel.com>
Signed-off-by: Uma Shankar <uma.shankar@intel.com>
Reviewed-by: Vinod Govindapillai <vinod.govindapillai@intel.com>
Reviewed-by: Jonathan Cavitt <jonathan.cavitt@intel.com>
Link: https://lore.kernel.org/r/20250904095338.300813-2-uma.shankar@intel.com
2 months agodrm/i915/gvt: Remove redundant ternary operators
Liao Yuanhong [Thu, 4 Sep 2025 11:26:40 +0000 (19:26 +0800)] 
drm/i915/gvt: Remove redundant ternary operators

For ternary operators in the form of "a ? false : true", if 'a' itself
returns a boolean result, the ternary operator can be omitted. Remove
redundant ternary operators to clean up the code.

Signed-off-by: Liao Yuanhong <liaoyuanhong@vivo.com>
Link: https://lore.kernel.org/r/20250904112644.350512-1-liaoyuanhong@vivo.com
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
2 months agodrm/i915/ddi: abstract figuring out encoder name
Jani Nikula [Wed, 3 Sep 2025 10:10:50 +0000 (13:10 +0300)] 
drm/i915/ddi: abstract figuring out encoder name

The encoder name deduction has become a bit cumbersome within
intel_ddi_init(). Split it out to a separate function to declutter
intel_ddi_init(), even if that means having to use a temp seq buffer for
the name.

Cc: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
Reviewed-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
Link: https://lore.kernel.org/r/20250903101050.3671305-1-jani.nikula@intel.com
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
2 months agodrm/i915/power: fix size for for_each_set_bit() in abox iteration
Jani Nikula [Fri, 5 Sep 2025 10:41:49 +0000 (13:41 +0300)] 
drm/i915/power: fix size for for_each_set_bit() in abox iteration

for_each_set_bit() expects size to be in bits, not bytes. The abox mask
iteration uses bytes, but it works by coincidence, because the local
variable holding the mask is unsigned long, and the mask only ever has
bit 2 as the highest bit. Using a smaller type could lead to subtle and
very hard to track bugs.

Fixes: 62afef2811e4 ("drm/i915/rkl: RKL uses ABOX0 for pixel transfers")
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Cc: Matt Roper <matthew.d.roper@intel.com>
Cc: stable@vger.kernel.org # v5.9+
Reviewed-by: Matt Roper <matthew.d.roper@intel.com>
Link: https://lore.kernel.org/r/20250905104149.1144751-1-jani.nikula@intel.com
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
2 months agodrm/i915/psr: Panel Replay SU cap dpcd read return value
Jouni Högander [Wed, 27 Aug 2025 06:08:09 +0000 (09:08 +0300)] 
drm/i915/psr: Panel Replay SU cap dpcd read return value

Currently return value of drm_dpcd_readb is not checked when reading sink
Panel Replay Selective Update capabilities.

Fix this and switch to drm_dpcd_read_byte.

Signed-off-by: Jouni Högander <jouni.hogander@intel.com>
Reviewed-by: Mika Kahola <mika.kahola@intel.com>
Reviewed-by: Michał Grzelak <michal.grzelak@intel.com>
Link: https://lore.kernel.org/r/20250827060809.2461725-1-jouni.hogander@intel.com
2 months agodrm/i915/psr: Add poll for checking PSR is idle before starting update
Jouni Högander [Fri, 5 Sep 2025 07:27:08 +0000 (10:27 +0300)] 
drm/i915/psr: Add poll for checking PSR is idle before starting update

We are currently observing crc failures after we started using dsb for PSR
updates as well. This seems to happen because PSR HW is still sending
couple of updates using old framebuffers on wake-up.

Fix this by adding poll ensuring PSR is idle before starting update.

v2: pass new_crtc_state->dsb_commit to intel_psr_wait_for_idle_dsb

Signed-off-by: Jouni Högander <jouni.hogander@intel.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://lore.kernel.org/r/20250905072708.2659411-5-jouni.hogander@intel.com
2 months agodrm/i915/psr: New interface adding PSR idle poll into dsb commit
Jouni Högander [Fri, 5 Sep 2025 07:27:07 +0000 (10:27 +0300)] 
drm/i915/psr: New interface adding PSR idle poll into dsb commit

We are currently observing crc failures after we started using dsb for PSR
updates as well. This seems to happen because PSR HW is still sending
couple of updates using old framebuffers on wake-up.

This patch is preparing to fix that by adding interface which can be used
to add poll ensuring PSR HW is idle into dsb commit.

v3: add intel_dsb as a parameter to intel_psr_wait_for_idle_dsb
v2: add pass crtc_state->dsb_commit as parameter

Signed-off-by: Jouni Högander <jouni.hogander@intel.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://lore.kernel.org/r/20250905072708.2659411-4-jouni.hogander@intel.com
2 months agodrm/i915/psr: Add new define for PSR idle timeout
Jouni Högander [Fri, 5 Sep 2025 07:27:06 +0000 (10:27 +0300)] 
drm/i915/psr: Add new define for PSR idle timeout

Currently we are using value 50ms as timeout for waiting PSR to idle. Add
own define for this purpose.

Signed-off-by: Jouni Högander <jouni.hogander@intel.com>
Reviewed-by: Mika Kahola <mika.kahola@intel.com>
Link: https://lore.kernel.org/r/20250905072708.2659411-3-jouni.hogander@intel.com
2 months agodrm/i915/psr: Pass intel_crtc_state instead of intel_dp in wait_for_idle
Jouni Högander [Fri, 5 Sep 2025 07:27:05 +0000 (10:27 +0300)] 
drm/i915/psr: Pass intel_crtc_state instead of intel_dp in wait_for_idle

This is preparation to add own function for polling PSR being ready for
update when doing dsb commit.

Signed-off-by: Jouni Högander <jouni.hogander@intel.com>
Reviewed-by: Mika Kahola <mika.kahola@intel.com>
Link: https://lore.kernel.org/r/20250905072708.2659411-2-jouni.hogander@intel.com
2 months agodrm/i915/display: Avoid divide by zero
Juha-Pekka Heikkila [Fri, 5 Sep 2025 10:46:26 +0000 (13:46 +0300)] 
drm/i915/display: Avoid divide by zero

skl_crtc_allocate_plane_ddb allow iter.data_rate to be zero
which could cause divide by zero in skl_allocate_plane_ddb,
check against that.

Signed-off-by: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
Reviewed-by: Suraj Kandpal <suraj.kandpal@intel.com>
Signed-off-by: Mika Kahola <mika.kahola@intel.com>
Link: https://lore.kernel.org/r/20250905104626.1274147-3-juhapekka.heikkila@gmail.com
2 months agodrm/i915/display: log fail from intel_sdvo_enable_hotplug
Juha-Pekka Heikkila [Fri, 5 Sep 2025 10:46:25 +0000 (13:46 +0300)] 
drm/i915/display: log fail from intel_sdvo_enable_hotplug

Report in log if intel_sdvo_enable_hotplug failed

Signed-off-by: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
Reviewed-by: Suraj Kandpal <suraj.kandpal@intel.com>
Signed-off-by: Mika Kahola <mika.kahola@intel.com>
Link: https://lore.kernel.org/r/20250905104626.1274147-2-juhapekka.heikkila@gmail.com
2 months agodrm/i915/display: take out dead code
Juha-Pekka Heikkila [Fri, 5 Sep 2025 10:46:24 +0000 (13:46 +0300)] 
drm/i915/display: take out dead code

if __waitfor timeout, ret will have -ETIMEDOUT. Then if condition
was met, and read_ret will have error that's handled.
Then if ret was zero, read_ret was zero ksv_ready must have value.

Signed-off-by: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Mika Kahola <mika.kahola@intel.com>
Link: https://lore.kernel.org/r/20250905104626.1274147-1-juhapekka.heikkila@gmail.com
2 months agodrm/i915/dram: Print memory details even if something went wrong
Ville Syrjälä [Tue, 2 Sep 2025 13:31:13 +0000 (16:31 +0300)] 
drm/i915/dram: Print memory details even if something went wrong

Print the memory details even if the detection failed in some way
but we continued the driver initialization anyway. It'll be easier
to debug issues if we at least know what the final results were.

And while at it also print the number of PSF GV points. Previously
we only printed the QGV points.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20250902133113.18778-9-ville.syrjala@linux.intel.com
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
2 months agodrm/i915/dram: Don't call skl_get_dram_info()/skl_get_dram_type() on icl
Ville Syrjälä [Tue, 2 Sep 2025 13:31:12 +0000 (16:31 +0300)] 
drm/i915/dram: Don't call skl_get_dram_info()/skl_get_dram_type() on icl

Currently the icl codepaths first determine the memory type from the
memory controller registers (via skl_get_dram_info()->skl_get_dram_type())
and then overwrite the results with icl_pcode_read_mem_global_info().
Get rid of the pointless (and potentially incorrect) skl_get_dram_type()
stuff.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20250902133113.18778-8-ville.syrjala@linux.intel.com
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
2 months agodrm/i915/dram: Fix some spelling around the 16Gb DIMM w/a
Ville Syrjälä [Tue, 2 Sep 2025 13:31:11 +0000 (16:31 +0300)] 
drm/i915/dram: Fix some spelling around the 16Gb DIMM w/a

Use consistent spelling when talking about the 16Gb DIMM w/a.

Even currently language is a bit off as the w/a is actually
about DIMMs with 16Gb DRAM devices on them, not the total capacity
of the whole DIMM. But this language does more or less match how
Bspec talks about this stuff.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20250902133113.18778-7-ville.syrjala@linux.intel.com
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
2 months agodrm/i915/dram: Move 16Gb DIMM detection fully to the skl/icl codepaths
Ville Syrjälä [Tue, 2 Sep 2025 13:31:10 +0000 (16:31 +0300)] 
drm/i915/dram: Move 16Gb DIMM detection fully to the skl/icl codepaths

We are incorrectly applying the 16Gb DIMM w/a (adding 1 extra
usec to WM0 latency) on MTL+ even though the w/a is only needed
for SKL/ICL.

The current way of setting this is up is a bit of a disaster:
1. always set has_16gb_dimms=true for all platforms except BXT/GLK
2. has_16gb_dimms potentially gets overwritten with something else
 * BXT/GLK don't do anything since we never set has_16gb_dimms to
   begin with
 * skl_get_dram_info() overwrites has_16gb_dimms with the actual
   detection results for SKL/ICL/derivatives
 * gen12_get_dram_info() (correctly) resets has_16gb_dimms
   for TGL/ADL/derivatives
 * xelpdp_get_dram_info() doesn't do anything, leaving
   has_16gb_dimms incorrectly set for MTL+

Clean up the whole mess by only setting has_16gb_dimms in the
SKL/ICL codepaths where we have the actual detection code for
it. This avois applying the w/a incorrectly on MTL+.

v2: Rewrite commit msg (Jani)

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20250902133113.18778-6-ville.syrjala@linux.intel.com
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
2 months agodrm/i915/dram: s/wm_lv0.../has_16gb_dimms/
Ville Syrjälä [Tue, 2 Sep 2025 13:31:09 +0000 (16:31 +0300)] 
drm/i915/dram: s/wm_lv0.../has_16gb_dimms/

The DRAM code shouldn't know anything about watermarks. Rename
wm_lv_0_adjust_needed to has_16gb_dimms. How this gets used is
up to the watermark code.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20250902133113.18778-5-ville.syrjala@linux.intel.com
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
2 months agodrm/i915/dram: Pack dram_info better
Ville Syrjälä [Tue, 2 Sep 2025 13:31:08 +0000 (16:31 +0300)] 
drm/i915/dram: Pack dram_info better

struct dram_info has two holes in the middle. Shuffle things
around to plug them.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20250902133113.18778-4-ville.syrjala@linux.intel.com
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
2 months agodrm/i915/dram: Use intel_dram_type_str() for pnv
Ville Syrjälä [Tue, 2 Sep 2025 13:31:07 +0000 (16:31 +0300)] 
drm/i915/dram: Use intel_dram_type_str() for pnv

Replace the hand rolled PNV memory type printk string
stuff with intel_dram_type_str().

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20250902133113.18778-3-ville.syrjala@linux.intel.com
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
2 months agodrm/i915/dram: Populate PNV memory type accurately
Ville Syrjälä [Tue, 2 Sep 2025 13:31:06 +0000 (16:31 +0300)] 
drm/i915/dram: Populate PNV memory type accurately

If PNV doesn't have DDR3 then it has DDR2. Add the appropriate memory
type for it.

No functional change since we currently only care about the
DDR3 vs. not difference.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20250902133113.18778-2-ville.syrjala@linux.intel.com
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
2 months agodrm/i915/hpd: Fix mtp_tc_hpd_enable_detection()
Ville Syrjälä [Tue, 2 Sep 2025 15:39:15 +0000 (18:39 +0300)] 
drm/i915/hpd: Fix mtp_tc_hpd_enable_detection()

Set the MTP TC hotplug bits in the correct register.

Shouldn't matter really as this only gets used for eDP
detection and there should be never eDP on TC ports on
current hw.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20250902153915.4423-1-ville.syrjala@linux.intel.com
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
2 months agodrm/i915/display: Remove power state verification before HW readout
Imre Deak [Wed, 3 Sep 2025 12:21:52 +0000 (15:21 +0300)] 
drm/i915/display: Remove power state verification before HW readout

During system resume the display power state verification will print the

"power well x state mismatch (refcount 0/enabled 1)"

error message from the early resume sequence for a power well left
enabled by BIOS. This power well was probably left enabled by BIOS
inadvertently, since BIOS versions on current platforms do not leave any
display output enabled while resuming from an Sx power state, hence the
enabled display power well is unused. In theory however it is possible
that BIOS leaves a display output enabled, in that case the enabled
power well shouldn't be reported as an error.

According to the above, remove the display power state verification from
the early resume phase to avoid incorrectly reporting an enabled power
well without a power reference as an error.

Note: The refcount for any enabled and used power well (i.e. used for an
enabled display output) will be acquired following the early resume
sequence, after the HW state for display outputs (encoder/crtc etc.) is
read out. Any power well enabled but not used (hence not holding a
reference) will be disabled after the HW state readout. The display
power state will be verified afterwards in intel_power_domains_enable().

Closes: https://gitlab.freedesktop.org/drm/xe/kernel/-/issues/6012
Reviewed-by: Mika Kahola <mika.kahola@intel.com>
Signed-off-by: Imre Deak <imre.deak@intel.com>
Link: https://lore.kernel.org/r/20250903122152.2526050-1-imre.deak@intel.com
2 months agodrm/i915/alpm: Use actual lfps cycle and silence periods in wake time
Jouni Högander [Fri, 29 Aug 2025 05:39:28 +0000 (08:39 +0300)] 
drm/i915/alpm: Use actual lfps cycle and silence periods in wake time

Currently we are using maximum lfps cycle and silence period times when
calculating AUXLess wake time. Use actual values instead.

Signed-off-by: Jouni Högander <jouni.hogander@intel.com>
Reviewed-by: Animesh Manna <animesh.manna@intel.com>
Link: https://lore.kernel.org/r/20250829053929.3585636-5-jouni.hogander@intel.com
2 months agodrm/i915/alpm: Replace hardcoded LFPS cycle with proper calculation
Jouni Högander [Fri, 29 Aug 2025 05:39:27 +0000 (08:39 +0300)] 
drm/i915/alpm: Replace hardcoded LFPS cycle with proper calculation

Currently LFPS is hadcoded for different port clocks. Replace this with
proper calculation.

v2: replace hardcoded 20 with 2 * LFPS_CYCLE_COUNT

Signed-off-by: Jouni Högander <jouni.hogander@intel.com>
Reviewed-by: Animesh Manna <animesh.manna@intel.com>
Link: https://lore.kernel.org/r/20250829053929.3585636-4-jouni.hogander@intel.com
2 months agodrm/i915/alpm: Add own define for LFPS count
Jouni Högander [Fri, 29 Aug 2025 05:39:26 +0000 (08:39 +0300)] 
drm/i915/alpm: Add own define for LFPS count

Add own define for LFPS count and use it for the configuration. This new
define will be used for calculating ALPM parameters as well.

Signed-off-by: Jouni Högander <jouni.hogander@intel.com>
Reviewed-by: Animesh Manna <animesh.manna@intel.com>
Link: https://lore.kernel.org/r/20250829053929.3585636-3-jouni.hogander@intel.com
2 months agodrm/i915/alpm: Calculate silence period
Jouni Högander [Fri, 29 Aug 2025 05:39:25 +0000 (08:39 +0300)] 
drm/i915/alpm: Calculate silence period

Calculate silence period instead of hardcoding it in switch case.

Signed-off-by: Jouni Högander <jouni.hogander@intel.com>
Reviewed-by: Animesh Manna <animesh.manna@intel.com>
Link: https://lore.kernel.org/r/20250829053929.3585636-2-jouni.hogander@intel.com
3 months agodrm/i915/pps: prefer poll_timeout_us() over read_poll_timeout()
Jani Nikula [Thu, 28 Aug 2025 12:21:02 +0000 (15:21 +0300)] 
drm/i915/pps: prefer poll_timeout_us() over read_poll_timeout()

Unify on using poll_timeout_us() throughout instead of mixing with
readx_poll_timeout().

Reviewed-by: Jouni Högander <jouni.hogander@intel.com>
Link: https://lore.kernel.org/r/260fd455df743453f123d96fc01e7ca96a36f0fa.1756383233.git.jani.nikula@intel.com
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
3 months agodrm/i915/ddi: prefer poll_timeout_us() over readx_poll_timeout()
Jani Nikula [Thu, 28 Aug 2025 12:21:01 +0000 (15:21 +0300)] 
drm/i915/ddi: prefer poll_timeout_us() over readx_poll_timeout()

Unify on using poll_timeout_us() throughout instead of mixing with
readx_poll_timeout(). While the latter can be ever so slightly simpler,
they are both complicated enough that it's better to unify on one
approach only.

While at it, better separate the handling of error returns from
drm_dp_dpcd_readb() and the actual status byte. This is best achieved by
inlining the read_fec_detected_status() function, and switching to
drm_dp_dpcd_read_byte().

v2: Use drm_dp_dpcd_read_byte() (Imre)

Cc: Imre Deak <imre.deak@intel.com>
Reviewed-by: Jouni Högander <jouni.hogander@intel.com>
Link: https://lore.kernel.org/r/63b10a36c7ab545c640b24bc8fc007ce2ea74623.1756383233.git.jani.nikula@intel.com
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
3 months agodrm/i915/opregion: use generic poll_timeout_us() instead of wait_for()
Jani Nikula [Thu, 28 Aug 2025 12:21:00 +0000 (15:21 +0300)] 
drm/i915/opregion: use generic poll_timeout_us() instead of wait_for()

Prefer generic poll helpers over i915 custom helpers.

The functional change is losing the exponentially growing sleep of
wait_for(), which used to be 10, 20, 40, ..., 640, and 1280 us.

Use an arbitrary constant 1 ms sleep instead. The timeout remains, being
opregion defined, 50 ms by default, and 1500 ms at most.

Reviewed-by: Jouni Högander <jouni.hogander@intel.com>
Link: https://lore.kernel.org/r/63db3a1e1db9e55a18ed322c55f2dffe511a10bb.1756383233.git.jani.nikula@intel.com
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
3 months agodrm/i915/lspcon: use generic poll_timeout_us() instead of wait_for()
Jani Nikula [Thu, 28 Aug 2025 12:20:59 +0000 (15:20 +0300)] 
drm/i915/lspcon: use generic poll_timeout_us() instead of wait_for()

Prefer generic poll helpers over i915 custom helpers.

The functional change is losing the exponentially growing sleep of
wait_for(), which used to be 10, 20, 40, ..., 640, and 1280 us.

Use an arbitrary constant 5 ms sleep instead. The timeouts remain, being
400 ms or 800 ms, depending on the case.

Reviewed-by: Jouni Högander <jouni.hogander@intel.com>
Link: https://lore.kernel.org/r/4065fa96c0ef6afd51a384f365761d2ca802256b.1756383233.git.jani.nikula@intel.com
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
3 months agodrm/i915/dsb: use generic poll_timeout_us() instead of wait_for()
Jani Nikula [Thu, 28 Aug 2025 12:20:58 +0000 (15:20 +0300)] 
drm/i915/dsb: use generic poll_timeout_us() instead of wait_for()

Prefer generic poll helpers over i915 custom helpers.

The functional change is losing the exponentially growing sleep of
wait_for(), which used to be 10, 20, 40, ..., 640, and 1280 us.

Use an arbitrary constant 100 us sleep instead. The timeout remains at 1
ms.

Reviewed-by: Jouni Högander <jouni.hogander@intel.com>
Link: https://lore.kernel.org/r/979eae02af1184b3756746ace61379dd1947a79b.1756383233.git.jani.nikula@intel.com
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
3 months agodrm/i915/tc: use generic poll_timeout_us() instead of wait_for()
Jani Nikula [Thu, 28 Aug 2025 12:20:57 +0000 (15:20 +0300)] 
drm/i915/tc: use generic poll_timeout_us() instead of wait_for()

Prefer generic poll helpers over i915 custom helpers.

The functional change is losing the exponentially growing sleep of
wait_for(), which used to be 10, 20, 40, ..., 640, and 1280 us.

Use an arbitrary constant 200 us sleep for the 5 ms timeout, and 1000 us
sleep for the 500 ms timeout. The timeouts remain the same.

Reviewed-by: Jouni Högander <jouni.hogander@intel.com>
Link: https://lore.kernel.org/r/50cd06b61210f541d5bb52a36af2d8bf059dd3a1.1756383233.git.jani.nikula@intel.com
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
3 months agodrm/i915/vblank: use generic poll_timeout_us() instead of wait_for()
Jani Nikula [Thu, 28 Aug 2025 12:20:56 +0000 (15:20 +0300)] 
drm/i915/vblank: use generic poll_timeout_us() instead of wait_for()

Prefer generic poll helpers over i915 custom helpers.

The functional change is losing the exponentially growing sleep of
wait_for(), which used to be 10, 20, 40, ..., 640, and 1280 us.

Use an arbitrary constant 500 us sleep instead. The timeout remains at
100 ms.

Reviewed-by: Jouni Högander <jouni.hogander@intel.com>
Link: https://lore.kernel.org/r/162dff5862d3213304491a6d2eb31a57346b523e.1756383233.git.jani.nikula@intel.com
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
3 months agodrm/i915/dp: use generic poll_timeout_us() instead of wait_for() in link training
Jani Nikula [Thu, 28 Aug 2025 12:20:55 +0000 (15:20 +0300)] 
drm/i915/dp: use generic poll_timeout_us() instead of wait_for() in link training

Prefer generic poll helpers over i915 custom helpers.

The functional change is losing the exponentially growing sleep of
wait_for(), which used to be 10, 20, 40, ..., 640, and 1280 us.

Use an arbitrary constant 500 us sleep instead. The timeout remains at
500 ms.

Reviewed-by: Jouni Högander <jouni.hogander@intel.com>
Link: https://lore.kernel.org/r/29ab4738758fe844dc1323c4a59d5d6bdcf87308.1756383233.git.jani.nikula@intel.com
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
3 months agodrm/i915/dp: use generic poll_timeout_us() instead of wait_for()
Jani Nikula [Thu, 28 Aug 2025 12:20:54 +0000 (15:20 +0300)] 
drm/i915/dp: use generic poll_timeout_us() instead of wait_for()

Prefer generic poll helpers over i915 custom helpers.

The functional change is losing the exponentially growing sleep of
wait_for(), which used to be 10, 20, 40, ..., 640, and 1280 us.

Use an arbitrary constant 1 ms sleep instead. The timeouts remain, being
500 ms or 1000 ms depending on the case.

Reviewed-by: Jouni Högander <jouni.hogander@intel.com>
Link: https://lore.kernel.org/r/83d3417d4e5af1db13eb4c6eaa48b5f9c12caeb4.1756383233.git.jani.nikula@intel.com
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
3 months agodrm/i915/power-well: use generic poll_timeout_us() instead of wait_for() for VLV/CHV
Jani Nikula [Thu, 28 Aug 2025 12:20:53 +0000 (15:20 +0300)] 
drm/i915/power-well: use generic poll_timeout_us() instead of wait_for() for VLV/CHV

Prefer generic poll helpers over i915 custom helpers.

The functional change is losing the exponentially growing sleep of
wait_for(), which used to be 10, 20, 40, ..., 640, and 1280 us.

Use an arbitrary constant 500 us sleep instead. The timeout remains at
100 ms.

Reviewed-by: Jouni Högander <jouni.hogander@intel.com>
Link: https://lore.kernel.org/r/c644b7b5611a3c047ea5d3d52acd91830b2fa6b4.1756383233.git.jani.nikula@intel.com
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
3 months agodrm/i915/power-well: use generic poll_timeout_us() instead of wait_for() for DKL PHY
Jani Nikula [Thu, 28 Aug 2025 12:20:52 +0000 (15:20 +0300)] 
drm/i915/power-well: use generic poll_timeout_us() instead of wait_for() for DKL PHY

Prefer generic poll helpers over i915 custom helpers.

The functional change is losing the exponentially growing sleep of
wait_for(), which used to be 10, 20, 40, ..., 640, and 1280 us.

Use an arbitrary constant 100 us sleep instead. The timeout remains at 1
ms.

Reviewed-by: Jouni Högander <jouni.hogander@intel.com>
Link: https://lore.kernel.org/r/663c9edf4a98b09121d7200f8d734ebc829da85b.1756383233.git.jani.nikula@intel.com
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
3 months agodrm/i915/power: use generic poll_timeout_us() instead of wait_for()
Jani Nikula [Thu, 28 Aug 2025 12:20:51 +0000 (15:20 +0300)] 
drm/i915/power: use generic poll_timeout_us() instead of wait_for()

Prefer generic poll helpers over i915 custom helpers.

The functional change is losing the exponentially growing sleep of
wait_for(), which used to be 10, 20, 40, ..., 640, and 1280 us.

Use an arbitrary constant 100 us sleep instead. The timeout remains at 1
ms.

Reviewed-by: Jouni Högander <jouni.hogander@intel.com>
Link: https://lore.kernel.org/r/900680516b047ae32e3298b5cdbcede0393e0466.1756383233.git.jani.nikula@intel.com
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
3 months agodrm/i915/cdclk: use generic poll_timeout_us() instead of wait_for()
Jani Nikula [Thu, 28 Aug 2025 12:20:50 +0000 (15:20 +0300)] 
drm/i915/cdclk: use generic poll_timeout_us() instead of wait_for()

Prefer generic poll helpers over i915 custom helpers.

The functional change is losing the exponentially growing sleep of
wait_for(), which used to be 10, 20, 40, ..., 640, and 1280 us.

Use an arbitrary constant 500 us sleep instead. The timeout remains at
50 ms.

Reviewed-by: Jouni Högander <jouni.hogander@intel.com>
Link: https://lore.kernel.org/r/6d50031411d5517508867d4b595ce90a2b44073b.1756383233.git.jani.nikula@intel.com
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
3 months agodrm/i915/wm: use generic poll_timeout_us() instead of wait_for()
Jani Nikula [Thu, 28 Aug 2025 12:20:49 +0000 (15:20 +0300)] 
drm/i915/wm: use generic poll_timeout_us() instead of wait_for()

Prefer generic poll helpers over i915 custom helpers.

The functional change is losing the exponentially growing sleep of
wait_for(), which used to be 10, 20, 40, ..., 640, and 1280 us.

Use an arbitrary constant 500 us sleep instead. The timeout remains at 3
ms.

Reviewed-by: Jouni Högander <jouni.hogander@intel.com>
Link: https://lore.kernel.org/r/52c80860ea7b98e84f2386ed6cdd761f03190b1e.1756383233.git.jani.nikula@intel.com
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
3 months agodrm/i915/gmbus: use generic poll_timeout*() instead of wait_for*()
Jani Nikula [Thu, 28 Aug 2025 12:20:48 +0000 (15:20 +0300)] 
drm/i915/gmbus: use generic poll_timeout*() instead of wait_for*()

Prefer generic poll helpers over i915 custom helpers.

The "two tier" wait_for_us() + wait_for() combination appeared without
much explanation in commit 4e6c2d58ba86 ("drm/i915: Take forcewake once
for the entire GMBUS transaction"). Try to mimic roughly the same with
the generic helpers.

wait_for_us() with 10 us or shorter timeouts ends up in
_wait_for_atomic(). Thus use poll_timeout_us_atomic() for the first try,
with the same 2 us timeout and no sleep.

For the fallback, the functional change is losing the exponentially
growing sleep of wait_for(), which used to be 10, 20, 40, ..., 640, and
1280 us. Use an arbitrary constant 500 us sleep instead. The timeout
remains at 50 ms.

Reviewed-by: Jouni Högander <jouni.hogander@intel.com>
Link: https://lore.kernel.org/r/564b397352c53a1116519fb2d53050c0426bc0dc.1756383233.git.jani.nikula@intel.com
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
3 months agodrm/i915/dsi-pll: use generic poll_timeout_us() instead of wait_for()
Jani Nikula [Thu, 28 Aug 2025 12:20:47 +0000 (15:20 +0300)] 
drm/i915/dsi-pll: use generic poll_timeout_us() instead of wait_for()

Prefer generic poll helpers over i915 custom helpers.

The functional change is losing the exponentially growing sleep of
wait_for(), which used to be 10, 20, 40, ..., 640, and 1280 us.

Use an arbitrary constant 500 us sleep instead. The timeout remains at
20 ms.

Reviewed-by: Jouni Högander <jouni.hogander@intel.com>
Link: https://lore.kernel.org/r/476fcc5aad9e2ddbf6d8c14bd5ff5cbf071c5dca.1756383233.git.jani.nikula@intel.com
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
3 months agodrm/i915/dsi: use generic poll_timeout_us() instead of wait_for_us()
Jani Nikula [Thu, 28 Aug 2025 12:20:46 +0000 (15:20 +0300)] 
drm/i915/dsi: use generic poll_timeout_us() instead of wait_for_us()

Prefer generic poll helpers over i915 custom helpers.

The sleep and timeout remain the same as for wait_for_us().

Reviewed-by: Jouni Högander <jouni.hogander@intel.com>
Link: https://lore.kernel.org/r/02ebcd2864819b7eaf9cf455aa2b968980a2f671.1756383233.git.jani.nikula@intel.com
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
3 months agodrm/i915/hdcp: use generic poll_timeout_us() instead of wait_for()
Jani Nikula [Thu, 28 Aug 2025 12:20:45 +0000 (15:20 +0300)] 
drm/i915/hdcp: use generic poll_timeout_us() instead of wait_for()

Prefer generic poll helpers over i915 custom helpers.

The functional change is losing the exponentially growing sleep of
wait_for(), which used to be 10, 20, 40, ..., 640, and 1280 us.

Use an arbitrary constant 100 us sleep instead. The timeout remains at 1
ms.

While at it, use the last failing value for debug logging instead of
reading it again.

Reviewed-by: Jouni Högander <jouni.hogander@intel.com>
Link: https://lore.kernel.org/r/2871a07337401c25ef3df44073c5e78fedc45e8e.1756383233.git.jani.nikula@intel.com
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
3 months agodrm/i915/hdcp: use generic poll_timeout_us() instead of __wait_for()
Jani Nikula [Thu, 28 Aug 2025 12:20:44 +0000 (15:20 +0300)] 
drm/i915/hdcp: use generic poll_timeout_us() instead of __wait_for()

Prefer generic poll helpers over i915 custom helpers.

The functional change is losing the exponentially growing sleep of
__wait_for(), which used to be 1, 2, 4, ... 64, and 128 ms in this
particular case.

Use an arbitrary 100 ms sleep instead. The timeout remains at 5000 ms.

Cc: Suraj Kandpal <suraj.kandpal@intel.com>
Reviewed-by: Jouni Högander <jouni.hogander@intel.com>
Link: https://lore.kernel.org/r/bfc9f941ec1628830644f1419d606e3d085aaba0.1756383233.git.jani.nikula@intel.com
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
3 months agodrm/i915/hdmi: use generic poll_timeout_us() instead of __wait_for()
Jani Nikula [Thu, 28 Aug 2025 12:20:43 +0000 (15:20 +0300)] 
drm/i915/hdmi: use generic poll_timeout_us() instead of __wait_for()

Prefer generic poll helpers over i915 custom helpers.

The functional change is losing the exponentially growing sleep of
__wait_for(), which used to be 1, 2, 4, and 8 ms in this particular
case.

Use an arbitrary constant 4 ms sleep instead. The timeout remains,
varying between 20 ms and 3000 ms.

Cc: Suraj Kandpal <suraj.kandpal@intel.com>
Reviewed-by: Jouni Högander <jouni.hogander@intel.com>
Link: https://lore.kernel.org/r/fc3a67f9de0049f415a276bba1c11a4df97e01d6.1756383233.git.jani.nikula@intel.com
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
3 months agodrm/i915: use REG_BIT on FW_BLC_SELF_* macros
Luca Coelho [Wed, 27 Aug 2025 10:12:06 +0000 (13:12 +0300)] 
drm/i915: use REG_BIT on FW_BLC_SELF_* macros

Use REG_BIT() instead of open coding the shift in the FW_BLC_SELF_*
macro definitions to avoid potentially typing them as 'int'.

For example, this happens when we pass them to _MASKED_BIT_ENABLE(),
because of the typeof() construct there.  When we pass 1 << 15 (the
FW_BLC_SELF_EN macro), we get typeof(1 << 15), which is 'int'.  Then
the value becomes negative (-2147450880) and we try to assign it to a
'u32'.

In practice this is not a problem though, because when we try to
assign -2147450880 to the u32, that becomes 0x80008000, which was the
intended result.

Link: https://lore.kernel.org/intel-gfx/20250827111109.401604-1-luciano.coelho@intel.com/
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Reviewed-by: Andi Shyti <andi.shyti@linux.intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
3 months agodrm/i915/bios: Remove unnecessary checks of PSR idle frames in VBT binary
Jouni Högander [Mon, 1 Sep 2025 10:10:33 +0000 (13:10 +0300)] 
drm/i915/bios: Remove unnecessary checks of PSR idle frames in VBT binary

PSR idle frames in VBT binary is a 4 bits wide bitfield. Checking if it's
below 0 or over 15 doesn't make sense. Remove these checks.

Signed-off-by: Jouni Högander <jouni.hogander@intel.com>
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Link: https://lore.kernel.org/r/20250901101033.4176277-1-jouni.hogander@intel.com
3 months agodrm/i915/power: drop a couple of &i915->drm usages
Jani Nikula [Tue, 2 Sep 2025 14:49:29 +0000 (17:49 +0300)] 
drm/i915/power: drop a couple of &i915->drm usages

Switch from &i915->drm to display->drm.

Reviewed-by: Andi Shyti <andi.shyti@linux.intel.com>
Link: https://lore.kernel.org/r/20250902144929.3026700-1-jani.nikula@intel.com
Signed-off-by: Jani Nikula <jani.nikula@intel.com>