Skip to contentSkip to conversation

drm/i915: Enable HDCP 1.4 and 2.2 on Gen12+

PATCH Superseded Ramalingam C 2 participants 5 messages Aug 19, 2019

Subsystems (5)

v6 of 12 Superseded Latest is v12 →

lore
Share & tools
lore
#0 lore raw

v6 cover drm/i915: Enable HDCP 1.4 and 2.2 on Gen12+

Enabling the HDCP1.4 and 2.2 on TGL by supporting the HW block movement from DDI into transcoder.

v6:
Extending the I915-MEI HDCP interface to include the transcoder. For register programming, transcoder is used instead of PIPE. Just
readability improvement
pipe and transcoder definition is moved into i915_drm.h

Ramalingam C (3):
drm/i915: enum transcoder and pipe are moved into i915_drm.h misc/mei_hdcp: Adding the transcoder detail in payload input drm/i915: Enable HDCP 1.4 and 2.2 on Gen12+

 drivers/gpu/drm/i915/display/intel_display.h |  44 -----
 drivers/gpu/drm/i915/display/intel_dp.c      |   3 +
 drivers/gpu/drm/i915/display/intel_hdcp.c    | 160 +++++++++++++------
 drivers/gpu/drm/i915/display/intel_hdcp.h    |   2 +
 drivers/gpu/drm/i915/display/intel_hdmi.c    |  12 +-
 drivers/gpu/drm/i915/i915_reg.h              | 124 ++++++++++++--
 drivers/misc/mei/hdcp/mei_hdcp.c             |  27 ++++
 drivers/misc/mei/hdcp/mei_hdcp.h             |  15 +-
 include/drm/i915_drm.h                       |  46 ++++++
 include/drm/i915_mei_hdcp_interface.h        |   2 +
 10 files changed, 326 insertions(+), 109 deletions(-)
Signature · 6 lines
2.20.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#1 lore raw

PATCH v6 1/3 drm/i915: enum transcoder and pipe are moved into i915_drm.h

For the reusability of the enum transcoder and enum pipe in other driver modules (like mei_hdcp), enum port definition is moved from I915 local header intel_display.h to drm/i915_drm.h

---
 drivers/gpu/drm/i915/display/intel_display.h | 44 -------------------
 include/drm/i915_drm.h                       | 46 ++++++++++++++++++++
 2 files changed, 46 insertions(+), 44 deletions(-)
drivers/gpu/drm/i915/display/intel_display.h +0 -44
index d2c718f25478..aa314ac52aa9 100644
@@ -49,50 +49,6 @@ enum i915_gpio {
 	GPIOO,
 };
 
-/*
- * Keep the pipe enum values fixed: the code assumes that PIPE_A=0, the
- * rest have consecutive values and match the enum values of transcoders
- * with a 1:1 transcoder -> pipe mapping.
- */
-enum pipe {
-	INVALID_PIPE = -1,
-
-	PIPE_A = 0,
-	PIPE_B,
-	PIPE_C,
-	PIPE_D,
-	_PIPE_EDP,
-
-	I915_MAX_PIPES = _PIPE_EDP
-};
-
-#define pipe_name(p) ((p) + 'A')
-
-enum transcoder {
-	/*
-	 * The following transcoders have a 1:1 transcoder -> pipe mapping,
-	 * keep their values fixed: the code assumes that TRANSCODER_A=0, the
-	 * rest have consecutive values and match the enum values of the pipes
-	 * they map to.
-	 */
-	TRANSCODER_A = PIPE_A,
-	TRANSCODER_B = PIPE_B,
-	TRANSCODER_C = PIPE_C,
-	TRANSCODER_D = PIPE_D,
-
-	/*
-	 * The following transcoders can map to any pipe, their enum value
-	 * doesn't need to stay fixed.
-	 */
-	TRANSCODER_EDP,
-	TRANSCODER_DSI_0,
-	TRANSCODER_DSI_1,
-	TRANSCODER_DSI_A = TRANSCODER_DSI_0,	/* legacy DSI */
-	TRANSCODER_DSI_C = TRANSCODER_DSI_1,	/* legacy DSI */
-
-	I915_MAX_TRANSCODERS
-};
-
 static inline const char *transcoder_name(enum transcoder transcoder)
 {
 	switch (transcoder) {
include/drm/i915_drm.h +46 -0

50 lines not on this page · raw message

Signature · 6 lines
2.20.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#2 lore raw

PATCH v6 2/3 misc/mei_hdcp: Adding the transcoder detail in payload input

In reply to Ramalingam C

ME FW takes the transcoder details for Gen12+ platforms, as HDCP HW block is moved to transcoders.

hdcp_port_data is extended with enum transcoder. Payload structure is modified and populated from the hdcp_port_data.

---
 drivers/misc/mei/hdcp/mei_hdcp.c      | 27 +++++++++++++++++++++++++++
 drivers/misc/mei/hdcp/mei_hdcp.h      | 15 ++++++++++++++-
 include/drm/i915_mei_hdcp_interface.h |  2 ++
 3 files changed, 43 insertions(+), 1 deletion(-)
drivers/misc/mei/hdcp/mei_hdcp.c +27 -0
index c681f6fab342..7efe3b65a986 100644
@@ -39,6 +39,22 @@ static inline u8 mei_get_ddi_index(enum port port)
 	}
 }
 
+static inline u8 mei_get_tc_type(enum transcoder tc)
+{
+	switch (tc) {
+	case TRANSCODER_A ... TRANSCODER_D:
+		return (u8)(tc | 0x10);
+	case TRANSCODER_EDP:
+		return TC_EDP;
+	case TRANSCODER_DSI_0:
+		return TC_DSI0;
+	case TRANSCODER_DSI_1:
+		return TC_DSI1;
+	default:
+		return MEI_INVALID_TRANSCODER;
+	}
+}
+
 /**
  * mei_hdcp_initiate_session() - Initiate a Wired HDCP2.2 Tx Session in ME FW
  * @dev: device corresponding to the mei_cl_device
@@ -70,6 +86,7 @@ mei_hdcp_initiate_session(struct device *dev, struct hdcp_port_data *data,
 
 	session_init_in.port.integrated_port_type = data->port_type;
 	session_init_in.port.physical_port = mei_get_ddi_index(data->port);
+	session_init_in.port.attached_transcoder = mei_get_tc_type(data->tc);
 	session_init_in.protocol = data->protocol;
 
 	byte = mei_cldev_send(cldev, (u8 *)&session_init_in,
@@ -139,6 +156,7 @@ mei_hdcp_verify_receiver_cert_prepare_km(struct device *dev,
 
 	verify_rxcert_in.port.integrated_port_type = data->port_type;
 	verify_rxcert_in.port.physical_port = mei_get_ddi_index(data->port);
+	verify_rxcert_in.port.attached_transcoder = mei_get_tc_type(data->tc);
 
 	verify_rxcert_in.cert_rx = rx_cert->cert_rx;
 	memcpy(verify_rxcert_in.r_rx, &rx_cert->r_rx, HDCP_2_2_RRX_LEN);
@@ -209,6 +227,7 @@ mei_hdcp_verify_hprime(struct device *dev, struct hdcp_port_data *data,
 
 	send_hprime_in.port.integrated_port_type = data->port_type;
 	send_hprime_in.port.physical_port = mei_get_ddi_index(data->port);
+	send_hprime_in.port.attached_transcoder = mei_get_tc_type(data->tc);
 
 	memcpy(send_hprime_in.h_prime, rx_hprime->h_prime,
 	       HDCP_2_2_H_PRIME_LEN);
@@ -266,6 +285,7 @@ mei_hdcp_store_pairing_info(struct device *dev, struct hdcp_port_data *data,
 
 	pairing_info_in.port.integrated_port_type = data->port_type;
 	pairing_info_in.port.physical_port = mei_get_ddi_index(data->port);
+	pairing_info_in.port.attached_transcoder = mei_get_tc_type(data->tc);
 
 	memcpy(pairing_info_in.e_kh_km, pairing_info->e_kh_km,
 	       HDCP_2_2_E_KH_KM_LEN);
@@ -324,6 +344,7 @@ mei_hdcp_initiate_locality_check(struct device *dev,
 
 	lc_init_in.port.integrated_port_type = data->port_type;
 	lc_init_in.port.physical_port = mei_get_ddi_index(data->port);
+	lc_init_in.port.attached_transcoder = mei_get_tc_type(data->tc);
 
 	byte = mei_cldev_send(cldev, (u8 *)&lc_init_in, sizeof(lc_init_in));
 	if (byte < 0) {
@@ -379,6 +400,7 @@ mei_hdcp_verify_lprime(struct device *dev, struct hdcp_port_data *data,
 
 	verify_lprime_in.port.integrated_port_type = data->port_type;
 	verify_lprime_in.port.physical_port = mei_get_ddi_index(data->port);
+	verify_lprime_in.port.attached_transcoder = mei_get_tc_type(data->tc);
 
 	memcpy(verify_lprime_in.l_prime, rx_lprime->l_prime,
 	       HDCP_2_2_L_PRIME_LEN);
@@ -436,6 +458,7 @@ static int mei_hdcp_get_session_key(struct device *dev,
 
 	get_skey_in.port.integrated_port_type = data->port_type;
 	get_skey_in.port.physical_port = mei_get_ddi_index(data->port);
+	get_skey_in.port.attached_transcoder = mei_get_tc_type(data->tc);
 
 	byte = mei_cldev_send(cldev, (u8 *)&get_skey_in, sizeof(get_skey_in));
 	if (byte < 0) {
@@ -500,6 +523,7 @@ mei_hdcp_repeater_check_flow_prepare_ack(struct device *dev,
 
 	verify_repeater_in.port.integrated_port_type = data->port_type;
 	verify_repeater_in.port.physical_port = mei_get_ddi_index(data->port);
+	verify_repeater_in.port.attached_transcoder = mei_get_tc_type(data->tc);
 
 	memcpy(verify_repeater_in.rx_info, rep_topology->rx_info,
 	       HDCP_2_2_RXINFO_LEN);
@@ -570,6 +594,7 @@ static int mei_hdcp_verify_mprime(struct device *dev,
 
 	verify_mprime_in.port.integrated_port_type = data->port_type;
 	verify_mprime_in.port.physical_port = mei_get_ddi_index(data->port);
+	verify_mprime_in.port.attached_transcoder = mei_get_tc_type(data->tc);
 
 	memcpy(verify_mprime_in.m_prime, stream_ready->m_prime,
 	       HDCP_2_2_MPRIME_LEN);
@@ -631,6 +656,7 @@ static int mei_hdcp_enable_authentication(struct device *dev,
 
 	enable_auth_in.port.integrated_port_type = data->port_type;
 	enable_auth_in.port.physical_port = mei_get_ddi_index(data->port);
+	enable_auth_in.port.attached_transcoder = mei_get_tc_type(data->tc);
 	enable_auth_in.stream_type = data->streams[0].stream_type;
 
 	byte = mei_cldev_send(cldev, (u8 *)&enable_auth_in,
@@ -685,6 +711,7 @@ mei_hdcp_close_session(struct device *dev, struct hdcp_port_data *data)
 
 	session_close_in.port.integrated_port_type = data->port_type;
 	session_close_in.port.physical_port = mei_get_ddi_index(data->port);
+	session_close_in.port.attached_transcoder = mei_get_tc_type(data->tc);
 
 	byte = mei_cldev_send(cldev, (u8 *)&session_close_in,
 			      sizeof(session_close_in));
drivers/misc/mei/hdcp/mei_hdcp.h +14 -1
index e4b1cd54c853..89e2f99ff60a 100644
@@ -184,8 +184,10 @@ struct hdcp_cmd_no_data {
 /* Uniquely identifies the hdcp port being addressed for a given command. */
 struct hdcp_port_id {
 	u8	integrated_port_type;
+	/* Used until Gen11.5. Must be zero for Gen11.5+ */
 	u8	physical_port;
-	u16	reserved;
+	u8	attached_transcoder;
+	u8	reserved;
 } __packed;
 
 /*
@@ -374,4 +376,15 @@ enum mei_fw_ddi {
 	MEI_DDI_A = 7,
 	MEI_DDI_RANGE_END = MEI_DDI_A,
 };
+
+enum mei_fw_tc {
+	MEI_INVALID_TRANSCODER = 0x00,	// Invalid transcoder type
+	TC_EDP,				// Transcoder for eDP
+	TC_DSI0,			// Transcoder for DSI0
+	TC_DSI1,			// Transcoder for DSI1
+	TC_A = 0x10,			// Transcoder TCA
+	TC_B,				// Transcoder TCB
+	TC_C,				// Transcoder TCC
+	TC_D				// Transcoder TCD
+};
 #endif /* __MEI_HDCP_H__ */
include/drm/i915_mei_hdcp_interface.h +2 -0
index 8c344255146a..dc0de63ce0cb 100644
@@ -45,6 +45,7 @@ enum hdcp_wired_protocol {
 /**
  * struct hdcp_port_data - intel specific HDCP port data
  * @port: port index as per I915
+ * @tc: transcoder index as per I915
  * @port_type: HDCP port type as per ME FW classification
  * @protocol: HDCP adaptation as per ME FW
  * @k: No of streams transmitted on a port. Only on DP MST this is != 1
@@ -57,6 +58,7 @@ enum hdcp_wired_protocol {
  */
 struct hdcp_port_data {
 	enum port port;
+	enum transcoder tc;
 	u8 port_type;
 	u8 protocol;
 	u16 k;
Signature · 6 lines
2.20.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#3 lore raw

PATCH v6 3/3 drm/i915: Enable HDCP 1.4 and 2.2 on Gen12+

In reply to Ramalingam C

From Gen12 onwards, HDCP HW block is implemented within transcoders. Till Gen11 HDCP HW block was part of DDI.

Hence required changes in HW programming is handled here.

As ME FW needs the transcoder detail on which HDCP is enabled on Gen12+ platform, we are populating the detail in hdcp_port_data.

v2:
_MMIO_TRANS is used [Lucas and Daniel]
platform check is moved into the caller [Lucas]
v3:
platform check is moved into a macro [Shashank]
v4:
Few optimizations in the coding [Shashank]
v5:
Fixed alignment in macro definition in i915_reg.h [Shashank] unused variables "reg" is removed.
v6:
Configuring the transcoder at compute_config. transcoder is used instead of pipe in macros.

---
 drivers/gpu/drm/i915/display/intel_dp.c   |   3 +
 drivers/gpu/drm/i915/display/intel_hdcp.c | 160 +++++++++++++++-------
 drivers/gpu/drm/i915/display/intel_hdcp.h |   2 +
 drivers/gpu/drm/i915/display/intel_hdmi.c |  12 +-
 drivers/gpu/drm/i915/i915_reg.h           | 124 +++++++++++++++--
 5 files changed, 237 insertions(+), 64 deletions(-)
drivers/gpu/drm/i915/display/intel_dp.c +3 -0
index 0eb5d66f87a7..21a9fcf79e88 100644
@@ -2243,6 +2243,9 @@ intel_dp_compute_config(struct intel_encoder *encoder,
 
 	intel_psr_compute_config(intel_dp, pipe_config);
 
+	intel_hdcp_transcoder_config(intel_connector,
+				     pipe_config->cpu_transcoder);
+
 	return 0;
 }
 
drivers/gpu/drm/i915/display/intel_hdcp.c +108 -52

356 lines not on this page · raw message

drivers/gpu/drm/i915/display/intel_hdcp.h +2 -0
index 13555b054930..1041b2c11fe9 100644
@@ -19,6 +19,8 @@ struct intel_hdcp_shim;
 void intel_hdcp_atomic_check(struct drm_connector *connector,
 			     struct drm_connector_state *old_state,
 			     struct drm_connector_state *new_state);
+void intel_hdcp_transcoder_config(struct intel_connector *connector,
+				  enum transcoder trans);
 int intel_hdcp_init(struct intel_connector *connector,
 		    const struct intel_hdcp_shim *hdcp_shim);
 int intel_hdcp_enable(struct intel_connector *connector, u8 content_type);
drivers/gpu/drm/i915/display/intel_hdmi.c +9 -3
index 9bf28de10401..fef8392fdc61 100644
@@ -1491,7 +1491,10 @@ bool intel_hdmi_hdcp_check_link(struct intel_digital_port *intel_dig_port)
 {
 	struct drm_i915_private *dev_priv =
 		intel_dig_port->base.base.dev->dev_private;
+	struct intel_connector *connector =
+		intel_dig_port->hdmi.attached_connector;
 	enum port port = intel_dig_port->base.port;
+	enum transcoder tc = connector->hdcp.port_data.tc;
 	int ret;
 	union {
 		u32 reg;
@@ -1502,13 +1505,13 @@ bool intel_hdmi_hdcp_check_link(struct intel_digital_port *intel_dig_port)
 	if (ret)
 		return false;
 
-	I915_WRITE(PORT_HDCP_RPRIME(port), ri.reg);
+	I915_WRITE(HDCP_RPRIME(dev_priv, tc, port), ri.reg);
 
 	/* Wait for Ri prime match */
-	if (wait_for(I915_READ(PORT_HDCP_STATUS(port)) &
+	if (wait_for(I915_READ(HDCP_STATUS(dev_priv, tc, port)) &
 		     (HDCP_STATUS_RI_MATCH | HDCP_STATUS_ENC), 1)) {
 		DRM_ERROR("Ri' mismatch detected, link check failed (%x)\n",
-			  I915_READ(PORT_HDCP_STATUS(port)));
+			  I915_READ(HDCP_STATUS(dev_priv, tc, port)));
 		return false;
 	}
 	return true;
@@ -2432,6 +2435,9 @@ int intel_hdmi_compute_config(struct intel_encoder *encoder,
 		return -EINVAL;
 	}
 
+	intel_hdcp_transcoder_config(intel_hdmi->attached_connector,
+				     pipe_config->cpu_transcoder);
+
 	return 0;
 }
 
drivers/gpu/drm/i915/i915_reg.h +115 -9

165 lines not on this page · raw message

Signature · 6 lines
2.20.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#4 lore raw

✗ Fi.CI.BAT: failure for drm/i915: Enable HDCP 1.4 and 2.2 on Gen12+ (rev3)

In reply to Ramalingam C
== Series Details ==

== Series Details ==

Series: drm/i915: Enable HDCP 1.4 and 2.2 on Gen12+ (rev3)
URL : https://patchwork.freedesktop.org/series/63432/
State : failure

== Summary ==

Applying: drm/i915: enum transcoder and pipe are moved into i915_drm.h
Applying: misc/mei_hdcp: Adding the transcoder detail in payload input
Applying: drm/i915: Enable HDCP 1.4 and 2.2 on Gen12+
Using index info to reconstruct a base tree...
M drivers/gpu/drm/i915/display/intel_dp.c
M drivers/gpu/drm/i915/display/intel_hdcp.c
M drivers/gpu/drm/i915/display/intel_hdmi.c
M drivers/gpu/drm/i915/i915_reg.h
Falling back to patching base and 3-way merge...
Auto-merging drivers/gpu/drm/i915/i915_reg.h
Auto-merging drivers/gpu/drm/i915/display/intel_hdmi.c Auto-merging drivers/gpu/drm/i915/display/intel_hdcp.c
CONFLICT (content): Merge conflict in drivers/gpu/drm/i915/display/intel_hdcp.c Auto-merging drivers/gpu/drm/i915/display/intel_dp.c
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch' to see the failed patch Patch failed at 0003 drm/i915: Enable HDCP 1.4 and 2.2 on Gen12+ When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx