From patchwork Tue Dec 3 17:36:24 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Paul X-Patchwork-Id: 11271753 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 088EB930 for ; Tue, 3 Dec 2019 17:37:03 +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 E25CD206EC for ; Tue, 3 Dec 2019 17:37:02 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E25CD206EC Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=poorly.run Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E1B576EA35; Tue, 3 Dec 2019 17:37:01 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-yb1-xb44.google.com (mail-yb1-xb44.google.com [IPv6:2607:f8b0:4864:20::b44]) by gabe.freedesktop.org (Postfix) with ESMTPS id A74716EA36 for ; Tue, 3 Dec 2019 17:37:00 +0000 (UTC) Received: by mail-yb1-xb44.google.com with SMTP id r201so1839777ybc.10 for ; Tue, 03 Dec 2019 09:37:00 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=xeeGZfYufHDDThZZkCNhlPdUw/ATxZKnbtQlImLeHzE=; b=pX1XLSC5rtoOWplTkoVa3nt9sq+xOyL7Q5sXPrg60kUNKyvaL+H2M+5piZ4NYWGFWh XhRMBTrVcktaUW7yXSKFtt9l8yntVOZ3fvcceitimFjvMYavZCKOqKTyiMZdHWwZewrT F4L8cVSxbprvHry83LgJirZLCq59t7y297TELrCdp2+TvmlOuhK+AJ0eqa6mGvF8vx83 79nAq4oiRURKv22AifwlNCCthjCjlPP5tbez3rUMzOCUOZ9/Od+Tv6ZFxLGbRkbq+QNh sW984L9m0JrAo671Jeak23Cz2OcYgu+SZGjGJiYH2jrZONnifbht1TK/YpC7RXoXEq6I 4aNQ== X-Gm-Message-State: APjAAAUh6/qL5UgZpjrB3bsLHbpvcHUBN7NSMGZAI+VZ/eKYoURY2owD /M6ZRT6jvb1pM7J64pyixplFBvrObR6SOA== X-Google-Smtp-Source: APXvYqxiMpI/ZJUJfq+HWSgGaFlb7XMaUvg3BmERIw0yoe2xI8QAmfiQBaq40Bq/2cNOSz3TCr1yeQ== X-Received: by 2002:a25:ae12:: with SMTP id a18mr5204934ybj.120.1575394618477; Tue, 03 Dec 2019 09:36:58 -0800 (PST) Received: from rosewood.cam.corp.google.com ([2620:0:1013:11:89c6:2139:5435:371d]) by smtp.gmail.com with ESMTPSA id g190sm1729426ywf.41.2019.12.03.09.36.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Dec 2019 09:36:58 -0800 (PST) From: Sean Paul To: dri-devel@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, ramalingm.c@intel.com Subject: [PATCH 01/11] drm/i915: Fix sha_text population code Date: Tue, 3 Dec 2019 12:36:24 -0500 Message-Id: <20191203173638.94919-2-sean@poorly.run> X-Mailer: git-send-email 2.24.0.393.g34dc348eaf-goog In-Reply-To: <20191203173638.94919-1-sean@poorly.run> References: <20191203173638.94919-1-sean@poorly.run> MIME-Version: 1.0 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=poorly.run; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=xeeGZfYufHDDThZZkCNhlPdUw/ATxZKnbtQlImLeHzE=; b=e+99GIhkG7gRu6w9n+9FiPQorXrVx8PolI+WOX4gxHjKQ9kjN2F1VF3MMA6BAWBMKD CSbaSMkvgQyXIYY++ltCrFJlhhmHx9vO3XOs2WjgIt0bAUFZDmyKqeyxmpTg/R4nq318 pKEGZRj2IxAEtzQWhINvN0CMBxqD0DowE5gbKDu5XmucGX3Arx1ZDv73Ale6RY9laPmV uddaWK7vJNA7K3uEfUbUKRIwPugVjjVdCYsOlTNJLLiAirqWjNy0O4wAEvWo79vO7ma8 R+r8OqDesE4VQTAlm4Dysii+kmQz5wj0V+HHs0uPgKxNlvb27APnDlvwSdkCgSVjW1S7 FWDw== X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: David Airlie , Daniel Vetter , Sean Paul , stable@vger.kernel.org, Rodrigo Vivi , Sean Paul Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Sean Paul This patch fixes a few bugs: 1- We weren't taking into account sha_leftovers when adding multiple ksvs to sha_text. As such, we were or'ing the end of ksv[j - 1] with the beginning of ksv[j] 2- In the sha_leftovers == 2 and sha_leftovers == 3 case, bstatus was being placed on the wrong half of sha_text, overlapping the leftover ksv value 3- In the sha_leftovers == 2 case, we need to manually terminate the byte stream with 0x80 since the hardware doesn't have enough room to add it after writing M0 The upside is that all of the "HDCP supported" HDMI repeaters I could find on Amazon just strip HDCP anyways, so it turns out to be _really_ hard to hit any of these cases without an MST hub, which is not (yet) supported. Oh, and the sha_leftovers == 1 case works perfectly! Fixes: ee5e5e7a5e0f ("drm/i915: Add HDCP framework + base implementation") Cc: Chris Wilson Cc: Ramalingam C Cc: Daniel Vetter Cc: Sean Paul Cc: Jani Nikula Cc: Joonas Lahtinen Cc: Rodrigo Vivi Cc: intel-gfx@lists.freedesktop.org Cc: # v4.17+ Signed-off-by: Sean Paul --- drivers/gpu/drm/i915/display/intel_hdcp.c | 25 +++++++++++++++++------ include/drm/drm_hdcp.h | 3 +++ 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/i915/display/intel_hdcp.c b/drivers/gpu/drm/i915/display/intel_hdcp.c index f1f41ca8402b..8325bf9501e4 100644 --- a/drivers/gpu/drm/i915/display/intel_hdcp.c +++ b/drivers/gpu/drm/i915/display/intel_hdcp.c @@ -335,8 +335,10 @@ int intel_hdcp_validate_v_prime(struct intel_connector *connector, /* Fill up the empty slots in sha_text and write it out */ sha_empty = sizeof(sha_text) - sha_leftovers; - for (j = 0; j < sha_empty; j++) - sha_text |= ksv[j] << ((sizeof(sha_text) - j - 1) * 8); + for (j = 0; j < sha_empty; j++) { + u8 off = ((sizeof(sha_text) - j - 1 - sha_leftovers) * 8); + sha_text |= ksv[j] << off; + } ret = intel_write_sha_text(dev_priv, sha_text); if (ret < 0) @@ -426,7 +428,7 @@ int intel_hdcp_validate_v_prime(struct intel_connector *connector, } else if (sha_leftovers == 2) { /* Write 32 bits of text */ I915_WRITE(HDCP_REP_CTL, rep_ctl | HDCP_SHA1_TEXT_32); - sha_text |= bstatus[0] << 24 | bstatus[1] << 16; + sha_text |= bstatus[0] << 8 | bstatus[1]; ret = intel_write_sha_text(dev_priv, sha_text); if (ret < 0) return ret; @@ -440,16 +442,27 @@ int intel_hdcp_validate_v_prime(struct intel_connector *connector, return ret; sha_idx += sizeof(sha_text); } + + /* + * Terminate the SHA-1 stream by hand. For the other leftover + * cases this is appended by the hardware. + */ + I915_WRITE(HDCP_REP_CTL, rep_ctl | HDCP_SHA1_TEXT_32); + sha_text = DRM_HDCP_SHA1_TERMINATOR << 24; + ret = intel_write_sha_text(dev_priv, sha_text); + if (ret < 0) + return ret; + sha_idx += sizeof(sha_text); } else if (sha_leftovers == 3) { - /* Write 32 bits of text */ + /* Write 32 bits of text (filled from LSB) */ I915_WRITE(HDCP_REP_CTL, rep_ctl | HDCP_SHA1_TEXT_32); - sha_text |= bstatus[0] << 24; + sha_text |= bstatus[0]; ret = intel_write_sha_text(dev_priv, sha_text); if (ret < 0) return ret; sha_idx += sizeof(sha_text); - /* Write 8 bits of text, 24 bits of M0 */ + /* Write 8 bits of text (filled from LSB), 24 bits of M0 */ I915_WRITE(HDCP_REP_CTL, rep_ctl | HDCP_SHA1_TEXT_8); ret = intel_write_sha_text(dev_priv, bstatus[1]); if (ret < 0) diff --git a/include/drm/drm_hdcp.h b/include/drm/drm_hdcp.h index 06a11202a097..20498c822204 100644 --- a/include/drm/drm_hdcp.h +++ b/include/drm/drm_hdcp.h @@ -29,6 +29,9 @@ /* Slave address for the HDCP registers in the receiver */ #define DRM_HDCP_DDC_ADDR 0x3A +/* Value to use at the end of the SHA-1 bytestream used for repeaters */ +#define DRM_HDCP_SHA1_TERMINATOR 0x80 + /* HDCP register offsets for HDMI/DVI devices */ #define DRM_HDCP_DDC_BKSV 0x00 #define DRM_HDCP_DDC_RI_PRIME 0x08 From patchwork Tue Dec 3 17:36:25 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Sean Paul X-Patchwork-Id: 11271757 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 83969930 for ; Tue, 3 Dec 2019 17:37: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 68B012080F for ; Tue, 3 Dec 2019 17:37:09 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 68B012080F Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=poorly.run Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9ED3E6EA37; Tue, 3 Dec 2019 17:37:08 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-yb1-xb41.google.com (mail-yb1-xb41.google.com [IPv6:2607:f8b0:4864:20::b41]) by gabe.freedesktop.org (Postfix) with ESMTPS id F29896EA38 for ; Tue, 3 Dec 2019 17:37:06 +0000 (UTC) Received: by mail-yb1-xb41.google.com with SMTP id o22so1312513ybg.6 for ; Tue, 03 Dec 2019 09:37:06 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=X6sNlVpgJqZUTF2LBDVfN2KTo3rKVtV7s8d4MgGBrfw=; b=FjgKa1CXkhJBTMNeiEGjIwn2XjbH8VsXBshqAE1hAfriLX0BXLle/Jxm4X0/LDaRzy uMmxaR1aBUlRO4bsw4ptR9+XvAOZWpYriBeEvuOyM89hIpjNiXZsujZtVWYGNAgs6Bly h/0f6IstTr+qwtZABAT+O1RZfAsWoqjZGuqQtr08tdcBFBJP5kVacUDnfb9qfgzmvNVg z9K82MREa8evVYHHhcZ3I8hyY1P1oHuC/cR0f6QDWTF+Ib+F1clA93A+8vAQVMSsVn/w HSDmnsUNs+QEGCk25yW7M+MWLCGdjW6B1BftCic2cjbTWu7MO5uxbZgfdj28qjoo2VUS 566A== X-Gm-Message-State: APjAAAXVvzCBLIQ1vpYQpRmHVlFA2nlcYCiBBn4ldJVvD2Pb59vDFh4n h7phwSivMB9THUBDvMzRe52eYdUCNCKScg== X-Google-Smtp-Source: APXvYqwrYDr7iNgEM1SWLZi/pYA9DfnE9DJ3vVKeHlVWG0u5mpHYDQm6vWTYSGLc6nS7YrDj3ue3lw== X-Received: by 2002:a5b:443:: with SMTP id s3mr5184402ybp.197.1575394625799; Tue, 03 Dec 2019 09:37:05 -0800 (PST) Received: from rosewood.cam.corp.google.com ([2620:0:1013:11:89c6:2139:5435:371d]) by smtp.gmail.com with ESMTPSA id g190sm1729426ywf.41.2019.12.03.09.37.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Dec 2019 09:37:05 -0800 (PST) From: Sean Paul To: dri-devel@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, ramalingm.c@intel.com Subject: [PATCH 02/11] drm/i915: Intercept Aksv writes in the aux hooks Date: Tue, 3 Dec 2019 12:36:25 -0500 Message-Id: <20191203173638.94919-3-sean@poorly.run> X-Mailer: git-send-email 2.24.0.393.g34dc348eaf-goog In-Reply-To: <20191203173638.94919-1-sean@poorly.run> References: <20191203173638.94919-1-sean@poorly.run> MIME-Version: 1.0 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=poorly.run; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=X6sNlVpgJqZUTF2LBDVfN2KTo3rKVtV7s8d4MgGBrfw=; b=RwAWrscCqcMya1X9tIqHH5wnB6nWBRFhjyTj6QmoW1RgHHI5TanAQ7YmntUOlvCdQJ 2C3uQ4QYT+s/uHX4moi9HbxNr+5x+C+JIl9fSnQ6KtgMTlbRS036FLUjdRyco4P4/qwM xFcurqbNROtmEHWq39n0O39IImvEWsJ2R83bEBt1t/an0JciM0Ej+GZkmYJMQi0LE7C8 QmPr0elj4s7pzmxmpF6GVrmy7GQnVUyxTiHb/x1t42ULA5YnOof0egnV6/6OFAkMz1DL zfHgTKuvbeN6SA4fi35i5KeMdJQqha+FMNRe4AJEw5f3Pq1I9aLSXmcKOMGXz0DuDFcI jSBg== X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: David Airlie , Sean Paul , Rodrigo Vivi Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Sean Paul Instead of hand rolling the transfer ourselves in the hdcp hook, inspect aux messages and add the aksv flag in the aux transfer hook. IIRC, this was the original implementation and folks wanted this hack to be isolated to the hdcp code, which makes sense. However in testing an LG monitor on my desk, I noticed it was passing back a DEFER reply. This wasn't handled in our hand-rolled code and HDCP auth was failing as a result. Instead of copy/pasting all of the retry logic and delays from drm dp helpers, let's just use the helpers and hide the aksv select as best as we can. Signed-off-by: Sean Paul Reviewed-by: Ville Syrjälä --- drivers/gpu/drm/i915/display/intel_dp.c | 64 ++++++++++++------------- 1 file changed, 31 insertions(+), 33 deletions(-) diff --git a/drivers/gpu/drm/i915/display/intel_dp.c b/drivers/gpu/drm/i915/display/intel_dp.c index d958e789ab96..7a407c651fb2 100644 --- a/drivers/gpu/drm/i915/display/intel_dp.c +++ b/drivers/gpu/drm/i915/display/intel_dp.c @@ -1515,12 +1515,29 @@ intel_dp_aux_header(u8 txbuf[HEADER_SIZE], txbuf[3] = msg->size - 1; } +static u32 intel_dp_aux_generate_xfer_flags(struct drm_dp_aux_msg *msg) +{ + if ((msg->request & ~DP_AUX_I2C_MOT) != DP_AUX_NATIVE_WRITE) + return 0; + + /* + * If we're trying to send the HDCP Aksv, we need to set a the Aksv + * select bit to inform the hardware to send the Aksv after our header + * since we can't access that data from software. + */ + if (msg->address == DP_AUX_HDCP_AKSV) + return DP_AUX_CH_CTL_AUX_AKSV_SELECT; + + return 0; +} + static ssize_t intel_dp_aux_transfer(struct drm_dp_aux *aux, struct drm_dp_aux_msg *msg) { struct intel_dp *intel_dp = container_of(aux, struct intel_dp, aux); u8 txbuf[20], rxbuf[20]; size_t txsize, rxsize; + u32 flags = intel_dp_aux_generate_xfer_flags(msg); int ret; intel_dp_aux_header(txbuf, msg); @@ -1541,7 +1558,7 @@ intel_dp_aux_transfer(struct drm_dp_aux *aux, struct drm_dp_aux_msg *msg) memcpy(txbuf + HEADER_SIZE, msg->buffer, msg->size); ret = intel_dp_aux_xfer(intel_dp, txbuf, txsize, - rxbuf, rxsize, 0); + rxbuf, rxsize, flags); if (ret > 0) { msg->reply = rxbuf[0] >> 4; @@ -1564,7 +1581,7 @@ intel_dp_aux_transfer(struct drm_dp_aux *aux, struct drm_dp_aux_msg *msg) return -E2BIG; ret = intel_dp_aux_xfer(intel_dp, txbuf, txsize, - rxbuf, rxsize, 0); + rxbuf, rxsize, flags); if (ret > 0) { msg->reply = rxbuf[0] >> 4; /* @@ -5858,17 +5875,9 @@ static int intel_dp_hdcp_write_an_aksv(struct intel_digital_port *intel_dig_port, u8 *an) { - struct intel_dp *intel_dp = enc_to_intel_dp(&intel_dig_port->base.base); - static const struct drm_dp_aux_msg msg = { - .request = DP_AUX_NATIVE_WRITE, - .address = DP_AUX_HDCP_AKSV, - .size = DRM_HDCP_KSV_LEN, - }; - u8 txbuf[HEADER_SIZE + DRM_HDCP_KSV_LEN] = {}, rxbuf[2], reply = 0; + u8 txbuf[DRM_HDCP_KSV_LEN] = {}; ssize_t dpcd_ret; - int ret; - /* Output An first, that's easy */ dpcd_ret = drm_dp_dpcd_write(&intel_dig_port->dp.aux, DP_AUX_HDCP_AN, an, DRM_HDCP_AN_LEN); if (dpcd_ret != DRM_HDCP_AN_LEN) { @@ -5878,29 +5887,18 @@ int intel_dp_hdcp_write_an_aksv(struct intel_digital_port *intel_dig_port, } /* - * Since Aksv is Oh-So-Secret, we can't access it in software. So in - * order to get it on the wire, we need to create the AUX header as if - * we were writing the data, and then tickle the hardware to output the - * data once the header is sent out. + * Since Aksv is Oh-So-Secret, we can't access it in software. So we + * send an empty buffer of the correct length through the DP helpers. On + * the other side, in the transfer hook, we'll generate a flag based on + * the destination address which will tickle the hardware to output the + * Aksv on our behalf after the header is sent. */ - intel_dp_aux_header(txbuf, &msg); - - ret = intel_dp_aux_xfer(intel_dp, txbuf, HEADER_SIZE + msg.size, - rxbuf, sizeof(rxbuf), - DP_AUX_CH_CTL_AUX_AKSV_SELECT); - if (ret < 0) { - DRM_DEBUG_KMS("Write Aksv over DP/AUX failed (%d)\n", ret); - return ret; - } else if (ret == 0) { - DRM_DEBUG_KMS("Aksv write over DP/AUX was empty\n"); - return -EIO; - } - - reply = (rxbuf[0] >> 4) & DP_AUX_NATIVE_REPLY_MASK; - if (reply != DP_AUX_NATIVE_REPLY_ACK) { - DRM_DEBUG_KMS("Aksv write: no DP_AUX_NATIVE_REPLY_ACK %x\n", - reply); - return -EIO; + dpcd_ret = drm_dp_dpcd_write(&intel_dig_port->dp.aux, DP_AUX_HDCP_AKSV, + txbuf, DRM_HDCP_KSV_LEN); + if (dpcd_ret != DRM_HDCP_KSV_LEN) { + DRM_DEBUG_KMS("Failed to write Aksv over DP/AUX (%zd)\n", + dpcd_ret); + return dpcd_ret >= 0 ? -EIO : dpcd_ret; } return 0; } From patchwork Tue Dec 3 17:36:26 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Paul X-Patchwork-Id: 11271761 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 2DD5B930 for ; Tue, 3 Dec 2019 17:37:15 +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 13A2420803 for ; Tue, 3 Dec 2019 17:37:15 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 13A2420803 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=poorly.run Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 249B26EA3B; Tue, 3 Dec 2019 17:37:14 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-yw1-xc42.google.com (mail-yw1-xc42.google.com [IPv6:2607:f8b0:4864:20::c42]) by gabe.freedesktop.org (Postfix) with ESMTPS id C77646EA3F for ; Tue, 3 Dec 2019 17:37:12 +0000 (UTC) Received: by mail-yw1-xc42.google.com with SMTP id h126so1635060ywc.6 for ; Tue, 03 Dec 2019 09:37:12 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=5RS+iM/8Pmfn6MpQu7z1NjYnwPdtK2Ar3CetwZVrW2g=; b=emRcteZ3Ypg5sZN/1LE+9WSxwlinGBfFnjvta8WK90IhlkxzT2+YCLxtIOhsdjTTY+ f2Uk5Cu9ytCfZbzgI1pyRZUZCRTv9AscZho+hcuThwrSW9oB49eFz0pax/Cqo6vKgI6A 90hGd2EBoQv/rchjYNr+DnXGbjw1WIrOaZF4q8xNBYzeK2/ZTu4EtZpo3S7on+z4XrvA us9J/ZPoR7plgtbBxiHlckYHZkKNaxSFcHcWiZJVZpTuKZsbVUCSviiv4+yAIzMD7JK3 hqxyjnGgGViO/dUEoRw7ph2e8ktWg9nHZFQIo1jGcLtj4HQrQlgQBqzXVUjEpz4vszga /pZQ== X-Gm-Message-State: APjAAAUYTBP5bBy7Zfe5kv6AYtO3p8oDUSBTReqi7vXU0LHwEM0D2a0q 2HoFCyOXydrsYBcFW1ZW9lUDfbG2WucWAw== X-Google-Smtp-Source: APXvYqy6hNUL7CTqpboW/YMRNd11R7bjZGZhsCjUK3Lmf1H/sFSH/bqlZtRf4fJLBnU6sGxoiT76gw== X-Received: by 2002:a81:4bd1:: with SMTP id y200mr4983901ywa.94.1575394631862; Tue, 03 Dec 2019 09:37:11 -0800 (PST) Received: from rosewood.cam.corp.google.com ([2620:0:1013:11:89c6:2139:5435:371d]) by smtp.gmail.com with ESMTPSA id g190sm1729426ywf.41.2019.12.03.09.37.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Dec 2019 09:37:11 -0800 (PST) From: Sean Paul To: dri-devel@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, ramalingm.c@intel.com Subject: [PATCH 03/11] drm/i915: Disable HDCP signalling on transcoder disable Date: Tue, 3 Dec 2019 12:36:26 -0500 Message-Id: <20191203173638.94919-4-sean@poorly.run> X-Mailer: git-send-email 2.24.0.393.g34dc348eaf-goog In-Reply-To: <20191203173638.94919-1-sean@poorly.run> References: <20191203173638.94919-1-sean@poorly.run> MIME-Version: 1.0 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=poorly.run; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=5RS+iM/8Pmfn6MpQu7z1NjYnwPdtK2Ar3CetwZVrW2g=; b=FRUmH04bVZo7IFI3jxMpLzrJ643A59AfWyQ6Z6zHqAlMxHtWf9NdhM9Ycd8w3tOKTb 8Yk4/4KMfFECAUCg5GDJ4sfJHinyXCCpp+iW/I/OjZpnNsbLnHj523ya4DJhuqfp9nCn /6ufaeOzMYiDVNL/wdbYoLXs216xCUdGDOUArQmkrEIdj4/MngnXZvbw3lneaihpWu25 YZ09tjHt1dzRmhX3FbdXVWmsSmdrAatDXxUWlZldFMtcM8PA1X78XJdxcfYPD+U14K5u 35seMN8J7eiqHTyltWfFHbwOleV+01vMrONfYu44h7CEv3FcuSjoUYxEQnnZDXgJmpwQ uuPA== X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: David Airlie , Sean Paul , Rodrigo Vivi Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Sean Paul Currently we rely on intel_hdcp_disable() to disable HDCP signalling in the DDI Function Control register. This patch adds a safety net by also clearing the bit when we disable the transcoder. Once we have HDCP over MST and disappearing connectors, we want to make sure that the signalling is truly disabled even if HDCP teardown doesn't go as planned. Signed-off-by: Sean Paul --- drivers/gpu/drm/i915/display/intel_ddi.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/i915/display/intel_ddi.c b/drivers/gpu/drm/i915/display/intel_ddi.c index b51f244ad7a5..e8ac98a8ee7f 100644 --- a/drivers/gpu/drm/i915/display/intel_ddi.c +++ b/drivers/gpu/drm/i915/display/intel_ddi.c @@ -1952,13 +1952,12 @@ void intel_ddi_disable_transcoder_func(const struct intel_crtc_state *crtc_state i915_reg_t reg = TRANS_DDI_FUNC_CTL(cpu_transcoder); u32 val = I915_READ(reg); - if (INTEL_GEN(dev_priv) >= 12) { - val &= ~(TRANS_DDI_FUNC_ENABLE | TGL_TRANS_DDI_PORT_MASK | - TRANS_DDI_DP_VC_PAYLOAD_ALLOC); - } else { - val &= ~(TRANS_DDI_FUNC_ENABLE | TRANS_DDI_PORT_MASK | - TRANS_DDI_DP_VC_PAYLOAD_ALLOC); - } + val &= ~(TRANS_DDI_FUNC_ENABLE | TRANS_DDI_DP_VC_PAYLOAD_ALLOC | + TRANS_DDI_HDCP_SIGNALLING); + if (INTEL_GEN(dev_priv) >= 12) + val &= ~TGL_TRANS_DDI_PORT_MASK; + else + val &= ~TRANS_DDI_PORT_MASK; I915_WRITE(reg, val); if (dev_priv->quirks & QUIRK_INCREASE_DDI_DISABLED_TIME && From patchwork Tue Dec 3 17:36:27 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Paul X-Patchwork-Id: 11271765 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 CF414139A for ; Tue, 3 Dec 2019 17:37:18 +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 B4D9B20803 for ; Tue, 3 Dec 2019 17:37:18 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B4D9B20803 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=poorly.run Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id ECD326EA40; Tue, 3 Dec 2019 17:37:17 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-yb1-xb44.google.com (mail-yb1-xb44.google.com [IPv6:2607:f8b0:4864:20::b44]) by gabe.freedesktop.org (Postfix) with ESMTPS id 1B4F06EA41 for ; Tue, 3 Dec 2019 17:37:17 +0000 (UTC) Received: by mail-yb1-xb44.google.com with SMTP id o22so1312728ybg.6 for ; Tue, 03 Dec 2019 09:37:17 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=UBWGlnwv4Vv3lZO/zfX1A8+cvPWGrGOAfy9S3S5HX8I=; b=aR7wlGwvevH69MMAkK6FBafwQaac40IM0Qza314Gh5O6f140YANxb8aC48lMajYb42 cKAi/HI0W9DE9LK9VLgIIovN+7mU2wh53T2fe5jk37cYNyPKBrEl5nzBc8XJy1ITcys7 QYob4LF/ypaLPyZb/iKl9VwYoI3ydbH7NvZOL3ewArjAbhm8djnBL4wI/Lw7Aqwdvvvm FRnyAll+SfBVeBytkadKTQsvGWhOg52iMsYNckpvPfdaCVEM6agz3H/NDdwxGorumbYj Yx9OlMHVlpOVJHUl1j82xkJC+7j7EEQutGeGAJJMVgOG/f4AMK7H524l6hmpgmjK1qig SuNQ== X-Gm-Message-State: APjAAAWmUhwoAQFKR/O0bH9MJo7pnlp+1ACjgaTQY+PqoVFxgdm1CIZk E4LocB3B2DuN7nZGfD82/6CnpJ8qxvrq6Q== X-Google-Smtp-Source: APXvYqzKkH47uFrEbPlnVN2ni6vYohlGrLaKhFWLORav+baal7eEhNZjav1pddjTgLy/0PuQ4ChJ/g== X-Received: by 2002:a25:dec1:: with SMTP id v184mr5045858ybg.62.1575394636041; Tue, 03 Dec 2019 09:37:16 -0800 (PST) Received: from rosewood.cam.corp.google.com ([2620:0:1013:11:89c6:2139:5435:371d]) by smtp.gmail.com with ESMTPSA id g190sm1729426ywf.41.2019.12.03.09.37.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Dec 2019 09:37:15 -0800 (PST) From: Sean Paul To: dri-devel@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, ramalingm.c@intel.com Subject: [PATCH 04/11] drm/i915: Don't WARN on HDCP toggle if get_hw_state returns false Date: Tue, 3 Dec 2019 12:36:27 -0500 Message-Id: <20191203173638.94919-5-sean@poorly.run> X-Mailer: git-send-email 2.24.0.393.g34dc348eaf-goog In-Reply-To: <20191203173638.94919-1-sean@poorly.run> References: <20191203173638.94919-1-sean@poorly.run> MIME-Version: 1.0 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=poorly.run; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=UBWGlnwv4Vv3lZO/zfX1A8+cvPWGrGOAfy9S3S5HX8I=; b=bnkpDUyLuTywW2KNOURTlo5ZwpG4Anq4dv4h9mS5B5m0+zct+NLsuvMgkqgRA402q1 8/tOOWcYf4bsHybeYkUrm4J6CCHuJtJGrC2OxnmiAzhXTkV6Uvzs0jYM14tCM8yHHBCj ALMMEwftNBjPg1JooyQdqktcx4NZ257pjkbvElXerp2e+tQ/h0BVe2ow7HNZKysJY+/y Xfl+sJjqKUFht0+b5xob20EvMJYlE55EWCfqe5Y0+819vvztIVwic/fHgAGXz3kE40wK bdtJd/QOoBHf20YlT3RF2cX2twAbJqobsc3YWLSUEJHKODZmjtAgoyQRiwT72d5h/YWL XP6A== X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: David Airlie , Sean Paul , Rodrigo Vivi Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Sean Paul Now that we can rely on transcoder disable to toggle signalling off, it's less of a catastrophe if get_hw_state() returns false. Once we enable MST, this will be a valid exit path and we want to make sure we're not spamming the logs needlessly. Signed-off-by: Sean Paul --- drivers/gpu/drm/i915/display/intel_ddi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/i915/display/intel_ddi.c b/drivers/gpu/drm/i915/display/intel_ddi.c index e8ac98a8ee7f..ca28913a4c9f 100644 --- a/drivers/gpu/drm/i915/display/intel_ddi.c +++ b/drivers/gpu/drm/i915/display/intel_ddi.c @@ -1983,7 +1983,7 @@ int intel_ddi_toggle_hdcp_signalling(struct intel_encoder *intel_encoder, if (WARN_ON(!wakeref)) return -ENXIO; - if (WARN_ON(!intel_encoder->get_hw_state(intel_encoder, &pipe))) { + if (!intel_encoder->get_hw_state(intel_encoder, &pipe)) { ret = -EIO; goto out; } From patchwork Tue Dec 3 17:36:28 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Paul X-Patchwork-Id: 11271769 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 3B6C7930 for ; Tue, 3 Dec 2019 17:37:24 +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 1EA09206EC for ; Tue, 3 Dec 2019 17:37:24 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1EA09206EC Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=poorly.run Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D8B426EA42; Tue, 3 Dec 2019 17:37:22 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-yb1-xb43.google.com (mail-yb1-xb43.google.com [IPv6:2607:f8b0:4864:20::b43]) by gabe.freedesktop.org (Postfix) with ESMTPS id 0B0336EA46 for ; Tue, 3 Dec 2019 17:37:22 +0000 (UTC) Received: by mail-yb1-xb43.google.com with SMTP id h23so1865872ybg.2 for ; Tue, 03 Dec 2019 09:37:21 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Zdk7jcACJGexHRY9r9jbCWjX0hzsKELzVolsTiUAB1M=; b=LpcDf/fV2UC9+lox8+lInXrpYYkZSFLvPhe53f1DIMXZfo8PUKLOUDUtfND7jY6LLC TQ1ObGD5BWo1+kjommm61wTIJKFQRnlKdmWV9PO1RZY1uCDDJWPZwT4KWF5EvwJLM6I+ P2g6j0o16AKsFvSM8xdbqL04jWk1iCKkbLoVtFXP1TritQ7hi111iqnCy+Fgi9WQFTiK WHr3boF7Xd4CQ6mkWM1HeJJOL2uv3mO8d9Z2njBt1/GR24gPuJUHGBcvWXA6xQ2ZBOnp ng9neDgD2yW1e/tSa+t6I+Jzwpr8n1MCJSkeVnT2YWck+QkZaf+RLSm8NL2wOERaMh0l pmrQ== X-Gm-Message-State: APjAAAXqh3WnMBaMweqBm/YaDF8A1X/VhjbouoFok+3Dmy/kcN2y/JC6 vZwXH5i0/AuK8K6PSeDT8x2+RoXienmmvw== X-Google-Smtp-Source: APXvYqy6lhu568vyWQOFd++ZJT4fguyh/U2k8NyI+ygsi10Yzs7Uiyx3F24BuibC24NMGrwMGBMHHw== X-Received: by 2002:a25:2d0a:: with SMTP id t10mr5413145ybt.506.1575394640801; Tue, 03 Dec 2019 09:37:20 -0800 (PST) Received: from rosewood.cam.corp.google.com ([2620:0:1013:11:89c6:2139:5435:371d]) by smtp.gmail.com with ESMTPSA id g190sm1729426ywf.41.2019.12.03.09.37.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Dec 2019 09:37:20 -0800 (PST) From: Sean Paul To: dri-devel@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, ramalingm.c@intel.com Subject: [PATCH 05/11] drm/i915: Change toggle_signalling() argument to connector Date: Tue, 3 Dec 2019 12:36:28 -0500 Message-Id: <20191203173638.94919-6-sean@poorly.run> X-Mailer: git-send-email 2.24.0.393.g34dc348eaf-goog In-Reply-To: <20191203173638.94919-1-sean@poorly.run> References: <20191203173638.94919-1-sean@poorly.run> MIME-Version: 1.0 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=poorly.run; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Zdk7jcACJGexHRY9r9jbCWjX0hzsKELzVolsTiUAB1M=; b=HqiIdJSbgXUmCo2ZzpX1v+CT8gwA8z5iEC2XyTiT1+QEIZjPMddQm7BVixnzaHJ0je c8hWr2xudzArZ8kgEtxRM6mrFcWj8nU+DsUMxwvz5jRR8KczDwaO7fBOrcT6i43dmR+3 qNaryGsrQWts7rSksDBD9wl8uwLJDp8GXOZg7LKQUOc65c58MieSM+B8EkPJtFJxHhD9 q+eF7NP+jWUxLsoVwbbhbZyZYuN3LmPAMLpPA0Xm6va8qrkrXkRZpHPKR6P/MUJD+IRA VUVV8Zh+a+Giny6uFSW4XjRmUwcluN6qoxDYD+VxeE+r0pPuQqyavDL4a7d47OgoefPG 73Rw== X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: David Airlie , Sean Paul , Rodrigo Vivi Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Sean Paul HDCP over MST requires us to toggle ddi signalling. Since we'll want to toggle signalling on the pipe associated with the fake encoder as opposed to the digital port's base, we need to get it from connector. This patch converts all existing callers and implementations to use connector instead of digital port. Signed-off-by: Sean Paul --- drivers/gpu/drm/i915/display/intel_display_types.h | 2 +- drivers/gpu/drm/i915/display/intel_dp.c | 2 +- drivers/gpu/drm/i915/display/intel_hdcp.c | 10 ++++------ drivers/gpu/drm/i915/display/intel_hdmi.c | 8 ++++---- 4 files changed, 10 insertions(+), 12 deletions(-) diff --git a/drivers/gpu/drm/i915/display/intel_display_types.h b/drivers/gpu/drm/i915/display/intel_display_types.h index 4341bd66a418..bbd44772b9b0 100644 --- a/drivers/gpu/drm/i915/display/intel_display_types.h +++ b/drivers/gpu/drm/i915/display/intel_display_types.h @@ -300,7 +300,7 @@ struct intel_hdcp_shim { int i, u32 *part); /* Enables HDCP signalling on the port */ - int (*toggle_signalling)(struct intel_digital_port *intel_dig_port, + int (*toggle_signalling)(struct intel_connector *connector, bool enable); /* Ensures the link is still protected */ diff --git a/drivers/gpu/drm/i915/display/intel_dp.c b/drivers/gpu/drm/i915/display/intel_dp.c index 7a407c651fb2..e26fb26b1909 100644 --- a/drivers/gpu/drm/i915/display/intel_dp.c +++ b/drivers/gpu/drm/i915/display/intel_dp.c @@ -6038,7 +6038,7 @@ int intel_dp_hdcp_read_v_prime_part(struct intel_digital_port *intel_dig_port, } static -int intel_dp_hdcp_toggle_signalling(struct intel_digital_port *intel_dig_port, +int intel_dp_hdcp_toggle_signalling(struct intel_connector *connector, bool enable) { /* Not used for single stream DisplayPort setups */ diff --git a/drivers/gpu/drm/i915/display/intel_hdcp.c b/drivers/gpu/drm/i915/display/intel_hdcp.c index 8325bf9501e4..0966a8ec47d2 100644 --- a/drivers/gpu/drm/i915/display/intel_hdcp.c +++ b/drivers/gpu/drm/i915/display/intel_hdcp.c @@ -693,7 +693,7 @@ static int intel_hdcp_auth(struct intel_connector *connector) intel_hdcp_get_repeater_ctl(dev_priv, cpu_transcoder, port)); - ret = shim->toggle_signalling(intel_dig_port, true); + ret = shim->toggle_signalling(connector, true); if (ret) return ret; @@ -787,7 +787,7 @@ static int _intel_hdcp_disable(struct intel_connector *connector) return -ETIMEDOUT; } - ret = hdcp->shim->toggle_signalling(intel_dig_port, false); + ret = hdcp->shim->toggle_signalling(connector, false); if (ret) { DRM_ERROR("Failed to disable HDCP signalling\n"); return ret; @@ -1537,7 +1537,6 @@ static int hdcp2_authenticate_sink(struct intel_connector *connector) static int hdcp2_enable_encryption(struct intel_connector *connector) { - struct intel_digital_port *intel_dig_port = conn_to_dig_port(connector); struct drm_i915_private *dev_priv = to_i915(connector->base.dev); struct intel_hdcp *hdcp = &connector->hdcp; enum port port = connector->encoder->port; @@ -1547,7 +1546,7 @@ static int hdcp2_enable_encryption(struct intel_connector *connector) WARN_ON(I915_READ(HDCP2_STATUS(dev_priv, cpu_transcoder, port)) & LINK_ENCRYPTION_STATUS); if (hdcp->shim->toggle_signalling) { - ret = hdcp->shim->toggle_signalling(intel_dig_port, true); + ret = hdcp->shim->toggle_signalling(connector, true); if (ret) { DRM_ERROR("Failed to enable HDCP signalling. %d\n", ret); @@ -1575,7 +1574,6 @@ static int hdcp2_enable_encryption(struct intel_connector *connector) static int hdcp2_disable_encryption(struct intel_connector *connector) { - struct intel_digital_port *intel_dig_port = conn_to_dig_port(connector); struct drm_i915_private *dev_priv = to_i915(connector->base.dev); struct intel_hdcp *hdcp = &connector->hdcp; enum port port = connector->encoder->port; @@ -1598,7 +1596,7 @@ static int hdcp2_disable_encryption(struct intel_connector *connector) DRM_DEBUG_KMS("Disable Encryption Timedout"); if (hdcp->shim->toggle_signalling) { - ret = hdcp->shim->toggle_signalling(intel_dig_port, false); + ret = hdcp->shim->toggle_signalling(connector, false); if (ret) { DRM_ERROR("Failed to disable HDCP signalling. %d\n", ret); diff --git a/drivers/gpu/drm/i915/display/intel_hdmi.c b/drivers/gpu/drm/i915/display/intel_hdmi.c index f6f5312205c4..6a1e711c4f7a 100644 --- a/drivers/gpu/drm/i915/display/intel_hdmi.c +++ b/drivers/gpu/drm/i915/display/intel_hdmi.c @@ -1475,18 +1475,18 @@ static int kbl_repositioning_enc_en_signal(struct intel_connector *connector) } static -int intel_hdmi_hdcp_toggle_signalling(struct intel_digital_port *intel_dig_port, +int intel_hdmi_hdcp_toggle_signalling(struct intel_connector *connector, bool enable) { - struct intel_hdmi *hdmi = &intel_dig_port->hdmi; - struct intel_connector *connector = hdmi->attached_connector; + struct intel_encoder *encoder = + intel_attached_encoder(&connector->base); struct drm_i915_private *dev_priv = to_i915(connector->base.dev); int ret; if (!enable) usleep_range(6, 60); /* Bspec says >= 6us */ - ret = intel_ddi_toggle_hdcp_signalling(&intel_dig_port->base, enable); + ret = intel_ddi_toggle_hdcp_signalling(encoder, enable); if (ret) { DRM_ERROR("%s HDCP signalling failed (%d)\n", enable ? "Enable" : "Disable", ret); From patchwork Tue Dec 3 17:36:29 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Paul X-Patchwork-Id: 11271773 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 69DB7139A for ; Tue, 3 Dec 2019 17:37:29 +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 4F86120848 for ; Tue, 3 Dec 2019 17:37:29 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4F86120848 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=poorly.run Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 315826EA3A; Tue, 3 Dec 2019 17:37:28 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-yb1-xb41.google.com (mail-yb1-xb41.google.com [IPv6:2607:f8b0:4864:20::b41]) by gabe.freedesktop.org (Postfix) with ESMTPS id 35C366EA47 for ; Tue, 3 Dec 2019 17:37:25 +0000 (UTC) Received: by mail-yb1-xb41.google.com with SMTP id g38so1837147ybe.11 for ; Tue, 03 Dec 2019 09:37:25 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=sF65Xbx4lIUFf1KfjPlqrzhPYP6KtmBXkWJnLLZAKc0=; b=XiUCyUDjg2FbyoKJmXva7RaduZvAn5rxc5mHRPzzT+ZjWt0ZFsD9l1u07PsY2fY/5a jot9/sOr/1KZiomX5nsm0Z84FaVq4hX6GGYeQd2ByNp5ZB/vbGTzyiWJjB4OcBRsEDXc nLl8woNQInd62K+T5thgoCuQ9zBJrtq76pos5v/Uwueg2PGgBNsFn0KAFLN2l7ozz59e tTgeaAHMQrNecOlEI5ZcWeQ5r+FFaXKNN4iPlggI0nGuhl24qvjFU32p6p342L7ZmzLJ XuMisTuv2IA7DqBHud8J+Cdxxy1bwSGI17NVjsxC0b9VSGZsrQxaWl/uEpqFtfEuodn4 u6Ag== X-Gm-Message-State: APjAAAU2iAKioTlHBvcRW8tRKJlvFL/PJ+ELxXTd1YHjG+zsTBleJ8su lCeu2drfXVCoyMR4+BQCWhbvACmaMih1iw== X-Google-Smtp-Source: APXvYqyBynH6e1PuP8PuZfyAAY04IGTC0v8W0iV4y9eUxGMCxGQByzK1hpLvFFQ9Xa92ENx+TVxbiw== X-Received: by 2002:a25:ca17:: with SMTP id a23mr5415858ybg.385.1575394644026; Tue, 03 Dec 2019 09:37:24 -0800 (PST) Received: from rosewood.cam.corp.google.com ([2620:0:1013:11:89c6:2139:5435:371d]) by smtp.gmail.com with ESMTPSA id g190sm1729426ywf.41.2019.12.03.09.37.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Dec 2019 09:37:23 -0800 (PST) From: Sean Paul To: dri-devel@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, ramalingm.c@intel.com Subject: [PATCH 06/11] drm/i915: Factor out hdcp->value assignments Date: Tue, 3 Dec 2019 12:36:29 -0500 Message-Id: <20191203173638.94919-7-sean@poorly.run> X-Mailer: git-send-email 2.24.0.393.g34dc348eaf-goog In-Reply-To: <20191203173638.94919-1-sean@poorly.run> References: <20191203173638.94919-1-sean@poorly.run> MIME-Version: 1.0 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=poorly.run; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=sF65Xbx4lIUFf1KfjPlqrzhPYP6KtmBXkWJnLLZAKc0=; b=LctP0hgmFBVY1cZxXLh38Y9PyFp1OGmHbFwdwwbqoEwb5qvYqkzNJe+G6fzSKX6rOR TTvWDRbwiavkGsZzeKC9Jrenmb9BaddIGE5bBIc6G5OhPWeZINU2DV5zt/a2x+9pBPjY pcrGWVnMz+Ya/In/4RtVhYmVDa7QMmP9g10blZwjBoR0q4DWBHYD/FW5NxJut4pDkj/J yO2eAtZypRUXwnLWDWfT8tN08fKU9eut/G5G58s0IGDyPNPFzAzKVg6iSPe26pfBm0Vh QVYczZfj5T/wp7qFE+HXFqPv7nRhCw+SvVJqYRfZUhz3yVkI/gZGDyyQ4rl6VJ21KWCJ y3ig== X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: David Airlie , Sean Paul , Rodrigo Vivi Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Sean Paul This is a bit of housecleaning for a future patch. Instead of sprinkling hdcp->value assignments and prop_work scheduling everywhere, introduce a function to do it for us. Signed-off-by: Sean Paul --- drivers/gpu/drm/i915/display/intel_hdcp.c | 67 ++++++++++++++++------- 1 file changed, 46 insertions(+), 21 deletions(-) diff --git a/drivers/gpu/drm/i915/display/intel_hdcp.c b/drivers/gpu/drm/i915/display/intel_hdcp.c index 0966a8ec47d2..f34763fa5b42 100644 --- a/drivers/gpu/drm/i915/display/intel_hdcp.c +++ b/drivers/gpu/drm/i915/display/intel_hdcp.c @@ -846,6 +846,21 @@ struct intel_connector *intel_hdcp_to_connector(struct intel_hdcp *hdcp) return container_of(hdcp, struct intel_connector, hdcp); } +static void intel_hdcp_update_value(struct intel_connector *connector, + u64 value, bool update_property) +{ + struct intel_hdcp *hdcp = &connector->hdcp; + + WARN_ON(!mutex_is_locked(&hdcp->mutex)); + + if (hdcp->value == value) + return; + + hdcp->value = value; + if (update_property) + schedule_work(&hdcp->prop_work); +} + /* Implements Part 3 of the HDCP authorization procedure */ static int intel_hdcp_check_link(struct intel_connector *connector) { @@ -872,15 +887,16 @@ static int intel_hdcp_check_link(struct intel_connector *connector) I915_READ(HDCP_STATUS(dev_priv, cpu_transcoder, port))); ret = -ENXIO; - hdcp->value = DRM_MODE_CONTENT_PROTECTION_DESIRED; - schedule_work(&hdcp->prop_work); + intel_hdcp_update_value(connector, + DRM_MODE_CONTENT_PROTECTION_DESIRED, + true); goto out; } if (hdcp->shim->check_link(intel_dig_port)) { if (hdcp->value != DRM_MODE_CONTENT_PROTECTION_UNDESIRED) { - hdcp->value = DRM_MODE_CONTENT_PROTECTION_ENABLED; - schedule_work(&hdcp->prop_work); + intel_hdcp_update_value(connector, + DRM_MODE_CONTENT_PROTECTION_ENABLED, true); } goto out; } @@ -891,16 +907,18 @@ static int intel_hdcp_check_link(struct intel_connector *connector) ret = _intel_hdcp_disable(connector); if (ret) { DRM_ERROR("Failed to disable hdcp (%d)\n", ret); - hdcp->value = DRM_MODE_CONTENT_PROTECTION_DESIRED; - schedule_work(&hdcp->prop_work); + intel_hdcp_update_value(connector, + DRM_MODE_CONTENT_PROTECTION_DESIRED, + true); goto out; } ret = _intel_hdcp_enable(connector); if (ret) { DRM_ERROR("Failed to enable hdcp (%d)\n", ret); - hdcp->value = DRM_MODE_CONTENT_PROTECTION_DESIRED; - schedule_work(&hdcp->prop_work); + intel_hdcp_update_value(connector, + DRM_MODE_CONTENT_PROTECTION_DESIRED, + true); goto out; } @@ -1706,16 +1724,18 @@ static int intel_hdcp2_check_link(struct intel_connector *connector) I915_READ(HDCP2_STATUS(dev_priv, cpu_transcoder, port))); ret = -ENXIO; - hdcp->value = DRM_MODE_CONTENT_PROTECTION_DESIRED; - schedule_work(&hdcp->prop_work); + intel_hdcp_update_value(connector, + DRM_MODE_CONTENT_PROTECTION_DESIRED, + true); goto out; } ret = hdcp->shim->check_2_2_link(intel_dig_port); if (ret == HDCP_LINK_PROTECTED) { if (hdcp->value != DRM_MODE_CONTENT_PROTECTION_UNDESIRED) { - hdcp->value = DRM_MODE_CONTENT_PROTECTION_ENABLED; - schedule_work(&hdcp->prop_work); + intel_hdcp_update_value(connector, + DRM_MODE_CONTENT_PROTECTION_ENABLED, + true); } goto out; } @@ -1727,8 +1747,9 @@ static int intel_hdcp2_check_link(struct intel_connector *connector) DRM_DEBUG_KMS("HDCP2.2 Downstream topology change\n"); ret = hdcp2_authenticate_repeater_topology(connector); if (!ret) { - hdcp->value = DRM_MODE_CONTENT_PROTECTION_ENABLED; - schedule_work(&hdcp->prop_work); + intel_hdcp_update_value(connector, + DRM_MODE_CONTENT_PROTECTION_ENABLED, + true); goto out; } DRM_DEBUG_KMS("[%s:%d] Repeater topology auth failed.(%d)\n", @@ -1743,8 +1764,8 @@ static int intel_hdcp2_check_link(struct intel_connector *connector) if (ret) { DRM_ERROR("[%s:%d] Failed to disable hdcp2.2 (%d)\n", connector->base.name, connector->base.base.id, ret); - hdcp->value = DRM_MODE_CONTENT_PROTECTION_DESIRED; - schedule_work(&hdcp->prop_work); + intel_hdcp_update_value(connector, + DRM_MODE_CONTENT_PROTECTION_DESIRED, true); goto out; } @@ -1753,8 +1774,9 @@ static int intel_hdcp2_check_link(struct intel_connector *connector) DRM_DEBUG_KMS("[%s:%d] Failed to enable hdcp2.2 (%d)\n", connector->base.name, connector->base.base.id, ret); - hdcp->value = DRM_MODE_CONTENT_PROTECTION_DESIRED; - schedule_work(&hdcp->prop_work); + intel_hdcp_update_value(connector, + DRM_MODE_CONTENT_PROTECTION_DESIRED, + true); goto out; } @@ -2004,8 +2026,9 @@ int intel_hdcp_enable(struct intel_connector *connector, u8 content_type) if (!ret) { schedule_delayed_work(&hdcp->check_work, check_link_interval); - hdcp->value = DRM_MODE_CONTENT_PROTECTION_ENABLED; - schedule_work(&hdcp->prop_work); + intel_hdcp_update_value(connector, + DRM_MODE_CONTENT_PROTECTION_ENABLED, + true); } mutex_unlock(&hdcp->mutex); @@ -2023,7 +2046,9 @@ int intel_hdcp_disable(struct intel_connector *connector) mutex_lock(&hdcp->mutex); if (hdcp->value != DRM_MODE_CONTENT_PROTECTION_UNDESIRED) { - hdcp->value = DRM_MODE_CONTENT_PROTECTION_UNDESIRED; + intel_hdcp_update_value(connector, + DRM_MODE_CONTENT_PROTECTION_UNDESIRED, + false); if (hdcp->hdcp2_encrypted) ret = _intel_hdcp2_disable(connector); else if (hdcp->hdcp_encrypted) From patchwork Tue Dec 3 17:36:30 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Paul X-Patchwork-Id: 11271777 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 BA2B7139A for ; Tue, 3 Dec 2019 17:37:32 +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 A001F20803 for ; Tue, 3 Dec 2019 17:37:32 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A001F20803 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=poorly.run Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D9A506EA47; Tue, 3 Dec 2019 17:37:31 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-yb1-xb42.google.com (mail-yb1-xb42.google.com [IPv6:2607:f8b0:4864:20::b42]) by gabe.freedesktop.org (Postfix) with ESMTPS id 061E16EA49 for ; Tue, 3 Dec 2019 17:37:31 +0000 (UTC) Received: by mail-yb1-xb42.google.com with SMTP id a11so1843415ybc.9 for ; Tue, 03 Dec 2019 09:37:30 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Km82VcRkTZuSw6qGN0kn4itOohtD+O7wdXp8OYBw050=; b=hRyWjabj4WrjlN2vrXP2x0uWf26coJ8p5xnRsQYNVHgE78o1DJWMUzpHZ+tpv/xphq pc/UMbD+hg8+kYUVx0tCvDwMPUjQoTYplhZzC9kXc//0rOFuzuUlVqmJ6dqhX5Jy+uA1 gthCohfmGCugNNZTqcUCCMiorM6ZyTddyTh13t0yBx0cFVpyKlRFdz+1goZhx2RNiNTI 7pYyqQX2kIBhGS+ZdoYG7K42ife9T5yCPD2pDYyEIvpTi0D6L1wfahGq1tzh2z4ENXT1 JzIjvW/p+fJ762rr5bOo++AqJQfq4Rg9wzNnILcXp+LHqQsb/Vby9clF9dPsXHjr/ru/ iKOw== X-Gm-Message-State: APjAAAW/tqQGXDXz1Y6zMswAB/3dKV/rj80JWoq97wSzjOCdCCJeI6vS MbpM3NCfxvKxEbZ4enVEAXZbwZqYezk5rA== X-Google-Smtp-Source: APXvYqz8xSQ7FEL3txDfFc9JPXjfO9mHCYMS6nNLBPvKfRL5AiTGaM3naoaBIVRQGTjA39BZw7XaHg== X-Received: by 2002:a25:b090:: with SMTP id f16mr5433670ybj.437.1575394649890; Tue, 03 Dec 2019 09:37:29 -0800 (PST) Received: from rosewood.cam.corp.google.com ([2620:0:1013:11:89c6:2139:5435:371d]) by smtp.gmail.com with ESMTPSA id g190sm1729426ywf.41.2019.12.03.09.37.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Dec 2019 09:37:29 -0800 (PST) From: Sean Paul To: dri-devel@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, ramalingm.c@intel.com Subject: [PATCH 07/11] drm/i915: Don't fully disable HDCP on a port if multiple pipes are using it Date: Tue, 3 Dec 2019 12:36:30 -0500 Message-Id: <20191203173638.94919-8-sean@poorly.run> X-Mailer: git-send-email 2.24.0.393.g34dc348eaf-goog In-Reply-To: <20191203173638.94919-1-sean@poorly.run> References: <20191203173638.94919-1-sean@poorly.run> MIME-Version: 1.0 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=poorly.run; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Km82VcRkTZuSw6qGN0kn4itOohtD+O7wdXp8OYBw050=; b=I4JYMUkd0vXwZQRB6JAog8eIW4nnp9K74RxN6q6Has4Es9uMZbuWvFedZ9UhZ8xrbw qn57pyoZIe2ZPgcXYnGz3zSyWiOBlzEqD9ef/oJqytzcb1n9PGVypRRltio2M3gNUeoP pH2VuDV7asTEF2Ut7NnurXt0ScIgLv5Q0qZNACHpTSqLuDcRu/1IvSzwWrSX/1QEIhlE 2jdZtsvTpR2aLym86RXaOHC3RwV76QayWFW/dSnADmT2IkdrjDnTC629SJlY9bvelEg8 x20eyhsDJ9e7YYDQUYmrZ3Ji4A03YZhatWajxGeymZ/vRyNi635r0FtQMjsWyF0/uxxe I9Sw== X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: David Airlie , Sean Paul , Rodrigo Vivi Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Sean Paul This patch is required for HDCP over MST. If a port is being used for multiple HDCP streams, we don't want to fully disable HDCP on a port if one of them is disabled. Instead, we just disable the HDCP signalling on that particular pipe and exit early. The last pipe to disable HDCP will also bring down HDCP on the port. In order to achieve this, we need to keep a refcount in intel_digital_port and protect it using a new hdcp_mutex. Signed-off-by: Sean Paul --- drivers/gpu/drm/i915/display/intel_ddi.c | 3 ++ .../drm/i915/display/intel_display_types.h | 5 ++ drivers/gpu/drm/i915/display/intel_dp.c | 2 + drivers/gpu/drm/i915/display/intel_hdcp.c | 49 ++++++++++++++++--- drivers/gpu/drm/i915/display/intel_hdmi.c | 2 + 5 files changed, 53 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/i915/display/intel_ddi.c b/drivers/gpu/drm/i915/display/intel_ddi.c index ca28913a4c9f..a55bc7109045 100644 --- a/drivers/gpu/drm/i915/display/intel_ddi.c +++ b/drivers/gpu/drm/i915/display/intel_ddi.c @@ -4717,6 +4717,9 @@ void intel_ddi_init(struct drm_i915_private *dev_priv, enum port port) intel_encoder = &intel_dig_port->base; encoder = &intel_encoder->base; + mutex_init(&intel_dig_port->hdcp_mutex); + intel_dig_port->num_hdcp_streams = 0; + drm_encoder_init(&dev_priv->drm, encoder, &intel_ddi_funcs, DRM_MODE_ENCODER_TMDS, "DDI %c", port_name(port)); diff --git a/drivers/gpu/drm/i915/display/intel_display_types.h b/drivers/gpu/drm/i915/display/intel_display_types.h index bbd44772b9b0..489e1d00928b 100644 --- a/drivers/gpu/drm/i915/display/intel_display_types.h +++ b/drivers/gpu/drm/i915/display/intel_display_types.h @@ -1309,6 +1309,11 @@ struct intel_digital_port { enum phy_fia tc_phy_fia; u8 tc_phy_fia_idx; + /* protects num_hdcp_streams reference count */ + struct mutex hdcp_mutex; + /* the number of pipes using HDCP signalling out of this port */ + unsigned int num_hdcp_streams; + void (*write_infoframe)(struct intel_encoder *encoder, const struct intel_crtc_state *crtc_state, unsigned int type, diff --git a/drivers/gpu/drm/i915/display/intel_dp.c b/drivers/gpu/drm/i915/display/intel_dp.c index e26fb26b1909..fc5a7dc6ab9b 100644 --- a/drivers/gpu/drm/i915/display/intel_dp.c +++ b/drivers/gpu/drm/i915/display/intel_dp.c @@ -7535,6 +7535,8 @@ bool intel_dp_init(struct drm_i915_private *dev_priv, intel_encoder = &intel_dig_port->base; encoder = &intel_encoder->base; + mutex_init(&intel_dig_port->hdcp_mutex); + if (drm_encoder_init(&dev_priv->drm, &intel_encoder->base, &intel_dp_enc_funcs, DRM_MODE_ENCODER_TMDS, "DP %c", port_name(port))) diff --git a/drivers/gpu/drm/i915/display/intel_hdcp.c b/drivers/gpu/drm/i915/display/intel_hdcp.c index f34763fa5b42..cd246f501738 100644 --- a/drivers/gpu/drm/i915/display/intel_hdcp.c +++ b/drivers/gpu/drm/i915/display/intel_hdcp.c @@ -849,6 +849,7 @@ struct intel_connector *intel_hdcp_to_connector(struct intel_hdcp *hdcp) static void intel_hdcp_update_value(struct intel_connector *connector, u64 value, bool update_property) { + struct intel_digital_port *intel_dig_port = conn_to_dig_port(connector); struct intel_hdcp *hdcp = &connector->hdcp; WARN_ON(!mutex_is_locked(&hdcp->mutex)); @@ -856,6 +857,15 @@ static void intel_hdcp_update_value(struct intel_connector *connector, if (hdcp->value == value) return; + WARN_ON(!mutex_is_locked(&intel_dig_port->hdcp_mutex)); + + if (hdcp->value == DRM_MODE_CONTENT_PROTECTION_ENABLED) { + if (!WARN_ON(intel_dig_port->num_hdcp_streams == 0)) + intel_dig_port->num_hdcp_streams--; + } else if (value == DRM_MODE_CONTENT_PROTECTION_ENABLED) { + intel_dig_port->num_hdcp_streams++; + } + hdcp->value = value; if (update_property) schedule_work(&hdcp->prop_work); @@ -872,6 +882,8 @@ static int intel_hdcp_check_link(struct intel_connector *connector) int ret = 0; mutex_lock(&hdcp->mutex); + mutex_lock(&intel_dig_port->hdcp_mutex); + cpu_transcoder = hdcp->cpu_transcoder; /* Check_link valid only when HDCP1.4 is enabled */ @@ -923,6 +935,7 @@ static int intel_hdcp_check_link(struct intel_connector *connector) } out: + mutex_unlock(&intel_dig_port->hdcp_mutex); mutex_unlock(&hdcp->mutex); return ret; } @@ -1994,6 +2007,7 @@ int intel_hdcp_init(struct intel_connector *connector, int intel_hdcp_enable(struct intel_connector *connector, u8 content_type) { + struct intel_digital_port *intel_dig_port = conn_to_dig_port(connector); struct intel_hdcp *hdcp = &connector->hdcp; unsigned long check_link_interval = DRM_HDCP_CHECK_PERIOD_MS; int ret = -EINVAL; @@ -2002,6 +2016,7 @@ int intel_hdcp_enable(struct intel_connector *connector, u8 content_type) return -ENOENT; mutex_lock(&hdcp->mutex); + mutex_lock(&intel_dig_port->hdcp_mutex); WARN_ON(hdcp->value == DRM_MODE_CONTENT_PROTECTION_ENABLED); hdcp->content_type = content_type; @@ -2031,12 +2046,14 @@ int intel_hdcp_enable(struct intel_connector *connector, u8 content_type) true); } + mutex_unlock(&intel_dig_port->hdcp_mutex); mutex_unlock(&hdcp->mutex); return ret; } int intel_hdcp_disable(struct intel_connector *connector) { + struct intel_digital_port *intel_dig_port = conn_to_dig_port(connector); struct intel_hdcp *hdcp = &connector->hdcp; int ret = 0; @@ -2044,17 +2061,33 @@ int intel_hdcp_disable(struct intel_connector *connector) return -ENOENT; mutex_lock(&hdcp->mutex); + mutex_lock(&intel_dig_port->hdcp_mutex); - if (hdcp->value != DRM_MODE_CONTENT_PROTECTION_UNDESIRED) { - intel_hdcp_update_value(connector, - DRM_MODE_CONTENT_PROTECTION_UNDESIRED, - false); - if (hdcp->hdcp2_encrypted) - ret = _intel_hdcp2_disable(connector); - else if (hdcp->hdcp_encrypted) - ret = _intel_hdcp_disable(connector); + if (hdcp->value == DRM_MODE_CONTENT_PROTECTION_UNDESIRED) + goto out; + + intel_hdcp_update_value(connector, + DRM_MODE_CONTENT_PROTECTION_UNDESIRED, false); + + /* + * If there are other connectors on this port using HDCP, don't disable + * it. Instead, toggle the HDCP signalling off on that particular + * connector/pipe and exit. + */ + if (intel_dig_port->num_hdcp_streams > 0) { + ret = hdcp->shim->toggle_signalling(connector, false); + if (ret) + DRM_DEBUG_KMS("Failed to disable HDCP signalling\n"); + goto out; } + if (hdcp->hdcp2_encrypted) + ret = _intel_hdcp2_disable(connector); + else if (hdcp->hdcp_encrypted) + ret = _intel_hdcp_disable(connector); + +out: + mutex_unlock(&intel_dig_port->hdcp_mutex); mutex_unlock(&hdcp->mutex); cancel_delayed_work_sync(&hdcp->check_work); return ret; diff --git a/drivers/gpu/drm/i915/display/intel_hdmi.c b/drivers/gpu/drm/i915/display/intel_hdmi.c index 6a1e711c4f7a..c230d37c4276 100644 --- a/drivers/gpu/drm/i915/display/intel_hdmi.c +++ b/drivers/gpu/drm/i915/display/intel_hdmi.c @@ -3243,6 +3243,8 @@ void intel_hdmi_init(struct drm_i915_private *dev_priv, intel_encoder = &intel_dig_port->base; + mutex_init(&intel_dig_port->hdcp_mutex); + drm_encoder_init(&dev_priv->drm, &intel_encoder->base, &intel_hdmi_enc_funcs, DRM_MODE_ENCODER_TMDS, "HDMI %c", port_name(port)); From patchwork Tue Dec 3 17:36:31 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Paul X-Patchwork-Id: 11271783 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 744F4930 for ; Tue, 3 Dec 2019 17:37:37 +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 59E9E206EC for ; Tue, 3 Dec 2019 17:37:37 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 59E9E206EC Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=poorly.run Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D00E26EA4E; Tue, 3 Dec 2019 17:37:35 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-yw1-xc43.google.com (mail-yw1-xc43.google.com [IPv6:2607:f8b0:4864:20::c43]) by gabe.freedesktop.org (Postfix) with ESMTPS id 4996389166 for ; Tue, 3 Dec 2019 17:37:34 +0000 (UTC) Received: by mail-yw1-xc43.google.com with SMTP id t141so1618942ywc.11 for ; Tue, 03 Dec 2019 09:37:34 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=agSIMt9qL1hxT3fbJ0reE7XcbpJIccyYjH/rTo8BTDM=; b=lj4iK4NPZWWeyghxdIpIomU3b0xns3txakYmc0EbDzH/phG0H2XO8biH3ZB2lxGEd5 3Ih09NwXF9JYFm+ueJIPsmlk2uqUQUDormgDsKBxyXyefJMVedsdT6QT8uAaojXn7Xco wuT30BHBG8NPjVOgveX4wBuYSXauV0Ta9RVSy8A65vq64rv8ri9JJAbPyYRrzuOTT0pW r+NziUf1b0Dr4jULrwCkAbXupUblZG3rFQyHuwc/ON59Ouy3/iubtcKCeS4ZeN3wYGDo PgP1hfAomRpXgCgZ+T83RwH8JeKRu6GjHKpAfGduEzluB7EzChQ9SAqNjBRQEMcGI+JJ hCsQ== X-Gm-Message-State: APjAAAWOCFID2bVUJLX9D+kD4b6kf8ow8mJCrv0mXm9rrWV/H4yGsc/B dcCq1fFG6JmHDd8wef/hA34zZjPThF3L7g== X-Google-Smtp-Source: APXvYqx4IVEfP7pQN+lP5WTSHgMM7XPAJ14VoUzEu3yt+G7yWz8prX6m1eairvUDa9pdwOuBO86Miw== X-Received: by 2002:a81:47d7:: with SMTP id u206mr4789709ywa.15.1575394653270; Tue, 03 Dec 2019 09:37:33 -0800 (PST) Received: from rosewood.cam.corp.google.com ([2620:0:1013:11:89c6:2139:5435:371d]) by smtp.gmail.com with ESMTPSA id g190sm1729426ywf.41.2019.12.03.09.37.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Dec 2019 09:37:32 -0800 (PST) From: Sean Paul To: dri-devel@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, ramalingm.c@intel.com Subject: [PATCH 08/11] drm/i915: Support DP MST in enc_to_dig_port() function Date: Tue, 3 Dec 2019 12:36:31 -0500 Message-Id: <20191203173638.94919-9-sean@poorly.run> X-Mailer: git-send-email 2.24.0.393.g34dc348eaf-goog In-Reply-To: <20191203173638.94919-1-sean@poorly.run> References: <20191203173638.94919-1-sean@poorly.run> MIME-Version: 1.0 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=poorly.run; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=agSIMt9qL1hxT3fbJ0reE7XcbpJIccyYjH/rTo8BTDM=; b=ChDdZ6TjP5A9oU/M88m7XHvamZnU26ETrpdD7G17nvWnJhul4L21AbY6XaT+9PVDA1 TymOOsv/7E/flmRjZMQsUJ/xn7rDJC7u0WY6ngxDhcbfG8x/Shjq7JskSNqHGgaaXPNV O1+Ci4EA/ttgstGHRV9zULi23BuFrREVrxSRH9eTPTkdIgH5hxMsLY3FgQh+RATCGo4Y wevD2/2HjXOPjCiswgN0v9nYrqls2JxiC6tJ8e1X2IKXSNX8Cq6fZWanQGPWO29DKSBe z47INp+KiQlxM2VAjBR8qmnzdpXPGz/eXxwQwvHVYZm7F50LjB2o6CfPxa5bHRqPn2+8 yb/w== X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: David Airlie , Sean Paul , Rodrigo Vivi Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Sean Paul Although DP_MST fake encoders are not subclassed from digital ports, they are associated with them. Support these encoders. Signed-off-by: Sean Paul --- .../drm/i915/display/intel_display_types.h | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/i915/display/intel_display_types.h b/drivers/gpu/drm/i915/display/intel_display_types.h index 489e1d00928b..4924784f3f4c 100644 --- a/drivers/gpu/drm/i915/display/intel_display_types.h +++ b/drivers/gpu/drm/i915/display/intel_display_types.h @@ -1414,6 +1414,17 @@ static inline bool intel_encoder_is_dig_port(struct intel_encoder *encoder) } } +static inline bool intel_encoder_is_mst(struct intel_encoder *encoder) +{ + return encoder->type == INTEL_OUTPUT_DP_MST; +} + +static inline struct intel_dp_mst_encoder * +enc_to_mst(struct drm_encoder *encoder) +{ + return container_of(encoder, struct intel_dp_mst_encoder, base.base); +} + static inline struct intel_digital_port * enc_to_dig_port(struct drm_encoder *encoder) { @@ -1422,6 +1433,8 @@ enc_to_dig_port(struct drm_encoder *encoder) if (intel_encoder_is_dig_port(intel_encoder)) return container_of(encoder, struct intel_digital_port, base.base); + else if (intel_encoder_is_mst(intel_encoder)) + return enc_to_mst(encoder)->primary; else return NULL; } @@ -1432,12 +1445,6 @@ conn_to_dig_port(struct intel_connector *connector) return enc_to_dig_port(&intel_attached_encoder(&connector->base)->base); } -static inline struct intel_dp_mst_encoder * -enc_to_mst(struct drm_encoder *encoder) -{ - return container_of(encoder, struct intel_dp_mst_encoder, base.base); -} - static inline struct intel_dp *enc_to_intel_dp(struct drm_encoder *encoder) { return &enc_to_dig_port(encoder)->dp; From patchwork Tue Dec 3 17:36:32 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Paul X-Patchwork-Id: 11271787 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 11436159A for ; Tue, 3 Dec 2019 17:37:41 +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 EA9C5206EC for ; Tue, 3 Dec 2019 17:37:40 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org EA9C5206EC Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=poorly.run Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A645A6EA48; Tue, 3 Dec 2019 17:37:39 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-yw1-xc42.google.com (mail-yw1-xc42.google.com [IPv6:2607:f8b0:4864:20::c42]) by gabe.freedesktop.org (Postfix) with ESMTPS id F2E816EA51 for ; Tue, 3 Dec 2019 17:37:37 +0000 (UTC) Received: by mail-yw1-xc42.google.com with SMTP id w11so1627013ywj.9 for ; Tue, 03 Dec 2019 09:37:37 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=iLJkGW9i+0Daici6e/qwf4xogV6B3/LFitXBdz22Y10=; b=NbbhdYLHQEKgd2IOgvuwECDyGiwddFE1mzSsFrVKB+uX/n+//G3slRxZMisZHQuSgD zj90M1HWWLYe5zmhq2nseZV28EDI9UhmwOo7EwB/hwlw4gPjgj7n21qiik049mbpTjX8 2kATogZJENtXhvQyDk9OQka21NiUbCi3u/IupTS4lKnIWoAtJwnyP7Sa57gzSZH5u+mS ZXrPqDdaqnqS61yYQhjBzfCqWvPXPZ7lLY9FpZ+81jBM7pIHgtVtpINnc+N62G8/ausX G35nWAOqBNSWM2kMVZ5auWQ9x4d1mHkde7viIDb7hjS2vtyBlg0uS8ZCXUfnr+mpQAEX DJ8w== X-Gm-Message-State: APjAAAWdPcpHBJJ8leMCk0sgMrisPTX/FlySstiitQytcp91YkJv9f/Q DPg8/6vLUQwdrI/uxHIkL5j+KuEhB5uYAw== X-Google-Smtp-Source: APXvYqxSqYKRhRFO2SfSRmbkDVQL4pqPtfUMx5dUe435JUHSnfGJ9izLT1+pJQ4UOaemcQUmnSBX2g== X-Received: by 2002:a81:44b:: with SMTP id 72mr4774884ywe.373.1575394656967; Tue, 03 Dec 2019 09:37:36 -0800 (PST) Received: from rosewood.cam.corp.google.com ([2620:0:1013:11:89c6:2139:5435:371d]) by smtp.gmail.com with ESMTPSA id g190sm1729426ywf.41.2019.12.03.09.37.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Dec 2019 09:37:36 -0800 (PST) From: Sean Paul To: dri-devel@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, ramalingm.c@intel.com Subject: [PATCH 09/11] drm/i915: Use ddi_update_pipe in intel_dp_mst Date: Tue, 3 Dec 2019 12:36:32 -0500 Message-Id: <20191203173638.94919-10-sean@poorly.run> X-Mailer: git-send-email 2.24.0.393.g34dc348eaf-goog In-Reply-To: <20191203173638.94919-1-sean@poorly.run> References: <20191203173638.94919-1-sean@poorly.run> MIME-Version: 1.0 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=poorly.run; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=iLJkGW9i+0Daici6e/qwf4xogV6B3/LFitXBdz22Y10=; b=I0LSSZgKZGNzdSuQo6F3Vs1o+zJduNMwyp4Toai4EIRmm0h5fMzlGl7gNRxFoaUoBS nTKKcjQVV/R4USEL/NfvmYf2uWdphbxosvWFWUOME1AqCI/MWVKzShHGkHyRk7FfxfSK zCzMSEHWitgkg5bID+JyPTHVOnsPqqsj72axXH+hoWfC0SQjwDFpYWK70Vf3Mc5rGB3W 24ohXEJXt15rzf0B9XsbIKmFk5IUfxrUcb4xuMIVo64iBZiPrDxmJzBz4c0WMF97//7h hbjFUS6ihHAXs8JSXDQcetSDPx/0QbV5/2c99E7CX8nPH2RHcaIiE3N8/m9cJ/CMhQTC AxMg== X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: David Airlie , Sean Paul , Rodrigo Vivi Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Sean Paul In order to act upon content_protection property changes, we'll need to implement the .update_pipe() hook. We can re-use intel_ddi_update_pipe for this Signed-off-by: Sean Paul --- drivers/gpu/drm/i915/display/intel_ddi.c | 9 +++++---- drivers/gpu/drm/i915/display/intel_dp.h | 6 ++++++ drivers/gpu/drm/i915/display/intel_dp_mst.c | 1 + 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/i915/display/intel_ddi.c b/drivers/gpu/drm/i915/display/intel_ddi.c index a55bc7109045..005afefbcbfa 100644 --- a/drivers/gpu/drm/i915/display/intel_ddi.c +++ b/drivers/gpu/drm/i915/display/intel_ddi.c @@ -4029,9 +4029,9 @@ static void intel_ddi_update_pipe_dp(struct intel_encoder *encoder, intel_panel_update_backlight(encoder, crtc_state, conn_state); } -static void intel_ddi_update_pipe(struct intel_encoder *encoder, - const struct intel_crtc_state *crtc_state, - const struct drm_connector_state *conn_state) +void intel_ddi_update_pipe(struct intel_encoder *encoder, + const struct intel_crtc_state *crtc_state, + const struct drm_connector_state *conn_state) { struct intel_connector *connector = to_intel_connector(conn_state->connector); @@ -4041,7 +4041,8 @@ static void intel_ddi_update_pipe(struct intel_encoder *encoder, conn_state->content_protection != DRM_MODE_CONTENT_PROTECTION_UNDESIRED); - if (!intel_crtc_has_type(crtc_state, INTEL_OUTPUT_HDMI)) + if (!intel_crtc_has_type(crtc_state, INTEL_OUTPUT_HDMI) && + !intel_encoder_is_mst(encoder)) intel_ddi_update_pipe_dp(encoder, crtc_state, conn_state); /* diff --git a/drivers/gpu/drm/i915/display/intel_dp.h b/drivers/gpu/drm/i915/display/intel_dp.h index 3da166054788..db732b432809 100644 --- a/drivers/gpu/drm/i915/display/intel_dp.h +++ b/drivers/gpu/drm/i915/display/intel_dp.h @@ -123,6 +123,12 @@ static inline unsigned int intel_dp_unused_lane_mask(int lane_count) return ~((1 << lane_count) - 1) & 0xf; } + u32 intel_dp_mode_to_fec_clock(u32 mode_clock); +/* Shared between intel_dp and intel_dp_mst */ +void intel_ddi_update_pipe(struct intel_encoder *encoder, + const struct intel_crtc_state *crtc_state, + const struct drm_connector_state *conn_state); + #endif /* __INTEL_DP_H__ */ diff --git a/drivers/gpu/drm/i915/display/intel_dp_mst.c b/drivers/gpu/drm/i915/display/intel_dp_mst.c index 715b7109c388..8ebf545c6fe5 100644 --- a/drivers/gpu/drm/i915/display/intel_dp_mst.c +++ b/drivers/gpu/drm/i915/display/intel_dp_mst.c @@ -628,6 +628,7 @@ intel_dp_create_fake_mst_encoder(struct intel_digital_port *intel_dig_port, enum intel_encoder->compute_config = intel_dp_mst_compute_config; intel_encoder->disable = intel_mst_disable_dp; intel_encoder->post_disable = intel_mst_post_disable_dp; + intel_encoder->update_pipe = intel_ddi_update_pipe; intel_encoder->pre_pll_enable = intel_mst_pre_pll_enable_dp; intel_encoder->post_pll_disable = intel_mst_post_pll_disable_dp; intel_encoder->pre_enable = intel_mst_pre_enable_dp; From patchwork Tue Dec 3 17:36:33 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Paul X-Patchwork-Id: 11271789 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 9FB80930 for ; Tue, 3 Dec 2019 17:37:44 +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 8559D206EC for ; Tue, 3 Dec 2019 17:37:44 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8559D206EC Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=poorly.run Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 210856EA50; Tue, 3 Dec 2019 17:37:43 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-yb1-xb42.google.com (mail-yb1-xb42.google.com [IPv6:2607:f8b0:4864:20::b42]) by gabe.freedesktop.org (Postfix) with ESMTPS id 98D756EA50 for ; Tue, 3 Dec 2019 17:37:41 +0000 (UTC) Received: by mail-yb1-xb42.google.com with SMTP id q7so1862750ybk.4 for ; Tue, 03 Dec 2019 09:37:41 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=DQr43OWwM0zkaVjx1CwvWsP5lq5M+BXcr+mK36r5o+8=; b=uimqumi/HFH9R2DOubrkvHRjPdVR3V0WEbIRi+ghqQfiX5uaFOW/iLS5B/DR8AsRQP soloSGpQYwzuWIEIX7vedwiw3EYPF5FsL35VyAIMWaF7tAg2UYyGgkDWeRH38QLRle+K b0wm0UhX+P8FxPs/pZzrOUp8A6dX65FfVLobs9DCgBq6gMlrKUKmiySiyLn0sJ9N/GG6 +HyU9+tm5PXR0T0xMFY2c8d8rECDTw8Gs9ibc4D4XnwrWRLUL66h1IuOUHMFSqBPq3/M BZr0XVe3F073DUV1mglekHN0HWrbp9Dajx3AwEG3yq0yeEVp6htSofGN2LGswZzF7sPx Qqjw== X-Gm-Message-State: APjAAAVBGwajrHfHyaLXp79fQlZkug3AMAMBFjvaR8a97Wk4bRwlMlLN MYd8MXQJ076c7wtoc71Gj85vR8Py7v0Y4g== X-Google-Smtp-Source: APXvYqzVw5f0JcPRhP2RucAj/uzMfNGC1FuRkgZBkGzkHEUxLcClmgFXDzDYUpOQTQE/fVZ/EeKRMg== X-Received: by 2002:a25:5903:: with SMTP id n3mr5413188ybb.466.1575394660518; Tue, 03 Dec 2019 09:37:40 -0800 (PST) Received: from rosewood.cam.corp.google.com ([2620:0:1013:11:89c6:2139:5435:371d]) by smtp.gmail.com with ESMTPSA id g190sm1729426ywf.41.2019.12.03.09.37.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Dec 2019 09:37:40 -0800 (PST) From: Sean Paul To: dri-devel@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, ramalingm.c@intel.com Subject: [PATCH 10/11] drm/i915: Expose HDCP shim functions from dp for use by dp_mst Date: Tue, 3 Dec 2019 12:36:33 -0500 Message-Id: <20191203173638.94919-11-sean@poorly.run> X-Mailer: git-send-email 2.24.0.393.g34dc348eaf-goog In-Reply-To: <20191203173638.94919-1-sean@poorly.run> References: <20191203173638.94919-1-sean@poorly.run> MIME-Version: 1.0 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=poorly.run; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=DQr43OWwM0zkaVjx1CwvWsP5lq5M+BXcr+mK36r5o+8=; b=UTd06HGFOu6Cou21yEQ6U+Vc0AL8giEbLpS6mmZsRRezw1gz76mzjgbwhfMgLEjzoZ nJA9gSOuS+wyuRhJCj4fXbP10oYdC8+kZGxXgu7AIO8Agqi0azg4qt266wQiTPOr6S/W JPKzsBPdauq2AxoggXXxaIPkDTAhr7ifMENwgdCInTknOvv9AuEs1Ct6fwc8CCY69fWX Cj4ItSnmNXade5oayJTXAUp/K7mcVG/JvBkrU6NnuDPeX2Ax8cYKv5D0jqa7iG8hf+nW jANmI0tTqzefPjjrIeeeAW2BoBxBNcfVEbPb1KU/nq4XS68rDPMJpwYLr3V3xBfSCpQ6 aFmg== X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: David Airlie , Sean Paul , Rodrigo Vivi Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Sean Paul These functions are all the same for dp and dp_mst, so expose them for use by the dp_mst hdcp implementation. Signed-off-by: Sean Paul --- .../drm/i915/display/intel_display_types.h | 22 +++++++++++++++++++ drivers/gpu/drm/i915/display/intel_dp.c | 14 ++---------- 2 files changed, 24 insertions(+), 12 deletions(-) diff --git a/drivers/gpu/drm/i915/display/intel_display_types.h b/drivers/gpu/drm/i915/display/intel_display_types.h index 4924784f3f4c..6fafa92dcf76 100644 --- a/drivers/gpu/drm/i915/display/intel_display_types.h +++ b/drivers/gpu/drm/i915/display/intel_display_types.h @@ -1573,4 +1573,26 @@ static inline u32 intel_plane_ggtt_offset(const struct intel_plane_state *state) return i915_ggtt_offset(state->vma); } +int intel_dp_hdcp_write_an_aksv(struct intel_digital_port *intel_dig_port, + u8 *an); +int intel_dp_hdcp_read_bksv(struct intel_digital_port *intel_dig_port, + u8 *bksv); +int intel_dp_hdcp_read_bstatus(struct intel_digital_port *intel_dig_port, + u8 *bstatus); +int intel_dp_hdcp_read_bcaps(struct intel_digital_port *intel_dig_port, + u8 *bcaps); +int intel_dp_hdcp_repeater_present(struct intel_digital_port *intel_dig_port, + bool *repeater_present); +int intel_dp_hdcp_read_ri_prime(struct intel_digital_port *intel_dig_port, + u8 *ri_prime); +int intel_dp_hdcp_read_ksv_ready(struct intel_digital_port *intel_dig_port, + bool *ksv_ready); +int intel_dp_hdcp_read_ksv_fifo(struct intel_digital_port *intel_dig_port, + int num_downstream, u8 *ksv_fifo); +int intel_dp_hdcp_read_v_prime_part(struct intel_digital_port *intel_dig_port, + int i, u32 *part); +bool intel_dp_hdcp_check_link(struct intel_digital_port *intel_dig_port); +int intel_dp_hdcp_capable(struct intel_digital_port *intel_dig_port, + bool *hdcp_capable); + #endif /* __INTEL_DISPLAY_TYPES_H__ */ diff --git a/drivers/gpu/drm/i915/display/intel_dp.c b/drivers/gpu/drm/i915/display/intel_dp.c index fc5a7dc6ab9b..600de7606596 100644 --- a/drivers/gpu/drm/i915/display/intel_dp.c +++ b/drivers/gpu/drm/i915/display/intel_dp.c @@ -5871,7 +5871,6 @@ static void intel_dp_hdcp_wait_for_cp_irq(struct intel_hdcp *hdcp, int timeout) DRM_DEBUG_KMS("Timedout at waiting for CP_IRQ\n"); } -static int intel_dp_hdcp_write_an_aksv(struct intel_digital_port *intel_dig_port, u8 *an) { @@ -5903,8 +5902,7 @@ int intel_dp_hdcp_write_an_aksv(struct intel_digital_port *intel_dig_port, return 0; } -static int intel_dp_hdcp_read_bksv(struct intel_digital_port *intel_dig_port, - u8 *bksv) +int intel_dp_hdcp_read_bksv(struct intel_digital_port *intel_dig_port, u8 *bksv) { ssize_t ret; ret = drm_dp_dpcd_read(&intel_dig_port->dp.aux, DP_AUX_HDCP_BKSV, bksv, @@ -5916,7 +5914,7 @@ static int intel_dp_hdcp_read_bksv(struct intel_digital_port *intel_dig_port, return 0; } -static int intel_dp_hdcp_read_bstatus(struct intel_digital_port *intel_dig_port, +int intel_dp_hdcp_read_bstatus(struct intel_digital_port *intel_dig_port, u8 *bstatus) { ssize_t ret; @@ -5934,7 +5932,6 @@ static int intel_dp_hdcp_read_bstatus(struct intel_digital_port *intel_dig_port, return 0; } -static int intel_dp_hdcp_read_bcaps(struct intel_digital_port *intel_dig_port, u8 *bcaps) { @@ -5950,7 +5947,6 @@ int intel_dp_hdcp_read_bcaps(struct intel_digital_port *intel_dig_port, return 0; } -static int intel_dp_hdcp_repeater_present(struct intel_digital_port *intel_dig_port, bool *repeater_present) { @@ -5965,7 +5961,6 @@ int intel_dp_hdcp_repeater_present(struct intel_digital_port *intel_dig_port, return 0; } -static int intel_dp_hdcp_read_ri_prime(struct intel_digital_port *intel_dig_port, u8 *ri_prime) { @@ -5979,7 +5974,6 @@ int intel_dp_hdcp_read_ri_prime(struct intel_digital_port *intel_dig_port, return 0; } -static int intel_dp_hdcp_read_ksv_ready(struct intel_digital_port *intel_dig_port, bool *ksv_ready) { @@ -5995,7 +5989,6 @@ int intel_dp_hdcp_read_ksv_ready(struct intel_digital_port *intel_dig_port, return 0; } -static int intel_dp_hdcp_read_ksv_fifo(struct intel_digital_port *intel_dig_port, int num_downstream, u8 *ksv_fifo) { @@ -6018,7 +6011,6 @@ int intel_dp_hdcp_read_ksv_fifo(struct intel_digital_port *intel_dig_port, return 0; } -static int intel_dp_hdcp_read_v_prime_part(struct intel_digital_port *intel_dig_port, int i, u32 *part) { @@ -6045,7 +6037,6 @@ int intel_dp_hdcp_toggle_signalling(struct intel_connector *connector, return 0; } -static bool intel_dp_hdcp_check_link(struct intel_digital_port *intel_dig_port) { ssize_t ret; @@ -6061,7 +6052,6 @@ bool intel_dp_hdcp_check_link(struct intel_digital_port *intel_dig_port) return !(bstatus & (DP_BSTATUS_LINK_FAILURE | DP_BSTATUS_REAUTH_REQ)); } -static int intel_dp_hdcp_capable(struct intel_digital_port *intel_dig_port, bool *hdcp_capable) { From patchwork Tue Dec 3 17:36:34 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Paul X-Patchwork-Id: 11271795 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 4CAE9930 for ; Tue, 3 Dec 2019 17:37:52 +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 31D4E206EC for ; Tue, 3 Dec 2019 17:37:52 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 31D4E206EC Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=poorly.run Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 5F5266EA52; Tue, 3 Dec 2019 17:37:51 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-yw1-xc43.google.com (mail-yw1-xc43.google.com [IPv6:2607:f8b0:4864:20::c43]) by gabe.freedesktop.org (Postfix) with ESMTPS id D3B896EA52 for ; Tue, 3 Dec 2019 17:37:49 +0000 (UTC) Received: by mail-yw1-xc43.google.com with SMTP id d12so1612656ywl.12 for ; Tue, 03 Dec 2019 09:37:49 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=tqAc5zOWHYJkZ2j7vRtBQBCRiw72m2Sq2wZnWRM1z9o=; b=Tpq1+k1Z6n3ZXRp+WUOEVlk6DNavBCyN30m10No9u9n0LCkIfdAb/v6ZMbxRtWZ/TE lgz3ZvAcsfQ9sfbGDaU5XePxQjc7sFz/dS71VLO5Mz1t0VSm2oXeMHIcPKpjV/4M6s4H 1DbwZlnkTwzrfQNwmlzYjmYW9td4TOQVjK/gSSC/uXlJT13EDbTBU3anjueF6N9pAaxY Y60GW9Q76LRzP+Orrfbg9bh+l1uYowmJ4rNGYG1g6I7BsbdwFQI3wPbsfQgdsz9bV2Mv E0OgHl5GWSZqBWFyWXwE2FSiP1cbEwQQDZxD2SVvqve5m6k2wF0AkGVaMsLE6dTc1SQ5 89Vg== X-Gm-Message-State: APjAAAVT7RybGzoIIwGJBYnuOPUyDuaFtbgIDSFiWgPjF/qBUHdYXgUW PjRF1BWSzougwsFn91h9Kaq7ekWPXBXWrw== X-Google-Smtp-Source: APXvYqxwggdXHEO4lUvFuZnat8cgVI8lfop2fEsXt2ptEIeZ3zE4wUDz1l2HCj8aJwsso+/Rv0iHwQ== X-Received: by 2002:a81:17c4:: with SMTP id 187mr4758498ywx.146.1575394663925; Tue, 03 Dec 2019 09:37:43 -0800 (PST) Received: from rosewood.cam.corp.google.com ([2620:0:1013:11:89c6:2139:5435:371d]) by smtp.gmail.com with ESMTPSA id g190sm1729426ywf.41.2019.12.03.09.37.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Dec 2019 09:37:43 -0800 (PST) From: Sean Paul To: dri-devel@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, ramalingm.c@intel.com Subject: [PATCH 11/11] drm/i915: Add HDCP 1.4 support for MST connectors Date: Tue, 3 Dec 2019 12:36:34 -0500 Message-Id: <20191203173638.94919-12-sean@poorly.run> X-Mailer: git-send-email 2.24.0.393.g34dc348eaf-goog In-Reply-To: <20191203173638.94919-1-sean@poorly.run> References: <20191203173638.94919-1-sean@poorly.run> MIME-Version: 1.0 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=poorly.run; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=tqAc5zOWHYJkZ2j7vRtBQBCRiw72m2Sq2wZnWRM1z9o=; b=DRR4ITgkz7m42etZkNNupA5GG1qAKpkYI5UpatuaB3HjudqhGFt2oxQfsoU3EM/9a+ BUiOBq0tgBBBOS2d3OXz+9pZIWDsrUnr2n6wLpeLxs5jRfK+8V1ka0A4hb2YVcojGDPo EdHaRmEqt4j6C6zWEf90HpvN+NZYRQfbI19v/6v8kuAbG66AcLyd3dtCZxR9hNOyF6lc U3rlbCudulXBXwXu3Y7MPfOXmVUwGTzNDGLCmM24gNCwyFEvABncQxft0eyHqywZSFQa rpFM/ltaPd1KxeE0qf6u07uMU8/qE9k+IdovMs8Im/KYGXcX8BjPv/1ynyMT0Mr6kpub uCbQ== X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: David Airlie , Sean Paul , Rodrigo Vivi Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Sean Paul Now that all the groundwork has been laid, we can turn on HDCP 1.4 over MST. Everything except for toggling the HDCP signalling and HDCP 2.2 support is the same as the DP case, so we'll re-use those callbacks Signed-off-by: Sean Paul --- drivers/gpu/drm/i915/display/intel_dp_mst.c | 83 +++++++++++++++++++++ 1 file changed, 83 insertions(+) diff --git a/drivers/gpu/drm/i915/display/intel_dp_mst.c b/drivers/gpu/drm/i915/display/intel_dp_mst.c index 8ebf545c6fe5..d26f12cb432c 100644 --- a/drivers/gpu/drm/i915/display/intel_dp_mst.c +++ b/drivers/gpu/drm/i915/display/intel_dp_mst.c @@ -36,6 +36,7 @@ #include "intel_dp.h" #include "intel_dp_mst.h" #include "intel_dpio_phy.h" +#include "intel_hdcp.h" static int intel_dp_mst_compute_link_config(struct intel_encoder *encoder, struct intel_crtc_state *crtc_state, @@ -495,11 +496,83 @@ static bool intel_dp_mst_get_hw_state(struct intel_connector *connector) return false; } +static int +intel_dp_mst_hdcp_toggle_signalling(struct intel_connector *connector, + bool enable) +{ + int ret; + struct intel_encoder *enc = intel_attached_encoder(&connector->base); + + ret = intel_ddi_toggle_hdcp_signalling(enc, enable); + if (ret) + DRM_DEBUG_KMS("%s HDCP signalling failed (%d)\n", + enable ? "Enable" : "Disable", ret); + return ret; +} + +static +int intel_dp_mst_hdcp2_write_msg(struct intel_digital_port *intel_dig_port, + void *buf, size_t size) +{ + return -EOPNOTSUPP; +} + +static +int intel_dp_mst_hdcp2_read_msg(struct intel_digital_port *intel_dig_port, + u8 msg_id, void *buf, size_t size) +{ + return -EOPNOTSUPP; +} + +static int +intel_dp_mst_hdcp2_config_stream_type(struct intel_digital_port *intel_dig_port, + bool is_repeater, u8 content_type) +{ + return -EOPNOTSUPP; +} + +static +int intel_dp_mst_hdcp2_check_link(struct intel_digital_port *intel_dig_port) +{ + return -EOPNOTSUPP; +} + +static +int intel_dp_mst_hdcp2_capable(struct intel_digital_port *intel_dig_port, + bool *capable) +{ + *capable = false; + 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, + .read_bstatus = intel_dp_hdcp_read_bstatus, + .repeater_present = intel_dp_hdcp_repeater_present, + .read_ri_prime = intel_dp_hdcp_read_ri_prime, + .read_ksv_ready = intel_dp_hdcp_read_ksv_ready, + .read_ksv_fifo = intel_dp_hdcp_read_ksv_fifo, + .read_v_prime_part = intel_dp_hdcp_read_v_prime_part, + .toggle_signalling = intel_dp_mst_hdcp_toggle_signalling, + .check_link = intel_dp_hdcp_check_link, + .hdcp_capable = intel_dp_hdcp_capable, + + .write_2_2_msg = intel_dp_mst_hdcp2_write_msg, + .read_2_2_msg = intel_dp_mst_hdcp2_read_msg, + .config_stream_type = intel_dp_mst_hdcp2_config_stream_type, + .check_2_2_link = intel_dp_mst_hdcp2_check_link, + .hdcp_2_2_capable = intel_dp_mst_hdcp2_capable, + + .protocol = HDCP_PROTOCOL_DP, +}; + static struct drm_connector *intel_dp_add_mst_connector(struct drm_dp_mst_topology_mgr *mgr, struct drm_dp_mst_port *port, const char *pathprop) { struct intel_dp *intel_dp = container_of(mgr, struct intel_dp, mst_mgr); struct intel_digital_port *intel_dig_port = dp_to_dig_port(intel_dp); struct drm_device *dev = intel_dig_port->base.base.dev; + struct intel_encoder *intel_encoder = &intel_dig_port->base; struct drm_i915_private *dev_priv = to_i915(dev); struct intel_connector *intel_connector; struct drm_connector *connector; @@ -544,6 +617,12 @@ static struct drm_connector *intel_dp_add_mst_connector(struct drm_dp_mst_topolo intel_attach_force_audio_property(connector); intel_attach_broadcast_rgb_property(connector); + if (is_hdcp_supported(dev_priv, intel_encoder->port)) { + int ret = intel_hdcp_init(intel_connector, &intel_dp_hdcp_shim); + if (ret) + DRM_DEBUG_KMS("HDCP init failed, skipping.\n"); + } + /* * Reuse the prop from the SST connector because we're * not allowed to create new props after device registration. @@ -575,8 +654,12 @@ static void intel_dp_destroy_mst_connector(struct drm_dp_mst_topology_mgr *mgr, struct drm_connector *connector) { struct drm_i915_private *dev_priv = to_i915(connector->dev); + struct intel_connector *intel_connector = + to_intel_connector(connector); DRM_DEBUG_KMS("[CONNECTOR:%d:%s]\n", connector->base.id, connector->name); + + intel_hdcp_disable(intel_connector); drm_connector_unregister(connector); if (dev_priv->fbdev)