[PATCH 03/10] drm: Add CP System Renewability Msg Property

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 <ramalingam.c@xxxxxxxxx>
---
 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);
-- 
2.7.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux