From: "Hogander, Jouni" <jouni.hogander@intel.com>
To: "intel-xe@lists.freedesktop.org" <intel-xe@lists.freedesktop.org>,
"Nikula, Jani" <jani.nikula@intel.com>,
"intel-gfx@lists.freedesktop.org"
<intel-gfx@lists.freedesktop.org>
Cc: "ville.syrjala@linux.intel.com" <ville.syrjala@linux.intel.com>
Subject: Re: [PATCH 03/20] drm/i915/hdcp: use generic poll_timeout_us() instead of wait_for()
Date: Thu, 4 Sep 2025 04:14:57 +0000 [thread overview]
Message-ID: <fc6b73b68abd7bf1d190d48ef7a342cdc6f0efa5.camel@intel.com> (raw)
In-Reply-To: <2871a07337401c25ef3df44073c5e78fedc45e8e.1756383233.git.jani.nikula@intel.com>
On Thu, 2025-08-28 at 15:20 +0300, Jani Nikula wrote:
> 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.
>
> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
> ---
> drivers/gpu/drm/i915/display/intel_hdcp.c | 17 ++++++++++-------
> 1 file changed, 10 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/display/intel_hdcp.c
> b/drivers/gpu/drm/i915/display/intel_hdcp.c
> index 0c98e50501a6..d6a105959d26 100644
> --- a/drivers/gpu/drm/i915/display/intel_hdcp.c
> +++ b/drivers/gpu/drm/i915/display/intel_hdcp.c
> @@ -817,6 +817,7 @@ static int intel_hdcp_auth(struct intel_connector
> *connector)
> enum port port = dig_port->base.port;
> unsigned long r0_prime_gen_start;
> int ret, i, tries = 2;
> + u32 val;
> union {
> u32 reg[2];
> u8 shim[DRM_HDCP_AN_LEN];
> @@ -905,8 +906,10 @@ static int intel_hdcp_auth(struct
> intel_connector *connector)
> HDCP_CONF_AUTH_AND_ENC);
>
> /* Wait for R0 ready */
> - if (wait_for(intel_de_read(display, HDCP_STATUS(display,
> cpu_transcoder, port)) &
> - (HDCP_STATUS_R0_READY | HDCP_STATUS_ENC), 1)) {
> + ret = poll_timeout_us(val = intel_de_read(display,
> HDCP_STATUS(display, cpu_transcoder, port)),
> + val & (HDCP_STATUS_R0_READY |
> HDCP_STATUS_ENC),
> + 100, 1000, false);
> + if (ret) {
> drm_err(display->drm, "Timed out waiting for R0
> ready\n");
> return -ETIMEDOUT;
You can return ret here?
Anyways:
Reviewed-by: Jouni Högander <jouni.hogander@intel.com>
> }
> @@ -938,16 +941,16 @@ static int intel_hdcp_auth(struct
> intel_connector *connector)
> ri.reg);
>
> /* Wait for Ri prime match */
> - if (!wait_for(intel_de_read(display,
> HDCP_STATUS(display, cpu_transcoder, port)) &
> - (HDCP_STATUS_RI_MATCH |
> HDCP_STATUS_ENC), 1))
> + ret = poll_timeout_us(val = intel_de_read(display,
> HDCP_STATUS(display, cpu_transcoder, port)),
> + val & (HDCP_STATUS_RI_MATCH |
> HDCP_STATUS_ENC),
> + 100, 1000, false);
> + if (!ret)
> break;
> }
>
> if (i == tries) {
> drm_dbg_kms(display->drm,
> - "Timed out waiting for Ri prime match
> (%x)\n",
> - intel_de_read(display,
> - HDCP_STATUS(display,
> cpu_transcoder, port)));
> + "Timed out waiting for Ri prime match
> (%x)\n", val);
> return -ETIMEDOUT;
> }
>
next prev parent reply other threads:[~2025-09-04 4:15 UTC|newest]
Thread overview: 49+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-28 12:20 [PATCH 00/20] drm/i915/display: convert to generic poll_timeout_us() Jani Nikula
2025-08-28 12:20 ` [PATCH 01/20] drm/i915/hdmi: use generic poll_timeout_us() instead of __wait_for() Jani Nikula
2025-09-03 13:29 ` Hogander, Jouni
2025-09-04 11:26 ` Jani Nikula
2025-08-28 12:20 ` [PATCH 02/20] drm/i915/hdcp: " Jani Nikula
2025-09-03 13:42 ` Hogander, Jouni
2025-08-28 12:20 ` [PATCH 03/20] drm/i915/hdcp: use generic poll_timeout_us() instead of wait_for() Jani Nikula
2025-09-04 4:14 ` Hogander, Jouni [this message]
2025-08-28 12:20 ` [PATCH 04/20] drm/i915/dsi: use generic poll_timeout_us() instead of wait_for_us() Jani Nikula
2025-09-04 4:27 ` Hogander, Jouni
2025-08-28 12:20 ` [PATCH 05/20] drm/i915/dsi-pll: use generic poll_timeout_us() instead of wait_for() Jani Nikula
2025-09-04 4:34 ` Hogander, Jouni
2025-08-28 12:20 ` [PATCH 06/20] drm/i915/gmbus: use generic poll_timeout*() instead of wait_for*() Jani Nikula
2025-09-04 4:53 ` Hogander, Jouni
2025-08-28 12:20 ` [PATCH 07/20] drm/i915/wm: use generic poll_timeout_us() instead of wait_for() Jani Nikula
2025-09-04 5:01 ` Hogander, Jouni
2025-08-28 12:20 ` [PATCH 08/20] drm/i915/cdclk: " Jani Nikula
2025-09-04 5:45 ` Hogander, Jouni
2025-08-28 12:20 ` [PATCH 09/20] drm/i915/power: " Jani Nikula
2025-09-04 5:47 ` Hogander, Jouni
2025-08-28 12:20 ` [PATCH 10/20] drm/i915/power-well: use generic poll_timeout_us() instead of wait_for() for DKL PHY Jani Nikula
2025-09-04 5:48 ` Hogander, Jouni
2025-08-28 12:20 ` [PATCH 11/20] drm/i915/power-well: use generic poll_timeout_us() instead of wait_for() for VLV/CHV Jani Nikula
2025-09-04 5:54 ` Hogander, Jouni
2025-08-28 12:20 ` [PATCH 12/20] drm/i915/dp: use generic poll_timeout_us() instead of wait_for() Jani Nikula
2025-09-04 6:08 ` Hogander, Jouni
2025-08-28 12:20 ` [PATCH 13/20] drm/i915/dp: use generic poll_timeout_us() instead of wait_for() in link training Jani Nikula
2025-09-04 6:15 ` Hogander, Jouni
2025-08-28 12:20 ` [PATCH 14/20] drm/i915/vblank: use generic poll_timeout_us() instead of wait_for() Jani Nikula
2025-09-04 8:05 ` Hogander, Jouni
2025-08-28 12:20 ` [PATCH 15/20] drm/i915/tc: " Jani Nikula
2025-09-04 8:41 ` Hogander, Jouni
2025-08-28 12:20 ` [PATCH 16/20] drm/i915/dsb: " Jani Nikula
2025-09-04 8:42 ` Hogander, Jouni
2025-08-28 12:20 ` [PATCH 17/20] drm/i915/lspcon: " Jani Nikula
2025-09-04 8:47 ` Hogander, Jouni
2025-08-28 12:21 ` [PATCH 18/20] drm/i915/opregion: " Jani Nikula
2025-09-04 9:06 ` Hogander, Jouni
2025-08-28 12:21 ` [PATCH 19/20] drm/i915/ddi: prefer poll_timeout_us() over readx_poll_timeout() Jani Nikula
2025-09-04 9:19 ` Hogander, Jouni
2025-08-28 12:21 ` [PATCH 20/20] drm/i915/pps: prefer poll_timeout_us() over read_poll_timeout() Jani Nikula
2025-09-04 10:23 ` Hogander, Jouni
2025-08-28 15:48 ` ✗ CI.checkpatch: warning for drm/i915/display: convert to generic poll_timeout_us() Patchwork
2025-08-28 15:49 ` ✓ CI.KUnit: success " Patchwork
2025-08-28 16:05 ` ✗ CI.checksparse: warning " Patchwork
2025-08-28 16:29 ` ✓ Xe.CI.BAT: success " Patchwork
2025-08-28 17:44 ` ✓ i915.CI.BAT: " Patchwork
2025-08-28 21:01 ` ✓ Xe.CI.Full: " Patchwork
2025-08-29 0:27 ` ✗ i915.CI.Full: failure " Patchwork
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=fc6b73b68abd7bf1d190d48ef7a342cdc6f0efa5.camel@intel.com \
--to=jouni.hogander@intel.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=intel-xe@lists.freedesktop.org \
--cc=jani.nikula@intel.com \
--cc=ville.syrjala@linux.intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.