Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Matt Roper <matthew.d.roper@intel.com>
To: Suraj Kandpal <suraj.kandpal@intel.com>
Cc: <intel-xe@lists.freedesktop.org>,
	<intel-gfx@lists.freedesktop.org>, <jani.nikula@intel.com>
Subject: Re: [PATCH] drm/i915/hdcp: Handle HDCP Line Rekeying for HDCP 1.4
Date: Thu, 7 Nov 2024 13:44:19 -0800	[thread overview]
Message-ID: <20241107214419.GS4891@mdroper-desk1.amr.corp.intel.com> (raw)
In-Reply-To: <20241107022807.869744-1-suraj.kandpal@intel.com>

On Thu, Nov 07, 2024 at 07:58:08AM +0530, Suraj Kandpal wrote:
> TRANS_DDI_FUNC_CTL asks us to disable hdcp line rekeying when not in
> hdcp 2.2 and we are not using an hdmi transcoder and it need to be
> enabled when we are using an HDMI transcoder to enable HDCP 1.4.
> We use intel_de_rmw cycles to update TRANS_DDI_FUNC_CTL register so
> we cannot depend on the value being 0 by default everytime which calls
> for seprate handling of HDCP 1.4 case.
> 
> --v2
> -Use the exising function and modify it based on a bool rather than
> have a different function [Matt]
> 
> --v3
> -No need for kzalloc [Jani]
> 
> --v4
> -i915_reg_t should not be pointer [Jani]
> -use rekey_bit to ensure when writing to reg everything is initialized
> 
> Bspec: 69964, 50493, 50054
> Signed-off-by: Suraj Kandpal <suraj.kandpal@intel.com>

Reviewed-by: Matt Roper <matthew.d.roper@intel.com>

> ---
>  drivers/gpu/drm/i915/display/intel_hdcp.c | 37 ++++++++++++++---------
>  1 file changed, 22 insertions(+), 15 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_hdcp.c b/drivers/gpu/drm/i915/display/intel_hdcp.c
> index 4e937fbba4d2..dbcdd1777fa3 100644
> --- a/drivers/gpu/drm/i915/display/intel_hdcp.c
> +++ b/drivers/gpu/drm/i915/display/intel_hdcp.c
> @@ -32,27 +32,32 @@
>  #define HDCP2_LC_RETRY_CNT			3
>  
>  static void
> -intel_hdcp_disable_hdcp_line_rekeying(struct intel_encoder *encoder,
> -				      struct intel_hdcp *hdcp)
> +intel_hdcp_adjust_hdcp_line_rekeying(struct intel_encoder *encoder,
> +				     struct intel_hdcp *hdcp,
> +				     bool enable)
>  {
>  	struct intel_display *display = to_intel_display(encoder);
> +	i915_reg_t rekey_reg;
> +	u32 rekey_bit = 0;
>  
>  	/* Here we assume HDMI is in TMDS mode of operation */
>  	if (encoder->type != INTEL_OUTPUT_HDMI)
>  		return;
>  
> -	if (DISPLAY_VER(display) >= 30)
> -		intel_de_rmw(display,
> -			     TRANS_DDI_FUNC_CTL(display, hdcp->cpu_transcoder),
> -			     0, XE3_TRANS_DDI_HDCP_LINE_REKEY_DISABLE);
> -	else if (IS_DISPLAY_VERx100_STEP(display, 1401, STEP_B0, STEP_FOREVER) ||
> -		 IS_DISPLAY_VERx100_STEP(display, 2000, STEP_B0, STEP_FOREVER))
> -		intel_de_rmw(display,
> -			     TRANS_DDI_FUNC_CTL(display, hdcp->cpu_transcoder),
> -			     0, TRANS_DDI_HDCP_LINE_REKEY_DISABLE);
> -	else if (IS_DISPLAY_VERx100_STEP(display, 1400, STEP_D0, STEP_FOREVER))
> -		intel_de_rmw(display, MTL_CHICKEN_TRANS(hdcp->cpu_transcoder),
> -			     0, HDCP_LINE_REKEY_DISABLE);
> +	if (DISPLAY_VER(display) >= 30) {
> +		rekey_reg = TRANS_DDI_FUNC_CTL(display, hdcp->cpu_transcoder);
> +		rekey_bit = XE3_TRANS_DDI_HDCP_LINE_REKEY_DISABLE;
> +	} else if (IS_DISPLAY_VERx100_STEP(display, 1401, STEP_B0, STEP_FOREVER) ||
> +		   IS_DISPLAY_VERx100_STEP(display, 2000, STEP_B0, STEP_FOREVER)) {
> +		rekey_reg = TRANS_DDI_FUNC_CTL(display, hdcp->cpu_transcoder);
> +		rekey_bit = TRANS_DDI_HDCP_LINE_REKEY_DISABLE;
> +	} else if (IS_DISPLAY_VERx100_STEP(display, 1400, STEP_D0, STEP_FOREVER)) {
> +		rekey_reg = MTL_CHICKEN_TRANS(hdcp->cpu_transcoder);
> +		rekey_bit = HDCP_LINE_REKEY_DISABLE;
> +	}
> +
> +	if (rekey_bit)
> +		intel_de_rmw(display, rekey_reg, rekey_bit, enable ? 0 : rekey_bit);
>  }
>  
>  static int intel_conn_to_vcpi(struct intel_atomic_state *state,
> @@ -1049,6 +1054,8 @@ static int intel_hdcp1_enable(struct intel_connector *connector)
>  		return ret;
>  	}
>  
> +	intel_hdcp_adjust_hdcp_line_rekeying(connector->encoder, hdcp, true);
> +
>  	/* Incase of authentication failures, HDCP spec expects reauth. */
>  	for (i = 0; i < tries; i++) {
>  		ret = intel_hdcp_auth(connector);
> @@ -2062,7 +2069,7 @@ static int _intel_hdcp2_enable(struct intel_atomic_state *state,
>  		    connector->base.base.id, connector->base.name,
>  		    hdcp->content_type);
>  
> -	intel_hdcp_disable_hdcp_line_rekeying(connector->encoder, hdcp);
> +	intel_hdcp_adjust_hdcp_line_rekeying(connector->encoder, hdcp, false);
>  
>  	ret = hdcp2_authenticate_and_encrypt(state, connector);
>  	if (ret) {
> -- 
> 2.34.1
> 

-- 
Matt Roper
Graphics Software Engineer
Linux GPU Platform Enablement
Intel Corporation

  parent reply	other threads:[~2024-11-07 21:44 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-07  2:28 [PATCH] drm/i915/hdcp: Handle HDCP Line Rekeying for HDCP 1.4 Suraj Kandpal
2024-11-07  3:15 ` ✓ Fi.CI.BAT: success for drm/i915/hdcp: Handle HDCP Line Rekeying for HDCP 1.4 (rev4) Patchwork
2024-11-07  4:48 ` ✗ Fi.CI.IGT: failure " Patchwork
2024-11-07 21:48   ` Matt Roper
2024-11-07 21:44 ` Matt Roper [this message]
  -- strict thread matches above, loose matches on Subject: below --
2024-11-06 17:40 [PATCH] drm/i915/hdcp: Handle HDCP Line Rekeying for HDCP 1.4 Suraj Kandpal
2024-11-07  1:54 ` kernel test robot
2024-11-06 12:51 Suraj Kandpal
2024-11-06 16:29 ` Jani Nikula
2024-11-06 16:53   ` Kandpal, Suraj
2024-11-06  9:38 Suraj Kandpal
2024-11-06 10:03 ` Jani Nikula

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=20241107214419.GS4891@mdroper-desk1.amr.corp.intel.com \
    --to=matthew.d.roper@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=jani.nikula@intel.com \
    --cc=suraj.kandpal@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox