Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Matt Roper <matthew.d.roper@intel.com>
To: Gustavo Sousa <gustavo.sousa@intel.com>
Cc: <intel-xe@lists.freedesktop.org>,
	Shuicheng Lin <shuicheng.lin@intel.com>
Subject: Re: [PATCH v2] drm/xe/hdcp: Add NULL check for media_gt in intel_hdcp_gsc_check_status()
Date: Thu, 16 Apr 2026 12:37:33 -0700	[thread overview]
Message-ID: <20260416193733.GG755471@mdroper-desk1.amr.corp.intel.com> (raw)
In-Reply-To: <20260416-check-for-null-media_gt-in-intel_hdcp_gsc_check_status-v2-1-9adb9fd3b621@intel.com>

On Thu, Apr 16, 2026 at 03:17:19PM -0300, Gustavo Sousa wrote:
> When media GT is disabled via configfs, there is no allocation for
> media_gt, which is kept as NULL.  In such scenario,
> intel_hdcp_gsc_check_status() results in a kernel pagefault error due to
> &gt->uc.gsc being evaluated as an invalid memory address.
> 
> Fix that by introducing a NULL check on media_gt and bailing out early
> if so.
> 
> While at it, also drop the NULL check for gsc, since it can't be NULL if
> media_gt is not NULL.
> 
> v2:
>   - Get address for gsc only after checking that gt is not NULL.
>     (Shuicheng)
>   - Drop the NULL check for gsc. (Shuicheng)
> 
> Cc: Shuicheng Lin <shuicheng.lin@intel.com>
> Signed-off-by: Gustavo Sousa <gustavo.sousa@intel.com>

We should probably also have

Fixes: 4af50beb4e0f ("drm/xe: Use gsc_proxy_init_done to check proxy status")
Cc: <stable@vger.kernel.org> # v6.10+

too?  Or I guess we could make the argument that there don't seem to be
any real devices without the media GT, so it only became possible to
trigger this once we added configfs support for manually disabling GTs?
In that case,

Fixes: 7abd69278bb5 ("drm/xe/configfs: Add attribute to disable GT types")
Cc: <stable@vger.kernel.org> # v6.19+

minimizes the number of kernel versions this would be backported to.


Anyway, the change itself is

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

> ---
> Changes in v2:
> - EDITME: describe what is new in this series revision.
> - EDITME: use bulletpoints and terse descriptions.
> - Link to v1: https://patch.msgid.link/20260302-check-for-null-media_gt-in-intel_hdcp_gsc_check_status-v1-1-163d5f826b30@intel.com
> ---
>  drivers/gpu/drm/xe/display/xe_hdcp_gsc.c | 12 ++++++++++--
>  1 file changed, 10 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/xe/display/xe_hdcp_gsc.c b/drivers/gpu/drm/xe/display/xe_hdcp_gsc.c
> index 29c72aa4b0d2..33494b86205d 100644
> --- a/drivers/gpu/drm/xe/display/xe_hdcp_gsc.c
> +++ b/drivers/gpu/drm/xe/display/xe_hdcp_gsc.c
> @@ -37,9 +37,17 @@ static bool intel_hdcp_gsc_check_status(struct drm_device *drm)
>  	struct xe_device *xe = to_xe_device(drm);
>  	struct xe_tile *tile = xe_device_get_root_tile(xe);
>  	struct xe_gt *gt = tile->media_gt;
> -	struct xe_gsc *gsc = &gt->uc.gsc;
> +	struct xe_gsc *gsc;
> +
> +	if (!gt) {
> +		drm_dbg_kms(&xe->drm,
> +			    "not checking GSC status for HDCP2.x: media GT not present or disabled\n");
> +		return false;
> +	}
> +
> +	gsc = &gt->uc.gsc;
>  
> -	if (!gsc || !xe_uc_fw_is_available(&gsc->fw)) {
> +	if (!xe_uc_fw_is_available(&gsc->fw)) {
>  		drm_dbg_kms(&xe->drm,
>  			    "GSC Components not ready for HDCP2.x\n");
>  		return false;
> 
> ---
> base-commit: 9ac7dca8d82a4e6d9806ac6c991f0777338833bb
> change-id: 20260302-check-for-null-media_gt-in-intel_hdcp_gsc_check_status-071898b8a402
> 
> Best regards,
> --  
> Gustavo Sousa <gustavo.sousa@intel.com>
> 

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

  parent reply	other threads:[~2026-04-16 19:37 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-16 18:17 [PATCH v2] drm/xe/hdcp: Add NULL check for media_gt in intel_hdcp_gsc_check_status() Gustavo Sousa
2026-04-16 18:42 ` ✓ CI.KUnit: success for drm/xe/hdcp: Add NULL check for media_gt in intel_hdcp_gsc_check_status() (rev2) Patchwork
2026-04-16 19:37 ` Matt Roper [this message]
2026-04-17  2:20   ` [PATCH v2] drm/xe/hdcp: Add NULL check for media_gt in intel_hdcp_gsc_check_status() Lin, Shuicheng
2026-04-29 15:09     ` Gustavo Sousa
2026-04-29 18:27       ` Gustavo Sousa
2026-04-16 20:13 ` ✓ Xe.CI.BAT: success for drm/xe/hdcp: Add NULL check for media_gt in intel_hdcp_gsc_check_status() (rev2) Patchwork
2026-04-16 21:58 ` ✗ Xe.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=20260416193733.GG755471@mdroper-desk1.amr.corp.intel.com \
    --to=matthew.d.roper@intel.com \
    --cc=gustavo.sousa@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=shuicheng.lin@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