From patchwork Sat Mar 9 04:04:50 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ramalingam C X-Patchwork-Id: 10845757 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 111831669 for ; Sat, 9 Mar 2019 04:03:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F0F53300D2 for ; Sat, 9 Mar 2019 04:03:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E59E1300EE; Sat, 9 Mar 2019 04:03:12 +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 6C96A300D2 for ; Sat, 9 Mar 2019 04:03:12 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 2A68F6E43F; Sat, 9 Mar 2019 04:03:03 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by gabe.freedesktop.org (Postfix) with ESMTPS id BC2766E438; Sat, 9 Mar 2019 04:02:59 +0000 (UTC) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 08 Mar 2019 20:02:59 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.58,458,1544515200"; d="scan'208";a="124618847" Received: from dut-ram.iind.intel.com ([10.223.34.157]) by orsmga006.jf.intel.com with ESMTP; 08 Mar 2019 20:02:57 -0800 From: Ramalingam C To: intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, daniel.vetter@ffwll.ch, maarten.lankhorst@linux.intel.com Subject: [PATCH v2 6/8] drm: Add CP downstream_info property Date: Sat, 9 Mar 2019 09:34:50 +0530 Message-Id: <20190309040452.23699-7-ramalingam.c@intel.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190309040452.23699-1-ramalingam.c@intel.com> References: <20190309040452.23699-1-ramalingam.c@intel.com> MIME-Version: 1.0 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: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP This patch adds a optional CP downstream info blob property to the connectors. This enables the Userspace to read the information of HDCP authenticated downstream topology. Driver will updated this blob with all downstream information at the end of the authentication. In case userspace configures this platform as repeater, then this information is needed for the authentication with upstream HDCP transmitter. v2: %s/cp_downstream/content_protection_downstream [daniel] Signed-off-by: Ramalingam C --- drivers/gpu/drm/drm_atomic_uapi.c | 4 ++ drivers/gpu/drm/drm_connector.c | 89 +++++++++++++++++++++++++++++++ include/drm/drm_connector.h | 12 +++++ include/uapi/drm/drm_mode.h | 27 ++++++++++ 4 files changed, 132 insertions(+) diff --git a/drivers/gpu/drm/drm_atomic_uapi.c b/drivers/gpu/drm/drm_atomic_uapi.c index f383d4be5a92..51fa217f99f6 100644 --- a/drivers/gpu/drm/drm_atomic_uapi.c +++ b/drivers/gpu/drm/drm_atomic_uapi.c @@ -826,6 +826,10 @@ drm_atomic_connector_get_property(struct drm_connector *connector, *val = state->content_protection; } else if (property == connector->content_protection_type_property) { *val = state->content_protection_type; + } else if (property == + connector->content_protection_downstream_property) { + *val = connector->content_protection_downstream_blob_ptr ? + connector->content_protection_downstream_blob_ptr->base.id : 0; } 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 4ce0830e9fb4..3a11624ca73c 100644 --- a/drivers/gpu/drm/drm_connector.c +++ b/drivers/gpu/drm/drm_connector.c @@ -245,6 +245,7 @@ int drm_connector_init(struct drm_device *dev, INIT_LIST_HEAD(&connector->modes); mutex_init(&connector->mutex); connector->edid_blob_ptr = NULL; + connector->content_protection_downstream_blob_ptr = NULL; connector->status = connector_status_unknown; connector->display_info.panel_orientation = DRM_MODE_PANEL_ORIENTATION_UNKNOWN; @@ -982,6 +983,25 @@ DRM_ENUM_NAME_FN(drm_get_content_protection_type_name, * authentication process. If content type is changed when * content_protection is not UNDESIRED, then kernel will disable the HDCP * and re-enable with new type in the same atomic commit + * Content_protection_downstream_info: + * This blob property is used to pass the HDCP downstream topology details + * of a HDCP encrypted connector, from kernel to userspace. + * This provides all required information to userspace, so that userspace + * can implement the HDCP repeater using the kernel as downstream ports of + * the repeater. as illustrated below: + * + * HDCP Repeaters + * +--------------------------------------------------------------+ + * | | + * | | | + * | Userspace HDCP Receiver +-----> KMD HDCP transmitters | + * | (Upstream Port) <------+ (Downstream Ports) | + * | | | + * | | + * +--------------------------------------------------------------+ + * + * Kernel will populate this blob only when the HDCP authentication is + * successful. * * max bpc: * This range property is used by userspace to limit the bit depth. When @@ -1610,6 +1630,75 @@ drm_connector_attach_content_protection_type_property(struct drm_connector * } EXPORT_SYMBOL(drm_connector_attach_content_protection_type_property); +/** + * drm_connector_attach_content_protection_downstream_property - attach content + * protection downstream property + * + * @connector: connector to attach content protection downstream property on. + * + * This is used to add support for content protection downstream info on + * select connectors. when Intel platform is configured as repeater, + * this downstream info is used by userspace, to complete the repeater + * authentication of HDCP specification with upstream HDCP transmitter. + * + * The content protection downstream will be set to + * &drm_connector_state.content_protection_downstream + * + * Returns: + * Zero on success, negative errno on failure. + */ +int drm_connector_attach_content_protection_downstream_property( + struct drm_connector *connector) +{ + struct drm_device *dev = connector->dev; + struct drm_property *prop; + + prop = drm_property_create(dev, DRM_MODE_PROP_BLOB | + DRM_MODE_PROP_IMMUTABLE, + "CP_downstream_info", 0); + if (!prop) + return -ENOMEM; + + drm_object_attach_property(&connector->base, prop, 0); + + connector->content_protection_downstream_property = prop; + + return 0; +} +EXPORT_SYMBOL(drm_connector_attach_content_protection_downstream_property); + +/** + * drm_connector_update_content_protection_downstream_property - update + * the content_protection_downstream property of a connector + * @connector: drm connector + * @content_protection_downstream_info: new value of the + * content_protection_downstream property + * + * This function creates a new blob modeset object and assigns its id to the + * connector's content_protection_downstream property. + * + * Returns: + * Zero on success, negative errno on failure. + */ +int drm_connector_update_content_protection_downstream_property( + struct drm_connector *connector, + const struct content_protection_downstream_info *info) +{ + struct drm_device *dev = connector->dev; + int ret; + + if (!info) + return -EINVAL; + + ret = drm_property_replace_global_blob(dev, + &connector->content_protection_downstream_blob_ptr, + sizeof(struct content_protection_downstream_info), + info, &connector->base, + connector->content_protection_downstream_property); + return ret; +} +EXPORT_SYMBOL(drm_connector_update_content_protection_downstream_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 2116732789ec..247a9338be72 100644 --- a/include/drm/drm_connector.h +++ b/include/drm/drm_connector.h @@ -1047,6 +1047,13 @@ struct drm_connector { */ struct drm_property *content_protection_type_property; + /** + * @content_protection_downstream_property: DRM BLOB property for + * content protection downstream information. + */ + struct drm_property *content_protection_downstream_property; + struct drm_property_blob *content_protection_downstream_blob_ptr; + /** * @path_blob_ptr: * @@ -1324,6 +1331,11 @@ int drm_connector_attach_content_protection_property( struct drm_connector *connector); int drm_connector_attach_content_protection_type_property( struct drm_connector *connector); +int drm_connector_attach_content_protection_downstream_property( + struct drm_connector *connector); +int drm_connector_update_content_protection_downstream_property( + struct drm_connector *connector, + const struct content_protection_downstream_info *info); 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); diff --git a/include/uapi/drm/drm_mode.h b/include/uapi/drm/drm_mode.h index 65b4e4d8fdfb..629ed7fdc15a 100644 --- a/include/uapi/drm/drm_mode.h +++ b/include/uapi/drm/drm_mode.h @@ -214,6 +214,33 @@ extern "C" { #define DRM_MODE_CONTENT_PROTECTION_TYPE0 0 #define DRM_MODE_CONTENT_PROTECTION_TYPE1 1 +#define DRM_MODE_HDCP_KSV_LEN 5 +#define DRM_MODE_HDCP_MAX_DEVICE_CNT 127 + +struct content_protection_downstream_info { + /* KSV of immediate HDCP Sink. In Little-Endian Format. */ + char bksv[DRM_MODE_HDCP_KSV_LEN]; + + /* Whether Immediate HDCP sink is a repeater? */ + bool is_repeater; + + /* Depth received from immediate downstream repeater */ + __u8 depth; + + /* Device count received from immediate downstream repeater */ + __u32 device_count; + + /* + * Max buffer required to hold ksv list received from immediate + * repeater. In this array first device_count * DRM_MODE_HDCP_KSV_LEN + * will hold the valid ksv bytes. + * If authentication specification is + * HDCP1.4 - each KSV's Bytes will be in Little-Endian format. + * HDCP2.2 - each KSV's Bytes will be in Big-Endian format. + */ + char ksv_list[DRM_MODE_HDCP_KSV_LEN * DRM_MODE_HDCP_MAX_DEVICE_CNT]; +}; + struct drm_mode_modeinfo { __u32 clock; __u16 hdisplay;