From patchwork Sun Feb 4 14:24:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Kandpal, Suraj" X-Patchwork-Id: 13544687 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 1D513C48298 for ; Sun, 4 Feb 2024 14:27:13 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 044B310F8B6; Sun, 4 Feb 2024 14:27:08 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="ImbsfqhM"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.8]) by gabe.freedesktop.org (Postfix) with ESMTPS id 2C85C1121CE for ; Sun, 4 Feb 2024 14:27:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1707056826; x=1738592826; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=HHNqQmpgNPG5po9xJpfWXOxe7pXF5h86aUav4mcEBAs=; b=ImbsfqhMjKKO66WZhJb8aaB24nuoK/xSKdzTQW6wpcbtwvbhWTbDPChq 63tJp8pW8Igdmn/89iH61DAGFuR1iMHQZlfzAn+cg5fL8LD5CDWKDejNk qKKbuFK8SZplxub2YUg9XcDDCJMAig26JZ6P58KzIRVZc6jyyiZum7ZWx pqRvTy3H8sMs5R3PKXwgJRihYMatAdsUoAoMImow2x0VRP5alExqJ1ZWR QKQR4igOfbVnf/cIivPjRyoRDsmSe98AdbYnvVfcypDB+RmwJwuOJLEqx cbK3liyZDlvHb0mXV1Vi39mfFdSM284pSFHOujVSJ7vZju5VaLQrKWn6o Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10973"; a="17920759" X-IronPort-AV: E=Sophos;i="6.05,242,1701158400"; d="scan'208";a="17920759" Received: from fmviesa001.fm.intel.com ([10.60.135.141]) by fmvoesa102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Feb 2024 06:27:06 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.05,242,1701158400"; d="scan'208";a="31605257" Received: from kandpal-x299-ud4-pro.iind.intel.com ([10.190.239.32]) by fmviesa001.fm.intel.com with ESMTP; 04 Feb 2024 06:27:04 -0800 From: Suraj Kandpal To: intel-gfx@lists.freedesktop.org Cc: uma.shankar@intel.com, ankit.k.nautiyal@intel.com, Suraj Kandpal Subject: [PATCH 01/11] drm/i915/hdcp: Move to direct reads for HDCP Date: Sun, 4 Feb 2024 19:54:55 +0530 Message-Id: <20240204142505.1157146-2-suraj.kandpal@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240204142505.1157146-1-suraj.kandpal@intel.com> References: <20240204142505.1157146-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" Even for MST scenarios we need to do direct reads only on the immediate downstream device the rest of the authentication is taken care by that device. Remote reads will only be used to check capability of the monitors in MST topology. --v2 -Add fixes tag [Ankit] -Derive aux where needed rather than through a function [Ankit] Fixes: ae4f902bb344 ("drm/i915/hdcp: Send the correct aux for DPMST HDCP scenario") Signed-off-by: Suraj Kandpal Reviewed-by: Ankit Nautiyal --- drivers/gpu/drm/i915/display/intel_dp_hdcp.c | 31 ++++++-------------- 1 file changed, 9 insertions(+), 22 deletions(-) diff --git a/drivers/gpu/drm/i915/display/intel_dp_hdcp.c b/drivers/gpu/drm/i915/display/intel_dp_hdcp.c index 3a595cd433d4..defc90936317 100644 --- a/drivers/gpu/drm/i915/display/intel_dp_hdcp.c +++ b/drivers/gpu/drm/i915/display/intel_dp_hdcp.c @@ -330,23 +330,13 @@ static const struct hdcp2_dp_msg_data hdcp2_dp_msg_data[] = { 0, 0 }, }; -static struct drm_dp_aux * -intel_dp_hdcp_get_aux(struct intel_connector *connector) -{ - struct intel_digital_port *dig_port = intel_attached_dig_port(connector); - - if (intel_encoder_is_mst(connector->encoder)) - return &connector->port->aux; - else - return &dig_port->dp.aux; -} - static int intel_dp_hdcp2_read_rx_status(struct intel_connector *connector, u8 *rx_status) { struct drm_i915_private *i915 = to_i915(connector->base.dev); - struct drm_dp_aux *aux = intel_dp_hdcp_get_aux(connector); + struct intel_digital_port *dig_port = intel_attached_dig_port(connector); + struct drm_dp_aux *aux = &dig_port->dp.aux; ssize_t ret; ret = drm_dp_dpcd_read(aux, @@ -454,8 +444,9 @@ int intel_dp_hdcp2_write_msg(struct intel_connector *connector, unsigned int offset; u8 *byte = buf; ssize_t ret, bytes_to_write, len; + struct intel_digital_port *dig_port = intel_attached_dig_port(connector); + struct drm_dp_aux *aux = &dig_port->dp.aux; const struct hdcp2_dp_msg_data *hdcp2_msg_data; - struct drm_dp_aux *aux; hdcp2_msg_data = get_hdcp2_dp_msg_data(*byte); if (!hdcp2_msg_data) @@ -463,8 +454,6 @@ int intel_dp_hdcp2_write_msg(struct intel_connector *connector, offset = hdcp2_msg_data->offset; - aux = intel_dp_hdcp_get_aux(connector); - /* No msg_id in DP HDCP2.2 msgs */ bytes_to_write = size - 1; byte++; @@ -490,7 +479,8 @@ static ssize_t get_receiver_id_list_rx_info(struct intel_connector *connector, u32 *dev_cnt, u8 *byte) { - struct drm_dp_aux *aux = intel_dp_hdcp_get_aux(connector); + struct intel_digital_port *dig_port = intel_attached_dig_port(connector); + struct drm_dp_aux *aux = &dig_port->dp.aux; ssize_t ret; u8 *rx_info = byte; @@ -516,7 +506,7 @@ int intel_dp_hdcp2_read_msg(struct intel_connector *connector, struct intel_digital_port *dig_port = intel_attached_dig_port(connector); struct drm_i915_private *i915 = to_i915(dig_port->base.base.dev); struct intel_hdcp *hdcp = &connector->hdcp; - struct drm_dp_aux *aux; + struct drm_dp_aux *aux = &dig_port->dp.aux; unsigned int offset; u8 *byte = buf; ssize_t ret, bytes_to_recv, len; @@ -530,8 +520,6 @@ int intel_dp_hdcp2_read_msg(struct intel_connector *connector, return -EINVAL; offset = hdcp2_msg_data->offset; - aux = intel_dp_hdcp_get_aux(connector); - ret = intel_dp_hdcp2_wait_for_msg(connector, hdcp2_msg_data); if (ret < 0) return ret; @@ -651,12 +639,11 @@ static int intel_dp_hdcp2_capable(struct intel_connector *connector, bool *capable) { - struct drm_dp_aux *aux; + struct intel_digital_port *dig_port = intel_attached_dig_port(connector); + struct drm_dp_aux *aux = &dig_port->dp.aux; u8 rx_caps[3]; int ret; - aux = intel_dp_hdcp_get_aux(connector); - *capable = false; ret = drm_dp_dpcd_read(aux, DP_HDCP_2_2_REG_RX_CAPS_OFFSET, From patchwork Sun Feb 4 14:24:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Kandpal, Suraj" X-Patchwork-Id: 13544685 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 F07DEC48286 for ; Sun, 4 Feb 2024 14:27:12 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 973BE1121CF; Sun, 4 Feb 2024 14:27:10 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="dp7d0mkj"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.8]) by gabe.freedesktop.org (Postfix) with ESMTPS id 10D3F112042 for ; Sun, 4 Feb 2024 14:27:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1707056828; x=1738592828; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=DmXH77JzL2gQAf3NuOdkbR1ZdM01R3rgybZEtk05+f4=; b=dp7d0mkjXnEc4+tXiKnSdLhJ0QQ8gkF3OPCT2ntw2C6mvA1gHqoIJpHi o7AEEI0/DWyR3rxUhDO6JlX+FQDpaDazupiKOPMj8V//gXIIbtU0cSd6y BL5gBX25nQnSaXxGae5klY+RfFThPMpRfknu0+77f6r9bWzJdGtNEGHoi iQwZoORQoKWU9ecFUDPJPHGR9jEquNwWHe+qJNcfEmE0UfoD7MTi1pfmN C/D0zlpHRuHeF4QNecOhRmnnTUiAb7b9bIt4MCWZvoGTfWP966krj06nl fquj2RLBd234dBm4YJTLcmu60aJmDnQAKwH0/viGByhbnw1mC4OBoI/Wj A==; X-IronPort-AV: E=McAfee;i="6600,9927,10973"; a="17920764" X-IronPort-AV: E=Sophos;i="6.05,242,1701158400"; d="scan'208";a="17920764" Received: from fmviesa001.fm.intel.com ([10.60.135.141]) by fmvoesa102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Feb 2024 06:27:08 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.05,242,1701158400"; d="scan'208";a="31605260" Received: from kandpal-x299-ud4-pro.iind.intel.com ([10.190.239.32]) by fmviesa001.fm.intel.com with ESMTP; 04 Feb 2024 06:27:06 -0800 From: Suraj Kandpal To: intel-gfx@lists.freedesktop.org Cc: uma.shankar@intel.com, ankit.k.nautiyal@intel.com, Suraj Kandpal Subject: [PATCH 02/11] drm/i915/hdcp: Move source hdcp2 checks into its own function Date: Sun, 4 Feb 2024 19:54:56 +0530 Message-Id: <20240204142505.1157146-3-suraj.kandpal@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240204142505.1157146-1-suraj.kandpal@intel.com> References: <20240204142505.1157146-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" Move checks on the source side for HDCP2.2 into its own function so that they can be used in the HDCP remote capability check function. Signed-off-by: Suraj Kandpal Reviewed-by: Ankit Nautiyal --- drivers/gpu/drm/i915/display/intel_hdcp.c | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/i915/display/intel_hdcp.c b/drivers/gpu/drm/i915/display/intel_hdcp.c index c3e692e7f790..4593ac10e2fa 100644 --- a/drivers/gpu/drm/i915/display/intel_hdcp.c +++ b/drivers/gpu/drm/i915/display/intel_hdcp.c @@ -160,12 +160,14 @@ bool intel_hdcp_capable(struct intel_connector *connector) return capable; } -/* Is HDCP2.2 capable on Platform and Sink */ -bool intel_hdcp2_capable(struct intel_connector *connector) +/* + * Check if the source has all the building blocks ready to make + * HDCP 2.2 work + */ +static bool intel_hdcp2_prerequisite(struct intel_connector *connector) { struct drm_i915_private *i915 = to_i915(connector->base.dev); struct intel_hdcp *hdcp = &connector->hdcp; - bool capable = false; /* I915 support for HDCP2.2 */ if (!hdcp->hdcp2_supported) @@ -185,6 +187,18 @@ bool intel_hdcp2_capable(struct intel_connector *connector) } mutex_unlock(&i915->display.hdcp.hdcp_mutex); + return true; +} + +/* Is HDCP2.2 capable on Platform and Sink */ +bool intel_hdcp2_capable(struct intel_connector *connector) +{ + struct intel_hdcp *hdcp = &connector->hdcp; + bool capable = false; + + if (!intel_hdcp2_prerequisite(connector)) + return false; + /* Sink's capability for HDCP2.2 */ hdcp->shim->hdcp_2_2_capable(connector, &capable); From patchwork Sun Feb 4 14:24:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Kandpal, Suraj" X-Patchwork-Id: 13544686 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 23667C48299 for ; Sun, 4 Feb 2024 14:27:13 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 01F5E1121D4; Sun, 4 Feb 2024 14:27:11 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="mOKYgmwA"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.8]) by gabe.freedesktop.org (Postfix) with ESMTPS id 990B8112042 for ; Sun, 4 Feb 2024 14:27:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1707056829; x=1738592829; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=l6QzlcssIDhR7EgvE62NsNE59R16jlfPcjBP0HfBrzU=; b=mOKYgmwAKqJry+BDwBEFLSjm/jOmsjboc2hauEDpoHClBQMj62WZNvYA KBDau/fdxINulCc1HX9sIRDKYEH75ORYMYRhHxCI2iQpZ1/TDWIaBZC9T npxr3aIZINn05qprE/2+jYHPU2fC8Mu/oR/IIswNz2W3vD4r3r2zZCsTb B1mmiU/C74EmbD0oyXOg7bozKoJGaG8r/JF8GfvhCrlkLpuMn90pN6CA7 vEVpWCTsWxhsVDvqfLR8sMNLfx/RsVVongItJ2N5b0XB3HqEYCH5Xyf2u DgfhAEsJYn5eex0pbHUSnHsi5DWgwEV5lCb/ccCKpZHfRQkPc9ZNjloPA w==; X-IronPort-AV: E=McAfee;i="6600,9927,10973"; a="17920766" X-IronPort-AV: E=Sophos;i="6.05,242,1701158400"; d="scan'208";a="17920766" Received: from fmviesa001.fm.intel.com ([10.60.135.141]) by fmvoesa102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Feb 2024 06:27:09 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.05,242,1701158400"; d="scan'208";a="31605263" Received: from kandpal-x299-ud4-pro.iind.intel.com ([10.190.239.32]) by fmviesa001.fm.intel.com with ESMTP; 04 Feb 2024 06:27:08 -0800 From: Suraj Kandpal To: intel-gfx@lists.freedesktop.org Cc: uma.shankar@intel.com, ankit.k.nautiyal@intel.com, Suraj Kandpal Subject: [PATCH 03/11] drm/i915/hdcp: Refactor intel_dp_hdcp2_capable Date: Sun, 4 Feb 2024 19:54:57 +0530 Message-Id: <20240204142505.1157146-4-suraj.kandpal@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240204142505.1157146-1-suraj.kandpal@intel.com> References: <20240204142505.1157146-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" Break intel_dp_hdcp2_capable so that the common the code can be reused for the remote capability check. Signed-off-by: Suraj Kandpal Reviewed-by: Ankit Nautiyal --- drivers/gpu/drm/i915/display/intel_dp_hdcp.c | 14 ++++++++++++-- 1 file changed, 12 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 defc90936317..9aeee6b49b3d 100644 --- a/drivers/gpu/drm/i915/display/intel_dp_hdcp.c +++ b/drivers/gpu/drm/i915/display/intel_dp_hdcp.c @@ -636,8 +636,8 @@ int intel_dp_hdcp2_check_link(struct intel_digital_port *dig_port, } static -int intel_dp_hdcp2_capable(struct intel_connector *connector, - bool *capable) +int _intel_dp_hdcp2_capable(struct drm_dp_aux *aux, + bool *capable) { struct intel_digital_port *dig_port = intel_attached_dig_port(connector); struct drm_dp_aux *aux = &dig_port->dp.aux; @@ -658,6 +658,16 @@ int intel_dp_hdcp2_capable(struct intel_connector *connector, return 0; } +static +int intel_dp_hdcp2_capable(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; + + return _intel_dp_hdcp2_capable(aux, capable); +} + static const struct intel_hdcp_shim intel_dp_hdcp_shim = { .write_an_aksv = intel_dp_hdcp_write_an_aksv, .read_bksv = intel_dp_hdcp_read_bksv, From patchwork Sun Feb 4 14:24:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Kandpal, Suraj" X-Patchwork-Id: 13544688 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 87484C4829A for ; Sun, 4 Feb 2024 14:27:14 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C1556112042; Sun, 4 Feb 2024 14:27:12 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="I74zcl38"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.8]) by gabe.freedesktop.org (Postfix) with ESMTPS id 2E21C112042 for ; Sun, 4 Feb 2024 14:27:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1707056831; x=1738592831; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=NgLFeQB5hmq6sO1kLgtKpu0vC90sS2OZMM8jj/MHHfs=; b=I74zcl38qTaDKOD2wrIauaLz+Z5vKeBemriyDH5THg3o9tHsrwOUgF8p 1W3Z+8xeyPCyoSqgv5YsUCICO8DhX5na3Fn/MHg4TwFIG2gAAIXd7AhEX ssGnIsW1F+F7wvCCrZ5uNfBJ7Ha8nuITcs6UXCmcFQqCEiI9O234Ma7gV YbVfClSG4MPybOp5Qfs4Rkr/wQSdSYSjmIA+CBZwS4Pb7yTI8r+cZb//P vHeyqkMEiXfNWY1n5nl40qSYoRWlJVH7GZdJFDA/IvApMbyDN0vm/sZSH dxzf4Stwf1jbhk0qzbXnVEfb6nzI+4tRWU0VgDCCxduWMdKh+ZXINOLvH g==; X-IronPort-AV: E=McAfee;i="6600,9927,10973"; a="17920772" X-IronPort-AV: E=Sophos;i="6.05,242,1701158400"; d="scan'208";a="17920772" Received: from fmviesa001.fm.intel.com ([10.60.135.141]) by fmvoesa102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Feb 2024 06:27:11 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.05,242,1701158400"; d="scan'208";a="31605267" Received: from kandpal-x299-ud4-pro.iind.intel.com ([10.190.239.32]) by fmviesa001.fm.intel.com with ESMTP; 04 Feb 2024 06:27:10 -0800 From: Suraj Kandpal To: intel-gfx@lists.freedesktop.org Cc: uma.shankar@intel.com, ankit.k.nautiyal@intel.com, Suraj Kandpal Subject: [PATCH 04/11] drm/i915/hdcp: Pass drm_dp_aux to read_bcaps function Date: Sun, 4 Feb 2024 19:54:58 +0530 Message-Id: <20240204142505.1157146-5-suraj.kandpal@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240204142505.1157146-1-suraj.kandpal@intel.com> References: <20240204142505.1157146-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" Pass drm_dp_aux to intel_dp_hdcp_read_bcaps function so as to aid in reading the bcaps for the remote monitor later on. Signed-off-by: Suraj Kandpal Reviewed-by: Ankit Nautiyal --- drivers/gpu/drm/i915/display/intel_dp_hdcp.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/i915/display/intel_dp_hdcp.c b/drivers/gpu/drm/i915/display/intel_dp_hdcp.c index 9aeee6b49b3d..ef1a4c90c225 100644 --- a/drivers/gpu/drm/i915/display/intel_dp_hdcp.c +++ b/drivers/gpu/drm/i915/display/intel_dp_hdcp.c @@ -122,13 +122,13 @@ static int intel_dp_hdcp_read_bstatus(struct intel_digital_port *dig_port, } static -int intel_dp_hdcp_read_bcaps(struct intel_digital_port *dig_port, +int intel_dp_hdcp_read_bcaps(struct drm_dp_aux *aux, + struct drm_i915_private *i915, u8 *bcaps) { - struct drm_i915_private *i915 = to_i915(dig_port->base.base.dev); ssize_t ret; - ret = drm_dp_dpcd_read(&dig_port->dp.aux, DP_AUX_HDCP_BCAPS, + ret = drm_dp_dpcd_read(aux, DP_AUX_HDCP_BCAPS, bcaps, 1); if (ret != 1) { drm_dbg_kms(&i915->drm, @@ -143,10 +143,11 @@ static int intel_dp_hdcp_repeater_present(struct intel_digital_port *dig_port, bool *repeater_present) { + struct drm_i915_private *i915 = to_i915(dig_port->base.base.dev); ssize_t ret; u8 bcaps; - ret = intel_dp_hdcp_read_bcaps(dig_port, &bcaps); + ret = intel_dp_hdcp_read_bcaps(&dig_port->dp.aux, i915, &bcaps); if (ret) return ret; @@ -268,10 +269,11 @@ static int intel_dp_hdcp_capable(struct intel_digital_port *dig_port, bool *hdcp_capable) { + struct drm_i915_private *i915 = to_i915(dig_port->base.base.dev); ssize_t ret; u8 bcaps; - ret = intel_dp_hdcp_read_bcaps(dig_port, &bcaps); + ret = intel_dp_hdcp_read_bcaps(&dig_port->dp.aux, i915, &bcaps); if (ret) return ret; @@ -639,8 +641,6 @@ static int _intel_dp_hdcp2_capable(struct drm_dp_aux *aux, bool *capable) { - struct intel_digital_port *dig_port = intel_attached_dig_port(connector); - struct drm_dp_aux *aux = &dig_port->dp.aux; u8 rx_caps[3]; int ret; From patchwork Sun Feb 4 14:24:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Kandpal, Suraj" X-Patchwork-Id: 13544689 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 26A01C4828F for ; Sun, 4 Feb 2024 14:27:16 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 84EB21121D0; Sun, 4 Feb 2024 14:27:15 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="jlV92b4V"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.8]) by gabe.freedesktop.org (Postfix) with ESMTPS id B9AF811218F for ; Sun, 4 Feb 2024 14:27:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1707056834; x=1738592834; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=B6dTnSNuhZUOvlfsDkGxuvwj4VNAmWbwEjRHIALV4So=; b=jlV92b4V+WfVTQodN4nbkJD2+rYufN+8TVQZcs9W5lKy1e9IM9I+6Cjz +15PYAconNhAD/3WrHKQnv6ausa54P4C6WKA/xg2GNQ+++dl4EI55TxGJ JKzMgE5YCT+RpXKiCLGuJdFKruTYOGn4umW4Z7IeigSAxxS7F65BT7W4Z X/ttcbM3cU6gyhq6EQj0vHxcLsAakiY7Fg2jh5Bv5MK7Dh/OXf8U5X4QY beK9YE7oivvK0LVq9+90X3vGdWDhj9X6WjIxTXfjBByAytPoL1St2oFai 2mYxrmIuK5ehq/9PKKlzz3vXTwC8YyuA0/alZRz/G0xgJDNX1fsbHlVOJ A==; X-IronPort-AV: E=McAfee;i="6600,9927,10973"; a="17920775" X-IronPort-AV: E=Sophos;i="6.05,242,1701158400"; d="scan'208";a="17920775" Received: from fmviesa001.fm.intel.com ([10.60.135.141]) by fmvoesa102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Feb 2024 06:27:13 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.05,242,1701158400"; d="scan'208";a="31605272" Received: from kandpal-x299-ud4-pro.iind.intel.com ([10.190.239.32]) by fmviesa001.fm.intel.com with ESMTP; 04 Feb 2024 06:27:11 -0800 From: Suraj Kandpal To: intel-gfx@lists.freedesktop.org Cc: uma.shankar@intel.com, ankit.k.nautiyal@intel.com, Suraj Kandpal Subject: [PATCH 05/11] drm/i915/hdcp: Add new remote capability check shim function Date: Sun, 4 Feb 2024 19:54:59 +0530 Message-Id: <20240204142505.1157146-6-suraj.kandpal@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240204142505.1157146-1-suraj.kandpal@intel.com> References: <20240204142505.1157146-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" Create a remote HDCP capability shim function which can read the remote monitor HDCP capability when in MST configuration. --v2 -Add an assertion to make sure only mst encoder call this remote_cap function [Ankit] Signed-off-by: Suraj Kandpal Reviewed-by: Ankit Nautiyal --- .../drm/i915/display/intel_display_types.h | 4 +++ drivers/gpu/drm/i915/display/intel_dp_hdcp.c | 26 +++++++++++++++++++ drivers/gpu/drm/i915/display/intel_hdcp.c | 16 ++++++++++++ drivers/gpu/drm/i915/display/intel_hdcp.h | 3 +++ 4 files changed, 49 insertions(+) diff --git a/drivers/gpu/drm/i915/display/intel_display_types.h b/drivers/gpu/drm/i915/display/intel_display_types.h index ae2e8cff9d69..7e7a370a3b30 100644 --- a/drivers/gpu/drm/i915/display/intel_display_types.h +++ b/drivers/gpu/drm/i915/display/intel_display_types.h @@ -532,6 +532,10 @@ struct intel_hdcp_shim { /* HDCP2.2 Link Integrity Check */ int (*check_2_2_link)(struct intel_digital_port *dig_port, struct intel_connector *connector); + + /* HDCP remote sink cap */ + int (*remote_hdcp_cap)(struct intel_connector *connector, + bool *hdcp_capable, bool *hdcp2_capable); }; struct intel_hdcp { diff --git a/drivers/gpu/drm/i915/display/intel_dp_hdcp.c b/drivers/gpu/drm/i915/display/intel_dp_hdcp.c index ef1a4c90c225..ccd274200f92 100644 --- a/drivers/gpu/drm/i915/display/intel_dp_hdcp.c +++ b/drivers/gpu/drm/i915/display/intel_dp_hdcp.c @@ -668,6 +668,31 @@ int intel_dp_hdcp2_capable(struct intel_connector *connector, return _intel_dp_hdcp2_capable(aux, capable); } +static +int intel_dp_hdcp_remote_cap(struct intel_connector *connector, + bool *hdcp_capable, bool *hdcp2_capable) +{ + struct drm_i915_private *i915 = to_i915(connector->base.dev); + struct drm_dp_aux *aux = &connector->port->aux; + u8 bcaps; + int ret; + + if (!intel_encoder_is_mst(connector->encoder)) + return -EINVAL; + + ret = _intel_dp_hdcp2_capable(aux, hdcp2_capable); + if (ret) + return ret; + + ret = intel_dp_hdcp_read_bcaps(aux, i915, &bcaps); + if (ret) + return ret; + + *hdcp_capable = bcaps & DP_BCAPS_HDCP_CAPABLE; + + return 0; +} + static const struct intel_hdcp_shim intel_dp_hdcp_shim = { .write_an_aksv = intel_dp_hdcp_write_an_aksv, .read_bksv = intel_dp_hdcp_read_bksv, @@ -685,6 +710,7 @@ static const struct intel_hdcp_shim intel_dp_hdcp_shim = { .config_stream_type = intel_dp_hdcp2_config_stream_type, .check_2_2_link = intel_dp_hdcp2_check_link, .hdcp_2_2_capable = intel_dp_hdcp2_capable, + .remote_hdcp_cap = intel_dp_hdcp_remote_cap, .protocol = HDCP_PROTOCOL_DP, }; diff --git a/drivers/gpu/drm/i915/display/intel_hdcp.c b/drivers/gpu/drm/i915/display/intel_hdcp.c index 4593ac10e2fa..2b739249b60c 100644 --- a/drivers/gpu/drm/i915/display/intel_hdcp.c +++ b/drivers/gpu/drm/i915/display/intel_hdcp.c @@ -205,6 +205,22 @@ bool intel_hdcp2_capable(struct intel_connector *connector) return capable; } +void intel_hdcp_remote_cap(struct intel_connector *connector, + bool *hdcp_capable, + bool *hdcp2_capable) +{ + struct intel_hdcp *hdcp = &connector->hdcp; + + /* Remote Sink's capability for HDCP */ + if (!hdcp->shim->remote_hdcp_cap) + return; + + hdcp->shim->remote_hdcp_cap(connector, hdcp_capable, hdcp2_capable); + + if (intel_hdcp2_prerequisite(connector)) + *hdcp2_capable = false; +} + static bool intel_hdcp_in_use(struct drm_i915_private *i915, enum transcoder cpu_transcoder, enum port port) { diff --git a/drivers/gpu/drm/i915/display/intel_hdcp.h b/drivers/gpu/drm/i915/display/intel_hdcp.h index a9c784fd9ba5..213d286ca3fa 100644 --- a/drivers/gpu/drm/i915/display/intel_hdcp.h +++ b/drivers/gpu/drm/i915/display/intel_hdcp.h @@ -40,6 +40,9 @@ void intel_hdcp_update_pipe(struct intel_atomic_state *state, bool is_hdcp_supported(struct drm_i915_private *i915, enum port port); bool intel_hdcp_capable(struct intel_connector *connector); bool intel_hdcp2_capable(struct intel_connector *connector); +void intel_hdcp_remote_cap(struct intel_connector *connector, + bool *hdcp_capable, + bool *hdcp2_capable); void intel_hdcp_component_init(struct drm_i915_private *i915); void intel_hdcp_component_fini(struct drm_i915_private *i915); void intel_hdcp_cleanup(struct intel_connector *connector); From patchwork Sun Feb 4 14:25:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Kandpal, Suraj" X-Patchwork-Id: 13544690 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 64D97C48286 for ; Sun, 4 Feb 2024 14:27:17 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id ABBAA1121D2; Sun, 4 Feb 2024 14:27:16 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="BrYDpPqQ"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.8]) by gabe.freedesktop.org (Postfix) with ESMTPS id 9E4161121D1 for ; Sun, 4 Feb 2024 14:27:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1707056835; x=1738592835; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=G/hrLaB75Ckq9Ej1RP+ipXMt4UMNt6j3G2bWZVcyWTk=; b=BrYDpPqQTRHWSD7xRDR/UWuCq2bs6EA1jE4EpJLZL2FRUnQ1QPp8im0b HoK/5T2teYKcc0cMbpcOp1tqfPEJ0OaflwZ9sJEktePibzMLVPZ0n42lQ pjzT1DasS8j8OdisUTBxsmyumsix5VYHCp/lmL8+c2EyIJf9bPi23nUt4 cVu9HtNmjRKCiGtcEnoipBjb1VIxJgw/IaniyRMXCRXEX9aUcOLahv9wX 0HIoAMbgOepv25IK5pyrD5k9a3r+5D5FrNMRP7aaFhAr/4KoW3fDKaSnP awCyntbEYGgoRjA4Rj6jiuJlLnyyQvxqqVW1CQ1lgg1l6/D3Ifp5BUdVX w==; X-IronPort-AV: E=McAfee;i="6600,9927,10973"; a="17920778" X-IronPort-AV: E=Sophos;i="6.05,242,1701158400"; d="scan'208";a="17920778" Received: from fmviesa001.fm.intel.com ([10.60.135.141]) by fmvoesa102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Feb 2024 06:27:15 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.05,242,1701158400"; d="scan'208";a="31605276" Received: from kandpal-x299-ud4-pro.iind.intel.com ([10.190.239.32]) by fmviesa001.fm.intel.com with ESMTP; 04 Feb 2024 06:27:14 -0800 From: Suraj Kandpal To: intel-gfx@lists.freedesktop.org Cc: uma.shankar@intel.com, ankit.k.nautiyal@intel.com, Suraj Kandpal Subject: [PATCH 06/11] drm/i915/hdcp: HDCP Capability for the downstream device Date: Sun, 4 Feb 2024 19:55:00 +0530 Message-Id: <20240204142505.1157146-7-suraj.kandpal@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240204142505.1157146-1-suraj.kandpal@intel.com> References: <20240204142505.1157146-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" Currently we are only checking capability of remote device and not immediate downstream device but during capability check we need are concerned with only the HDCP capability of downstream device. During i915_display_info reporting we need HDCP Capability for both the monitors and downstream branch device if any this patch adds that. --v2 -Use MST Hub HDCP version [Ankit] --v3 -Redefined how we seprate remote and direct read to make sure HDMI shim functions are not touched [Ankit] --v4 - Fix the conditions so that hdcp_info with remote_req true is sent only when encoder is mst [Ankit] Signed-off-by: Suraj Kandpal Reviewed-by: Ankit Nautiyal --- .../drm/i915/display/intel_display_debugfs.c | 24 +++++++++++++++---- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/i915/display/intel_display_debugfs.c b/drivers/gpu/drm/i915/display/intel_display_debugfs.c index 6f2d13c8ccf7..a51857dc4ece 100644 --- a/drivers/gpu/drm/i915/display/intel_display_debugfs.c +++ b/drivers/gpu/drm/i915/display/intel_display_debugfs.c @@ -188,7 +188,8 @@ static void intel_panel_info(struct seq_file *m, } static void intel_hdcp_info(struct seq_file *m, - struct intel_connector *intel_connector) + struct intel_connector *intel_connector, + bool remote_req) { bool hdcp_cap, hdcp2_cap; @@ -197,8 +198,13 @@ static void intel_hdcp_info(struct seq_file *m, goto out; } - hdcp_cap = intel_hdcp_capable(intel_connector); - hdcp2_cap = intel_hdcp2_capable(intel_connector); + if (remote_req) { + intel_hdcp_remote_cap(intel_connector, &hdcp_cap, + &hdcp2_cap); + } else { + hdcp_cap = intel_hdcp_capable(intel_connector); + hdcp2_cap = intel_hdcp2_capable(intel_connector); + } if (hdcp_cap) seq_puts(m, "HDCP1.4 "); @@ -285,7 +291,11 @@ static void intel_connector_info(struct seq_file *m, } seq_puts(m, "\tHDCP version: "); - intel_hdcp_info(m, intel_connector); + if (intel_encoder_is_mst(encoder)) { + intel_hdcp_info(m, intel_connector, true); + seq_puts(m, "\tMST Hub HDCP version: "); + } + intel_hdcp_info(m, intel_connector, false); seq_printf(m, "\tmax bpc: %u\n", connector->display_info.bpc); @@ -1131,7 +1141,11 @@ static int i915_hdcp_sink_capability_show(struct seq_file *m, void *data) seq_printf(m, "%s:%d HDCP version: ", connector->base.name, connector->base.base.id); - intel_hdcp_info(m, connector); + if (intel_encoder_is_mst(connector->encoder)) { + intel_hdcp_info(m, connector, true); + seq_puts(m, "\tMST Hub HDCP version: "); + } + intel_hdcp_info(m, connector, false); out: drm_modeset_unlock(&i915->drm.mode_config.connection_mutex); From patchwork Sun Feb 4 14:25:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Kandpal, Suraj" X-Patchwork-Id: 13544691 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 F423CC4828F for ; Sun, 4 Feb 2024 14:27:19 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 3F0811121D5; Sun, 4 Feb 2024 14:27:19 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="j9A96tPk"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.8]) by gabe.freedesktop.org (Postfix) with ESMTPS id ABB1811218F for ; Sun, 4 Feb 2024 14:27:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1707056837; x=1738592837; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=tTDJeujNTtZ8SUjgQq1tU+c7tMpOC1oO2XEYsZedL2I=; b=j9A96tPkpkAJrrmNB8P6dAtpOIXacYTKu4OqLDal0yncWM2mpjZJNL2L SUdxPrSuvWy98MbukqsWoAAdVuXN5Yy+bv6uIo93f/LchgSEjXF/gCO/f WnS/T6vEOfaeZpHk4x6e54yNSJzv9C/ulrfqLvJbaQqD69W3jBvTy7qPg D6vpu4wR1KjaaFgWXDfbqR+hLlzv/ZR4Fsh7FnQkFuTKctqXgk5U7Gp6J +Vc6nveVnCm8qhPXP2w7y79tLYmecY7nIkwS2AQ0Hh3jMm9uJeOMAKMm/ JTkqchv7Ct6TJfn/h3mhxutDXi7+3URCGhoOKBhsjXigZWgbdJ+sXQY3t g==; X-IronPort-AV: E=McAfee;i="6600,9927,10973"; a="17920781" X-IronPort-AV: E=Sophos;i="6.05,242,1701158400"; d="scan'208";a="17920781" Received: from fmviesa001.fm.intel.com ([10.60.135.141]) by fmvoesa102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Feb 2024 06:27:17 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.05,242,1701158400"; d="scan'208";a="31605280" Received: from kandpal-x299-ud4-pro.iind.intel.com ([10.190.239.32]) by fmviesa001.fm.intel.com with ESMTP; 04 Feb 2024 06:27:16 -0800 From: Suraj Kandpal To: intel-gfx@lists.freedesktop.org Cc: uma.shankar@intel.com, ankit.k.nautiyal@intel.com, Suraj Kandpal Subject: [PATCH 07/11] drm/i915/hdcp: Remove additional timing for reading mst hdcp message Date: Sun, 4 Feb 2024 19:55:01 +0530 Message-Id: <20240204142505.1157146-8-suraj.kandpal@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240204142505.1157146-1-suraj.kandpal@intel.com> References: <20240204142505.1157146-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" Now that we have moved back to direct reads the additional timing is not required hence this can be removed. --v2 -Add Fixes tag [Ankit] Fixes: 3974f9c17bb9 ("drm/i915/hdcp: Adjust timeout for read in DPMST Scenario") Signed-off-by: Suraj Kandpal Reviewed-by: Ankit Nautiyal --- drivers/gpu/drm/i915/display/intel_dp_hdcp.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/i915/display/intel_dp_hdcp.c b/drivers/gpu/drm/i915/display/intel_dp_hdcp.c index ccd274200f92..8697cba887e9 100644 --- a/drivers/gpu/drm/i915/display/intel_dp_hdcp.c +++ b/drivers/gpu/drm/i915/display/intel_dp_hdcp.c @@ -551,13 +551,8 @@ int intel_dp_hdcp2_read_msg(struct intel_connector *connector, /* Entire msg read timeout since initiate of msg read */ if (bytes_to_recv == size - 1 && hdcp2_msg_data->msg_read_timeout > 0) { - if (intel_encoder_is_mst(connector->encoder)) - msg_end = ktime_add_ms(ktime_get_raw(), - hdcp2_msg_data->msg_read_timeout * - connector->port->parent->num_ports); - else - msg_end = ktime_add_ms(ktime_get_raw(), - hdcp2_msg_data->msg_read_timeout); + msg_end = ktime_add_ms(ktime_get_raw(), + hdcp2_msg_data->msg_read_timeout); } ret = drm_dp_dpcd_read(aux, offset, From patchwork Sun Feb 4 14:25:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Kandpal, Suraj" X-Patchwork-Id: 13544692 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 03C55C48286 for ; Sun, 4 Feb 2024 14:27:20 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 53E5A1121D6; Sun, 4 Feb 2024 14:27:20 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="KxOwKxE7"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.8]) by gabe.freedesktop.org (Postfix) with ESMTPS id 3F1A61121D6 for ; Sun, 4 Feb 2024 14:27:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1707056839; x=1738592839; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=NPvsSE8Ixrt4cVrWja1EIJnrtRmMsxH4D4VGNNW9xSQ=; b=KxOwKxE7xTatnGCpgoI/eM9QkANM3LN/fuFVlln4n15biJgiCoDiSWzV 8ZyNeYDh/K9XLMh6WB0B3OY5g0sxlmeZ3TH2dH8lvxBG8cfSmdQyyE5xJ 4HBvmokcbRHy+wRqikUWTZc9ZZkSs7Kl3z6LL0SVWQV7FIXd6w5c1k8AY bIJobs0MD7oz7ONEc5NCPl/cjkraPCcHBTNXC6aTWiw8bpWZM5gpIKG/g fqfuLRg1F3S/X5zd9S9t2k8r4zD/aMaTDi6BvyjGuv2IPyOYwDU7jMYb9 Ptp7L8DMUE6gCkl0tYq8R7WlcUAMyDX2leKkqVML69JEtz86InN9xQxQa Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10973"; a="17920784" X-IronPort-AV: E=Sophos;i="6.05,242,1701158400"; d="scan'208";a="17920784" Received: from fmviesa001.fm.intel.com ([10.60.135.141]) by fmvoesa102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Feb 2024 06:27:19 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.05,242,1701158400"; d="scan'208";a="31605285" Received: from kandpal-x299-ud4-pro.iind.intel.com ([10.190.239.32]) by fmviesa001.fm.intel.com with ESMTP; 04 Feb 2024 06:27:18 -0800 From: Suraj Kandpal To: intel-gfx@lists.freedesktop.org Cc: uma.shankar@intel.com, ankit.k.nautiyal@intel.com, Suraj Kandpal Subject: [PATCH 08/11] drm/i915/hdcp: Extract hdcp structure from correct connector Date: Sun, 4 Feb 2024 19:55:02 +0530 Message-Id: <20240204142505.1157146-9-suraj.kandpal@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240204142505.1157146-1-suraj.kandpal@intel.com> References: <20240204142505.1157146-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" Currently intel_hdcp is not being extracted from primary connector this patch fixes that. Fixes: 524240b231ea ("drm/i915/hdcp: Propagate aux info in DP HDCP functions") Signed-off-by: Suraj Kandpal Reviewed-by: Ankit Nautiyal --- drivers/gpu/drm/i915/display/intel_dp_hdcp.c | 7 +++++-- 1 file changed, 5 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 8697cba887e9..0cc5740b0435 100644 --- a/drivers/gpu/drm/i915/display/intel_dp_hdcp.c +++ b/drivers/gpu/drm/i915/display/intel_dp_hdcp.c @@ -391,7 +391,9 @@ intel_dp_hdcp2_wait_for_msg(struct intel_connector *connector, const struct hdcp2_dp_msg_data *hdcp2_msg_data) { struct drm_i915_private *i915 = to_i915(connector->base.dev); - struct intel_hdcp *hdcp = &connector->hdcp; + struct intel_digital_port *dig_port = intel_attached_dig_port(connector); + struct intel_dp *dp = &dig_port->dp; + struct intel_hdcp *hdcp = &dp->attached_connector->hdcp; u8 msg_id = hdcp2_msg_data->msg_id; int ret, timeout; bool msg_ready = false; @@ -507,8 +509,9 @@ int intel_dp_hdcp2_read_msg(struct intel_connector *connector, { struct intel_digital_port *dig_port = intel_attached_dig_port(connector); struct drm_i915_private *i915 = to_i915(dig_port->base.base.dev); - struct intel_hdcp *hdcp = &connector->hdcp; struct drm_dp_aux *aux = &dig_port->dp.aux; + struct intel_dp *dp = &dig_port->dp; + struct intel_hdcp *hdcp = &dp->attached_connector->hdcp; unsigned int offset; u8 *byte = buf; ssize_t ret, bytes_to_recv, len; From patchwork Sun Feb 4 14:25:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Kandpal, Suraj" X-Patchwork-Id: 13544693 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 D1EF6C48292 for ; Sun, 4 Feb 2024 14:27:22 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 50DB71121D3; Sun, 4 Feb 2024 14:27:22 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="fOM3jyYf"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.8]) by gabe.freedesktop.org (Postfix) with ESMTPS id 182421121DA for ; Sun, 4 Feb 2024 14:27: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=1707056841; x=1738592841; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=IZK01uEEKk7DoB5PLAsBxt0HEK6gF66qhn4WCDSl348=; b=fOM3jyYfCsGTR/klIZ7g4YdZW5E4/2mmvZmfKnsqUfHNUlpUCOq4bcyL Yrj8OBzXWIgXWceGyQ147Tq0PsfliRHLx2I6GakRHz97GcKOhgtijpMZQ R6OYKsl0oeceMN+beq7ZzE0cecOAcavtC6vgSGsSm94KUE3cJTHPgKfAW xzU9Gn6qaeJEjTTXfXqXCOL+f3AuN/3pR47ITJtAzeQ9VegNN19SldmXC BP8/arMCloHdMxMMJb+9zMSIh7kepjN/ssrb3yOL2Y4PhFsZZUrVlVZQv VPkm8s5Q62yyOumZe7ZUiHiaiGpHo34b3jmcIoK0rvaGzzmQdWM4Qrlqy Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10973"; a="17920789" X-IronPort-AV: E=Sophos;i="6.05,242,1701158400"; d="scan'208";a="17920789" Received: from fmviesa001.fm.intel.com ([10.60.135.141]) by fmvoesa102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Feb 2024 06:27:21 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.05,242,1701158400"; d="scan'208";a="31605288" Received: from kandpal-x299-ud4-pro.iind.intel.com ([10.190.239.32]) by fmviesa001.fm.intel.com with ESMTP; 04 Feb 2024 06:27:19 -0800 From: Suraj Kandpal To: intel-gfx@lists.freedesktop.org Cc: uma.shankar@intel.com, ankit.k.nautiyal@intel.com, Suraj Kandpal Subject: [PATCH 09/11] drm/i915/hdcp: Save acquire_ctx in intel_hdcp Date: Sun, 4 Feb 2024 19:55:03 +0530 Message-Id: <20240204142505.1157146-10-suraj.kandpal@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240204142505.1157146-1-suraj.kandpal@intel.com> References: <20240204142505.1157146-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" Save acquire_ctx in intel_hdcp so that it can be used later for locking to get vcpi id without need to propate intel_atomic_state. Furthermore it can be called from work_struct where deriving intel_atomic_state is not possible. Signed-off-by: Suraj Kandpal --- .../gpu/drm/i915/display/intel_display_types.h | 1 + drivers/gpu/drm/i915/display/intel_hdcp.c | 15 ++++++++------- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/i915/display/intel_display_types.h b/drivers/gpu/drm/i915/display/intel_display_types.h index 7e7a370a3b30..d7b2af07b499 100644 --- a/drivers/gpu/drm/i915/display/intel_display_types.h +++ b/drivers/gpu/drm/i915/display/intel_display_types.h @@ -545,6 +545,7 @@ struct intel_hdcp { u64 value; struct delayed_work check_work; struct work_struct prop_work; + struct drm_modeset_acquire_ctx *acquire_ctx; /* HDCP1.4 Encryption status */ bool hdcp_encrypted; diff --git a/drivers/gpu/drm/i915/display/intel_hdcp.c b/drivers/gpu/drm/i915/display/intel_hdcp.c index 2b739249b60c..f6eccbd9e7ae 100644 --- a/drivers/gpu/drm/i915/display/intel_hdcp.c +++ b/drivers/gpu/drm/i915/display/intel_hdcp.c @@ -30,12 +30,13 @@ #define KEY_LOAD_TRIES 5 #define HDCP2_LC_RETRY_CNT 3 -static int intel_conn_to_vcpi(struct drm_atomic_state *state, - struct intel_connector *connector) +static int intel_conn_to_vcpi(struct intel_connector *connector) { struct drm_dp_mst_topology_mgr *mgr; struct drm_dp_mst_atomic_payload *payload; struct drm_dp_mst_topology_state *mst_state; + struct intel_hdcp *hdcp = &connector->hdcp; + struct drm_modeset_acquire_ctx *acquire_ctx = hdcp->acquire_ctx; int vcpi = 0; /* For HDMI this is forced to be 0x0. For DP SST also this is 0x0. */ @@ -43,7 +44,7 @@ static int intel_conn_to_vcpi(struct drm_atomic_state *state, return 0; mgr = connector->port->mgr; - drm_modeset_lock(&mgr->base.lock, state->acquire_ctx); + drm_modeset_lock(&mgr->base.lock, acquire_ctx); mst_state = to_drm_dp_mst_topology_state(mgr->base.state); payload = drm_atomic_get_mst_payload_state(mst_state, connector->port); if (drm_WARN_ON(mgr->dev, !payload)) @@ -2315,8 +2316,7 @@ int intel_hdcp_init(struct intel_connector *connector, } static int -intel_hdcp_set_streams(struct intel_digital_port *dig_port, - struct intel_atomic_state *state) +intel_hdcp_set_streams(struct intel_digital_port *dig_port) { struct drm_connector_list_iter conn_iter; struct intel_digital_port *conn_dig_port; @@ -2345,7 +2345,7 @@ intel_hdcp_set_streams(struct intel_digital_port *dig_port, continue; data->streams[data->k].stream_id = - intel_conn_to_vcpi(&state->base, connector); + intel_conn_to_vcpi(connector); data->k++; /* if there is only one active stream */ @@ -2400,12 +2400,13 @@ static int _intel_hdcp_enable(struct intel_atomic_state *state, dig_port->hdcp_port_data.hdcp_transcoder = intel_get_hdcp_transcoder(hdcp->cpu_transcoder); + hdcp->acquire_ctx = state->base.acquire_ctx; /* * Considering that HDCP2.2 is more secure than HDCP1.4, If the setup * is capable of HDCP2.2, it is preferred to use HDCP2.2. */ if (intel_hdcp2_capable(connector)) { - ret = intel_hdcp_set_streams(dig_port, state); + ret = intel_hdcp_set_streams(dig_port); if (!ret) { ret = _intel_hdcp2_enable(connector); if (!ret) From patchwork Sun Feb 4 14:25:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Kandpal, Suraj" X-Patchwork-Id: 13544694 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 54098C4828F for ; Sun, 4 Feb 2024 14:27:25 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id BFB891121DA; Sun, 4 Feb 2024 14:27:24 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="In7R1OyH"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.8]) by gabe.freedesktop.org (Postfix) with ESMTPS id D63501121D9 for ; Sun, 4 Feb 2024 14:27:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1707056843; x=1738592843; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=ZsatCKRGIt9BcWWWAmrsrGGnT+Z82IRwdjTfCE+zs4E=; b=In7R1OyHqq+fWzrRxZKxt6SSAVyLlzYo+vmPulBf04tuZHy7VcsVq5Au FeVRaEdE2YDFxTsdQ9yQTrkpvjSRqatOQwEZVliGJ8emj6BI5aWj/X7wQ jCV15RaadcWFCl7Uc4Rnm3C0zLtN7q5W54FKa+jFC2vY5Z4sGPlqYWyS0 /iJjS+C7evCN6CFiZ3/cTrHMKrll/k+tYndCHPLK1DGO9Bs/yvhQx5uSw T115GJZ7i7xbDPojmVhAsrCy3TUWsNaI/uvRnPgOJrsnstx7HWGOBXYxm DI/W7AHD9JVuHrtU1n0QECkrkUunOtge3yJ2QjKZ4ohuqed7VbZK3koh5 A==; X-IronPort-AV: E=McAfee;i="6600,9927,10973"; a="17920791" X-IronPort-AV: E=Sophos;i="6.05,242,1701158400"; d="scan'208";a="17920791" Received: from fmviesa001.fm.intel.com ([10.60.135.141]) by fmvoesa102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Feb 2024 06:27:22 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.05,242,1701158400"; d="scan'208";a="31605291" Received: from kandpal-x299-ud4-pro.iind.intel.com ([10.190.239.32]) by fmviesa001.fm.intel.com with ESMTP; 04 Feb 2024 06:27:21 -0800 From: Suraj Kandpal To: intel-gfx@lists.freedesktop.org Cc: uma.shankar@intel.com, ankit.k.nautiyal@intel.com, Suraj Kandpal Subject: [PATCH 10/11] drm/i915/hdcp: Allocate stream id after HDCP AKE stage Date: Sun, 4 Feb 2024 19:55:04 +0530 Message-Id: <20240204142505.1157146-11-suraj.kandpal@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240204142505.1157146-1-suraj.kandpal@intel.com> References: <20240204142505.1157146-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" Allocate stream id after HDCP AKE stage and not before so that it can also be done during link integrity check. Right now for MST scenarios LIC fails after hdcp enablement for this reason. Signed-off-by: Suraj Kandpal --- drivers/gpu/drm/i915/display/intel_hdcp.c | 115 ++++++++++------------ 1 file changed, 53 insertions(+), 62 deletions(-) diff --git a/drivers/gpu/drm/i915/display/intel_hdcp.c b/drivers/gpu/drm/i915/display/intel_hdcp.c index f6eccbd9e7ae..a624bfbe5718 100644 --- a/drivers/gpu/drm/i915/display/intel_hdcp.c +++ b/drivers/gpu/drm/i915/display/intel_hdcp.c @@ -69,19 +69,51 @@ static int intel_conn_to_vcpi(struct intel_connector *connector) * DP MST topology. Though it is not compulsory, security fw should change its * policy to mark different content_types for different streams. */ -static void -intel_hdcp_required_content_stream(struct intel_digital_port *dig_port) +static int +intel_hdcp_required_content_stream(struct intel_hdcp *hdcp, + struct intel_digital_port *dig_port) { + struct drm_connector_list_iter conn_iter; + struct intel_digital_port *conn_dig_port; + struct intel_connector *connector; + struct drm_i915_private *i915 = to_i915(dig_port->base.base.dev); struct hdcp_port_data *data = &dig_port->hdcp_port_data; bool enforce_type0 = false; int k; if (dig_port->hdcp_auth_status) - return; + return 0; + + data->k = 0; if (!dig_port->hdcp_mst_type1_capable) enforce_type0 = true; + drm_connector_list_iter_begin(&i915->drm, &conn_iter); + for_each_intel_connector_iter(connector, &conn_iter) { + if (connector->base.status == connector_status_disconnected) + continue; + + if (!intel_encoder_is_mst(intel_attached_encoder(connector))) + continue; + + conn_dig_port = intel_attached_dig_port(connector); + if (conn_dig_port != dig_port) + continue; + + data->streams[data->k].stream_id = + intel_conn_to_vcpi(connector); + data->k++; + + /* if there is only one active stream */ + if (dig_port->dp.active_mst_links <= 1) + break; + } + drm_connector_list_iter_end(&conn_iter); + + if (drm_WARN_ON(&i915->drm, data->k > INTEL_NUM_PIPES(i915) || data->k == 0)) + return -EINVAL; + /* * Apply common protection level across all streams in DP MST Topology. * Use highest supported content type for all streams in DP MST Topology. @@ -89,18 +121,23 @@ intel_hdcp_required_content_stream(struct intel_digital_port *dig_port) for (k = 0; k < data->k; k++) data->streams[k].stream_type = enforce_type0 ? DRM_MODE_HDCP_CONTENT_TYPE0 : DRM_MODE_HDCP_CONTENT_TYPE1; + + return 0; } -static void intel_hdcp_prepare_streams(struct intel_connector *connector) +static int intel_hdcp_prepare_streams(struct intel_connector *connector) { struct intel_digital_port *dig_port = intel_attached_dig_port(connector); struct hdcp_port_data *data = &dig_port->hdcp_port_data; struct intel_hdcp *hdcp = &connector->hdcp; if (!intel_encoder_is_mst(intel_attached_encoder(connector))) { + data->k = 1; + data->streams[0].stream_id = 0; data->streams[0].stream_type = hdcp->content_type; + return 0; } else { - intel_hdcp_required_content_stream(dig_port); + return intel_hdcp_required_content_stream(hdcp, dig_port); } } @@ -1911,7 +1948,13 @@ static int hdcp2_authenticate_and_encrypt(struct intel_connector *connector) for (i = 0; i < tries && !dig_port->hdcp_auth_status; i++) { ret = hdcp2_authenticate_sink(connector); if (!ret) { - intel_hdcp_prepare_streams(connector); + ret = intel_hdcp_prepare_streams(connector); + if (ret) { + drm_dbg_kms(&i915->drm, + "Prepare stream failed.(%d)\n", + ret); + break; + } ret = hdcp2_propagate_stream_management_info(connector); if (ret) { @@ -2315,51 +2358,6 @@ int intel_hdcp_init(struct intel_connector *connector, return 0; } -static int -intel_hdcp_set_streams(struct intel_digital_port *dig_port) -{ - struct drm_connector_list_iter conn_iter; - struct intel_digital_port *conn_dig_port; - struct intel_connector *connector; - struct drm_i915_private *i915 = to_i915(dig_port->base.base.dev); - struct hdcp_port_data *data = &dig_port->hdcp_port_data; - - if (!intel_encoder_is_mst(&dig_port->base)) { - data->k = 1; - data->streams[0].stream_id = 0; - return 0; - } - - data->k = 0; - - drm_connector_list_iter_begin(&i915->drm, &conn_iter); - for_each_intel_connector_iter(connector, &conn_iter) { - if (connector->base.status == connector_status_disconnected) - continue; - - if (!intel_encoder_is_mst(intel_attached_encoder(connector))) - continue; - - conn_dig_port = intel_attached_dig_port(connector); - if (conn_dig_port != dig_port) - continue; - - data->streams[data->k].stream_id = - intel_conn_to_vcpi(connector); - data->k++; - - /* if there is only one active stream */ - if (dig_port->dp.active_mst_links <= 1) - break; - } - drm_connector_list_iter_end(&conn_iter); - - if (drm_WARN_ON(&i915->drm, data->k > INTEL_NUM_PIPES(i915) || data->k == 0)) - return -EINVAL; - - return 0; -} - static int _intel_hdcp_enable(struct intel_atomic_state *state, struct intel_encoder *encoder, const struct intel_crtc_state *pipe_config, @@ -2406,17 +2404,10 @@ static int _intel_hdcp_enable(struct intel_atomic_state *state, * is capable of HDCP2.2, it is preferred to use HDCP2.2. */ if (intel_hdcp2_capable(connector)) { - ret = intel_hdcp_set_streams(dig_port); - if (!ret) { - ret = _intel_hdcp2_enable(connector); - if (!ret) - check_link_interval = - DRM_HDCP2_CHECK_PERIOD_MS; - } else { - drm_dbg_kms(&i915->drm, - "Set content streams failed: (%d)\n", - ret); - } + ret = _intel_hdcp2_enable(connector); + if (!ret) + check_link_interval = + DRM_HDCP2_CHECK_PERIOD_MS; } /* From patchwork Sun Feb 4 14:25:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Kandpal, Suraj" X-Patchwork-Id: 13544695 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 6C1B9C4828F for ; Sun, 4 Feb 2024 14:27:28 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C65921121D9; Sun, 4 Feb 2024 14:27:27 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="HnFVwKEI"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.8]) by gabe.freedesktop.org (Postfix) with ESMTPS id 645DA1121D9 for ; Sun, 4 Feb 2024 14:27:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1707056844; x=1738592844; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=fFqHHeLJqpHd10Fo5VFJq7yC3Rt1vy9bV0iUCg/QqrI=; b=HnFVwKEIP096IpYSt68m6MMpUZjisPvRxuKlHPlc0cT5Izql4iA2Gzyx /0ISYTJoRD57YSMHLUj57NDutxphMz65sDplwnDMSLetilLJYKu9QTUKJ HGtWc9MQTYWL7Sliz+APBFChNw7rWtyVcqTwWmVVIDVHGIT+MkxXfmD6C S0xaLcnQSlx+l4uPd5U3Jz4OgMe5Nha8bJBOemS7D8I4LAAGJqDyn+zVj 8yoLUWqNm5nQZXj2kOFmwXOuWWIG/AbvyX4GF/T6qvcfbvONCUr/wCpo6 SKCRQBt6tSqLxcqr01j7Foo4gcNmAVAL3KUSdQ8DMuWiz8gUGHZgVIvqU g==; X-IronPort-AV: E=McAfee;i="6600,9927,10973"; a="17920793" X-IronPort-AV: E=Sophos;i="6.05,242,1701158400"; d="scan'208";a="17920793" Received: from fmviesa001.fm.intel.com ([10.60.135.141]) by fmvoesa102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Feb 2024 06:27:24 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.05,242,1701158400"; d="scan'208";a="31605297" Received: from kandpal-x299-ud4-pro.iind.intel.com ([10.190.239.32]) by fmviesa001.fm.intel.com with ESMTP; 04 Feb 2024 06:27:23 -0800 From: Suraj Kandpal To: intel-gfx@lists.freedesktop.org Cc: uma.shankar@intel.com, ankit.k.nautiyal@intel.com, Suraj Kandpal Subject: [PATCH 11/11] drm/i915/hdcp: Read Rxcaps for robustibility Date: Sun, 4 Feb 2024 19:55:05 +0530 Message-Id: <20240204142505.1157146-12-suraj.kandpal@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240204142505.1157146-1-suraj.kandpal@intel.com> References: <20240204142505.1157146-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" We see some monitors and docks report incorrect hdcp version and capability in first few reads so we read rx_caps three times before we conclude the monitor's or docks HDCP capability --v2 -Add comment to justify the 3 time read loop for hdcp capability[Ankit] Signed-off-by: Suraj Kandpal Reviewed-by: Ankit Nautiyal --- drivers/gpu/drm/i915/display/intel_dp_hdcp.c | 29 ++++++++++++++------ 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/drivers/gpu/drm/i915/display/intel_dp_hdcp.c b/drivers/gpu/drm/i915/display/intel_dp_hdcp.c index 0cc5740b0435..5868ee9dfad9 100644 --- a/drivers/gpu/drm/i915/display/intel_dp_hdcp.c +++ b/drivers/gpu/drm/i915/display/intel_dp_hdcp.c @@ -640,18 +640,29 @@ int _intel_dp_hdcp2_capable(struct drm_dp_aux *aux, bool *capable) { u8 rx_caps[3]; - int ret; + int ret, i; *capable = false; - ret = drm_dp_dpcd_read(aux, - DP_HDCP_2_2_REG_RX_CAPS_OFFSET, - rx_caps, HDCP_2_2_RXCAPS_LEN); - if (ret != HDCP_2_2_RXCAPS_LEN) - return ret >= 0 ? -EIO : ret; - if (rx_caps[0] == HDCP_2_2_RX_CAPS_VERSION_VAL && - HDCP_2_2_DP_HDCP_CAPABLE(rx_caps[2])) - *capable = true; + /* + * Some HDCP monitors act really shady by not giving the correct hdcp + * capability on the first rx_caps read and usually take an extra read + * to give the capability. We read rx_caps three times before we + * declare a monitor not capable of HDCP 2.2. + */ + for (i = 0; i < 3; i++) { + ret = drm_dp_dpcd_read(aux, + DP_HDCP_2_2_REG_RX_CAPS_OFFSET, + rx_caps, HDCP_2_2_RXCAPS_LEN); + if (ret != HDCP_2_2_RXCAPS_LEN) + return ret >= 0 ? -EIO : ret; + + if (rx_caps[0] == HDCP_2_2_RX_CAPS_VERSION_VAL && + HDCP_2_2_DP_HDCP_CAPABLE(rx_caps[2])) { + *capable = true; + break; + } + } return 0; }