]> git.ipfire.org Git - thirdparty/linux.git/commit
drm/i915: Order OP vs. timeout correctly in __wait_for()
authorVille Syrjälä <ville.syrjala@linux.intel.com>
Fri, 13 Mar 2026 11:07:40 +0000 (13:07 +0200)
committerVille Syrjälä <ville.syrjala@linux.intel.com>
Thu, 19 Mar 2026 11:48:09 +0000 (13:48 +0200)
commita464bace0482aa9a83e9aa7beefbaf44cd58e6cf
tree063a39b5c94f0ca63add0e8759586ec3cb171e69
parent45c77d4bf8d4d15453d709b9b828e498898e0751
drm/i915: Order OP vs. timeout correctly in __wait_for()

Put the barrier() before the OP so that anything we read out in
OP and check in COND will actually be read out after the timeout
has been evaluated.

Currently the only place where we use OP is __intel_wait_for_register(),
but the use there is precisely susceptible to this reordering, assuming
the ktime_*() stuff itself doesn't act as a sufficient barrier:

__intel_wait_for_register(...)
{
...
ret = __wait_for(reg_value = intel_uncore_read_notrace(...),
   (reg_value & mask) == value, ...);
...
}

Cc: stable@vger.kernel.org
Fixes: 1c3c1dc66a96 ("drm/i915: Add compiler barrier to wait_for")
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patch.msgid.link/20260313110740.24620-1-ville.syrjala@linux.intel.com
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
drivers/gpu/drm/i915/i915_wait_util.h