From patchwork Mon Jul 22 06:44:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Kandpal, Suraj" X-Patchwork-Id: 13738344 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5C935C3DA70 for ; Mon, 22 Jul 2024 06:47:23 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id F37AF10E37C; Mon, 22 Jul 2024 06:47:22 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="RHW+RHx8"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.18]) by gabe.freedesktop.org (Postfix) with ESMTPS id 166B310E377; Mon, 22 Jul 2024 06:47:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1721630840; x=1753166840; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=5nj+a1tSiQsBdzAxyRX/1/yfha2zxl6FT84/M0QrWbs=; b=RHW+RHx8FEaqr/zVnczPGstSvwrAzHYGmsJtTDmzb4Cka33o+Bz5hLls Kte1Zftcn08Ww1UAGBNXkxwaWhq6OYikkxK7shvV48B4ffJIw4kKdYDu9 lVn3/yCHS/3GmMAt9sXL4cmlOyOyjBT36YdpaEEHpUzfpj5TS1bXWFLLx roqfTZkNXuMd7YKA6Lk/MDrHENcqHjGwmZubrjJDQfkBVthAnB3zIdGLF auWfe7sY10jkD0sJF9vEb4b294kCMX6aDH1hBpMQ0dYzIFphqeA/eHwA7 +aC6C07r+YXn9QjY12kjT0/51KFNjEvmoltNeHOzlrhaq6nDU/IOSSWGJ A==; X-CSE-ConnectionGUID: zgvlg4WnRFWzojCODLzjuQ== X-CSE-MsgGUID: IPGoCdaGS0+XLLSkI2M5IA== X-IronPort-AV: E=McAfee;i="6700,10204,11140"; a="18798181" X-IronPort-AV: E=Sophos;i="6.09,227,1716274800"; d="scan'208";a="18798181" Received: from fmviesa008.fm.intel.com ([10.60.135.148]) by fmvoesa112.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Jul 2024 23:47:20 -0700 X-CSE-ConnectionGUID: vQRgBcHZTnipxN6B4RDe1A== X-CSE-MsgGUID: QHaSgpkySSiq1856GcLo2Q== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.09,227,1716274800"; d="scan'208";a="51670544" Received: from kandpal-x299-ud4-pro.iind.intel.com ([10.190.239.32]) by fmviesa008.fm.intel.com with ESMTP; 21 Jul 2024 23:47:18 -0700 From: Suraj Kandpal To: intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org Cc: ankit.k.nautiyal@intel.com, Suraj Kandpal Subject: [PATCH 1/3] drm/i915/hdcp: Add encoder check in intel_hdcp_get_capability Date: Mon, 22 Jul 2024 12:14:49 +0530 Message-ID: <20240722064451.3610512-2-suraj.kandpal@intel.com> X-Mailer: git-send-email 2.43.2 In-Reply-To: <20240722064451.3610512-1-suraj.kandpal@intel.com> References: <20240722064451.3610512-1-suraj.kandpal@intel.com> MIME-Version: 1.0 X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" Sometimes during hotplug scenario or suspend/resume scenario encoder is not always initialized when intel_hdcp_get_capability add a check to avoid kernel null pointer dereference. Signed-off-by: Suraj Kandpal Reviewed-by: Dnyaneshwar Bhadane --- drivers/gpu/drm/i915/display/intel_hdcp.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/i915/display/intel_hdcp.c b/drivers/gpu/drm/i915/display/intel_hdcp.c index 3ebe035f382e..05402ae6b569 100644 --- a/drivers/gpu/drm/i915/display/intel_hdcp.c +++ b/drivers/gpu/drm/i915/display/intel_hdcp.c @@ -203,11 +203,16 @@ int intel_hdcp_read_valid_bksv(struct intel_digital_port *dig_port, /* Is HDCP1.4 capable on Platform and Sink */ bool intel_hdcp_get_capability(struct intel_connector *connector) { - struct intel_digital_port *dig_port = intel_attached_dig_port(connector); + struct intel_digital_port *dig_port; const struct intel_hdcp_shim *shim = connector->hdcp.shim; bool capable = false; u8 bksv[5]; + if (!intel_attached_encoder(connector)) + return capable; + + dig_port = intel_attached_dig_port(connector); + if (!shim) return capable; From patchwork Mon Jul 22 06:44:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Kandpal, Suraj" X-Patchwork-Id: 13738352 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 6648DC3DA7F for ; Mon, 22 Jul 2024 06:47:26 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A36DD10E397; Mon, 22 Jul 2024 06:47:25 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="k188xSw3"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.18]) by gabe.freedesktop.org (Postfix) with ESMTPS id 4D98F10E379; Mon, 22 Jul 2024 06:47:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1721630841; x=1753166841; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=01Mg8/Ynkf2T10801wGm3d+EGE6OLmpw9AX3TKT08ik=; b=k188xSw3MmV+hIN89OYST3Gdd7JT1sdVAYNuTGFOb6VcMaP22U62iFHR ZxQX/Jbjl8VEEhDxzoSeJZHt/2PZgonD4CyrunZulYpEZsCTvd1ahweYQ OtNk2Tgvmau3cW/IVkJsBsUieSss9XKLEn18uyvbLT37Ti3z00gmizeyN X9crk9lpk9ARybD3eKJlRCM0c5cYX78WOcmoU/GrUn0HtP6vJvDi+T0lW ZhVZVr/kulw6O3B0EhyhyM5+2HxuZW9qjxkwuy2BnkgTEWrd4H7NJUFfI bLNQD4HOcotAh1fEq7dw9sBzvGuOgufhkO+1oD2KAaPFyKqBhBVNKXQIt A==; X-CSE-ConnectionGUID: rlEutXhyRum3TPl66mMm6A== X-CSE-MsgGUID: dg343oE1TDeUwygy4j9BIg== X-IronPort-AV: E=McAfee;i="6700,10204,11140"; a="18798184" X-IronPort-AV: E=Sophos;i="6.09,227,1716274800"; d="scan'208";a="18798184" Received: from fmviesa008.fm.intel.com ([10.60.135.148]) by fmvoesa112.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Jul 2024 23:47:21 -0700 X-CSE-ConnectionGUID: uYLoxkjnRE6djznEQdzqDQ== X-CSE-MsgGUID: AJosCx2tRdCYqC9HVssgHQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.09,227,1716274800"; d="scan'208";a="51670553" Received: from kandpal-x299-ud4-pro.iind.intel.com ([10.190.239.32]) by fmviesa008.fm.intel.com with ESMTP; 21 Jul 2024 23:47:20 -0700 From: Suraj Kandpal To: intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org Cc: ankit.k.nautiyal@intel.com, Suraj Kandpal Subject: [PATCH 2/3] drm/i915/hdcp: Add encoder check in hdcp2_get_capability Date: Mon, 22 Jul 2024 12:14:50 +0530 Message-ID: <20240722064451.3610512-3-suraj.kandpal@intel.com> X-Mailer: git-send-email 2.43.2 In-Reply-To: <20240722064451.3610512-1-suraj.kandpal@intel.com> References: <20240722064451.3610512-1-suraj.kandpal@intel.com> MIME-Version: 1.0 X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" Add encoder check in intel_hdcp2_get_capability to avoid null pointer error. Signed-off-by: Suraj Kandpal Reviewed-by: Dnyaneshwar Bhadane --- drivers/gpu/drm/i915/display/intel_dp_hdcp.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/i915/display/intel_dp_hdcp.c b/drivers/gpu/drm/i915/display/intel_dp_hdcp.c index 2edffe62f360..47f51a5ab493 100644 --- a/drivers/gpu/drm/i915/display/intel_dp_hdcp.c +++ b/drivers/gpu/drm/i915/display/intel_dp_hdcp.c @@ -675,8 +675,15 @@ static int intel_dp_hdcp2_get_capability(struct intel_connector *connector, bool *capable) { - struct intel_digital_port *dig_port = intel_attached_dig_port(connector); - struct drm_dp_aux *aux = &dig_port->dp.aux; + struct intel_digital_port *dig_port; + struct drm_dp_aux *aux; + + *capable = false; + if (!intel_attached_encoder(connector)) + return -EINVAL; + + dig_port = intel_attached_dig_port(connector); + aux = &dig_port->dp.aux; return _intel_dp_hdcp2_get_capability(aux, capable); } From patchwork Mon Jul 22 06:44:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Kandpal, Suraj" X-Patchwork-Id: 13738353 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id BDEFAC3DA5D for ; Mon, 22 Jul 2024 06:47:27 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 0E07E10E388; Mon, 22 Jul 2024 06:47:27 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="aXGrivUC"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.18]) by gabe.freedesktop.org (Postfix) with ESMTPS id C382F10E37D; Mon, 22 Jul 2024 06:47:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1721630844; x=1753166844; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=VDm2z+0UFsY9+5jVlvAV2utSDLJbFzf/sz/4dn0G6LM=; b=aXGrivUC00gdjv8q8zLyu0D+Optq3YGRKPz4x1ugiYWEWKoGOidd+QW7 YTy/hdAmj3o7eLlwJsQPA7ro42EbCncObnpl/7vIlbimy9DAnDWhbgiU+ 4NpagIB9C/wUSzyaZYXjv3v+ruNOWDQHS30JoYuOsei5tJv/W/F31h2zX 604f6lFP8QirwT4zLB718nchlovkkUtanopO3BEE67BfAGzw/1AVtg86W NBUWG2wB2k2bXey0EF8ZOXW+itS0gcszVadmIKADt1S9JxhE+d755zuS6 NJ5nQnzQonDYE3IENWzdRFo6Zv/uM0JORNy4ZqrcFQiY2t1oZzFcrz7Wu w==; X-CSE-ConnectionGUID: 95mwdNDpRk6C9iQc8NrfAA== X-CSE-MsgGUID: 4sHvpCQSRNqPRWMHyWRfSA== X-IronPort-AV: E=McAfee;i="6700,10204,11140"; a="18798187" X-IronPort-AV: E=Sophos;i="6.09,227,1716274800"; d="scan'208";a="18798187" Received: from fmviesa008.fm.intel.com ([10.60.135.148]) by fmvoesa112.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Jul 2024 23:47:23 -0700 X-CSE-ConnectionGUID: vg9pjzfTT9uBTgEaW/djdA== X-CSE-MsgGUID: brL8zWG6QIayp2z7vvtw2A== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.09,227,1716274800"; d="scan'208";a="51670562" Received: from kandpal-x299-ud4-pro.iind.intel.com ([10.190.239.32]) by fmviesa008.fm.intel.com with ESMTP; 21 Jul 2024 23:47:21 -0700 From: Suraj Kandpal To: intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org Cc: ankit.k.nautiyal@intel.com, Suraj Kandpal Subject: [PATCH 3/3] drm/xe/hdcp: Check GSC structure validity Date: Mon, 22 Jul 2024 12:14:51 +0530 Message-ID: <20240722064451.3610512-4-suraj.kandpal@intel.com> X-Mailer: git-send-email 2.43.2 In-Reply-To: <20240722064451.3610512-1-suraj.kandpal@intel.com> References: <20240722064451.3610512-1-suraj.kandpal@intel.com> MIME-Version: 1.0 X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" Sometimes xe_gsc is not initialized when checked at HDCP capability check. Add gsc structure check to avoid null pointer error. Signed-off-by: Suraj Kandpal Reviewed-by: Dnyaneshwar Bhadane --- drivers/gpu/drm/xe/display/xe_hdcp_gsc.c | 8 ++++++-- 1 file changed, 6 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 990285aa9b26..0af667ebebf9 100644 --- a/drivers/gpu/drm/xe/display/xe_hdcp_gsc.c +++ b/drivers/gpu/drm/xe/display/xe_hdcp_gsc.c @@ -40,10 +40,14 @@ bool intel_hdcp_gsc_check_status(struct xe_device *xe) { struct xe_tile *tile = xe_device_get_root_tile(xe); struct xe_gt *gt = tile->media_gt; + struct xe_gsc *gsc = >->uc.gsc; bool ret = true; - if (!xe_uc_fw_is_enabled(>->uc.gsc.fw)) + if (!gsc && !xe_uc_fw_is_enabled(&gsc->fw)) { + drm_dbg_kms(&xe->drm, + "GSC Components not ready for HDCP2.x\n"); return false; + } xe_pm_runtime_get(xe); if (xe_force_wake_get(gt_to_fw(gt), XE_FW_GSC)) { @@ -53,7 +57,7 @@ bool intel_hdcp_gsc_check_status(struct xe_device *xe) goto out; } - if (!xe_gsc_proxy_init_done(>->uc.gsc)) + if (!xe_gsc_proxy_init_done(gsc)) ret = false; xe_force_wake_put(gt_to_fw(gt), XE_FW_GSC);