From patchwork Wed Jan 31 19:32:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Suraj Kandpal X-Patchwork-Id: 13539908 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 C2AC3C47258 for ; Wed, 31 Jan 2024 19:34:45 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 5B10D10FC1E; Wed, 31 Jan 2024 19:34:45 +0000 (UTC) Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.31]) by gabe.freedesktop.org (Postfix) with ESMTPS id E404110FC13 for ; Wed, 31 Jan 2024 19:34:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1706729682; x=1738265682; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=HHNqQmpgNPG5po9xJpfWXOxe7pXF5h86aUav4mcEBAs=; b=f5sRflD2+O8sBV6Fa1BmkrAjrokXWHRBcJOAIEvmuCP4zXh79B+DE1Vu L0o7gtyntzXPUOrDcQvZ8IrV8tSforCpmh7BPps4MW+I9wqKfhkRKrbgS tuodwGJf9QicLXSaO9DXzYb747nDxltB6HRQtA84mP7gAbLxmZNWG+sbx OtFfmdKQruOvF4cuvl1EsOqpLTJuOJP5/2WDxBCxUIhZ8ZF1DQSYrtxwk /Owj+mAMA5ZCghiRxju2BbTctvPYYizRvgqckEr/8dyzvFfq/L6hd8BZ5 XQ4JSnqf1b4ph+uhfGh2iYf1a/iWH5UtYTyi7LFDZlLWJ285q+epkPsi2 Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10969"; a="467936113" X-IronPort-AV: E=Sophos;i="6.05,233,1701158400"; d="scan'208";a="467936113" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 Jan 2024 11:34:42 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10969"; a="822686246" X-IronPort-AV: E=Sophos;i="6.05,233,1701158400"; d="scan'208";a="822686246" Received: from kandpal-x299-ud4-pro.iind.intel.com ([10.190.239.32]) by orsmga001.jf.intel.com with ESMTP; 31 Jan 2024 11:34:40 -0800 From: Suraj Kandpal To: intel-gfx@lists.freedesktop.org Subject: [PATCH 01/10] drm/i915/hdcp: Move to direct reads for HDCP Date: Thu, 1 Feb 2024 01:02:32 +0530 Message-Id: <20240131193240.938405-2-suraj.kandpal@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240131193240.938405-1-suraj.kandpal@intel.com> References: <20240131193240.938405-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 Wed Jan 31 19:32:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Suraj Kandpal X-Patchwork-Id: 13539909 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 16C8AC47258 for ; Wed, 31 Jan 2024 19:34:48 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9498110FC84; Wed, 31 Jan 2024 19:34:47 +0000 (UTC) Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.31]) by gabe.freedesktop.org (Postfix) with ESMTPS id BD64210FC84 for ; Wed, 31 Jan 2024 19:34:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1706729685; x=1738265685; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=0AKfqE2VWaJWGy38fdGY9PGsPXYUdR0smFlZMaD5dsU=; b=ARXDOJk+ujE3OTxyHtr2Qb1/jkGQJKxHGLtkgbDe1BbQ4If8mkPcTJnj bsqNlhD9X3xZdphx/HI7XPkBuWTJWc8UlCvafQMAdpsS3g/Tt6NAxyBJm igj6m7M/cz97k+ChOZBs/mu4eZnImOrsF3qTHWCC50nFm7fvmx+/rc6Ca vKP1ePiS9uAtG+5OuxAWNZ8zdazaWlGvaVdHvwyk7oxUIXU4t71segu3J dv+tYTIpIRff4JmLxhMPupl44fWq48MJ8qHrv1X0sRKrWtqUU+15FGnec nMPTfOMEI/Ja56mrlzgOKP668WEJ2rT1eRRvm3K7MzGbcDEBC3cTpJewb Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10969"; a="467936121" X-IronPort-AV: E=Sophos;i="6.05,233,1701158400"; d="scan'208";a="467936121" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 Jan 2024 11:34:44 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10969"; a="822686251" X-IronPort-AV: E=Sophos;i="6.05,233,1701158400"; d="scan'208";a="822686251" Received: from kandpal-x299-ud4-pro.iind.intel.com ([10.190.239.32]) by orsmga001.jf.intel.com with ESMTP; 31 Jan 2024 11:34:42 -0800 From: Suraj Kandpal To: intel-gfx@lists.freedesktop.org Subject: [PATCH 02/10] drm/i915/hdcp: Move source hdcp2 checks into its own function Date: Thu, 1 Feb 2024 01:02:33 +0530 Message-Id: <20240131193240.938405-3-suraj.kandpal@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240131193240.938405-1-suraj.kandpal@intel.com> References: <20240131193240.938405-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 --- 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 Wed Jan 31 19:32:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Suraj Kandpal X-Patchwork-Id: 13539910 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 A78D4C48285 for ; Wed, 31 Jan 2024 19:34:49 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 26CA810FC89; Wed, 31 Jan 2024 19:34:49 +0000 (UTC) Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.31]) by gabe.freedesktop.org (Postfix) with ESMTPS id 66C1E10FC84 for ; Wed, 31 Jan 2024 19:34:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1706729686; x=1738265686; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Z3Af0EfGKgMOKeh8clrW3fmorNOuEjmc6ui3gOPL5XY=; b=UCOqwuDYLqomy2PwMkiJqy5/veJbU2I4ABucabE5h2gV2ZXPJzaYg4FT SOhrzR4HXszs2s+z/DVyYpYsitQ/ReKe4r3Rc1amUrBuibBsf6cf9CRDw ZrmrmqkPzFCY+cCal9fsFOE5J9f+XvjAHvBjtLmyqUswPByNyoUbITUW/ 7irDoZ4I7VBibzBDOY+ekNm0j313xz+btytEUQdkqVX3wMc7keJRQmQYL p+e1oEtR06Z/oQXml61mcrIKTS9G3RR6dSolqoP//TrKLljmqntw1FTVW 0FesGaDdlTeYiJb2LYgEOuwvAlC8ZoEnPqW46mG/GQdN4bQXtpdsjXM6P g==; X-IronPort-AV: E=McAfee;i="6600,9927,10969"; a="467936136" X-IronPort-AV: E=Sophos;i="6.05,233,1701158400"; d="scan'208";a="467936136" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 Jan 2024 11:34:46 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10969"; a="822686255" X-IronPort-AV: E=Sophos;i="6.05,233,1701158400"; d="scan'208";a="822686255" Received: from kandpal-x299-ud4-pro.iind.intel.com ([10.190.239.32]) by orsmga001.jf.intel.com with ESMTP; 31 Jan 2024 11:34:44 -0800 From: Suraj Kandpal To: intel-gfx@lists.freedesktop.org Subject: [PATCH 03/10] drm/i915/hdcp: Refactor intel_dp_hdcp2_capable Date: Thu, 1 Feb 2024 01:02:34 +0530 Message-Id: <20240131193240.938405-4-suraj.kandpal@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240131193240.938405-1-suraj.kandpal@intel.com> References: <20240131193240.938405-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 --- 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 Wed Jan 31 19:32:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Suraj Kandpal X-Patchwork-Id: 13539913 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 40A87C47258 for ; Wed, 31 Jan 2024 19:34:56 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 228A310FC8B; Wed, 31 Jan 2024 19:34:55 +0000 (UTC) Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.31]) by gabe.freedesktop.org (Postfix) with ESMTPS id 7157310FC89 for ; Wed, 31 Jan 2024 19:34:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1706729688; x=1738265688; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=x160up0xtZYStNtxbne2Bc2915iJs6p2BhIYy3aPbeA=; b=Wtjg5l2reaYVJC8rM9MLYtY2dAV+rEuI3odB+m4LZtESMSJU96A6eAAO OaocxBpqHjvSJhppblq8Ubi6q6PWtIb3UMGKPrYQP3uKNx1X8SZpP/UBt T+sUR77k3oR2oJHy6q6Dha/74nEP6z232MKzB9SbbeAPVRjUMyzr3KKge YkqgIvJCfQ2cxrWtKJ6osTFLQB1cir9yuae9cdrE/JDAPHkR3frAFksmr FtyW1KICcx9kYH0vBm27IVFrio87D0EgqTvI2ah81xqGD9IV24DxL3G3u 0wE+ciojKGnpmERTGS08zoWKa+Y//7hMqFY65QcIqwOGciug9rKC74c/N g==; X-IronPort-AV: E=McAfee;i="6600,9927,10969"; a="467936146" X-IronPort-AV: E=Sophos;i="6.05,233,1701158400"; d="scan'208";a="467936146" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 Jan 2024 11:34:48 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10969"; a="822686260" X-IronPort-AV: E=Sophos;i="6.05,233,1701158400"; d="scan'208";a="822686260" Received: from kandpal-x299-ud4-pro.iind.intel.com ([10.190.239.32]) by orsmga001.jf.intel.com with ESMTP; 31 Jan 2024 11:34:46 -0800 From: Suraj Kandpal To: intel-gfx@lists.freedesktop.org Subject: [PATCH 04/10] drm/i915/hdcp: Pass drm_dp_aux to read_bcaps function Date: Thu, 1 Feb 2024 01:02:35 +0530 Message-Id: <20240131193240.938405-5-suraj.kandpal@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240131193240.938405-1-suraj.kandpal@intel.com> References: <20240131193240.938405-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 --- drivers/gpu/drm/i915/display/intel_dp_hdcp.c | 12 +++++------- 1 file changed, 5 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..261de01aa5d8 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, u8 *bcaps) { - struct drm_i915_private *i915 = to_i915(dig_port->base.base.dev); + struct drm_i915_private *i915 = to_i915(aux->crtc->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, @@ -146,7 +146,7 @@ int intel_dp_hdcp_repeater_present(struct intel_digital_port *dig_port, ssize_t ret; u8 bcaps; - ret = intel_dp_hdcp_read_bcaps(dig_port, &bcaps); + ret = intel_dp_hdcp_read_bcaps(&dig_port->dp.aux, &bcaps); if (ret) return ret; @@ -271,7 +271,7 @@ int intel_dp_hdcp_capable(struct intel_digital_port *dig_port, ssize_t ret; u8 bcaps; - ret = intel_dp_hdcp_read_bcaps(dig_port, &bcaps); + ret = intel_dp_hdcp_read_bcaps(&dig_port->dp.aux, &bcaps); if (ret) return ret; @@ -639,8 +639,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 Wed Jan 31 19:32:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Suraj Kandpal X-Patchwork-Id: 13539911 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 CCF36C47DB3 for ; Wed, 31 Jan 2024 19:34:52 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 4333110FC87; Wed, 31 Jan 2024 19:34:52 +0000 (UTC) Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.31]) by gabe.freedesktop.org (Postfix) with ESMTPS id D8BAF10FC87 for ; Wed, 31 Jan 2024 19:34:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1706729690; x=1738265690; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=k5LOFzuNM07VKLMUumxwfIr6Rtz3cNGH2PEp0AdgpFo=; b=X+CMBscSAHi4KNUXqzUHtb8MBXzr9aTAB7Ef/eSGZw+k2Q1fAsODxKn0 YkeDlyNdRl8xYeRLRQtMTr2bbgRzwDIR3uCysDSJRWpYKi0Bju1Enywyn eSJenxos6h6001bvyL/uqN9Zyb+RdajJfinObnZI5iuQRJTTRR4GacbKY N5ZpXBn8WsLvw6ipARlN6wpZAfZqeOBeDojhDNt0/HT0qBARY9A6scBEP YHIvg3fbf5WRowNHgnq5uoXnpK28J7TduxCHChItmgQkf3yTSvtFZuOyi 3LJnrWs8ldVNABO2DVcDvxLHqgXt2AkTxrrV3EyKLqhVCYdyeZdi03u7U Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10969"; a="467936159" X-IronPort-AV: E=Sophos;i="6.05,233,1701158400"; d="scan'208";a="467936159" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 Jan 2024 11:34:50 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10969"; a="822686266" X-IronPort-AV: E=Sophos;i="6.05,233,1701158400"; d="scan'208";a="822686266" Received: from kandpal-x299-ud4-pro.iind.intel.com ([10.190.239.32]) by orsmga001.jf.intel.com with ESMTP; 31 Jan 2024 11:34:48 -0800 From: Suraj Kandpal To: intel-gfx@lists.freedesktop.org Subject: [PATCH 05/10] drm/i915/hdcp: Add new remote capability check shim function Date: Thu, 1 Feb 2024 01:02:36 +0530 Message-Id: <20240131193240.938405-6-suraj.kandpal@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240131193240.938405-1-suraj.kandpal@intel.com> References: <20240131193240.938405-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. Signed-off-by: Suraj Kandpal --- .../drm/i915/display/intel_display_types.h | 4 ++++ drivers/gpu/drm/i915/display/intel_dp_hdcp.c | 22 +++++++++++++++++++ drivers/gpu/drm/i915/display/intel_hdcp.c | 16 ++++++++++++++ drivers/gpu/drm/i915/display/intel_hdcp.h | 3 +++ 4 files changed, 45 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 261de01aa5d8..56019b29fb49 100644 --- a/drivers/gpu/drm/i915/display/intel_dp_hdcp.c +++ b/drivers/gpu/drm/i915/display/intel_dp_hdcp.c @@ -666,6 +666,27 @@ 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_dp_aux *aux = &connector->port->aux; + u8 bcaps; + int ret; + + ret = _intel_dp_hdcp2_capable(aux, hdcp2_capable); + if (ret) + return ret; + + ret = intel_dp_hdcp_read_bcaps(aux, &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, @@ -683,6 +704,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 Wed Jan 31 19:32:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Suraj Kandpal X-Patchwork-Id: 13539912 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 568A9C47DB3 for ; Wed, 31 Jan 2024 19:34:55 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D2C7510F144; Wed, 31 Jan 2024 19:34:54 +0000 (UTC) Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.31]) by gabe.freedesktop.org (Postfix) with ESMTPS id E2F8110FC87 for ; Wed, 31 Jan 2024 19:34:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1706729691; x=1738265691; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=jmpjHiRNCgiE8190Lo/IuAMLOfomnS6UeBDdhiaGpRs=; b=idKVJ0RRVenvNsSyoMJTph6VjBDsRyCsixbli8OdVl+wJ19NAUtKPKdt pZOTS05YHv+W3b659tIgn+dNGMcFbKowXB/71O/CcpCdLfOn3XeMwoffu rKR37+D8gJe1uekHViKTLLn1Ri921IwOi/rjfw1TG1S6aj/twjMaAeb0s Om48SlSzic1bJQOymKyGyNTAhKpM7eXYZcVPP5fxi6yHia7sToOO3NU5R AUSmTmHP/5jTNIF0MiLrqAc4uNTHsgL8OEXrdO4Y/ry9vbYuCClozzWtl LpDkDbrR0A8S8UGD9Bia2y7EDz4WUNfcz57+DPa/JAxmW+NGNn+9pr1Aw w==; X-IronPort-AV: E=McAfee;i="6600,9927,10969"; a="467936161" X-IronPort-AV: E=Sophos;i="6.05,233,1701158400"; d="scan'208";a="467936161" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 Jan 2024 11:34:51 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10969"; a="822686269" X-IronPort-AV: E=Sophos;i="6.05,233,1701158400"; d="scan'208";a="822686269" Received: from kandpal-x299-ud4-pro.iind.intel.com ([10.190.239.32]) by orsmga001.jf.intel.com with ESMTP; 31 Jan 2024 11:34:50 -0800 From: Suraj Kandpal To: intel-gfx@lists.freedesktop.org Subject: [PATCH 06/10] drm/i915/hdcp: HDCP Capability for the downstream device Date: Thu, 1 Feb 2024 01:02:37 +0530 Message-Id: <20240131193240.938405-7-suraj.kandpal@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240131193240.938405-1-suraj.kandpal@intel.com> References: <20240131193240.938405-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] Signed-off-by: Suraj Kandpal --- .../drm/i915/display/intel_display_debugfs.c | 26 +++++++++++++++---- 1 file changed, 21 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..41458f1cae38 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,12 @@ static void intel_connector_info(struct seq_file *m, } seq_puts(m, "\tHDCP version: "); - intel_hdcp_info(m, intel_connector); + intel_hdcp_info(m, intel_connector, true); + + if (intel_encoder_is_mst(encoder)) { + 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 +1142,12 @@ 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); + intel_hdcp_info(m, connector, true); + + if (intel_encoder_is_mst(connector->encoder)) { + 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 Wed Jan 31 19:32:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Suraj Kandpal X-Patchwork-Id: 13539914 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 72DEEC47258 for ; Wed, 31 Jan 2024 19:35:13 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 0033310FC95; Wed, 31 Jan 2024 19:35:12 +0000 (UTC) Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.31]) by gabe.freedesktop.org (Postfix) with ESMTPS id CC87610FC90 for ; Wed, 31 Jan 2024 19:35: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=1706729711; x=1738265711; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=dkZAalOTSLA/yDEVX9bvzYMqSoYjiBWuye+omPkKl/o=; b=e5ktd1oybSYsbTa0rqL/s2EQbXoz/iY4ymPlZu9Gx7MnhcKjje6G7dYs E9mZ4/iJU07DOJ29Fp6hMJlRIG5EYxtYA3GL9OHu9pfC6Rtp1VPSWey0H zMhMV+NkqtWOgQKy817LXu0dERy3WiZ68/I+1iaGa2syDD+tOKKUleQnz TLieaCeG1iNRbgIuLf6S3yl95lM0n7n1zvkCULJIbdubvMO07pTMOoewp sm2rMaj5aYnPkIbgJBAsa6GTpwQUHc8ae4hVLVvjKFsYu/lK3d08042zM 3zpOCUamFOkpYrhbYlKEnZI1EaUFdbIL2QC5B3j13G6pi8vmi6sG86zll Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10969"; a="467936208" X-IronPort-AV: E=Sophos;i="6.05,233,1701158400"; d="scan'208";a="467936208" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 Jan 2024 11:34:56 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10969"; a="822686275" X-IronPort-AV: E=Sophos;i="6.05,233,1701158400"; d="scan'208";a="822686275" Received: from kandpal-x299-ud4-pro.iind.intel.com ([10.190.239.32]) by orsmga001.jf.intel.com with ESMTP; 31 Jan 2024 11:34:51 -0800 From: Suraj Kandpal To: intel-gfx@lists.freedesktop.org Subject: [PATCH 07/10] drm/i915/hdcp: Remove additional timing for reading mst hdcp message Date: Thu, 1 Feb 2024 01:02:38 +0530 Message-Id: <20240131193240.938405-8-suraj.kandpal@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240131193240.938405-1-suraj.kandpal@intel.com> References: <20240131193240.938405-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 56019b29fb49..6d28119f33fd 100644 --- a/drivers/gpu/drm/i915/display/intel_dp_hdcp.c +++ b/drivers/gpu/drm/i915/display/intel_dp_hdcp.c @@ -549,13 +549,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 Wed Jan 31 19:32:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Suraj Kandpal X-Patchwork-Id: 13539916 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 0225CC47DB3 for ; Wed, 31 Jan 2024 19:35:17 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 5C56610FC97; Wed, 31 Jan 2024 19:35:17 +0000 (UTC) Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.31]) by gabe.freedesktop.org (Postfix) with ESMTPS id B24E610FC90 for ; Wed, 31 Jan 2024 19:35:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1706729712; x=1738265712; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=f95pS4d1AirjMrJlIrrkT7GEYzm5hh4TOzxd0zWMWx4=; b=gummqIl2A5uONWtHKTjaibeXbxIhWNhRyYroAyrseFmWADTC3JgeLPZC cPpWpqpwc7HCTdAl4a/QMeedp89Ld8CAjZ5/tvhWHOShyPPC0J0MRZ4Jl /va2yzweBmlGSR6Rk9RhMFUxpHD4tHHTH4iIbguKyyXfrRJvqxHrvdoVh yCBYsZraaIZ9wnUejJG8s/qCBX1lvMZ0c/3kTXYlq4DpEjZQjZZnmwEi6 tFa8LESNNxkrjSEyps2s/5CV2DT7Z7jR5tn6/AaERyRkXH12LBPa/MTmh sYOcGH00PnsEgYJ1KiieaRaoJ2n7kRxblooOh8Scrp6ZmSqvjgHzlETWP Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10969"; a="467936214" X-IronPort-AV: E=Sophos;i="6.05,233,1701158400"; d="scan'208";a="467936214" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 Jan 2024 11:34:57 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10969"; a="822686281" X-IronPort-AV: E=Sophos;i="6.05,233,1701158400"; d="scan'208";a="822686281" Received: from kandpal-x299-ud4-pro.iind.intel.com ([10.190.239.32]) by orsmga001.jf.intel.com with ESMTP; 31 Jan 2024 11:34:55 -0800 From: Suraj Kandpal To: intel-gfx@lists.freedesktop.org Subject: [PATCH 08/10] drm/i915/hdcp: Extract hdcp structure from correct connector Date: Thu, 1 Feb 2024 01:02:39 +0530 Message-Id: <20240131193240.938405-9-suraj.kandpal@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240131193240.938405-1-suraj.kandpal@intel.com> References: <20240131193240.938405-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 --- 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 6d28119f33fd..2cd987645776 100644 --- a/drivers/gpu/drm/i915/display/intel_dp_hdcp.c +++ b/drivers/gpu/drm/i915/display/intel_dp_hdcp.c @@ -389,7 +389,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; @@ -505,8 +507,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 Wed Jan 31 19:32:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Suraj Kandpal X-Patchwork-Id: 13539915 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 5623EC47DB3 for ; Wed, 31 Jan 2024 19:35:14 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id CC0E410FC96; Wed, 31 Jan 2024 19:35:13 +0000 (UTC) Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.31]) by gabe.freedesktop.org (Postfix) with ESMTPS id 53A4A10FC90 for ; Wed, 31 Jan 2024 19:35:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1706729712; x=1738265712; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=tCI8ne1teGuZMRKCQwE3x6luc3eGcL50lFleLntDkQs=; b=arQH0gXbRNPOcDPczNEynhBuCoohwXsuEX/i2WySVj+A7wzoWg4aR2Pr 7KjiVq4eIw13nAPFD0ICAtqT+lnnrtwq8wtNKMTFjPVPGbbYYs4bqxO9G gKit72BWnjZE9nnovngJxbYJA2ztAGSBPDc0PkttFDfsYcvrKtVHobYZN SO1YcS8ZVq6U0dsIqS2ZSFQLS/uEJZ1JY/AGlnrCOdtAdqemX/o8AJ1j6 lROgvbp+pEfr2OvytD4rxESTnEenkKq2sXrBFpahY/orjlCkk9lMTWLaX 4J3Fz05copUoR+fSo/bubpzGm6pyIoxBHUuaSzLdFfpe1lnAjoxXyoCMH g==; X-IronPort-AV: E=McAfee;i="6600,9927,10969"; a="467936220" X-IronPort-AV: E=Sophos;i="6.05,233,1701158400"; d="scan'208";a="467936220" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 Jan 2024 11:34:59 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10969"; a="822686289" X-IronPort-AV: E=Sophos;i="6.05,233,1701158400"; d="scan'208";a="822686289" Received: from kandpal-x299-ud4-pro.iind.intel.com ([10.190.239.32]) by orsmga001.jf.intel.com with ESMTP; 31 Jan 2024 11:34:57 -0800 From: Suraj Kandpal To: intel-gfx@lists.freedesktop.org Subject: [PATCH 09/10] drm/i915/hdcp: Allocate stream id after HDCP AKE stage Date: Thu, 1 Feb 2024 01:02:40 +0530 Message-Id: <20240131193240.938405-10-suraj.kandpal@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240131193240.938405-1-suraj.kandpal@intel.com> References: <20240131193240.938405-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 --- .../drm/i915/display/intel_display_types.h | 1 + drivers/gpu/drm/i915/display/intel_hdcp.c | 124 ++++++++---------- 2 files changed, 59 insertions(+), 66 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..5c9da7b9756f 100644 --- a/drivers/gpu/drm/i915/display/intel_hdcp.c +++ b/drivers/gpu/drm/i915/display/intel_hdcp.c @@ -30,8 +30,9 @@ #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 drm_modeset_acquire_ctx *acquire_ctx, + struct intel_connector *connector) { struct drm_dp_mst_topology_mgr *mgr; struct drm_dp_mst_atomic_payload *payload; @@ -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)) @@ -68,19 +69,51 @@ static int intel_conn_to_vcpi(struct drm_atomic_state *state, * 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(hdcp->acquire_ctx, 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. @@ -88,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); } } @@ -1910,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) { @@ -2314,52 +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 intel_atomic_state *state) -{ - 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(&state->base, 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, @@ -2400,22 +2398,16 @@ 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); - 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; } /*