From patchwork Thu Feb 6 15:04:41 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Gupta, Anshuman" X-Patchwork-Id: 11368729 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6EF4F13A4 for ; Thu, 6 Feb 2020 15:15:09 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 57CC321741 for ; Thu, 6 Feb 2020 15:15:09 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 57CC321741 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=intel.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=intel-gfx-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C29E66FA82; Thu, 6 Feb 2020 15:15:08 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by gabe.freedesktop.org (Postfix) with ESMTPS id E498C6FA82 for ; Thu, 6 Feb 2020 15:15:00 +0000 (UTC) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 06 Feb 2020 07:15:00 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,410,1574150400"; d="scan'208";a="226176004" Received: from unknown (HELO genxfsim-desktop.iind.intel.com) ([10.223.74.178]) by fmsmga008.fm.intel.com with ESMTP; 06 Feb 2020 07:14:59 -0800 From: Anshuman Gupta To: intel-gfx@lists.freedesktop.org Date: Thu, 6 Feb 2020 20:34:41 +0530 Message-Id: <20200206150442.32353-2-anshuman.gupta@intel.com> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20200206150442.32353-1-anshuman.gupta@intel.com> References: <20200206150442.32353-1-anshuman.gupta@intel.com> MIME-Version: 1.0 Subject: [Intel-gfx] [PATCH 1/2] drm/i915/hdcp: Fix 1B-06 HDCP2.2 Comp test 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" HDCP Repeater initializes seq_num_V to 0 at the beginning of hdcp Session i.e. after AKE_init received. HDCP 2.2 Comp specs 1B-06 test verifies that whether DUT considers failures of authentication if the repeater provides a non-zero value in seq_num_V in the first, RepeaterAuth_Send_ReceiverID_List message after first AKE_Init. Fixing this broken test. Cc: Ramalingam C Signed-off-by: Anshuman Gupta --- drivers/gpu/drm/i915/display/intel_display_types.h | 3 +++ drivers/gpu/drm/i915/display/intel_hdcp.c | 13 +++++++++++++ 2 files changed, 16 insertions(+) diff --git a/drivers/gpu/drm/i915/display/intel_display_types.h b/drivers/gpu/drm/i915/display/intel_display_types.h index 7ae0bc8b80d1..2ae540e986ba 100644 --- a/drivers/gpu/drm/i915/display/intel_display_types.h +++ b/drivers/gpu/drm/i915/display/intel_display_types.h @@ -360,6 +360,9 @@ struct intel_hdcp { /* HDCP2.2 Encryption status */ bool hdcp2_encrypted; + /* Flag indicate if it is a first ReceiverID_List msg after AKE_Init */ + bool first_recvid_msg; + /* * Content Stream Type defined by content owner. TYPE0(0x0) content can * flow in the link protected by HDCP2.2 or HDCP1.4, where as TYPE1(0x1) diff --git a/drivers/gpu/drm/i915/display/intel_hdcp.c b/drivers/gpu/drm/i915/display/intel_hdcp.c index 4d1a33d13105..3e24a6df503a 100644 --- a/drivers/gpu/drm/i915/display/intel_hdcp.c +++ b/drivers/gpu/drm/i915/display/intel_hdcp.c @@ -1251,6 +1251,8 @@ static int hdcp2_authentication_key_exchange(struct intel_connector *connector) size_t size; int ret; + hdcp->first_recvid_msg = true; + /* Init for seq_num */ hdcp->seq_num_v = 0; hdcp->seq_num_m = 0; @@ -1462,6 +1464,16 @@ int hdcp2_authenticate_repeater_topology(struct intel_connector *connector) seq_num_v = drm_hdcp_be24_to_cpu((const u8 *)msgs.recvid_list.seq_num_v); + /* + * HDCP 2.2 Spec HDMI PAGE 19, DP PAGE 20 + * HDCP 2.2 Comp 1B-06 test requires to disable encryption if there is + * non zero seq_num_V from recevier. + */ + if (hdcp->first_recvid_msg && seq_num_v) { + drm_dbg_kms(&dev_priv->drm, "Non zero Seq_num_v at beginning of HDCP Session\n"); + return -EINVAL; + } + if (seq_num_v < hdcp->seq_num_v) { /* Roll over of the seq_num_v from repeater. Reauthenticate. */ DRM_DEBUG_KMS("Seq_num_v roll over.\n"); @@ -1484,6 +1496,7 @@ int hdcp2_authenticate_repeater_topology(struct intel_connector *connector) return ret; hdcp->seq_num_v = seq_num_v; + hdcp->first_recvid_msg = false; ret = shim->write_2_2_msg(intel_dig_port, &msgs.rep_ack, sizeof(msgs.rep_ack)); if (ret < 0) From patchwork Thu Feb 6 15:04:42 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Gupta, Anshuman" X-Patchwork-Id: 11368727 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id F3D59924 for ; Thu, 6 Feb 2020 15:15:04 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id DCDC320838 for ; Thu, 6 Feb 2020 15:15:04 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DCDC320838 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=intel.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=intel-gfx-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D900F89F2E; Thu, 6 Feb 2020 15:15:03 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by gabe.freedesktop.org (Postfix) with ESMTPS id 8E01C89F2E for ; Thu, 6 Feb 2020 15:15:02 +0000 (UTC) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 06 Feb 2020 07:15:02 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,410,1574150400"; d="scan'208";a="226176032" Received: from unknown (HELO genxfsim-desktop.iind.intel.com) ([10.223.74.178]) by fmsmga008.fm.intel.com with ESMTP; 06 Feb 2020 07:15:01 -0800 From: Anshuman Gupta To: intel-gfx@lists.freedesktop.org Date: Thu, 6 Feb 2020 20:34:42 +0530 Message-Id: <20200206150442.32353-3-anshuman.gupta@intel.com> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20200206150442.32353-1-anshuman.gupta@intel.com> References: <20200206150442.32353-1-anshuman.gupta@intel.com> MIME-Version: 1.0 Subject: [Intel-gfx] [PATCH 2/2] drm/i915/hdcp: Fix 1B-10 HDCP 2.2 Comp test 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" 1B-10 HDCP Comp test verifies that source DUT reattempts Content Stream Management following a failure of Content Stream Management, 1B-10 test fail if source DUT tries reauthentication following a Content Stream Management failure. Fixing this broken test. Cc: Ramalingam C Signed-off-by: Anshuman Gupta --- .../drm/i915/display/intel_display_types.h | 3 ++ drivers/gpu/drm/i915/display/intel_hdcp.c | 32 ++++++++++++++++--- 2 files changed, 31 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/i915/display/intel_display_types.h b/drivers/gpu/drm/i915/display/intel_display_types.h index 2ae540e986ba..9232c4e0e42e 100644 --- a/drivers/gpu/drm/i915/display/intel_display_types.h +++ b/drivers/gpu/drm/i915/display/intel_display_types.h @@ -363,6 +363,9 @@ struct intel_hdcp { /* Flag indicate if it is a first ReceiverID_List msg after AKE_Init */ bool first_recvid_msg; + /* Flag indicate whether reauth retries req */ + bool reauth_req; + /* * Content Stream Type defined by content owner. TYPE0(0x0) content can * flow in the link protected by HDCP2.2 or HDCP1.4, where as TYPE1(0x1) diff --git a/drivers/gpu/drm/i915/display/intel_hdcp.c b/drivers/gpu/drm/i915/display/intel_hdcp.c index 3e24a6df503a..ed523de20eac 100644 --- a/drivers/gpu/drm/i915/display/intel_hdcp.c +++ b/drivers/gpu/drm/i915/display/intel_hdcp.c @@ -1507,13 +1507,35 @@ int hdcp2_authenticate_repeater_topology(struct intel_connector *connector) static int hdcp2_authenticate_repeater(struct intel_connector *connector) { - int ret; + int ret, i, tries = 3; + struct intel_hdcp *hdcp = &connector->hdcp; + struct drm_i915_private *dev_priv = to_i915(connector->base.dev); ret = hdcp2_authenticate_repeater_topology(connector); if (ret < 0) return ret; - return hdcp2_propagate_stream_management_info(connector); + /* + * HDCP 2.2 HDCP Spec Stream Managemnt pass/fail transition + * to HDCP authticate state i.e. A9->A5. + * if it fails, retry for stream managemnt again and skip the reauth. + */ + for (i = 0; i < tries; i++) { + ret = hdcp2_propagate_stream_management_info(connector); + if (!ret) { + hdcp->reauth_req = true; + break; + } + + hdcp->seq_num_m++; + drm_dbg_kms(&dev_priv->drm, "HDCP2.2 stream management %d of %d Failed.(%d)\n", + i + 1, tries, ret); + } + + if (ret) + hdcp->reauth_req = false; + + return ret; } static int hdcp2_authenticate_sink(struct intel_connector *connector) @@ -1642,10 +1664,11 @@ static int hdcp2_disable_encryption(struct intel_connector *connector) static int hdcp2_authenticate_and_encrypt(struct intel_connector *connector) { int ret, i, tries = 3; + struct intel_hdcp *hdcp = &connector->hdcp; for (i = 0; i < tries; i++) { ret = hdcp2_authenticate_sink(connector); - if (!ret) + if (!ret || !hdcp->reauth_req) break; /* Clearing the mei hdcp session */ @@ -1655,7 +1678,7 @@ static int hdcp2_authenticate_and_encrypt(struct intel_connector *connector) DRM_DEBUG_KMS("Port deauth failed.\n"); } - if (i != tries) { + if (!ret) { /* * Ensuring the required 200mSec min time interval between * Session Key Exchange and encryption. @@ -1681,6 +1704,7 @@ static int _intel_hdcp2_enable(struct intel_connector *connector) connector->base.name, connector->base.base.id, hdcp->content_type); + hdcp->reauth_req = true; ret = hdcp2_authenticate_and_encrypt(connector); if (ret) { DRM_DEBUG_KMS("HDCP2 Type%d Enabling Failed. (%d)\n",