From patchwork Tue Feb 26 07:36:02 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ramalingam C X-Patchwork-Id: 10829627 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 15C8A1390 for ; Tue, 26 Feb 2019 07:42:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 090B82AA7E for ; Tue, 26 Feb 2019 07:42:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F1ACD2AAAD; Tue, 26 Feb 2019 07:42:25 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 8B3FB2AA7E for ; Tue, 26 Feb 2019 07:42:25 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 4FDF889C96; Tue, 26 Feb 2019 07:42:13 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by gabe.freedesktop.org (Postfix) with ESMTPS id A52C589C88; Tue, 26 Feb 2019 07:42:07 +0000 (UTC) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 25 Feb 2019 23:42:07 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.58,414,1544515200"; d="scan'208";a="125259442" Received: from mint-dev.iind.intel.com ([10.223.25.164]) by fmsmga007.fm.intel.com with ESMTP; 25 Feb 2019 23:42:05 -0800 From: Ramalingam C To: intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, daniel.vetter@ffwll.ch, uma.shankar@intel.com Subject: [PATCH 03/10] drm: Add CP System Renewability Msg Property Date: Tue, 26 Feb 2019 13:06:02 +0530 Message-Id: <1551166569-19683-4-git-send-email-ramalingam.c@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1551166569-19683-1-git-send-email-ramalingam.c@intel.com> References: <1551166569-19683-1-git-send-email-ramalingam.c@intel.com> 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: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP This patch adds a drm blob property to the selected connector. This property will be used to pass the SRM Blob ID from userspace to kernel. Revocated ksv list from SRM Table will be used by the kernel in the HDCP authentication. Kernel doesn't validate the incoming SRM table or store it in non-volatile storage. So it is expected that userspace will provide the latest valid SRM table on every power cycle before the HDCP authentication starts. Signed-off-by: Ramalingam C --- drivers/gpu/drm/drm_atomic_uapi.c | 10 ++++++++ drivers/gpu/drm/drm_connector.c | 52 +++++++++++++++++++++++++++++++++++++++ include/drm/drm_connector.h | 13 ++++++++++ 3 files changed, 75 insertions(+) diff --git a/drivers/gpu/drm/drm_atomic_uapi.c b/drivers/gpu/drm/drm_atomic_uapi.c index 5289486565ce..9c57d8c07d09 100644 --- a/drivers/gpu/drm/drm_atomic_uapi.c +++ b/drivers/gpu/drm/drm_atomic_uapi.c @@ -754,6 +754,14 @@ static int drm_atomic_connector_set_property(struct drm_connector *connector, return -EINVAL; } state->cp_content_type = val; + } else if (property == connector->cp_srm_property) { + if (state->content_protection != + DRM_MODE_CONTENT_PROTECTION_UNDESIRED && + state->cp_srm_blob_id != val) { + DRM_DEBUG_KMS("Disable CP, then change SRM Blob\n"); + return -EINVAL; + } + state->cp_srm_blob_id = val; } else if (property == connector->colorspace_property) { state->colorspace = val; } else if (property == config->writeback_fb_id_property) { @@ -832,6 +840,8 @@ drm_atomic_connector_get_property(struct drm_connector *connector, *val = state->content_protection; } else if (property == connector->cp_content_type_property) { *val = state->cp_content_type; + } else if (property == connector->cp_srm_property) { + *val = state->cp_srm_blob_id; } else if (property == config->writeback_fb_id_property) { /* Writeback framebuffer is one-shot, write and forget */ *val = 0; diff --git a/drivers/gpu/drm/drm_connector.c b/drivers/gpu/drm/drm_connector.c index 5d7738e1e977..510941ad532f 100644 --- a/drivers/gpu/drm/drm_connector.c +++ b/drivers/gpu/drm/drm_connector.c @@ -984,6 +984,24 @@ DRM_ENUM_NAME_FN(drm_get_cp_content_type_name, drm_cp_content_type_enum_list) * Guideline for programming: * - Property state can be changed only when "Content Protection state is * DRM_MODE_CONTENT_PROTECTION_UNDESIRED. + * CP_SRM: + * This Blob property is used by the userspace to pass the revocated + * receiver ID list of HDCP 1.4 and/or 2.2 versions. + * In the HDCP authentication, Kernel uses this list to identify the HDCP + * sink which are revocated by the DCP LLC. + * + * Please note: + * - Userspace is expected to validate the integrity of the SRM table + * through the DCP signatures. + * - Userspace has to store the latest SRM securely in non-volatile + * storage. + * - Kernel doesn't store or validate the incoming SRM tables. So on + * every power cycle, before every HDCP authentication, userspace is + * expected to pass the latest valid SRM to kernel. + * + * Guideline for programming: + * - Property state can be changed only when "Content Protection state is + * DRM_MODE_CONTENT_PROTECTION_UNDESIRED. * * max bpc: * This range property is used by userspace to limit the bit depth. When @@ -1612,6 +1630,40 @@ drm_connector_attach_cp_content_type_property(struct drm_connector *connector) EXPORT_SYMBOL(drm_connector_attach_cp_content_type_property); /** + * drm_connector_attach_cp_srm_property - attach cp srm + * property + * + * @connector: connector to attach cp srm property on. + * + * This is used to add support for sending the SRM table from userspace to + * kernel on selected connectors. Protected content provider will provide + * the system renewability Message(SRM) to userspace before requesting for + * HDCP on a port. Hence if a Port supports content protection (mostly HDCP) + * then this property will be attached to receive the SRM for revocation check + * of the ksvs. + * + * The srm blob id will be set to &drm_connector_state.cp_srm_blob_id + * + * Returns: + * Zero on success, negative errno on failure. + */ +int drm_connector_attach_cp_srm_property(struct drm_connector *connector) +{ + struct drm_device *dev = connector->dev; + struct drm_property *prop; + + prop = drm_property_create(dev, DRM_MODE_PROP_BLOB, "CP_SRM", 0); + if (!prop) + return -ENOMEM; + + drm_object_attach_property(&connector->base, prop, 0); + connector->cp_srm_property = prop; + + return 0; +} +EXPORT_SYMBOL(drm_connector_attach_cp_srm_property); + +/** * drm_mode_create_aspect_ratio_property - create aspect ratio property * @dev: DRM device * diff --git a/include/drm/drm_connector.h b/include/drm/drm_connector.h index 820feb7f0b42..796e5d5e9e5f 100644 --- a/include/drm/drm_connector.h +++ b/include/drm/drm_connector.h @@ -525,6 +525,12 @@ struct drm_connector_state { unsigned int cp_content_type; /** + * @cp_srm_blob_id: Connector property to pass the SRM table for content + * protection. This is most commonly used for HDCP. + */ + unsigned int cp_srm_blob_id; + + /** * @scaling_mode: Connector property to control the * upscaling, mostly used for built-in panels. */ @@ -1048,6 +1054,12 @@ struct drm_connector { struct drm_property *cp_content_type_property; /** + * @cp_srm_property: DRM BLOB property for content + * protection SRM information. + */ + struct drm_property *cp_srm_property; + + /** * @path_blob_ptr: * * DRM blob property data for the DP MST path property. This should only @@ -1324,6 +1336,7 @@ int drm_connector_attach_content_protection_property( struct drm_connector *connector); int drm_connector_attach_cp_content_type_property( struct drm_connector *connector); +int drm_connector_attach_cp_srm_property(struct drm_connector *connector); int drm_mode_create_aspect_ratio_property(struct drm_device *dev); int drm_mode_create_colorspace_property(struct drm_connector *connector); int drm_mode_create_content_type_property(struct drm_device *dev);