Skip to contentSkip to conversation

Enable HDCP2.x via GSC CS

PATCH Superseded Suraj Kandpal 4 participants 13 messages Jan 24, 2023 – Jan 31, 2023

Subsystems (5)

v8 of 13 Superseded Latest is v13 →

lore
Share & tools
lore
#0 lore raw

v8 cover Enable HDCP2.x via GSC CS

These patches enable HDCP2.x on machines MTL and above. From MTL onwards CSME is spilt into GSC and CSC and now we use GSC CS instead of MEI to talk to firmware to start HDCP authentication

--v2
-Fixing some checkpatch changes which I forgot before sending out the series

--v3
-Drop cp and fw to make naming more agnostic[Jani] -Sort header[Jani]
-remove static inline function from i915_hdcp_interface[Jani] -abstract DISPLAY_VER check[Jani]

--v4
-Remove stale comment P2 [Jani]
-Fix part where file rename looks like its removed in P2 and added in P3 [Jani]
-Add bitmask definition for host session id[Alan] -Seprating gsc load and heci cmd submission into different funcs[Alan] -Create comman function to fill gsc_mtl_header[Alan]

--v5
-No need to make hdcp_message field null as we use kzalloc [Alan] -use i915->drm instead of gt->i915->drm [Alan]

--v6
-Make each patch build individually [Jani]
-drop cp_fw stale commit subject [Jani]
-fix the date on license [Jani]
-revert back to orginal design where mei and gsc fill their own header

--v7
-remove RB by Ankit

--v8
-change design to allocate and deallocate hdcp_message only at enablement and disabling of hdcp [Alan]
-fix few formatting issue [Ankit]
-fix stale comments [Ankit]

Anshuman Gupta (1):
drm/i915/hdcp: Keep hdcp agonstic naming convention

Suraj Kandpal (5):
drm/i915/gsc: Create GSC request submission mechanism i915/hdcp: HDCP2.x Refactoring to agnostic hdcp drm/i915/hdcp: Refactor HDCP API structures drm/i915/mtl: Add function to send command to GSC CS drm/i915/mtl: Add HDCP GSC interface

 drivers/gpu/drm/i915/Makefile                 |   2 +
 .../gpu/drm/i915/display/intel_display_core.h |   8 +-
 .../drm/i915/display/intel_display_types.h    |   2 +-
 drivers/gpu/drm/i915/display/intel_hdcp.c     | 128 ++-
 drivers/gpu/drm/i915/display/intel_hdcp_gsc.c | 814 ++++++++++++++++++
 drivers/gpu/drm/i915/display/intel_hdcp_gsc.h |  30 +
 drivers/gpu/drm/i915/gt/intel_gpu_commands.h  |   2 +
 drivers/gpu/drm/i915/gt/uc/intel_gsc_fw.h     |   1 +
 .../i915/gt/uc/intel_gsc_uc_heci_cmd_submit.c | 109 +++
 .../i915/gt/uc/intel_gsc_uc_heci_cmd_submit.h |  61 ++
 drivers/misc/mei/hdcp/mei_hdcp.c              | 105 ++-
 drivers/misc/mei/hdcp/mei_hdcp.h              | 354 --------
 include/drm/i915_hdcp_interface.h             | 539 ++++++++++++
 include/drm/i915_mei_hdcp_interface.h         | 184 ----
 14 files changed, 1700 insertions(+), 639 deletions(-)
 create mode 100644 drivers/gpu/drm/i915/display/intel_hdcp_gsc.c
 create mode 100644 drivers/gpu/drm/i915/display/intel_hdcp_gsc.h
 create mode 100644 drivers/gpu/drm/i915/gt/uc/intel_gsc_uc_heci_cmd_submit.c
 create mode 100644 drivers/gpu/drm/i915/gt/uc/intel_gsc_uc_heci_cmd_submit.h
 create mode 100644 include/drm/i915_hdcp_interface.h
 delete mode 100644 include/drm/i915_mei_hdcp_interface.h
Signature · 1 line
2.25.1
#1 lore raw

PATCH v8 1/6 drm/i915/gsc: Create GSC request submission mechanism

HDCP and PXP will require a common function to allow it to submit commands to the gsc cs. Also adding the gsc mtl header that needs to be added on to the existing payloads of HDCP and PXP.

--v4
-Seprate gsc load and heci cmd submission into different functions in different files for better scalability [Alan] -Rename gsc address field [Alan]

Cc Daniele Ceraolo Spurio <[email protected]>
Cc Alan Previn <[email protected]>
---
 drivers/gpu/drm/i915/Makefile                 |  1 +
 drivers/gpu/drm/i915/gt/intel_gpu_commands.h  |  2 +
 drivers/gpu/drm/i915/gt/uc/intel_gsc_fw.h     |  1 +
 .../i915/gt/uc/intel_gsc_uc_heci_cmd_submit.c | 94 +++++++++++++++++++
 .../i915/gt/uc/intel_gsc_uc_heci_cmd_submit.h | 45 +++++++++
 5 files changed, 143 insertions(+)
 create mode 100644 drivers/gpu/drm/i915/gt/uc/intel_gsc_uc_heci_cmd_submit.c
 create mode 100644 drivers/gpu/drm/i915/gt/uc/intel_gsc_uc_heci_cmd_submit.h
drivers/gpu/drm/i915/Makefile +1 -0
index f47f00b162a4..461d6b40656d 100644
@@ -194,6 +194,7 @@ i915-y += \
 i915-y += \
 	  gt/uc/intel_gsc_fw.o \
 	  gt/uc/intel_gsc_uc.o \
+	  gt/uc/intel_gsc_uc_heci_cmd_submit.o\
 	  gt/uc/intel_guc.o \
 	  gt/uc/intel_guc_ads.o \
 	  gt/uc/intel_guc_capture.o \
drivers/gpu/drm/i915/gt/intel_gpu_commands.h +2 -0
index 2af1ae3831df..454179884801 100644
@@ -439,6 +439,8 @@
 #define GSC_FW_LOAD GSC_INSTR(1, 0, 2)
 #define   HECI1_FW_LIMIT_VALID (1 << 31)
 
+#define GSC_HECI_CMD_PKT GSC_INSTR(0, 0, 6)
+
 /*
  * Used to convert any address to canonical form.
  * Starting from gen8, some commands (e.g. STATE_BASE_ADDRESS,
drivers/gpu/drm/i915/gt/uc/intel_gsc_fw.h +1 -0
index 4b5dbb44afb4..146ac0128f69 100644
@@ -12,4 +12,5 @@ struct intel_gsc_uc;
 
 int intel_gsc_uc_fw_upload(struct intel_gsc_uc *gsc);
 bool intel_gsc_uc_fw_init_done(struct intel_gsc_uc *gsc);
+
 #endif
drivers/gpu/drm/i915/gt/uc/intel_gsc_uc_heci_cmd_submit.c new file +94 -0

94 lines not on this page · raw message

drivers/gpu/drm/i915/gt/uc/intel_gsc_uc_heci_cmd_submit.h new file +45 -0

45 lines not on this page · raw message

Signature · 1 line
2.25.1
#2 lore raw

PATCH v8 2/6 drm/i915/hdcp: Keep hdcp agonstic naming convention

In reply to Suraj Kandpal

From: Anshuman Gupta <[email protected]>

Change the include/drm/i915_mei_hdcp_interface.h to include/drm/i915_hdcp_interface.h

--v6
-make each patch build individually [Jani]

--v8
-change ME FW to ME/GSC FW [Ankit]
-fix formatting issue [Ankit]

---
 .../gpu/drm/i915/display/intel_display_core.h |  2 +-
 .../drm/i915/display/intel_display_types.h    |  2 +-
 drivers/gpu/drm/i915/display/intel_hdcp.c     | 81 ++++++++--------
 drivers/misc/mei/hdcp/mei_hdcp.c              | 61 ++++++------
 ...hdcp_interface.h => i915_hdcp_interface.h} | 92 +++++++++----------
 5 files changed, 118 insertions(+), 120 deletions(-)
 rename include/drm/{i915_mei_hdcp_interface.h => i915_hdcp_interface.h} (73%)
drivers/gpu/drm/i915/display/intel_display_core.h +1 -1
index 57ddce3ba02b..de71ff6ad80a 100644
@@ -368,7 +368,7 @@ struct intel_display {
 	} gmbus;
 
 	struct {
-		struct i915_hdcp_comp_master *master;
+		struct i915_hdcp_master *master;
 		bool comp_added;
 
 		/* Mutex to protect the above hdcp component related values. */
drivers/gpu/drm/i915/display/intel_display_types.h +1 -1
index 32e8b2fc3cc6..81d195ef5e57 100644
@@ -43,7 +43,7 @@
 #include <drm/drm_rect.h>
 #include <drm/drm_vblank.h>
 #include <drm/drm_vblank_work.h>
-#include <drm/i915_mei_hdcp_interface.h>
+#include <drm/i915_hdcp_interface.h>
 #include <media/cec-notifier.h>
 
 #include "i915_vma.h"
drivers/gpu/drm/i915/display/intel_hdcp.c +41 -40

274 lines not on this page · raw message

drivers/misc/mei/hdcp/mei_hdcp.c +29 -32

167 lines not on this page · raw message

include/drm/i915_hdcp_interface.h renamed from include/drm/i915_mei_hdcp_interface.h +46 -46

147 lines not on this page · raw message

Signature · 1 line
2.25.1
#3 lore raw

PATCH v8 3/6 i915/hdcp: HDCP2.x Refactoring to agnostic hdcp

In reply to Suraj Kandpal

As now we have more then one type of content protection secrity firmware. Let change the i915_hdcp_interface.h header naming convention to suit generic f/w type. %s/MEI_/HDCP_
%s/mei_dev/hdcp_dev

As interface to CP FW can be either a non i915 component or i915 intergral component, change structure name Accordingly. %s/i915_hdcp_comp_master/i915_hdcp_master %s/i915_hdcp_component_ops/i915_hdcp_ops

--v3
-Changing names to drop cp_fw to make naming more agnostic[Jani]

---
 drivers/gpu/drm/i915/display/intel_display_core.h | 1 +
 drivers/gpu/drm/i915/display/intel_hdcp.c         | 4 ++--
 2 files changed, 3 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/display/intel_display_core.h +1 -0
index de71ff6ad80a..132e9134ba05 100644
@@ -15,6 +15,7 @@
 
 #include <drm/drm_connector.h>
 #include <drm/drm_modeset_lock.h>
+#include <drm/i915_hdcp_interface.h>
 
 #include "intel_cdclk.h"
 #include "intel_display.h"
drivers/gpu/drm/i915/display/intel_hdcp.c +2 -2
index 262c76f21801..0d6aed1eb171 100644
@@ -1409,7 +1409,7 @@ static int hdcp2_authenticate_port(struct intel_connector *connector)
 	return ret;
 }
 
-static int hdcp2_close_mei_session(struct intel_connector *connector)
+static int hdcp2_close_session(struct intel_connector *connector)
 {
 	struct intel_digital_port *dig_port = intel_attached_dig_port(connector);
 	struct drm_i915_private *dev_priv = to_i915(connector->base.dev);
@@ -1433,7 +1433,7 @@ static int hdcp2_close_mei_session(struct intel_connector *connector)
 
 static int hdcp2_deauthenticate_port(struct intel_connector *connector)
 {
-	return hdcp2_close_mei_session(connector);
+	return hdcp2_close_session(connector);
 }
 
 /* Authentication flow starts from here */
Signature · 1 line
2.25.1
#4 lore raw

PATCH v8 4/6 drm/i915/hdcp: Refactor HDCP API structures

In reply to Suraj Kandpal

It requires to move intel specific HDCP API structures to i915_hdcp_interface.h from driver/misc/mei/hdcp/mei_hdcp.h so that any content protection fw interfaces can use these structures.

---
 drivers/misc/mei/hdcp/mei_hdcp.c  |  44 ++--
 drivers/misc/mei/hdcp/mei_hdcp.h  | 354 -----------------------------
 include/drm/i915_hdcp_interface.h | 355 ++++++++++++++++++++++++++++++
 3 files changed, 377 insertions(+), 376 deletions(-)
drivers/misc/mei/hdcp/mei_hdcp.c +22 -22
index b2c49599809c..a262e1fa3b48 100644
@@ -52,7 +52,7 @@ mei_hdcp_initiate_session(struct device *dev, struct hdcp_port_data *data,
 
 	session_init_in.header.api_version = HDCP_API_VERSION;
 	session_init_in.header.command_id = WIRED_INITIATE_HDCP2_SESSION;
-	session_init_in.header.status = ME_HDCP_STATUS_SUCCESS;
+	session_init_in.header.status = FW_HDCP_STATUS_SUCCESS;
 	session_init_in.header.buffer_len =
 				WIRED_CMD_BUF_LEN_INITIATE_HDCP2_SESSION_IN;
 
@@ -75,7 +75,7 @@ mei_hdcp_initiate_session(struct device *dev, struct hdcp_port_data *data,
 		return byte;
 	}
 
-	if (session_init_out.header.status != ME_HDCP_STATUS_SUCCESS) {
+	if (session_init_out.header.status != FW_HDCP_STATUS_SUCCESS) {
 		dev_dbg(dev, "ME cmd 0x%08X Failed. Status: 0x%X\n",
 			WIRED_INITIATE_HDCP2_SESSION,
 			session_init_out.header.status);
@@ -122,7 +122,7 @@ mei_hdcp_verify_receiver_cert_prepare_km(struct device *dev,
 
 	verify_rxcert_in.header.api_version = HDCP_API_VERSION;
 	verify_rxcert_in.header.command_id = WIRED_VERIFY_RECEIVER_CERT;
-	verify_rxcert_in.header.status = ME_HDCP_STATUS_SUCCESS;
+	verify_rxcert_in.header.status = FW_HDCP_STATUS_SUCCESS;
 	verify_rxcert_in.header.buffer_len =
 				WIRED_CMD_BUF_LEN_VERIFY_RECEIVER_CERT_IN;
 
@@ -148,7 +148,7 @@ mei_hdcp_verify_receiver_cert_prepare_km(struct device *dev,
 		return byte;
 	}
 
-	if (verify_rxcert_out.header.status != ME_HDCP_STATUS_SUCCESS) {
+	if (verify_rxcert_out.header.status != FW_HDCP_STATUS_SUCCESS) {
 		dev_dbg(dev, "ME cmd 0x%08X Failed. Status: 0x%X\n",
 			WIRED_VERIFY_RECEIVER_CERT,
 			verify_rxcert_out.header.status);
@@ -194,7 +194,7 @@ mei_hdcp_verify_hprime(struct device *dev, struct hdcp_port_data *data,
 
 	send_hprime_in.header.api_version = HDCP_API_VERSION;
 	send_hprime_in.header.command_id = WIRED_AKE_SEND_HPRIME;
-	send_hprime_in.header.status = ME_HDCP_STATUS_SUCCESS;
+	send_hprime_in.header.status = FW_HDCP_STATUS_SUCCESS;
 	send_hprime_in.header.buffer_len = WIRED_CMD_BUF_LEN_AKE_SEND_HPRIME_IN;
 
 	send_hprime_in.port.integrated_port_type = data->port_type;
@@ -218,7 +218,7 @@ mei_hdcp_verify_hprime(struct device *dev, struct hdcp_port_data *data,
 		return byte;
 	}
 
-	if (send_hprime_out.header.status != ME_HDCP_STATUS_SUCCESS) {
+	if (send_hprime_out.header.status != FW_HDCP_STATUS_SUCCESS) {
 		dev_dbg(dev, "ME cmd 0x%08X Failed. Status: 0x%X\n",
 			WIRED_AKE_SEND_HPRIME, send_hprime_out.header.status);
 		return -EIO;
@@ -251,7 +251,7 @@ mei_hdcp_store_pairing_info(struct device *dev, struct hdcp_port_data *data,
 
 	pairing_info_in.header.api_version = HDCP_API_VERSION;
 	pairing_info_in.header.command_id = WIRED_AKE_SEND_PAIRING_INFO;
-	pairing_info_in.header.status = ME_HDCP_STATUS_SUCCESS;
+	pairing_info_in.header.status = FW_HDCP_STATUS_SUCCESS;
 	pairing_info_in.header.buffer_len =
 					WIRED_CMD_BUF_LEN_SEND_PAIRING_INFO_IN;
 
@@ -276,7 +276,7 @@ mei_hdcp_store_pairing_info(struct device *dev, struct hdcp_port_data *data,
 		return byte;
 	}
 
-	if (pairing_info_out.header.status != ME_HDCP_STATUS_SUCCESS) {
+	if (pairing_info_out.header.status != FW_HDCP_STATUS_SUCCESS) {
 		dev_dbg(dev, "ME cmd 0x%08X failed. Status: 0x%X\n",
 			WIRED_AKE_SEND_PAIRING_INFO,
 			pairing_info_out.header.status);
@@ -311,7 +311,7 @@ mei_hdcp_initiate_locality_check(struct device *dev,
 
 	lc_init_in.header.api_version = HDCP_API_VERSION;
 	lc_init_in.header.command_id = WIRED_INIT_LOCALITY_CHECK;
-	lc_init_in.header.status = ME_HDCP_STATUS_SUCCESS;
+	lc_init_in.header.status = FW_HDCP_STATUS_SUCCESS;
 	lc_init_in.header.buffer_len = WIRED_CMD_BUF_LEN_INIT_LOCALITY_CHECK_IN;
 
 	lc_init_in.port.integrated_port_type = data->port_type;
@@ -330,7 +330,7 @@ mei_hdcp_initiate_locality_check(struct device *dev,
 		return byte;
 	}
 
-	if (lc_init_out.header.status != ME_HDCP_STATUS_SUCCESS) {
+	if (lc_init_out.header.status != FW_HDCP_STATUS_SUCCESS) {
 		dev_dbg(dev, "ME cmd 0x%08X Failed. status: 0x%X\n",
 			WIRED_INIT_LOCALITY_CHECK, lc_init_out.header.status);
 		return -EIO;
@@ -366,7 +366,7 @@ mei_hdcp_verify_lprime(struct device *dev, struct hdcp_port_data *data,
 
 	verify_lprime_in.header.api_version = HDCP_API_VERSION;
 	verify_lprime_in.header.command_id = WIRED_VALIDATE_LOCALITY;
-	verify_lprime_in.header.status = ME_HDCP_STATUS_SUCCESS;
+	verify_lprime_in.header.status = FW_HDCP_STATUS_SUCCESS;
 	verify_lprime_in.header.buffer_len =
 					WIRED_CMD_BUF_LEN_VALIDATE_LOCALITY_IN;
 
@@ -391,7 +391,7 @@ mei_hdcp_verify_lprime(struct device *dev, struct hdcp_port_data *data,
 		return byte;
 	}
 
-	if (verify_lprime_out.header.status != ME_HDCP_STATUS_SUCCESS) {
+	if (verify_lprime_out.header.status != FW_HDCP_STATUS_SUCCESS) {
 		dev_dbg(dev, "ME cmd 0x%08X failed. status: 0x%X\n",
 			WIRED_VALIDATE_LOCALITY,
 			verify_lprime_out.header.status);
@@ -425,7 +425,7 @@ static int mei_hdcp_get_session_key(struct device *dev,
 
 	get_skey_in.header.api_version = HDCP_API_VERSION;
 	get_skey_in.header.command_id = WIRED_GET_SESSION_KEY;
-	get_skey_in.header.status = ME_HDCP_STATUS_SUCCESS;
+	get_skey_in.header.status = FW_HDCP_STATUS_SUCCESS;
 	get_skey_in.header.buffer_len = WIRED_CMD_BUF_LEN_GET_SESSION_KEY_IN;
 
 	get_skey_in.port.integrated_port_type = data->port_type;
@@ -445,7 +445,7 @@ static int mei_hdcp_get_session_key(struct device *dev,
 		return byte;
 	}
 
-	if (get_skey_out.header.status != ME_HDCP_STATUS_SUCCESS) {
+	if (get_skey_out.header.status != FW_HDCP_STATUS_SUCCESS) {
 		dev_dbg(dev, "ME cmd 0x%08X failed. status: 0x%X\n",
 			WIRED_GET_SESSION_KEY, get_skey_out.header.status);
 		return -EIO;
@@ -489,7 +489,7 @@ mei_hdcp_repeater_check_flow_prepare_ack(struct device *dev,
 
 	verify_repeater_in.header.api_version = HDCP_API_VERSION;
 	verify_repeater_in.header.command_id = WIRED_VERIFY_REPEATER;
-	verify_repeater_in.header.status = ME_HDCP_STATUS_SUCCESS;
+	verify_repeater_in.header.status = FW_HDCP_STATUS_SUCCESS;
 	verify_repeater_in.header.buffer_len =
 					WIRED_CMD_BUF_LEN_VERIFY_REPEATER_IN;
 
@@ -520,7 +520,7 @@ mei_hdcp_repeater_check_flow_prepare_ack(struct device *dev,
 		return byte;
 	}
 
-	if (verify_repeater_out.header.status != ME_HDCP_STATUS_SUCCESS) {
+	if (verify_repeater_out.header.status != FW_HDCP_STATUS_SUCCESS) {
 		dev_dbg(dev, "ME cmd 0x%08X failed. status: 0x%X\n",
 			WIRED_VERIFY_REPEATER,
 			verify_repeater_out.header.status);
@@ -568,7 +568,7 @@ static int mei_hdcp_verify_mprime(struct device *dev,
 
 	verify_mprime_in->header.api_version = HDCP_API_VERSION;
 	verify_mprime_in->header.command_id = WIRED_REPEATER_AUTH_STREAM_REQ;
-	verify_mprime_in->header.status = ME_HDCP_STATUS_SUCCESS;
+	verify_mprime_in->header.status = FW_HDCP_STATUS_SUCCESS;
 	verify_mprime_in->header.buffer_len = cmd_size  - sizeof(verify_mprime_in->header);
 
 	verify_mprime_in->port.integrated_port_type = data->port_type;
@@ -597,7 +597,7 @@ static int mei_hdcp_verify_mprime(struct device *dev,
 		return byte;
 	}
 
-	if (verify_mprime_out.header.status != ME_HDCP_STATUS_SUCCESS) {
+	if (verify_mprime_out.header.status != FW_HDCP_STATUS_SUCCESS) {
 		dev_dbg(dev, "ME cmd 0x%08X failed. status: 0x%X\n",
 			WIRED_REPEATER_AUTH_STREAM_REQ,
 			verify_mprime_out.header.status);
@@ -630,7 +630,7 @@ static int mei_hdcp_enable_authentication(struct device *dev,
 
 	enable_auth_in.header.api_version = HDCP_API_VERSION;
 	enable_auth_in.header.command_id = WIRED_ENABLE_AUTH;
-	enable_auth_in.header.status = ME_HDCP_STATUS_SUCCESS;
+	enable_auth_in.header.status = FW_HDCP_STATUS_SUCCESS;
 	enable_auth_in.header.buffer_len = WIRED_CMD_BUF_LEN_ENABLE_AUTH_IN;
 
 	enable_auth_in.port.integrated_port_type = data->port_type;
@@ -652,7 +652,7 @@ static int mei_hdcp_enable_authentication(struct device *dev,
 		return byte;
 	}
 
-	if (enable_auth_out.header.status != ME_HDCP_STATUS_SUCCESS) {
+	if (enable_auth_out.header.status != FW_HDCP_STATUS_SUCCESS) {
 		dev_dbg(dev, "ME cmd 0x%08X failed. status: 0x%X\n",
 			WIRED_ENABLE_AUTH, enable_auth_out.header.status);
 		return -EIO;
@@ -684,7 +684,7 @@ mei_hdcp_close_session(struct device *dev, struct hdcp_port_data *data)
 
 	session_close_in.header.api_version = HDCP_API_VERSION;
 	session_close_in.header.command_id = WIRED_CLOSE_SESSION;
-	session_close_in.header.status = ME_HDCP_STATUS_SUCCESS;
+	session_close_in.header.status = FW_HDCP_STATUS_SUCCESS;
 	session_close_in.header.buffer_len =
 				WIRED_CMD_BUF_LEN_CLOSE_SESSION_IN;
 
@@ -706,7 +706,7 @@ mei_hdcp_close_session(struct device *dev, struct hdcp_port_data *data)
 		return byte;
 	}
 
-	if (session_close_out.header.status != ME_HDCP_STATUS_SUCCESS) {
+	if (session_close_out.header.status != FW_HDCP_STATUS_SUCCESS) {
 		dev_dbg(dev, "Session Close Failed. status: 0x%X\n",
 			session_close_out.header.status);
 		return -EIO;
drivers/misc/mei/hdcp/mei_hdcp.h +0 -354

358 lines not on this page · raw message

include/drm/i915_hdcp_interface.h +355 -0

359 lines not on this page · raw message

Signature · 1 line
2.25.1
#5 lore raw

PATCH v8 5/6 drm/i915/mtl: Add function to send command to GSC CS

In reply to Suraj Kandpal

Add function that takes care of sending command to gsc cs. We start of with allocation of memory for our command intel_hdcp_gsc_message that contains gsc cs memory header as directed in specs followed by the actual payload hdcp message that we want to send.
Spec states that we need to poll pending bit of response header around 20 times each try being 50ms apart hence adding that to current gsc_msg_send function
Also we use the same function to take care of both sending and receiving hence no separate function to get the response.

--v4
-Create common function to fill in gsc_mtl_header [Alan] -define host session bitmask [Alan]

--v5
-use i915 directly instead of gt->i915 [Alan]
-No need to make fields NULL as we are already
using kzalloc [Alan]

--v8
-change mechanism to reuse the same memory for one hdcp session[Alan] -fix header ordering
-add comments to explain flags and host session mask [Alan]

Cc Ankit Nautiyal <[email protected]>
Cc Daniele Ceraolo Spurio <[email protected]>
Cc Alan Pervin Teres <[email protected]>
Cc Uma Shankar <[email protected]>
Cc Anshuman Gupta <[email protected]>
---
 drivers/gpu/drm/i915/Makefile                 |   1 +
 .../gpu/drm/i915/display/intel_display_core.h |   5 +
 drivers/gpu/drm/i915/display/intel_hdcp.c     |  20 ++
 drivers/gpu/drm/i915/display/intel_hdcp_gsc.c | 185 ++++++++++++++++++
 drivers/gpu/drm/i915/display/intel_hdcp_gsc.h |  27 +++
 .../i915/gt/uc/intel_gsc_uc_heci_cmd_submit.c |  15 ++
 .../i915/gt/uc/intel_gsc_uc_heci_cmd_submit.h |  16 ++
 7 files changed, 269 insertions(+)
 create mode 100644 drivers/gpu/drm/i915/display/intel_hdcp_gsc.c
 create mode 100644 drivers/gpu/drm/i915/display/intel_hdcp_gsc.h
drivers/gpu/drm/i915/Makefile +1 -0
index 461d6b40656d..194aae92c354 100644
@@ -254,6 +254,7 @@ i915-y += \
 	display/intel_frontbuffer.o \
 	display/intel_global_state.o \
 	display/intel_hdcp.o \
+	display/intel_hdcp_gsc.o \
 	display/intel_hotplug.o \
 	display/intel_hti.o \
 	display/intel_lpe_audio.o \
drivers/gpu/drm/i915/display/intel_display_core.h +5 -0
index 132e9134ba05..7e9f3f87c767 100644
@@ -372,6 +372,11 @@ struct intel_display {
 		struct i915_hdcp_master *master;
 		bool comp_added;
 
+		/*HDCP message struct for allocation of memory which can be reused
+		 * when sending message to gsc cs
+		 * this is only populated post Meteorlake
+		 */
+		struct intel_hdcp_gsc_message *hdcp_message;
 		/* Mutex to protect the above hdcp component related values. */
 		struct mutex comp_mutex;
 	} hdcp;
drivers/gpu/drm/i915/display/intel_hdcp.c +20 -0
index 0d6aed1eb171..c578fcc34bfd 100644
@@ -23,6 +23,7 @@
 #include "intel_display_power_well.h"
 #include "intel_display_types.h"
 #include "intel_hdcp.h"
+#include "intel_hdcp_gsc.h"
 #include "intel_hdcp_regs.h"
 #include "intel_pcode.h"
 
@@ -1966,12 +1967,28 @@ static int _intel_hdcp2_enable(struct intel_connector *connector)
 {
 	struct drm_i915_private *i915 = to_i915(connector->base.dev);
 	struct intel_hdcp *hdcp = &connector->hdcp;
+	struct intel_hdcp_gsc_message *hdcp_message;
 	int ret;
 
 	drm_dbg_kms(&i915->drm, "[%s:%d] HDCP2.2 is being enabled. Type: %d\n",
 		    connector->base.name, connector->base.base.id,
 		    hdcp->content_type);
 
+	if (DISPLAY_VER(i915) >= 14) {
+		hdcp_message = kzalloc(sizeof(*hdcp_message), GFP_KERNEL);
+
+		if (!hdcp_message)
+			return -ENOMEM;
+
+		i915->display.hdcp.hdcp_message = hdcp_message;
+		ret = intel_hdcp_gsc_initialize_message(i915, hdcp_message);
+
+		if (ret) {
+			drm_err(&i915->drm, "Could not initialize hdcp_message\n");
+			return ret;
+		}
+	}
+
 	ret = hdcp2_authenticate_and_encrypt(connector);
 	if (ret) {
 		drm_dbg_kms(&i915->drm, "HDCP2 Type%d  Enabling Failed. (%d)\n",
@@ -2018,6 +2035,9 @@ _intel_hdcp2_disable(struct intel_connector *connector, bool hdcp2_link_recovery
 	if (hdcp2_deauthenticate_port(connector) < 0)
 		drm_dbg_kms(&i915->drm, "Port deauth failed.\n");
 
+	if (DISPLAY_VER(i915) >= 14)
+		intel_hdcp_gsc_free_message(i915);
+
 	connector->hdcp.hdcp2_encrypted = false;
 	dig_port->hdcp_auth_status = false;
 	data->k = 0;
drivers/gpu/drm/i915/display/intel_hdcp_gsc.c new file +185 -0

185 lines not on this page · raw message

drivers/gpu/drm/i915/display/intel_hdcp_gsc.h new file +27 -0
new file mode 100644
index 000000000000..8352b31a7e4a
@@ -0,0 +1,27 @@
+/* SPDX-License-Identifier: MIT */
+/*
+ * Copyright © 2023 Intel Corporation
+ */
+
+#ifndef __INTEL_HDCP_GSC_H__
+#define __INTEL_HDCP_GSC_H__
+
+#include <linux/err.h>
+#include <linux/types.h>
+
+struct drm_i915_private;
+
+struct intel_hdcp_gsc_message {
+	struct drm_i915_gem_object *obj;
+	struct i915_vma *vma;
+	void *hdcp_cmd;
+};
+
+int intel_hdcp_gsc_initialize_message(struct drm_i915_private *i915,
+				      struct intel_hdcp_gsc_message *hdcp_message);
+void intel_hdcp_gsc_free_message(struct drm_i915_private *i915);
+ssize_t intel_hdcp_gsc_msg_send(struct drm_i915_private *i915, u8 *msg_in,
+				size_t msg_in_len, u8 *msg_out,
+				size_t msg_out_len);
+
+#endif /* __INTEL_HDCP_GCS_H__ */
drivers/gpu/drm/i915/gt/uc/intel_gsc_uc_heci_cmd_submit.c +15 -0
index be2424af521d..ea0da06e2f39 100644
@@ -92,3 +92,18 @@ int intel_gsc_uc_heci_cmd_submit_packet(struct intel_gsc_uc *gsc, u64 addr_in,
 
 	return err;
 }
+
+void intel_gsc_uc_heci_cmd_emit_mtl_header(struct intel_gsc_mtl_header *header,
+					   u8 heci_client_id, u32 message_size,
+					   u64 host_session_id)
+{
+	host_session_id &= ~HOST_SESSION_MASK;
+	if (heci_client_id == HECI_MEADDRESS_PXP)
+		host_session_id |= HOST_SESSION_PXP_SINGLE;
+
+	header->validity_marker = GSC_HECI_VALIDITY_MARKER;
+	header->heci_client_id = heci_client_id;
+	header->host_session_handle = host_session_id;
+	header->header_version = MTL_GSC_HEADER_VERSION;
+	header->message_size = message_size;
+}
drivers/gpu/drm/i915/gt/uc/intel_gsc_uc_heci_cmd_submit.h +16 -0
index cf610dfca7a5..3d56ae501991 100644
@@ -22,7 +22,17 @@ struct intel_gsc_mtl_header {
 	u16 header_version;
 #define MTL_GSC_HEADER_VERSION 1
 
+	/*
+	 * FW allows host to decide host_session handle
+	 * as it sees fit.
+	 * For intertracebility reserving select bits(60-63)
+	 * to differentiate caller-target subsystem
+	 * 0000 - HDCP
+	 * 0001 - PXP Single Session
+	 */
 	u64 host_session_handle;
+#define HOST_SESSION_MASK	REG_GENMASK64(63, 60)
+#define HOST_SESSION_PXP_SINGLE BIT_ULL(60)
 	u64 gsc_message_handle;
 
 	u32 message_size; /* lower 20 bits only, upper 12 are reserved */
@@ -33,8 +43,11 @@ struct intel_gsc_mtl_header {
 	 * Bit 1: Session Cleanup;
 	 * Bits 2-15: Flags
 	 * Bits 16-31: Extension Size
+	 * According to internal spec flags are either input or output
+	 * we distinguish the flags using OUTFLAG or INFLAG
 	 */
 	u32 flags;
+#define GSC_OUTFLAG_MSG_PENDING	1
 
 	u32 status;
 } __packed;
@@ -42,4 +55,7 @@ struct intel_gsc_mtl_header {
 int intel_gsc_uc_heci_cmd_submit_packet(struct intel_gsc_uc *gsc,
 					u64 addr_in, u32 size_in,
 					u64 addr_out, u32 size_out);
+void intel_gsc_uc_heci_cmd_emit_mtl_header(struct intel_gsc_mtl_header *header,
+					   u8 heci_client_id, u32 message_size,
+					   u64 host_session_id);
 #endif
Signature · 1 line
2.25.1
#6 lore raw

Re: [Intel-gfx] [PATCH v8 5/6] drm/i915/mtl: Add function to send command to GSC CS

Quoted 61 lines · Suraj

Add function that takes care of sending command to gsc cs. We start of with allocation of memory for our command intel_hdcp_gsc_message that contains gsc cs memory header as directed in specs followed by the actual payload hdcp message that we want to send.
Spec states that we need to poll pending bit of response header around 20 times each try being 50ms apart hence adding that to current gsc_msg_send function
Also we use the same function to take care of both sending and receiving hence no separate function to get the response.

--v4

(quoted diff) +0 -5
-Create common function to fill in gsc_mtl_header [Alan]
-define host session bitmask [Alan]
 
--v5
-use i915 directly instead of gt->i915 [Alan]
-No need to make fields NULL as we are already

using kzalloc [Alan]

--v8

(quoted diff) +0 -3
-change mechanism to reuse the same memory for one hdcp session[Alan]
-fix header ordering
-add comments to explain flags and host session mask [Alan]
Cc Ankit Nautiyal <[email protected]>
Cc Daniele Ceraolo Spurio <[email protected]>
Cc Alan Pervin Teres <[email protected]>
Cc Uma Shankar <[email protected]>
Cc Anshuman Gupta <[email protected]>

---
 drivers/gpu/drm/i915/Makefile                 |   1 + .../gpu/drm/i915/display/intel_display_core.h |   5 + drivers/gpu/drm/i915/display/intel_hdcp.c     |  20 ++

 drivers/gpu/drm/i915/display/intel_hdcp_gsc.c | 185 ++++++++++++++++++
 drivers/gpu/drm/i915/display/intel_hdcp_gsc.h |  27 +++
 .../i915/gt/uc/intel_gsc_uc_heci_cmd_submit.c |  15 ++
 .../i915/gt/uc/intel_gsc_uc_heci_cmd_submit.h |  16 ++
 7 files changed, 269 insertions(+)

 create mode 100644 drivers/gpu/drm/i915/display/intel_hdcp_gsc.c create mode 100644 drivers/gpu/drm/i915/display/intel_hdcp_gsc.h

drivers/gpu/drm/i915/Makefile +1 -0
index 461d6b40656d..194aae92c354 100644
@@ -254,6 +254,7 @@ i915-y += \
         display/intel_frontbuffer.o \
         display/intel_global_state.o \
         display/intel_hdcp.o \
+       display/intel_hdcp_gsc.o \
         display/intel_hotplug.o \
         display/intel_hti.o \
         display/intel_lpe_audio.o \
drivers/gpu/drm/i915/display/intel_display_core.h +0 -0
index 132e9134ba05..7e9f3f87c767 100644
@@ -372,6 +372,11 @@ struct intel_display {
                 struct i915_hdcp_master *master;
                 bool comp_added;
Quoted 8 lines


+               /*HDCP message struct for allocation of memory which can be reused +                * when sending message to gsc cs
+                * this is only populated post Meteorlake
+                */
+               struct intel_hdcp_gsc_message *hdcp_message;
                /* Mutex to protect the above hdcp component related values. */ struct mutex comp_mutex;

alan: apologies for these additional self-narration drizzled with questions after an 8th rev - please bear with me:

1. Firstly thanks for changing the codes from allocating 'struct intel_hdcp_gsc_message' dynamically-as-we-need-send-a-msg it to an init-time allocation that we can continue to use over life of a hdcp-enabled-connector (so we dont have to keep allocating and freeing every few seconds).
2. With this new code i was lead to look at "intel_display->hdcp" usage. intel_display is a global context i.e. (not per crtc) and the hdcp substruct in intel_display is holding global structures too (with comp_mutex protecting master). However 'struct intel_hdcp_gsc_message' is used at a per-connector level (but only for active connectors which cannot exist without an attached crtc).
3. That said, although we do use comp_mutex for all the connector level hdcp activity, those activities sit behind a global lock and component interface. To me this looks inefficient because we are forcing serialization of hdcp operations across all the connectors with active hdcp operatoin. Putting an instance of hdcp_message per connector will allow parallelism and reduce overall latencies. (perhaps attaching hdcp_message to crtc works better as we might have more logical connectors than active - capped strictly by no. of crtcs).
4. I am aware that in the past we wouldn't have gained anything by such paralellism since the hdcp interactions would have to be serialized behind the hdcp component interface anyway. Today, with the gsc engine, we could try to parallelize stuff a bit more? (but not completely since there is only one gsc firmware and I can't recall if the GSC fw can operate on hdcp requests in parallel and if they support different host-session- handles per display pipe). As such, I am not sure if this ask can gain any value effort (thinking about dealing with 2 3 or more crtcs all with HDCP enabled and doing longer operations like re-establishing the hdcp link). Do you think its worth it? But i am not sure about whether this will work with display team direction (i.e. keeping the hdcp instructions as part of the component driver).
Thus, this would be your and display team's call, not mine.
5. Event if #4 is "lets not move hdcp_message to connector level", i believe it looks like you can allocate and free the hdcp_message at connector level hdcp init and teardown without checking if its been allocated before if multiple connectors are currently being enabled or already active. Please correct me if i am mistaken.

Quoted 26 lines

        } hdcp;

drivers/gpu/drm/i915/display/intel_hdcp.c +1 -0
index 0d6aed1eb171..c578fcc34bfd 100644
@@ -23,6 +23,7 @@
  #include "intel_display_power_well.h"
  #include "intel_display_types.h"
  #include "intel_hdcp.h"
+#include "intel_hdcp_gsc.h"
  #include "intel_hdcp_regs.h"
  #include "intel_pcode.h"

drivers/gpu/drm/i915/display/intel_hdcp.c +1 -0
@@ -1966,12 +1967,28 @@ static int _intel_hdcp2_enable(struct intel_connector *connector)
  {
         struct drm_i915_private *i915 = to_i915(connector->base.dev);
         struct intel_hdcp *hdcp = &connector->hdcp;
+       struct intel_hdcp_gsc_message *hdcp_message;
         int ret;


        drm_dbg_kms(&i915->drm, "[%s:%d] HDCP2.2 is being enabled. Type: %d\n", connector->base.name, connector->base.base.id, hdcp->content_type);

+       if (DISPLAY_VER(i915) >= 14) {
+               hdcp_message = kzalloc(sizeof(*hdcp_message), GFP_KERNEL);

drivers/gpu/drm/i915/display/intel_hdcp.c static int _intel_hdcp2_enable(struct intel_connector *connector) · line 1983

Quoted 5 lines
drivers/gpu/drm/i915/display/intel_hdcp.c +5 -0
+
+               if (!hdcp_message)
+                       return -ENOMEM;
+
+               i915->display.hdcp.hdcp_message = hdcp_message;

alan: non-blocker: honestly, just reading this code looks a bit of an issue (we are overriding a global's member-ptr from inside a connector level function). Perhaps a comment that says something like : Note: any connector level hdcp function would have already taken display->hdcp->comp_mutex farther up the stack so we can never trample hdcp_message between connector level hdcp functions concurrently. this is related to the last question in my point #5 above.

Quoted 66 lines

+               ret = intel_hdcp_gsc_initialize_message(i915, hdcp_message);

drivers/gpu/drm/i915/display/intel_hdcp.c +7 -0
+
+               if (ret) {
+                       drm_err(&i915->drm, "Could not initialize hdcp_message\n");
+                       return ret;
+               }
+       }
+

        ret = hdcp2_authenticate_and_encrypt(connector);
        if (ret) {
                drm_dbg_kms(&i915->drm, "HDCP2 Type%d  Enabling Failed. (%d)\n",

drivers/gpu/drm/i915/display/intel_hdcp.c +0 -0
@@ -2018,6 +2035,9 @@ _intel_hdcp2_disable(struct intel_connector *connector, bool hdcp2_link_recovery
         if (hdcp2_deauthenticate_port(connector) < 0)
                 drm_dbg_kms(&i915->drm, "Port deauth failed.\n");


+       if (DISPLAY_VER(i915) >= 14)
+               intel_hdcp_gsc_free_message(i915); +
        connector->hdcp.hdcp2_encrypted = false; dig_port->hdcp_auth_status = false; data->k = 0;

drivers/gpu/drm/i915/display/intel_hdcp_gsc.c new file +39 -0
new file mode 100644
index 000000000000..8da4faf9b10c
@@ -0,0 +1,185 @@
+// SPDX-License-Identifier: MIT
+/*
+ * Copyright 2023, Intel Corporation.
+ */
+
+#include "display/intel_hdcp_gsc.h"
+#include "gem/i915_gem_region.h"
+#include "gt/uc/intel_gsc_uc_heci_cmd_submit.h"
+#include "i915_drv.h"
+#include "i915_utils.h"
+
+/*This function helps allocate memory for the command that we will send to gsc cs */
+int intel_hdcp_gsc_initialize_message(struct drm_i915_private *i915,
+                                     struct intel_hdcp_gsc_message *hdcp_message)
+{
+       struct intel_gt *gt = i915->media_gt;
+       struct drm_i915_gem_object *obj = NULL;
+       struct i915_vma *vma = NULL;
+       void *cmd;
+       int err;
+
+       /* allocate object of one page for HDCP command memory and store it */
+       obj = i915_gem_object_create_shmem(i915, PAGE_SIZE);
+
+       if (IS_ERR(obj)) {
+               drm_err(&i915->drm, "Failed to allocate HDCP streaming command!\n");
+               return PTR_ERR(obj);
+       }
+
+       cmd = i915_gem_object_pin_map_unlocked(obj, i915_coherent_map_type(i915, obj, true));
+       if (IS_ERR(cmd)) {
+               drm_err(&i915->drm, "Failed to map gsc message page!\n");
+               err = PTR_ERR(cmd);
+               goto out_unpin;
+       }
+
+       vma = i915_vma_instance(obj, &gt->ggtt->vm, NULL);
+       if (IS_ERR(vma)) {
+               err = PTR_ERR(vma);

drivers/gpu/drm/i915/display/intel_hdcp_gsc.c line 49

Quoted 10 lines
drivers/gpu/drm/i915/display/intel_hdcp_gsc.c new file +10 -0
+               goto out_unmap;
+       }
+
+       err = i915_vma_pin(vma, 0, 0, PIN_GLOBAL);
+       if (err)
+               goto out_unmap;
+
+       memset(cmd, 0, obj->base.size);
+
+       hdcp_message->obj = obj;

see below comment about possible option to eliminate keeping obj

Quoted 18 lines
drivers/gpu/drm/i915/display/intel_hdcp_gsc.c new file +17 -0
+       hdcp_message->hdcp_cmd = cmd;
+       hdcp_message->vma = vma;
+
+       return 0;
+
+out_unmap:
+       i915_gem_object_unpin_map(obj);
+out_unpin:
+       i915_gem_object_put(obj);
+       return err;
+}
+
+void intel_hdcp_gsc_free_message(struct drm_i915_private *i915)
+{
+       struct intel_hdcp_gsc_message *hdcp_message =
+                                       i915->display.hdcp.hdcp_message;
+       struct drm_i915_gem_object *obj = fetch_and_zero(&hdcp_message->obj);

drivers/gpu/drm/i915/display/intel_hdcp_gsc.c line 76

Quoted 10 lines
drivers/gpu/drm/i915/display/intel_hdcp_gsc.c new file +10 -0
+
+       if (!obj)
+               return;
+
+       if (hdcp_message->vma)
+               i915_vma_unpin(fetch_and_zero(&hdcp_message->vma));
+
+       i915_gem_object_unpin_map(obj);
+       i915_gem_object_put(obj);
+       kfree(hdcp_message);

above cleanup code might be significantly minimized / cleaned up by using just i915_vma_unpin_and_release(vma, I915_VMA_RELEASE_MAP) which will also unmap, unpit and release the object internally and with that you don't need to carry "obj" in hdcp_message anymore.

Quoted 210 lines
drivers/gpu/drm/i915/display/intel_hdcp_gsc.c new file +109 -0
+}
+
+static int intel_gsc_send_sync(struct drm_i915_private *i915,
+                              struct intel_gsc_mtl_header *header, u64 addr,
+                              size_t msg_out_len)
+{
+       struct intel_gt *gt = i915->media_gt;
+       int ret;
+
+       header->flags = 0;
+       ret = intel_gsc_uc_heci_cmd_submit_packet(&gt->uc.gsc, addr,
+                                                 header->message_size,
+                                                 addr,
+                                                 msg_out_len + sizeof(*header));
+       if (ret) {
+               drm_err(&i915->drm, "failed to send gsc HDCP msg (%d)\n", ret);
+               return ret;
+       }
+       /*
+        * Checking validity marker for memory sanity
+        */
+       if (header->validity_marker != GSC_HECI_VALIDITY_MARKER) {
+               drm_err(&i915->drm, "invalid validity marker\n");
+               return -EINVAL;
+       }
+
+       if (header->status != 0) {
+               drm_err(&i915->drm, "header status indicates error %d\n",
+                       header->status);
+               return -EINVAL;
+       }
+
+       if (header->flags & GSC_OUTFLAG_MSG_PENDING)
+               return -EAGAIN;
+
+       return 0;
+}
+
+/*
+ * This function can now be used for sending requests and will also handle
+ * receipt of reply messages hence no different function of message retrieval
+ * is required. We will initialize intel_hdcp_gsc_message structure then add
+ * gsc cs memory header as stated in specs after which the normal HDCP payload
+ * will follow
+ */
+ssize_t intel_hdcp_gsc_msg_send(struct drm_i915_private *i915, u8 *msg_in,
+                               size_t msg_in_len, u8 *msg_out, size_t msg_out_len)
+{
+       struct intel_gt *gt = i915->media_gt;
+       struct intel_gsc_mtl_header *header;
+       const size_t max_msg_size = PAGE_SIZE - sizeof(*header);
+       struct intel_hdcp_gsc_message *hdcp_message;
+       u64 addr, host_session_id;
+       u32 reply_size, msg_size;
+       int ret, tries = 0;
+
+       if (!intel_uc_uses_gsc_uc(&gt->uc))
+               return -ENODEV;
+
+       if (msg_in_len > max_msg_size || msg_out_len > max_msg_size)
+               return -ENOSPC;
+
+       hdcp_message = i915->display.hdcp.hdcp_message;
+       header = hdcp_message->hdcp_cmd;
+       addr = i915_ggtt_offset(hdcp_message->vma);
+
+       msg_size = msg_in_len + sizeof(*header);
+       memset(header, 0, msg_size);
+       get_random_bytes(&host_session_id, sizeof(u64));
+       intel_gsc_uc_heci_cmd_emit_mtl_header(header, HECI_MEADDRESS_HDCP,
+                                             msg_size, host_session_id);
+       memcpy(hdcp_message->hdcp_cmd + sizeof(*header), msg_in, msg_in_len);
+
+       /*
+        * Keep sending request in case the pending bit is set no need to add
+        * message handle as we are using same address hence loc. of header is
+        * same and it will contain the message handle. we will send the message
+        * 20 times each message 50 ms apart
+        */
+       do {
+               ret = intel_gsc_send_sync(i915, header, addr, msg_out_len);
+
+               /* Only try again if gsc says so */
+               if (ret != -EAGAIN)
+                       break;
+
+               msleep(50);
+
+       } while (++tries < 20);
+
+       if (ret)
+               goto err;
+
+       /* we use the same mem for the reply, so header is in the same loc */
+       reply_size = header->message_size - sizeof(*header);
+       if (reply_size > msg_out_len) {
+               drm_warn(&i915->drm, "caller with insufficient HDCP reply size %u (%d)\n",
+                        reply_size, (u32)msg_out_len);
+               reply_size = msg_out_len;
+       } else if (reply_size != msg_out_len) {
+               drm_dbg_kms(&i915->drm, "caller unexpected HCDP reply size %u (%d)\n",
+                           reply_size, (u32)msg_out_len);
+       }
+
+       memcpy(msg_out, hdcp_message->hdcp_cmd + sizeof(*header), msg_out_len);
+
+err:
+       return ret;
+}
drivers/gpu/drm/i915/display/intel_hdcp_gsc.h new file +27 -0
new file mode 100644
index 000000000000..8352b31a7e4a
@@ -0,0 +1,27 @@
+/* SPDX-License-Identifier: MIT */
+/*
+ * Copyright © 2023 Intel Corporation
+ */
+
+#ifndef __INTEL_HDCP_GSC_H__
+#define __INTEL_HDCP_GSC_H__
+
+#include <linux/err.h>
+#include <linux/types.h>
+
+struct drm_i915_private;
+
+struct intel_hdcp_gsc_message {
+       struct drm_i915_gem_object *obj;
+       struct i915_vma *vma;
+       void *hdcp_cmd;
+};
+
+int intel_hdcp_gsc_initialize_message(struct drm_i915_private *i915,
+                                     struct intel_hdcp_gsc_message *hdcp_message);
+void intel_hdcp_gsc_free_message(struct drm_i915_private *i915);
+ssize_t intel_hdcp_gsc_msg_send(struct drm_i915_private *i915, u8 *msg_in,
+                               size_t msg_in_len, u8 *msg_out,
+                               size_t msg_out_len);
+
+#endif /* __INTEL_HDCP_GCS_H__ */
drivers/gpu/drm/i915/gt/uc/intel_gsc_uc_heci_cmd_submit.c +0 -0
index be2424af521d..ea0da06e2f39 100644
@@ -92,3 +92,18 @@ int intel_gsc_uc_heci_cmd_submit_packet(struct intel_gsc_uc *gsc, u64 addr_in,


        return err;
 }

drivers/gpu/drm/i915/gt/uc/intel_gsc_uc_heci_cmd_submit.c +15 -0
+
+void intel_gsc_uc_heci_cmd_emit_mtl_header(struct intel_gsc_mtl_header *header,
+                                          u8 heci_client_id, u32 message_size,
+                                          u64 host_session_id)
+{
+       host_session_id &= ~HOST_SESSION_MASK;
+       if (heci_client_id == HECI_MEADDRESS_PXP)
+               host_session_id |= HOST_SESSION_PXP_SINGLE;
+
+       header->validity_marker = GSC_HECI_VALIDITY_MARKER;
+       header->heci_client_id = heci_client_id;
+       header->host_session_handle = host_session_id;
+       header->header_version = MTL_GSC_HEADER_VERSION;
+       header->message_size = message_size;
+}
drivers/gpu/drm/i915/gt/uc/intel_gsc_uc_heci_cmd_submit.h +0 -0
index cf610dfca7a5..3d56ae501991 100644
@@ -22,7 +22,17 @@ struct intel_gsc_mtl_header {
         u16 header_version;
  #define MTL_GSC_HEADER_VERSION 1


+       /*
+        * FW allows host to decide host_session handle +        * as it sees fit.
+        * For intertracebility reserving select bits(60-63) +        * to differentiate caller-target subsystem +        * 0000 - HDCP
+        * 0001 - PXP Single Session
+        */
        u64 host_session_handle;

drivers/gpu/drm/i915/gt/uc/intel_gsc_uc_heci_cmd_submit.h +2 -0
+#define HOST_SESSION_MASK      REG_GENMASK64(63, 60)
+#define HOST_SESSION_PXP_SINGLE BIT_ULL(60)

        u64 gsc_message_handle;

        u32 message_size; /* lower 20 bits only, upper 12 are reserved */

drivers/gpu/drm/i915/gt/uc/intel_gsc_uc_heci_cmd_submit.h +3 -0
@@ -33,8 +43,11 @@ struct intel_gsc_mtl_header {
          * Bit 1: Session Cleanup;
          * Bits 2-15: Flags
          * Bits 16-31: Extension Size
+        * According to internal spec flags are either input or output
+        * we distinguish the flags using OUTFLAG or INFLAG
          */
         u32 flags;
+#define GSC_OUTFLAG_MSG_PENDING        1


        u32 status;
 } __packed;

drivers/gpu/drm/i915/gt/uc/intel_gsc_uc_heci_cmd_submit.h +3 -0
@@ -42,4 +55,7 @@ struct intel_gsc_mtl_header {
  int intel_gsc_uc_heci_cmd_submit_packet(struct intel_gsc_uc *gsc,
                                         u64 addr_in, u32 size_in,
                                         u64 addr_out, u32 size_out);
+void intel_gsc_uc_heci_cmd_emit_mtl_header(struct intel_gsc_mtl_header *header,
+                                          u8 heci_client_id, u32 message_size,
+                                          u64 host_session_id);
  #endif
Signature · 1 line
2.25.1
#7 lore raw

Re: [Intel-gfx] [PATCH v8 5/6] drm/i915/mtl: Add function to send command to GSC CS

Quoted 133 lines

-----Original Message-----
From: Teres Alexis, Alan Previn <[email protected]>
Sent: Friday, January 27, 2023 7:14 PM
To: Kandpal, Suraj <[email protected]>; intel- [email protected]
Cc: Shankar, Uma <[email protected]>; Nautiyal, Ankit K <[email protected]>; Ceraolo Spurio, Daniele <[email protected]>; Gupta, Anshuman <[email protected]>
Subject: Re: [PATCH v8 5/6] drm/i915/mtl: Add function to send command to GSC CS

Quoted 71 lines · Suraj

Add function that takes care of sending command to gsc cs. We start of with allocation of memory for our command intel_hdcp_gsc_message that contains gsc cs memory header as directed in specs followed by the actual payload hdcp message that we want to send.
Spec states that we need to poll pending bit of response header around 20 times each try being 50ms apart hence adding that to current gsc_msg_send function Also we use the same function to take care of both sending and receiving hence no separate function to get the response.

--v4
-Create common function to fill in gsc_mtl_header [Alan] -define host session bitmask [Alan]

--v5
-use i915 directly instead of gt->i915 [Alan] -No need to make fields NULL as we are already using kzalloc [Alan]

--v8

(quoted diff) +0 -2
-change mechanism to reuse the same memory for one hdcp session[Alan]
-fix header ordering -add comments to explain flags and host session

mask [Alan]

Cc Ankit Nautiyal <[email protected]>
Cc Daniele Ceraolo Spurio <[email protected]>
Cc Alan Pervin Teres <[email protected]>
Cc Uma Shankar <[email protected]>
Cc Anshuman Gupta <[email protected]>

---
 drivers/gpu/drm/i915/Makefile                 |   1 + .../gpu/drm/i915/display/intel_display_core.h |   5 + drivers/gpu/drm/i915/display/intel_hdcp.c     |  20 ++ drivers/gpu/drm/i915/display/intel_hdcp_gsc.c | 185
++++++++++++++++++

 drivers/gpu/drm/i915/display/intel_hdcp_gsc.h |  27 +++
 .../i915/gt/uc/intel_gsc_uc_heci_cmd_submit.c |  15 ++
 .../i915/gt/uc/intel_gsc_uc_heci_cmd_submit.h |  16 ++
 7 files changed, 269 insertions(+)

 create mode 100644 drivers/gpu/drm/i915/display/intel_hdcp_gsc.c create mode 100644 drivers/gpu/drm/i915/display/intel_hdcp_gsc.h

(quoted diff) +0 -0

b/drivers/gpu/drm/i915/Makefile index 461d6b40656d..194aae92c354 100644

drivers/gpu/drm/i915/Makefile +1 -0
@@ -254,6 +254,7 @@ i915-y += \
         display/intel_frontbuffer.o \
         display/intel_global_state.o \
         display/intel_hdcp.o \
+       display/intel_hdcp_gsc.o \
         display/intel_hotplug.o \
         display/intel_hti.o \
         display/intel_lpe_audio.o \
drivers/gpu/drm/i915/display/intel_display_core.h +6 -0
index 132e9134ba05..7e9f3f87c767 100644
@@ -372,6 +372,11 @@ struct intel_display {
                 struct i915_hdcp_master *master;
                 bool comp_added;
 
+               /*HDCP message struct for allocation of memory which
+can be reused
+                * when sending message to gsc cs
+                * this is only populated post Meteorlake
+                */
+               struct intel_hdcp_gsc_message *hdcp_message;
                 /* Mutex to protect the above hdcp component related
Quoted 2 lines

values. */
                struct mutex comp_mutex;

alan: apologies for these additional self-narration drizzled with questions after an 8th rev - please bear with me:

1. Firstly thanks for changing the codes from allocating 'struct intel_hdcp_gsc_message'
dynamically-as-we-need-send-a-msg it to an init-time allocation that we
can continue
to use over life of a hdcp-enabled-connector (so we dont have to keep
allocating and
freeing every few seconds).
2. With this new code i was lead to look at "intel_display->hdcp" usage. intel_display
is a global context i.e. (not per crtc) and the hdcp substruct in intel_display
is
holding global structures too (with comp_mutex protecting master).
However
'struct intel_hdcp_gsc_message' is used at a per-connector level (but only
for active
connectors which cannot exist without an attached crtc).
3. That said, although we do use comp_mutex for all the connector level hdcp activity,
those activities sit behind a global lock and component interface. To me this
looks
inefficient because we are forcing serialization of hdcp operations across all
the
connectors with active hdcp operatoin. Putting an instance of
hdcp_message per connector
will allow parallelism and reduce overall latencies. (perhaps attaching
hdcp_message
to crtc works better as we might have more logical connectors than active -
capped
strictly by no. of crtcs).
4. I am aware that in the past we wouldn't have gained anything by such paralellism since
the hdcp interactions would have to be serialized behind the hdcp
component interface
anyway. Today, with the gsc engine, we could try to parallelize stuff a bit
more?
(but not completely since there is only one gsc firmware and I can't recall if
the GSC fw
can operate on hdcp requests in parallel and if they support different host-
session-
handles per display pipe). As such, I am not sure if this ask can gain any
value effort
(thinking about dealing with 2 3 or more crtcs all with HDCP enabled and

Quoted 8 lines

doing longer
operations like re-establishing the hdcp link). Do you think its worth it? But i am not sure about whether this will work with display team direction
(i.e. keeping
the hdcp instructions as part of the component driver).
Thus, this would be your and display team's call, not mine.
5. Event if #4 is "lets not move hdcp_message to connector level", i believe it looks like

So I don’t see the any significant gain to parallelizing our approach to the amount of effort that would be needed To put in to change the design at this point

Quoted 5 lines

you can allocate and free the hdcp_message at connector level hdcp init
and teardown without
checking if its been allocated before if multiple connectors are currently
being enabled or
already active. Please correct me if i am mistaken.

Good point will try to get this done on my next revision

Quoted 29 lines
Quoted 29 lines

        } hdcp;

drivers/gpu/drm/i915/display/intel_hdcp.c +2 -0
index 0d6aed1eb171..c578fcc34bfd 100644
@@ -23,6 +23,7 @@
  #include "intel_display_power_well.h"
  #include "intel_display_types.h"
  #include "intel_hdcp.h"
+#include "intel_hdcp_gsc.h"
  #include "intel_hdcp_regs.h"
  #include "intel_pcode.h"
 
@@ -1966,12 +1967,28 @@ static int _intel_hdcp2_enable(struct
 intel_connector *connector)
  {
         struct drm_i915_private *i915 = to_i915(connector->base.dev);
         struct intel_hdcp *hdcp = &connector->hdcp;
+       struct intel_hdcp_gsc_message *hdcp_message;
         int ret;
 

        drm_dbg_kms(&i915->drm, "[%s:%d] HDCP2.2 is being enabled.
Type: %d\n",
                    connector->base.name, connector->base.base.id, hdcp->content_type);

Quoted 16 lines

drivers/gpu/drm/i915/display/intel_hdcp.c static int _intel_hdcp2_enable(struct intel_connector *connector) · line 1983

Quoted 8 lines

+       if (DISPLAY_VER(i915) >= 14) {
+               hdcp_message = kzalloc(sizeof(*hdcp_message),

drivers/gpu/drm/i915/display/intel_hdcp.c +6 -0
+GFP_KERNEL);
+
+               if (!hdcp_message)
+                       return -ENOMEM;
+
+               i915->display.hdcp.hdcp_message = hdcp_message;

alan: non-blocker: honestly, just reading this code looks a bit of an issue (we are overriding a global's member-ptr from inside a connector level function). Perhaps a comment that says something like : Note: any connector level hdcp function would have already taken display->hdcp->comp_mutex farther up the stack so we can never trample hdcp_message between connector level hdcp functions concurrently. this is related to the last question in my point #5 above.

This wont be an issue anymore as I am planning to move the allocation and deallocation to init And teardown as suggested by you

Quoted 112 lines
Quoted 76 lines

+               ret = intel_hdcp_gsc_initialize_message(i915,

drivers/gpu/drm/i915/display/intel_hdcp.c +9 -0
+hdcp_message);
+
+               if (ret) {
+                       drm_err(&i915->drm, "Could not initialize
+hdcp_message\n");
+                       return ret;
+               }
+       }
+

        ret = hdcp2_authenticate_and_encrypt(connector); if (ret) {
                drm_dbg_kms(&i915->drm, "HDCP2 Type%d  Enabling Failed. (%d)\n", @@ -2018,6 +2035,9 @@ _intel_hdcp2_disable(struct intel_connector *connector, bool hdcp2_link_recovery
        if (hdcp2_deauthenticate_port(connector) < 0) drm_dbg_kms(&i915->drm, "Port deauth failed.\n");

+       if (DISPLAY_VER(i915) >= 14)
+               intel_hdcp_gsc_free_message(i915); +
        connector->hdcp.hdcp2_encrypted = false; dig_port->hdcp_auth_status = false; data->k = 0;

drivers/gpu/drm/i915/display/intel_hdcp_gsc.c new file +44 -0
new file mode 100644
index 000000000000..8da4faf9b10c
@@ -0,0 +1,185 @@
+// SPDX-License-Identifier: MIT
+/*
+ * Copyright 2023, Intel Corporation.
+ */
+
+#include "display/intel_hdcp_gsc.h"
+#include "gem/i915_gem_region.h"
+#include "gt/uc/intel_gsc_uc_heci_cmd_submit.h"
+#include "i915_drv.h"
+#include "i915_utils.h"
+
+/*This function helps allocate memory for the command that we will
+send to gsc cs */ int intel_hdcp_gsc_initialize_message(struct
+drm_i915_private *i915,
+                                     struct intel_hdcp_gsc_message
+*hdcp_message) {
+       struct intel_gt *gt = i915->media_gt;
+       struct drm_i915_gem_object *obj = NULL;
+       struct i915_vma *vma = NULL;
+       void *cmd;
+       int err;
+
+       /* allocate object of one page for HDCP command memory and
+store it */
+       obj = i915_gem_object_create_shmem(i915, PAGE_SIZE);
+
+       if (IS_ERR(obj)) {
+               drm_err(&i915->drm, "Failed to allocate HDCP streaming
+command!\n");
+               return PTR_ERR(obj);
+       }
+
+       cmd = i915_gem_object_pin_map_unlocked(obj,
+i915_coherent_map_type(i915, obj, true));
+       if (IS_ERR(cmd)) {
+               drm_err(&i915->drm, "Failed to map gsc message
+page!\n");
+               err = PTR_ERR(cmd);
+               goto out_unpin;
+       }
+
+       vma = i915_vma_instance(obj, &gt->ggtt->vm, NULL);
+       if (IS_ERR(vma)) {
+               err = PTR_ERR(vma);

drivers/gpu/drm/i915/display/intel_hdcp_gsc.c line 54

Quoted 10 lines
drivers/gpu/drm/i915/display/intel_hdcp_gsc.c new file +10 -0
+               goto out_unmap;
+       }
+
+       err = i915_vma_pin(vma, 0, 0, PIN_GLOBAL);
+       if (err)
+               goto out_unmap;
+
+       memset(cmd, 0, obj->base.size);
+
+       hdcp_message->obj = obj;

see below comment about possible option to eliminate keeping obj

Quoted 25 lines
drivers/gpu/drm/i915/display/intel_hdcp_gsc.c new file +25 -0
+       hdcp_message->hdcp_cmd = cmd;
+       hdcp_message->vma = vma;
+
+       return 0;
+
+out_unmap:
+       i915_gem_object_unpin_map(obj);
+out_unpin:
+       i915_gem_object_put(obj);
+       return err;
+}
+
+void intel_hdcp_gsc_free_message(struct drm_i915_private *i915) {
+       struct intel_hdcp_gsc_message *hdcp_message =
+
+i915->display.hdcp.hdcp_message;
+       struct drm_i915_gem_object *obj =
+fetch_and_zero(&hdcp_message->obj);
+
+       if (!obj)
+               return;
+
+       if (hdcp_message->vma)
+               i915_vma_unpin(fetch_and_zero(&hdcp_message->vma));
+
Quoted 8 lines

drivers/gpu/drm/i915/display/intel_hdcp_gsc.c line 76

Quoted 4 lines
drivers/gpu/drm/i915/display/intel_hdcp_gsc.c new file +3 -0
+       i915_gem_object_unpin_map(obj);
+       i915_gem_object_put(obj);
+       kfree(hdcp_message);

above cleanup code might be significantly minimized / cleaned up by using just i915_vma_unpin_and_release(vma, I915_VMA_RELEASE_MAP) which will also unmap, unpit and release the object internally and with that you don't need to carry "obj" in hdcp_message anymore.

Ahh sorry for making you repeat this review missed this one while floating will Look into this

Regards,
Suraj Kandpal

Quoted 237 lines
Quoted 237 lines
drivers/gpu/drm/i915/display/intel_hdcp_gsc.c new file +129 -0
+}
+
+static int intel_gsc_send_sync(struct drm_i915_private *i915,
+                              struct intel_gsc_mtl_header *header,
+u64 addr,
+                              size_t msg_out_len) {
+       struct intel_gt *gt = i915->media_gt;
+       int ret;
+
+       header->flags = 0;
+       ret = intel_gsc_uc_heci_cmd_submit_packet(&gt->uc.gsc, addr,
+
+header->message_size,
+                                                 addr,
+                                                 msg_out_len +
+sizeof(*header));
+       if (ret) {
+               drm_err(&i915->drm, "failed to send gsc HDCP msg
+(%d)\n", ret);
+               return ret;
+       }
+       /*
+        * Checking validity marker for memory sanity
+        */
+       if (header->validity_marker != GSC_HECI_VALIDITY_MARKER) {
+               drm_err(&i915->drm, "invalid validity marker\n");
+               return -EINVAL;
+       }
+
+       if (header->status != 0) {
+               drm_err(&i915->drm, "header status indicates error
+%d\n",
+                       header->status);
+               return -EINVAL;
+       }
+
+       if (header->flags & GSC_OUTFLAG_MSG_PENDING)
+               return -EAGAIN;
+
+       return 0;
+}
+
+/*
+ * This function can now be used for sending requests and will also
+handle
+ * receipt of reply messages hence no different function of message
+retrieval
+ * is required. We will initialize intel_hdcp_gsc_message structure
+then add
+ * gsc cs memory header as stated in specs after which the normal
+HDCP payload
+ * will follow
+ */
+ssize_t intel_hdcp_gsc_msg_send(struct drm_i915_private *i915, u8
+*msg_in,
+                               size_t msg_in_len, u8 *msg_out, size_t
+msg_out_len) {
+       struct intel_gt *gt = i915->media_gt;
+       struct intel_gsc_mtl_header *header;
+       const size_t max_msg_size = PAGE_SIZE - sizeof(*header);
+       struct intel_hdcp_gsc_message *hdcp_message;
+       u64 addr, host_session_id;
+       u32 reply_size, msg_size;
+       int ret, tries = 0;
+
+       if (!intel_uc_uses_gsc_uc(&gt->uc))
+               return -ENODEV;
+
+       if (msg_in_len > max_msg_size || msg_out_len > max_msg_size)
+               return -ENOSPC;
+
+       hdcp_message = i915->display.hdcp.hdcp_message;
+       header = hdcp_message->hdcp_cmd;
+       addr = i915_ggtt_offset(hdcp_message->vma);
+
+       msg_size = msg_in_len + sizeof(*header);
+       memset(header, 0, msg_size);
+       get_random_bytes(&host_session_id, sizeof(u64));
+       intel_gsc_uc_heci_cmd_emit_mtl_header(header,
+HECI_MEADDRESS_HDCP,
+                                             msg_size,
+host_session_id);
+       memcpy(hdcp_message->hdcp_cmd + sizeof(*header), msg_in,
+msg_in_len);
+
+       /*
+        * Keep sending request in case the pending bit is set no need
+to add
+        * message handle as we are using same address hence loc. of
+header is
+        * same and it will contain the message handle. we will send
+the message
+        * 20 times each message 50 ms apart
+        */
+       do {
+               ret = intel_gsc_send_sync(i915, header, addr,
+msg_out_len);
+
+               /* Only try again if gsc says so */
+               if (ret != -EAGAIN)
+                       break;
+
+               msleep(50);
+
+       } while (++tries < 20);
+
+       if (ret)
+               goto err;
+
+       /* we use the same mem for the reply, so header is in the same
+loc */
+       reply_size = header->message_size - sizeof(*header);
+       if (reply_size > msg_out_len) {
+               drm_warn(&i915->drm, "caller with insufficient HDCP
+reply size %u (%d)\n",
+                        reply_size, (u32)msg_out_len);
+               reply_size = msg_out_len;
+       } else if (reply_size != msg_out_len) {
+               drm_dbg_kms(&i915->drm, "caller unexpected HCDP reply
+size %u (%d)\n",
+                           reply_size, (u32)msg_out_len);
+       }
+
+       memcpy(msg_out, hdcp_message->hdcp_cmd + sizeof(*header),
+msg_out_len);
+
+err:
+       return ret;
+}
drivers/gpu/drm/i915/display/intel_hdcp_gsc.h new file +27 -0
new file mode 100644
index 000000000000..8352b31a7e4a
@@ -0,0 +1,27 @@
+/* SPDX-License-Identifier: MIT */
+/*
+ * Copyright © 2023 Intel Corporation  */
+
+#ifndef __INTEL_HDCP_GSC_H__
+#define __INTEL_HDCP_GSC_H__
+
+#include <linux/err.h>
+#include <linux/types.h>
+
+struct drm_i915_private;
+
+struct intel_hdcp_gsc_message {
+       struct drm_i915_gem_object *obj;
+       struct i915_vma *vma;
+       void *hdcp_cmd;
+};
+
+int intel_hdcp_gsc_initialize_message(struct drm_i915_private *i915,
+                                     struct intel_hdcp_gsc_message
+*hdcp_message); void intel_hdcp_gsc_free_message(struct
+drm_i915_private *i915); ssize_t intel_hdcp_gsc_msg_send(struct
+drm_i915_private *i915, u8 *msg_in,
+                               size_t msg_in_len, u8 *msg_out,
+                               size_t msg_out_len);
+
+#endif /* __INTEL_HDCP_GCS_H__ */
drivers/gpu/drm/i915/gt/uc/intel_gsc_uc_heci_cmd_submit.c +0 -0
index be2424af521d..ea0da06e2f39 100644
@@ -92,3 +92,18 @@ int intel_gsc_uc_heci_cmd_submit_packet(struct
 intel_gsc_uc *gsc, u64 addr_in,
 
         return err;

 }

drivers/gpu/drm/i915/gt/uc/intel_gsc_uc_heci_cmd_submit.c +15 -0
+
+void intel_gsc_uc_heci_cmd_emit_mtl_header(struct
+intel_gsc_mtl_header *header,
+                                          u8 heci_client_id, u32
+message_size,
+                                          u64 host_session_id) {
+       host_session_id &= ~HOST_SESSION_MASK;
+       if (heci_client_id == HECI_MEADDRESS_PXP)
+               host_session_id |= HOST_SESSION_PXP_SINGLE;
+
+       header->validity_marker = GSC_HECI_VALIDITY_MARKER;
+       header->heci_client_id = heci_client_id;
+       header->host_session_handle = host_session_id;
+       header->header_version = MTL_GSC_HEADER_VERSION;
+       header->message_size = message_size; }
drivers/gpu/drm/i915/gt/uc/intel_gsc_uc_heci_cmd_submit.h +10 -0
index cf610dfca7a5..3d56ae501991 100644
@@ -22,7 +22,17 @@ struct intel_gsc_mtl_header {
         u16 header_version;
  #define MTL_GSC_HEADER_VERSION 1
 
+       /*
+        * FW allows host to decide host_session handle
+        * as it sees fit.
+        * For intertracebility reserving select bits(60-63)
+        * to differentiate caller-target subsystem
+        * 0000 - HDCP
+        * 0001 - PXP Single Session
+        */
         u64 host_session_handle;
+#define HOST_SESSION_MASK      REG_GENMASK64(63, 60) #define
+HOST_SESSION_PXP_SINGLE BIT_ULL(60)
         u64 gsc_message_handle;
 

        u32 message_size; /* lower 20 bits only, upper 12 are reserved */ @@ -33,8 +43,11 @@ struct intel_gsc_mtl_header {
         * Bit 1: Session Cleanup;
         * Bits 2-15: Flags
         * Bits 16-31: Extension Size
+        * According to internal spec flags are either input or output +        * we distinguish the flags using OUTFLAG or INFLAG */
        u32 flags;
+#define GSC_OUTFLAG_MSG_PENDING        1

        u32 status;
 } __packed;

drivers/gpu/drm/i915/gt/uc/intel_gsc_uc_heci_cmd_submit.h +5 -0
@@ -42,4 +55,7 @@ struct intel_gsc_mtl_header {
  int intel_gsc_uc_heci_cmd_submit_packet(struct intel_gsc_uc *gsc,
                                         u64 addr_in, u32 size_in,
                                         u64 addr_out, u32 size_out);
+void intel_gsc_uc_heci_cmd_emit_mtl_header(struct
+intel_gsc_mtl_header *header,
+                                          u8 heci_client_id, u32
+message_size,
+                                          u64 host_session_id);

 #endif
--
2.25.1

#8 lore raw

PATCH v8 6/6 drm/i915/mtl: Add HDCP GSC interface

In reply to Suraj Kandpal

MTL uses GSC command streamer i.e gsc cs to send HDCP/PXP commands to GSC f/w. It requires to keep hdcp display driver agnostic to content protection f/w (ME/GSC fw) in the form of i915_hdcp_fw_ops generic ops.

Adding HDCP GSC CS interface by leveraging the i915_hdcp_fw_ops generic ops instead of I915_HDCP_COMPONENT as integral part of i915.

Adding checks to see if GSC is loaded and proxy is setup

--v6
-dont change the license date in same patch series [Jani] -fix the license year {Jani]

--v8
-remove stale comment [Ankit]
-get headers in alphabetical order [Ankit]
-fix hdcp2_supported check [Ankit]

Cc Tomas Winkler <[email protected]>
Cc Rodrigo Vivi <[email protected]>
Cc Uma Shankar <[email protected]>
Cc Ankit Nautiyal <[email protected]>
---
 drivers/gpu/drm/i915/display/intel_hdcp.c     |  31 +-
 drivers/gpu/drm/i915/display/intel_hdcp_gsc.c | 631 +++++++++++++++++-
 drivers/gpu/drm/i915/display/intel_hdcp_gsc.h |   3 +
 3 files changed, 657 insertions(+), 8 deletions(-)
drivers/gpu/drm/i915/display/intel_hdcp.c +24 -7
index c578fcc34bfd..ddae476e4371 100644
@@ -204,13 +204,20 @@ bool intel_hdcp2_capable(struct intel_connector *connector)
 	struct intel_digital_port *dig_port = intel_attached_dig_port(connector);
 	struct drm_i915_private *dev_priv = to_i915(connector->base.dev);
 	struct intel_hdcp *hdcp = &connector->hdcp;
+	struct intel_gt *gt = dev_priv->media_gt;
+	struct intel_gsc_uc *gsc = &gt->uc.gsc;
 	bool capable = false;
 
 	/* I915 support for HDCP2.2 */
 	if (!hdcp->hdcp2_supported)
 		return false;
 
-	/* MEI interface is solid */
+	/* If MTL+ make sure gsc is loaded and proxy is setup */
+	if (intel_hdcp_gsc_cs_required(dev_priv))
+		if (!intel_uc_fw_is_running(&gsc->fw))
+			return false;
+
+	/* MEI/GSC interface is solid depending on which is used */
 	mutex_lock(&dev_priv->display.hdcp.comp_mutex);
 	if (!dev_priv->display.hdcp.comp_added ||  !dev_priv->display.hdcp.master) {
 		mutex_unlock(&dev_priv->display.hdcp.comp_mutex);
@@ -1974,7 +1981,7 @@ static int _intel_hdcp2_enable(struct intel_connector *connector)
 		    connector->base.name, connector->base.base.id,
 		    hdcp->content_type);
 
-	if (DISPLAY_VER(i915) >= 14) {
+	if (intel_hdcp_gsc_cs_required(i915)) {
 		hdcp_message = kzalloc(sizeof(*hdcp_message), GFP_KERNEL);
 
 		if (!hdcp_message)
@@ -2035,7 +2042,7 @@ _intel_hdcp2_disable(struct intel_connector *connector, bool hdcp2_link_recovery
 	if (hdcp2_deauthenticate_port(connector) < 0)
 		drm_dbg_kms(&i915->drm, "Port deauth failed.\n");
 
-	if (DISPLAY_VER(i915) >= 14)
+	if (intel_hdcp_gsc_cs_required(i915))
 		intel_hdcp_gsc_free_message(i915);
 
 	connector->hdcp.hdcp2_encrypted = false;
@@ -2255,6 +2262,9 @@ static int initialize_hdcp_port_data(struct intel_connector *connector,
 
 static bool is_hdcp2_supported(struct drm_i915_private *dev_priv)
 {
+	if (intel_hdcp_gsc_cs_required(dev_priv))
+		return true;
+
 	if (!IS_ENABLED(CONFIG_INTEL_MEI_HDCP))
 		return false;
 
@@ -2276,10 +2286,14 @@ void intel_hdcp_component_init(struct drm_i915_private *dev_priv)
 
 	dev_priv->display.hdcp.comp_added = true;
 	mutex_unlock(&dev_priv->display.hdcp.comp_mutex);
-	ret = component_add_typed(dev_priv->drm.dev, &i915_hdcp_ops,
-				  I915_COMPONENT_HDCP);
+	if (intel_hdcp_gsc_cs_required(dev_priv))
+		ret = intel_hdcp_gsc_init(dev_priv);
+	else
+		ret = component_add_typed(dev_priv->drm.dev, &i915_hdcp_ops,
+					  I915_COMPONENT_HDCP);
+
 	if (ret < 0) {
-		drm_dbg_kms(&dev_priv->drm, "Failed at component add(%d)\n",
+		drm_dbg_kms(&dev_priv->drm, "Failed at fw component add(%d)\n",
 			    ret);
 		mutex_lock(&dev_priv->display.hdcp.comp_mutex);
 		dev_priv->display.hdcp.comp_added = false;
@@ -2506,7 +2520,10 @@ void intel_hdcp_component_fini(struct drm_i915_private *dev_priv)
 	dev_priv->display.hdcp.comp_added = false;
 	mutex_unlock(&dev_priv->display.hdcp.comp_mutex);
 
-	component_del(dev_priv->drm.dev, &i915_hdcp_ops);
+	if (intel_hdcp_gsc_cs_required(dev_priv))
+		intel_hdcp_gsc_fini(dev_priv);
+	else
+		component_del(dev_priv->drm.dev, &i915_hdcp_ops);
 }
 
 void intel_hdcp_cleanup(struct intel_connector *connector)
drivers/gpu/drm/i915/display/intel_hdcp_gsc.c +630 -1

649 lines not on this page · raw message

drivers/gpu/drm/i915/display/intel_hdcp_gsc.h +3 -0
index 8352b31a7e4a..af29baf1d558 100644
@@ -20,8 +20,11 @@ struct intel_hdcp_gsc_message {
 int intel_hdcp_gsc_initialize_message(struct drm_i915_private *i915,
 				      struct intel_hdcp_gsc_message *hdcp_message);
 void intel_hdcp_gsc_free_message(struct drm_i915_private *i915);
+bool intel_hdcp_gsc_cs_required(struct drm_i915_private *i915);
 ssize_t intel_hdcp_gsc_msg_send(struct drm_i915_private *i915, u8 *msg_in,
 				size_t msg_in_len, u8 *msg_out,
 				size_t msg_out_len);
+int intel_hdcp_gsc_init(struct drm_i915_private *i915);
+int intel_hdcp_gsc_fini(struct drm_i915_private *i915);
 
 #endif /* __INTEL_HDCP_GCS_H__ */
Signature · 1 line
2.25.1
Reviewed-by on v8 6/6
#9 lore raw

Re: [Intel-gfx] [PATCH v8 6/6] drm/i915/mtl: Add HDCP GSC interface

Hi Suraj,

Minor suggestions inline.

Otherwise patch looks good to me.

Quoted 142 lines · Suraj Kandpal

MTL uses GSC command streamer i.e gsc cs to send HDCP/PXP commands to GSC f/w. It requires to keep hdcp display driver agnostic to content protection f/w (ME/GSC fw) in the form of i915_hdcp_fw_ops generic ops.

Adding HDCP GSC CS interface by leveraging the i915_hdcp_fw_ops generic ops instead of I915_HDCP_COMPONENT as integral part of i915.

Adding checks to see if GSC is loaded and proxy is setup

--v6

(quoted diff) +0 -6
-dont change the license date in same patch series [Jani]
-fix the license year {Jani]
 
--v8
-remove stale comment [Ankit]
-get headers in alphabetical order [Ankit]
-fix hdcp2_supported check [Ankit]
Cc Tomas Winkler <[email protected]>
Cc Rodrigo Vivi <[email protected]>
Cc Uma Shankar <[email protected]>
Cc Ankit Nautiyal <[email protected]>
---
  drivers/gpu/drm/i915/display/intel_hdcp.c     |  31 +-
  drivers/gpu/drm/i915/display/intel_hdcp_gsc.c | 631 +++++++++++++++++-
  drivers/gpu/drm/i915/display/intel_hdcp_gsc.h |   3 +
  3 files changed, 657 insertions(+), 8 deletions(-)
drivers/gpu/drm/i915/display/intel_hdcp.c +24 -7
index c578fcc34bfd..ddae476e4371 100644
@@ -204,13 +204,20 @@ bool intel_hdcp2_capable(struct intel_connector *connector)
  	struct intel_digital_port *dig_port = intel_attached_dig_port(connector);
  	struct drm_i915_private *dev_priv = to_i915(connector->base.dev);
  	struct intel_hdcp *hdcp = &connector->hdcp;
+	struct intel_gt *gt = dev_priv->media_gt;
+	struct intel_gsc_uc *gsc = &gt->uc.gsc;
  	bool capable = false;
 
  	/* I915 support for HDCP2.2 */
  	if (!hdcp->hdcp2_supported)
  		return false;
 
-	/* MEI interface is solid */
+	/* If MTL+ make sure gsc is loaded and proxy is setup */
+	if (intel_hdcp_gsc_cs_required(dev_priv))
+		if (!intel_uc_fw_is_running(&gsc->fw))
+			return false;
+
+	/* MEI/GSC interface is solid depending on which is used */
  	mutex_lock(&dev_priv->display.hdcp.comp_mutex);
  	if (!dev_priv->display.hdcp.comp_added ||  !dev_priv->display.hdcp.master) {
  		mutex_unlock(&dev_priv->display.hdcp.comp_mutex);
@@ -1974,7 +1981,7 @@ static int _intel_hdcp2_enable(struct intel_connector *connector)
  		    connector->base.name, connector->base.base.id,
  		    hdcp->content_type);
 
-	if (DISPLAY_VER(i915) >= 14) {
+	if (intel_hdcp_gsc_cs_required(i915)) {
  		hdcp_message = kzalloc(sizeof(*hdcp_message), GFP_KERNEL);
 
  		if (!hdcp_message)
@@ -2035,7 +2042,7 @@ _intel_hdcp2_disable(struct intel_connector *connector, bool hdcp2_link_recovery
  	if (hdcp2_deauthenticate_port(connector) < 0)
  		drm_dbg_kms(&i915->drm, "Port deauth failed.\n");
 
-	if (DISPLAY_VER(i915) >= 14)
+	if (intel_hdcp_gsc_cs_required(i915))
  		intel_hdcp_gsc_free_message(i915);
 
  	connector->hdcp.hdcp2_encrypted = false;
@@ -2255,6 +2262,9 @@ static int initialize_hdcp_port_data(struct intel_connector *connector,
 
  static bool is_hdcp2_supported(struct drm_i915_private *dev_priv)
  {
+	if (intel_hdcp_gsc_cs_required(dev_priv))
+		return true;
+
  	if (!IS_ENABLED(CONFIG_INTEL_MEI_HDCP))
  		return false;
 
@@ -2276,10 +2286,14 @@ void intel_hdcp_component_init(struct drm_i915_private *dev_priv)
 
  	dev_priv->display.hdcp.comp_added = true;
  	mutex_unlock(&dev_priv->display.hdcp.comp_mutex);
-	ret = component_add_typed(dev_priv->drm.dev, &i915_hdcp_ops,
-				  I915_COMPONENT_HDCP);
+	if (intel_hdcp_gsc_cs_required(dev_priv))
+		ret = intel_hdcp_gsc_init(dev_priv);
+	else
+		ret = component_add_typed(dev_priv->drm.dev, &i915_hdcp_ops,
+					  I915_COMPONENT_HDCP);
+
  	if (ret < 0) {
-		drm_dbg_kms(&dev_priv->drm, "Failed at component add(%d)\n",
+		drm_dbg_kms(&dev_priv->drm, "Failed at fw component add(%d)\n",
  			    ret);
  		mutex_lock(&dev_priv->display.hdcp.comp_mutex);
  		dev_priv->display.hdcp.comp_added = false;
@@ -2506,7 +2520,10 @@ void intel_hdcp_component_fini(struct drm_i915_private *dev_priv)
  	dev_priv->display.hdcp.comp_added = false;
  	mutex_unlock(&dev_priv->display.hdcp.comp_mutex);
 
-	component_del(dev_priv->drm.dev, &i915_hdcp_ops);
+	if (intel_hdcp_gsc_cs_required(dev_priv))
+		intel_hdcp_gsc_fini(dev_priv);
+	else
+		component_del(dev_priv->drm.dev, &i915_hdcp_ops);
  }
 
  void intel_hdcp_cleanup(struct intel_connector *connector)
drivers/gpu/drm/i915/display/intel_hdcp_gsc.c +13 -0
index 8da4faf9b10c..fb6042684014 100644
@@ -3,12 +3,640 @@
   * Copyright 2023, Intel Corporation.
   */
 
+#include <drm/i915_hdcp_interface.h>
+
  #include "display/intel_hdcp_gsc.h"
  #include "gem/i915_gem_region.h"
  #include "gt/uc/intel_gsc_uc_heci_cmd_submit.h"
  #include "i915_drv.h"
  #include "i915_utils.h"
 
+bool intel_hdcp_gsc_cs_required(struct drm_i915_private *i915)
+{
+	return DISPLAY_VER(i915) >= 14;
+}
+
+static int
+gsc_hdcp_initiate_session(struct device *dev, struct hdcp_port_data *data,
+			  struct hdcp2_ake_init *ake_data)
+{
+	struct wired_cmd_initiate_hdcp2_session_in session_init_in = { { 0 } };
+	struct wired_cmd_initiate_hdcp2_session_out

drivers/gpu/drm/i915/display/intel_hdcp_gsc.c line 34

Quoted 10 lines
drivers/gpu/drm/i915/display/intel_hdcp_gsc.c +10 -0
+						session_init_out = { { 0 } };
+	struct drm_i915_private *i915;
+	ssize_t byte;
+
+	if (!dev || !data || !ake_data)
+		return -EINVAL;
+
+	i915 = kdev_to_i915(dev);
+	if (!i915) {
+		dev_err(dev, "DRM not initialized, aborting HDCP.\n");

Generally we do not use Full stop at the end of logs, so lets drop it, to be consistent with other logs.

Same in other similar places below.

Quoted 593 lines
drivers/gpu/drm/i915/display/intel_hdcp_gsc.c +593 -0
+		return -ENODEV;
+	}
+
+	session_init_in.header.api_version = HDCP_API_VERSION;
+	session_init_in.header.command_id = WIRED_INITIATE_HDCP2_SESSION;
+	session_init_in.header.status = FW_HDCP_STATUS_SUCCESS;
+	session_init_in.header.buffer_len =
+				WIRED_CMD_BUF_LEN_INITIATE_HDCP2_SESSION_IN;
+
+	session_init_in.port.integrated_port_type = data->port_type;
+	session_init_in.port.physical_port = (u8)data->hdcp_ddi;
+	session_init_in.port.attached_transcoder = (u8)data->hdcp_transcoder;
+	session_init_in.protocol = data->protocol;
+
+	byte = intel_hdcp_gsc_msg_send(i915, (u8 *)&session_init_in,
+				       sizeof(session_init_in),
+				       (u8 *)&session_init_out,
+				       sizeof(session_init_out));
+	if (byte < 0) {
+		drm_dbg_kms(&i915->drm, "intel_hdcp_gsc_msg_send failed. %zd\n", byte);
+		return byte;
+	}
+
+	if (session_init_out.header.status != FW_HDCP_STATUS_SUCCESS) {
+		drm_dbg_kms(&i915->drm, "FW cmd 0x%08X Failed. Status: 0x%X\n",
+			    WIRED_INITIATE_HDCP2_SESSION,
+			    session_init_out.header.status);
+		return -EIO;
+	}
+
+	ake_data->msg_id = HDCP_2_2_AKE_INIT;
+	ake_data->tx_caps = session_init_out.tx_caps;
+	memcpy(ake_data->r_tx, session_init_out.r_tx, HDCP_2_2_RTX_LEN);
+
+	return 0;
+}
+
+static int
+gsc_hdcp_verify_receiver_cert_prepare_km(struct device *dev,
+					 struct hdcp_port_data *data,
+					 struct hdcp2_ake_send_cert *rx_cert,
+					 bool *km_stored,
+					 struct hdcp2_ake_no_stored_km
+								*ek_pub_km,
+					 size_t *msg_sz)
+{
+	struct wired_cmd_verify_receiver_cert_in verify_rxcert_in = { { 0 } };
+	struct wired_cmd_verify_receiver_cert_out verify_rxcert_out = { { 0 } };
+	struct drm_i915_private *i915;
+	ssize_t byte;
+
+	if (!dev || !data || !rx_cert || !km_stored || !ek_pub_km || !msg_sz)
+		return -EINVAL;
+
+	i915 = kdev_to_i915(dev);
+	if (!i915) {
+		dev_err(dev, "DRM not initialized, aborting HDCP.\n");
+		return -ENODEV;
+	}
+
+	verify_rxcert_in.header.api_version = HDCP_API_VERSION;
+	verify_rxcert_in.header.command_id = WIRED_VERIFY_RECEIVER_CERT;
+	verify_rxcert_in.header.status = FW_HDCP_STATUS_SUCCESS;
+	verify_rxcert_in.header.buffer_len =
+				WIRED_CMD_BUF_LEN_VERIFY_RECEIVER_CERT_IN;
+
+	verify_rxcert_in.port.integrated_port_type = data->port_type;
+	verify_rxcert_in.port.physical_port = (u8)data->hdcp_ddi;
+	verify_rxcert_in.port.attached_transcoder = (u8)data->hdcp_transcoder;
+
+	verify_rxcert_in.cert_rx = rx_cert->cert_rx;
+	memcpy(verify_rxcert_in.r_rx, &rx_cert->r_rx, HDCP_2_2_RRX_LEN);
+	memcpy(verify_rxcert_in.rx_caps, rx_cert->rx_caps, HDCP_2_2_RXCAPS_LEN);
+
+	byte = intel_hdcp_gsc_msg_send(i915, (u8 *)&verify_rxcert_in,
+				       sizeof(verify_rxcert_in),
+				       (u8 *)&verify_rxcert_out,
+				       sizeof(verify_rxcert_out));
+	if (byte < 0) {
+		drm_dbg_kms(&i915->drm, "intel_hdcp_gsc_msg_send failed: %zd\n", byte);
+		return byte;
+	}
+
+	if (verify_rxcert_out.header.status != FW_HDCP_STATUS_SUCCESS) {
+		drm_dbg_kms(&i915->drm, "FW cmd 0x%08X Failed. Status: 0x%X\n",
+			    WIRED_VERIFY_RECEIVER_CERT,
+			    verify_rxcert_out.header.status);
+		return -EIO;
+	}
+
+	*km_stored = !!verify_rxcert_out.km_stored;
+	if (verify_rxcert_out.km_stored) {
+		ek_pub_km->msg_id = HDCP_2_2_AKE_STORED_KM;
+		*msg_sz = sizeof(struct hdcp2_ake_stored_km);
+	} else {
+		ek_pub_km->msg_id = HDCP_2_2_AKE_NO_STORED_KM;
+		*msg_sz = sizeof(struct hdcp2_ake_no_stored_km);
+	}
+
+	memcpy(ek_pub_km->e_kpub_km, &verify_rxcert_out.ekm_buff,
+	       sizeof(verify_rxcert_out.ekm_buff));
+
+	return 0;
+}
+
+static int
+gsc_hdcp_verify_hprime(struct device *dev, struct hdcp_port_data *data,
+		       struct hdcp2_ake_send_hprime *rx_hprime)
+{
+	struct wired_cmd_ake_send_hprime_in send_hprime_in = { { 0 } };
+	struct wired_cmd_ake_send_hprime_out send_hprime_out = { { 0 } };
+	struct drm_i915_private *i915;
+	ssize_t byte;
+
+	if (!dev || !data || !rx_hprime)
+		return -EINVAL;
+
+	i915 = kdev_to_i915(dev);
+	if (!i915) {
+		dev_err(dev, "DRM not initialized, aborting HDCP.\n");
+		return -ENODEV;
+	}
+
+	send_hprime_in.header.api_version = HDCP_API_VERSION;
+	send_hprime_in.header.command_id = WIRED_AKE_SEND_HPRIME;
+	send_hprime_in.header.status = FW_HDCP_STATUS_SUCCESS;
+	send_hprime_in.header.buffer_len = WIRED_CMD_BUF_LEN_AKE_SEND_HPRIME_IN;
+
+	send_hprime_in.port.integrated_port_type = data->port_type;
+	send_hprime_in.port.physical_port = (u8)data->hdcp_ddi;
+	send_hprime_in.port.attached_transcoder = (u8)data->hdcp_transcoder;
+
+	memcpy(send_hprime_in.h_prime, rx_hprime->h_prime,
+	       HDCP_2_2_H_PRIME_LEN);
+
+	byte = intel_hdcp_gsc_msg_send(i915, (u8 *)&send_hprime_in,
+				       sizeof(send_hprime_in),
+				       (u8 *)&send_hprime_out,
+				       sizeof(send_hprime_out));
+	if (byte < 0) {
+		drm_dbg_kms(&i915->drm, "intel_hdcp_gsc_msg_send failed. %zd\n", byte);
+		return byte;
+	}
+
+	if (send_hprime_out.header.status != FW_HDCP_STATUS_SUCCESS) {
+		drm_dbg_kms(&i915->drm, "FW cmd 0x%08X Failed. Status: 0x%X\n",
+			    WIRED_AKE_SEND_HPRIME, send_hprime_out.header.status);
+		return -EIO;
+	}
+
+	return 0;
+}
+
+static int
+gsc_hdcp_store_pairing_info(struct device *dev, struct hdcp_port_data *data,
+			    struct hdcp2_ake_send_pairing_info *pairing_info)
+{
+	struct wired_cmd_ake_send_pairing_info_in pairing_info_in = { { 0 } };
+	struct wired_cmd_ake_send_pairing_info_out pairing_info_out = { { 0 } };
+	struct drm_i915_private *i915;
+	ssize_t byte;
+
+	if (!dev || !data || !pairing_info)
+		return -EINVAL;
+
+	i915 = kdev_to_i915(dev);
+	if (!i915) {
+		dev_err(dev, "DRM not initialized, aborting HDCP.\n");
+		return -ENODEV;
+	}
+
+	pairing_info_in.header.api_version = HDCP_API_VERSION;
+	pairing_info_in.header.command_id = WIRED_AKE_SEND_PAIRING_INFO;
+	pairing_info_in.header.status = FW_HDCP_STATUS_SUCCESS;
+	pairing_info_in.header.buffer_len =
+					WIRED_CMD_BUF_LEN_SEND_PAIRING_INFO_IN;
+
+	pairing_info_in.port.integrated_port_type = data->port_type;
+	pairing_info_in.port.physical_port = (u8)data->hdcp_ddi;
+	pairing_info_in.port.attached_transcoder = (u8)data->hdcp_transcoder;
+
+	memcpy(pairing_info_in.e_kh_km, pairing_info->e_kh_km,
+	       HDCP_2_2_E_KH_KM_LEN);
+
+	byte = intel_hdcp_gsc_msg_send(i915, (u8 *)&pairing_info_in,
+				       sizeof(pairing_info_in),
+				       (u8 *)&pairing_info_out,
+				       sizeof(pairing_info_out));
+	if (byte < 0) {
+		drm_dbg_kms(&i915->drm, "intel_hdcp_gsc_msg_send failed. %zd\n", byte);
+		return byte;
+	}
+
+	if (pairing_info_out.header.status != FW_HDCP_STATUS_SUCCESS) {
+		drm_dbg_kms(&i915->drm, "FW cmd 0x%08X failed. Status: 0x%X\n",
+			    WIRED_AKE_SEND_PAIRING_INFO,
+			    pairing_info_out.header.status);
+		return -EIO;
+	}
+
+	return 0;
+}
+
+static int
+gsc_hdcp_initiate_locality_check(struct device *dev,
+				 struct hdcp_port_data *data,
+				 struct hdcp2_lc_init *lc_init_data)
+{
+	struct wired_cmd_init_locality_check_in lc_init_in = { { 0 } };
+	struct wired_cmd_init_locality_check_out lc_init_out = { { 0 } };
+	struct drm_i915_private *i915;
+	ssize_t byte;
+
+	if (!dev || !data || !lc_init_data)
+		return -EINVAL;
+
+	i915 = kdev_to_i915(dev);
+	if (!i915) {
+		dev_err(dev, "DRM not initialized, aborting HDCP.\n");
+		return -ENODEV;
+	}
+
+	lc_init_in.header.api_version = HDCP_API_VERSION;
+	lc_init_in.header.command_id = WIRED_INIT_LOCALITY_CHECK;
+	lc_init_in.header.status = FW_HDCP_STATUS_SUCCESS;
+	lc_init_in.header.buffer_len = WIRED_CMD_BUF_LEN_INIT_LOCALITY_CHECK_IN;
+
+	lc_init_in.port.integrated_port_type = data->port_type;
+	lc_init_in.port.physical_port = (u8)data->hdcp_ddi;
+	lc_init_in.port.attached_transcoder = (u8)data->hdcp_transcoder;
+
+	byte = intel_hdcp_gsc_msg_send(i915, (u8 *)&lc_init_in, sizeof(lc_init_in),
+				       (u8 *)&lc_init_out, sizeof(lc_init_out));
+	if (byte < 0) {
+		drm_dbg_kms(&i915->drm, "intel_hdcp_gsc_msg_send failed. %zd\n", byte);
+		return byte;
+	}
+
+	if (lc_init_out.header.status != FW_HDCP_STATUS_SUCCESS) {
+		drm_dbg_kms(&i915->drm, "FW cmd 0x%08X Failed. status: 0x%X\n",
+			    WIRED_INIT_LOCALITY_CHECK, lc_init_out.header.status);
+		return -EIO;
+	}
+
+	lc_init_data->msg_id = HDCP_2_2_LC_INIT;
+	memcpy(lc_init_data->r_n, lc_init_out.r_n, HDCP_2_2_RN_LEN);
+
+	return 0;
+}
+
+static int
+gsc_hdcp_verify_lprime(struct device *dev, struct hdcp_port_data *data,
+		       struct hdcp2_lc_send_lprime *rx_lprime)
+{
+	struct wired_cmd_validate_locality_in verify_lprime_in = { { 0 } };
+	struct wired_cmd_validate_locality_out verify_lprime_out = { { 0 } };
+	struct drm_i915_private *i915;
+	ssize_t byte;
+
+	if (!dev || !data || !rx_lprime)
+		return -EINVAL;
+
+	i915 = kdev_to_i915(dev);
+	if (!i915) {
+		dev_err(dev, "DRM not initialized, aborting HDCP.\n");
+		return -ENODEV;
+	}
+
+	verify_lprime_in.header.api_version = HDCP_API_VERSION;
+	verify_lprime_in.header.command_id = WIRED_VALIDATE_LOCALITY;
+	verify_lprime_in.header.status = FW_HDCP_STATUS_SUCCESS;
+	verify_lprime_in.header.buffer_len =
+					WIRED_CMD_BUF_LEN_VALIDATE_LOCALITY_IN;
+
+	verify_lprime_in.port.integrated_port_type = data->port_type;
+	verify_lprime_in.port.physical_port = (u8)data->hdcp_ddi;
+	verify_lprime_in.port.attached_transcoder = (u8)data->hdcp_transcoder;
+
+	memcpy(verify_lprime_in.l_prime, rx_lprime->l_prime,
+	       HDCP_2_2_L_PRIME_LEN);
+
+	byte = intel_hdcp_gsc_msg_send(i915, (u8 *)&verify_lprime_in,
+				       sizeof(verify_lprime_in),
+				       (u8 *)&verify_lprime_out,
+				       sizeof(verify_lprime_out));
+	if (byte < 0) {
+		drm_dbg_kms(&i915->drm, "intel_hdcp_gsc_msg_send failed. %zd\n", byte);
+		return byte;
+	}
+
+	if (verify_lprime_out.header.status != FW_HDCP_STATUS_SUCCESS) {
+		drm_dbg_kms(&i915->drm, "FW cmd 0x%08X failed. status: 0x%X\n",
+			    WIRED_VALIDATE_LOCALITY,
+			    verify_lprime_out.header.status);
+		return -EIO;
+	}
+
+	return 0;
+}
+
+static int gsc_hdcp_get_session_key(struct device *dev,
+				    struct hdcp_port_data *data,
+				    struct hdcp2_ske_send_eks *ske_data)
+{
+	struct wired_cmd_get_session_key_in get_skey_in = { { 0 } };
+	struct wired_cmd_get_session_key_out get_skey_out = { { 0 } };
+	struct drm_i915_private *i915;
+	ssize_t byte;
+
+	if (!dev || !data || !ske_data)
+		return -EINVAL;
+
+	i915 = kdev_to_i915(dev);
+	if (!i915) {
+		dev_err(dev, "DRM not initialized, aborting HDCP.\n");
+		return -ENODEV;
+	}
+
+	get_skey_in.header.api_version = HDCP_API_VERSION;
+	get_skey_in.header.command_id = WIRED_GET_SESSION_KEY;
+	get_skey_in.header.status = FW_HDCP_STATUS_SUCCESS;
+	get_skey_in.header.buffer_len = WIRED_CMD_BUF_LEN_GET_SESSION_KEY_IN;
+
+	get_skey_in.port.integrated_port_type = data->port_type;
+	get_skey_in.port.physical_port = (u8)data->hdcp_ddi;
+	get_skey_in.port.attached_transcoder = (u8)data->hdcp_transcoder;
+
+	byte = intel_hdcp_gsc_msg_send(i915, (u8 *)&get_skey_in, sizeof(get_skey_in),
+				       (u8 *)&get_skey_out, sizeof(get_skey_out));
+	if (byte < 0) {
+		drm_dbg_kms(&i915->drm, "intel_hdcp_gsc_msg_send failed. %zd\n", byte);
+		return byte;
+	}
+
+	if (get_skey_out.header.status != FW_HDCP_STATUS_SUCCESS) {
+		drm_dbg_kms(&i915->drm, "FW cmd 0x%08X failed. status: 0x%X\n",
+			    WIRED_GET_SESSION_KEY, get_skey_out.header.status);
+		return -EIO;
+	}
+
+	ske_data->msg_id = HDCP_2_2_SKE_SEND_EKS;
+	memcpy(ske_data->e_dkey_ks, get_skey_out.e_dkey_ks,
+	       HDCP_2_2_E_DKEY_KS_LEN);
+	memcpy(ske_data->riv, get_skey_out.r_iv, HDCP_2_2_RIV_LEN);
+
+	return 0;
+}
+
+static int
+gsc_hdcp_repeater_check_flow_prepare_ack(struct device *dev,
+					 struct hdcp_port_data *data,
+					 struct hdcp2_rep_send_receiverid_list
+							*rep_topology,
+					 struct hdcp2_rep_send_ack
+							*rep_send_ack)
+{
+	struct wired_cmd_verify_repeater_in verify_repeater_in = { { 0 } };
+	struct wired_cmd_verify_repeater_out verify_repeater_out = { { 0 } };
+	struct drm_i915_private *i915;
+	ssize_t byte;
+
+	if (!dev || !rep_topology || !rep_send_ack || !data)
+		return -EINVAL;
+
+	i915 = kdev_to_i915(dev);
+	if (!i915) {
+		dev_err(dev, "DRM not initialized, aborting HDCP.\n");
+		return -ENODEV;
+	}
+
+	verify_repeater_in.header.api_version = HDCP_API_VERSION;
+	verify_repeater_in.header.command_id = WIRED_VERIFY_REPEATER;
+	verify_repeater_in.header.status = FW_HDCP_STATUS_SUCCESS;
+	verify_repeater_in.header.buffer_len =
+					WIRED_CMD_BUF_LEN_VERIFY_REPEATER_IN;
+
+	verify_repeater_in.port.integrated_port_type = data->port_type;
+	verify_repeater_in.port.physical_port = (u8)data->hdcp_ddi;
+	verify_repeater_in.port.attached_transcoder = (u8)data->hdcp_transcoder;
+
+	memcpy(verify_repeater_in.rx_info, rep_topology->rx_info,
+	       HDCP_2_2_RXINFO_LEN);
+	memcpy(verify_repeater_in.seq_num_v, rep_topology->seq_num_v,
+	       HDCP_2_2_SEQ_NUM_LEN);
+	memcpy(verify_repeater_in.v_prime, rep_topology->v_prime,
+	       HDCP_2_2_V_PRIME_HALF_LEN);
+	memcpy(verify_repeater_in.receiver_ids, rep_topology->receiver_ids,
+	       HDCP_2_2_RECEIVER_IDS_MAX_LEN);
+
+	byte = intel_hdcp_gsc_msg_send(i915, (u8 *)&verify_repeater_in,
+				       sizeof(verify_repeater_in),
+				       (u8 *)&verify_repeater_out,
+				       sizeof(verify_repeater_out));
+	if (byte < 0) {
+		drm_dbg_kms(&i915->drm, "intel_hdcp_gsc_msg_send failed. %zd\n", byte);
+		return byte;
+	}
+
+	if (verify_repeater_out.header.status != FW_HDCP_STATUS_SUCCESS) {
+		drm_dbg_kms(&i915->drm, "FW cmd 0x%08X failed. status: 0x%X\n",
+			    WIRED_VERIFY_REPEATER,
+			    verify_repeater_out.header.status);
+		return -EIO;
+	}
+
+	memcpy(rep_send_ack->v, verify_repeater_out.v,
+	       HDCP_2_2_V_PRIME_HALF_LEN);
+	rep_send_ack->msg_id = HDCP_2_2_REP_SEND_ACK;
+
+	return 0;
+}
+
+static int gsc_hdcp_verify_mprime(struct device *dev,
+				  struct hdcp_port_data *data,
+				  struct hdcp2_rep_stream_ready *stream_ready)
+{
+	struct wired_cmd_repeater_auth_stream_req_in *verify_mprime_in;
+	struct wired_cmd_repeater_auth_stream_req_out
+					verify_mprime_out = { { 0 } };
+	struct drm_i915_private *i915;
+	ssize_t byte;
+	size_t cmd_size;
+
+	if (!dev || !stream_ready || !data)
+		return -EINVAL;
+
+	i915 = kdev_to_i915(dev);
+	if (!i915) {
+		dev_err(dev, "DRM not initialized, aborting HDCP.\n");
+		return -ENODEV;
+	}
+
+	cmd_size = struct_size(verify_mprime_in, streams, data->k);
+	if (cmd_size == SIZE_MAX)
+		return -EINVAL;
+
+	verify_mprime_in = kzalloc(cmd_size, GFP_KERNEL);
+	if (!verify_mprime_in)
+		return -ENOMEM;
+
+	verify_mprime_in->header.api_version = HDCP_API_VERSION;
+	verify_mprime_in->header.command_id = WIRED_REPEATER_AUTH_STREAM_REQ;
+	verify_mprime_in->header.status = FW_HDCP_STATUS_SUCCESS;
+	verify_mprime_in->header.buffer_len = cmd_size  - sizeof(verify_mprime_in->header);
+
+	verify_mprime_in->port.integrated_port_type = data->port_type;
+	verify_mprime_in->port.physical_port = (u8)data->hdcp_ddi;
+	verify_mprime_in->port.attached_transcoder = (u8)data->hdcp_transcoder;
+
+	memcpy(verify_mprime_in->m_prime, stream_ready->m_prime, HDCP_2_2_MPRIME_LEN);
+	drm_hdcp_cpu_to_be24(verify_mprime_in->seq_num_m, data->seq_num_m);
+
+	memcpy(verify_mprime_in->streams, data->streams,
+	       array_size(data->k, sizeof(*data->streams)));
+
+	verify_mprime_in->k = cpu_to_be16(data->k);
+
+	byte = intel_hdcp_gsc_msg_send(i915, (u8 *)verify_mprime_in, cmd_size,
+				       (u8 *)&verify_mprime_out,
+				       sizeof(verify_mprime_out));
+	kfree(verify_mprime_in);
+	if (byte < 0) {
+		drm_dbg_kms(&i915->drm, "intel_hdcp_gsc_msg_send failed. %zd\n", byte);
+		return byte;
+	}
+
+	if (verify_mprime_out.header.status != FW_HDCP_STATUS_SUCCESS) {
+		drm_dbg_kms(&i915->drm, "FW cmd 0x%08X failed. status: 0x%X\n",
+			    WIRED_REPEATER_AUTH_STREAM_REQ,
+			    verify_mprime_out.header.status);
+		return -EIO;
+	}
+
+	return 0;
+}
+
+static int gsc_hdcp_enable_authentication(struct device *dev,
+					  struct hdcp_port_data *data)
+{
+	struct wired_cmd_enable_auth_in enable_auth_in = { { 0 } };
+	struct wired_cmd_enable_auth_out enable_auth_out = { { 0 } };
+	struct drm_i915_private *i915;
+	ssize_t byte;
+
+	if (!dev || !data)
+		return -EINVAL;
+
+	i915 = kdev_to_i915(dev);
+	if (!i915) {
+		dev_err(dev, "DRM not initialized, aborting HDCP.\n");
+		return -ENODEV;
+	}
+
+	enable_auth_in.header.api_version = HDCP_API_VERSION;
+	enable_auth_in.header.command_id = WIRED_ENABLE_AUTH;
+	enable_auth_in.header.status = FW_HDCP_STATUS_SUCCESS;
+	enable_auth_in.header.buffer_len = WIRED_CMD_BUF_LEN_ENABLE_AUTH_IN;
+
+	enable_auth_in.port.integrated_port_type = data->port_type;
+	enable_auth_in.port.physical_port = (u8)data->hdcp_ddi;
+	enable_auth_in.port.attached_transcoder = (u8)data->hdcp_transcoder;
+	enable_auth_in.stream_type = data->streams[0].stream_type;
+
+	byte = intel_hdcp_gsc_msg_send(i915, (u8 *)&enable_auth_in,
+				       sizeof(enable_auth_in),
+				       (u8 *)&enable_auth_out,
+				       sizeof(enable_auth_out));
+	if (byte < 0) {
+		drm_dbg_kms(&i915->drm, "intel_hdcp_gsc_msg_send failed. %zd\n", byte);
+		return byte;
+	}
+
+	if (enable_auth_out.header.status != FW_HDCP_STATUS_SUCCESS) {
+		drm_dbg_kms(&i915->drm, "FW cmd 0x%08X failed. status: 0x%X\n",
+			    WIRED_ENABLE_AUTH, enable_auth_out.header.status);
+		return -EIO;
+	}
+
+	return 0;
+}
+
+static int
+gsc_hdcp_close_session(struct device *dev, struct hdcp_port_data *data)
+{
+	struct wired_cmd_close_session_in session_close_in = { { 0 } };
+	struct wired_cmd_close_session_out session_close_out = { { 0 } };
+	struct drm_i915_private *i915;
+	ssize_t byte;
+
+	if (!dev || !data)
+		return -EINVAL;
+
+	i915 = kdev_to_i915(dev);
+	if (!i915) {
+		dev_err(dev, "DRM not initialized, aborting HDCP.\n");
+		return -ENODEV;
+	}
+
+	session_close_in.header.api_version = HDCP_API_VERSION;
+	session_close_in.header.command_id = WIRED_CLOSE_SESSION;
+	session_close_in.header.status = FW_HDCP_STATUS_SUCCESS;
+	session_close_in.header.buffer_len =
+				WIRED_CMD_BUF_LEN_CLOSE_SESSION_IN;
+
+	session_close_in.port.integrated_port_type = data->port_type;
+	session_close_in.port.physical_port = (u8)data->hdcp_ddi;
+	session_close_in.port.attached_transcoder = (u8)data->hdcp_transcoder;
+
+	byte = intel_hdcp_gsc_msg_send(i915, (u8 *)&session_close_in,
+				       sizeof(session_close_in),
+				       (u8 *)&session_close_out,
+				       sizeof(session_close_out));
+	if (byte < 0) {
+		drm_dbg_kms(&i915->drm, "intel_hdcp_gsc_msg_send failed. %zd\n", byte);
+		return byte;
+	}
+
+	if (session_close_out.header.status != FW_HDCP_STATUS_SUCCESS) {
+		drm_dbg_kms(&i915->drm, "Session Close Failed. status: 0x%X\n",
+			    session_close_out.header.status);
+		return -EIO;
+	}
+
+	return 0;
+}
+
+static const struct i915_hdcp_ops gsc_hdcp_ops = {
+	.initiate_hdcp2_session = gsc_hdcp_initiate_session,
+	.verify_receiver_cert_prepare_km =
+				gsc_hdcp_verify_receiver_cert_prepare_km,
+	.verify_hprime = gsc_hdcp_verify_hprime,
+	.store_pairing_info = gsc_hdcp_store_pairing_info,
+	.initiate_locality_check = gsc_hdcp_initiate_locality_check,
+	.verify_lprime = gsc_hdcp_verify_lprime,
+	.get_session_key = gsc_hdcp_get_session_key,
+	.repeater_check_flow_prepare_ack =
+				gsc_hdcp_repeater_check_flow_prepare_ack,
+	.verify_mprime = gsc_hdcp_verify_mprime,
+	.enable_hdcp_authentication = gsc_hdcp_enable_authentication,
+	.close_hdcp_session = gsc_hdcp_close_session,
+};
+
+int intel_hdcp_gsc_init(struct drm_i915_private *i915)
+{
+	struct i915_hdcp_master *data;
+
+	data = kzalloc(sizeof(struct i915_hdcp_master), GFP_KERNEL);
+	if (!data)
+		return -ENOMEM;
+
+	mutex_lock(&i915->display.hdcp.comp_mutex);
+	i915->display.hdcp.master = data;
+	i915->display.hdcp.master->hdcp_dev = i915->drm.dev;

drivers/gpu/drm/i915/display/intel_hdcp_gsc.c line 637

Quoted 10 lines
drivers/gpu/drm/i915/display/intel_hdcp_gsc.c +10 -0
+	i915->display.hdcp.master->ops = &gsc_hdcp_ops;
+	mutex_unlock(&i915->display.hdcp.comp_mutex);
+
+	return 0;
+}
+
+int intel_hdcp_gsc_fini(struct drm_i915_private *i915)
+{
+	kfree(i915->display.hdcp.master);
+	return 0;

I think we can do away with return type here.

Regards,

Ankit

Quoted 31 lines
drivers/gpu/drm/i915/display/intel_hdcp_gsc.c +4 -1
+}
+
  /*This function helps allocate memory for the command that we will send to gsc cs */
  int intel_hdcp_gsc_initialize_message(struct drm_i915_private *i915,
  				      struct intel_hdcp_gsc_message *hdcp_message)
@@ -120,7 +748,8 @@ static int intel_gsc_send_sync(struct drm_i915_private *i915,
   * will follow
   */
  ssize_t intel_hdcp_gsc_msg_send(struct drm_i915_private *i915, u8 *msg_in,
-				size_t msg_in_len, u8 *msg_out, size_t msg_out_len)
+				size_t msg_in_len, u8 *msg_out,
+				size_t msg_out_len)
  {
  	struct intel_gt *gt = i915->media_gt;
  	struct intel_gsc_mtl_header *header;
drivers/gpu/drm/i915/display/intel_hdcp_gsc.h +3 -0
index 8352b31a7e4a..af29baf1d558 100644
@@ -20,8 +20,11 @@ struct intel_hdcp_gsc_message {
  int intel_hdcp_gsc_initialize_message(struct drm_i915_private *i915,
  				      struct intel_hdcp_gsc_message *hdcp_message);
  void intel_hdcp_gsc_free_message(struct drm_i915_private *i915);
+bool intel_hdcp_gsc_cs_required(struct drm_i915_private *i915);
  ssize_t intel_hdcp_gsc_msg_send(struct drm_i915_private *i915, u8 *msg_in,
  				size_t msg_in_len, u8 *msg_out,
  				size_t msg_out_len);
+int intel_hdcp_gsc_init(struct drm_i915_private *i915);
+int intel_hdcp_gsc_fini(struct drm_i915_private *i915);
 
  #endif /* __INTEL_HDCP_GCS_H__ */
#11 lore raw

[Intel-gfx] ✓ Fi.CI.BAT: success for Enable HDCP2.x via GSC CS (rev8)

In reply to Suraj Kandpal
== Series Details ==

== Series Details ==

Series: Enable HDCP2.x via GSC CS (rev8)
URL : https://patchwork.freedesktop.org/series/111876/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_12627 -> Patchwork_111876v8
====================================================

Summary
-------

**SUCCESS**

No regressions found.

External URL: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_111876v8/index.html

Participating hosts (41 -> 35)
------------------------------

Missing (6): fi-kbl-soraka fi-rkl-11600 fi-tgl-dsi fi-snb-2520m fi-pnv-d510 fi-bsw-kefka

Known issues
------------

Here are the changes found in Patchwork_111876v8 that come from known issues:

### IGT changes ###

#### Issues hit ####

* igt@i915_selftest@live@gt_heartbeat:
- fi-apl-guc: [PASS][1] -> [DMESG-FAIL][2] ([i915#5334])
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12627/fi-apl-guc/igt@i915_selftest@live@gt_heartbeat.html
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_111876v8/fi-apl-guc/igt@i915_selftest@live@gt_heartbeat.html

#### Possible fixes ####

* igt@i915_selftest@live@guc:
- {bat-rpls-2}: [DMESG-WARN][3] ([i915#7852]) -> [PASS][4]
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12627/bat-rpls-2/igt@i915_selftest@[email protected]
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_111876v8/bat-rpls-2/igt@i915_selftest@[email protected]

* igt@i915_selftest@live@hangcheck:
- {bat-dg1-7}: [INCOMPLETE][5] ([i915#4983]) -> [PASS][6]
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12627/bat-dg1-7/igt@i915_selftest@[email protected]
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_111876v8/bat-dg1-7/igt@i915_selftest@[email protected]

* igt@i915_selftest@live@reset:
- {bat-rpls-1}: [DMESG-FAIL][7] ([i915#4983]) -> [PASS][8]
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12627/bat-rpls-1/igt@i915_selftest@[email protected]
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_111876v8/bat-rpls-1/igt@i915_selftest@[email protected]

{name}: This element is suppressed. This means it is ignored when computing
the status of the difference (SUCCESS, WARNING, or FAILURE).

[i915#4078]: https://gitlab.freedesktop.org/drm/intel/issues/4078
[i915#4983]: https://gitlab.freedesktop.org/drm/intel/issues/4983
[i915#5334]: https://gitlab.freedesktop.org/drm/intel/issues/5334
[i915#7359]: https://gitlab.freedesktop.org/drm/intel/issues/7359
[i915#7625]: https://gitlab.freedesktop.org/drm/intel/issues/7625
[i915#7828]: https://gitlab.freedesktop.org/drm/intel/issues/7828
[i915#7852]: https://gitlab.freedesktop.org/drm/intel/issues/7852

Build changes
-------------

* Linux: CI_DRM_12627 -> Patchwork_111876v8

CI-20190529: 20190529
CI_DRM_12627: a89114c496133077159d90f4ffc0ab3a5e6e89c0 @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_7136: 31b6af91747ad8c705399c9006cdb81cb1864146 @ https://gitlab.freedesktop.org/drm/igt-gpu-tools.git
Patchwork_111876v8: a89114c496133077159d90f4ffc0ab3a5e6e89c0 @ git://anongit.freedesktop.org/gfx-ci/linux

### Linux commits

2ec48fe121ac drm/i915/mtl: Add HDCP GSC interface d58561b33f14 drm/i915/mtl: Add function to send command to GSC CS 214b7b5ea3e3 drm/i915/hdcp: Refactor HDCP API structures b66a1e6bc92c i915/hdcp: HDCP2.x Refactoring to agnostic hdcp 6083a73d7f6c drm/i915/hdcp: Keep hdcp agonstic naming convention 083d344ec146 drm/i915/gsc: Create GSC request submission mechanism

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_111876v8/index.html

#12 lore raw

[Intel-gfx] ✓ Fi.CI.IGT: success for Enable HDCP2.x via GSC CS (rev8)

In reply to Suraj Kandpal
== Series Details ==

== Series Details ==

Series: Enable HDCP2.x via GSC CS (rev8)
URL : https://patchwork.freedesktop.org/series/111876/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_12627_full -> Patchwork_111876v8_full
====================================================

Summary
-------

**SUCCESS**

No regressions found.

External URL: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_111876v8/index.html

Participating hosts (13 -> 11)
------------------------------

Missing (2): pig-skl-6260u pig-kbl-iris

Known issues
------------

Here are the changes found in Patchwork_111876v8_full that come from known issues:

### IGT changes ###

#### Issues hit ####

* igt@gem_exec_fair@basic-none-share@rcs0:
- shard-glk: [PASS][1] -> [FAIL][2] ([i915#2842])
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12627/shard-glk9/igt@gem_exec_fair@[email protected]
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_111876v8/shard-glk3/igt@gem_exec_fair@[email protected]

* igt@gem_exec_fair@basic-pace@vcs0:
- shard-glk: NOTRUN -> [FAIL][3] ([i915#2842]) +1 similar issue
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_111876v8/shard-glk5/igt@gem_exec_fair@[email protected]

* igt@gem_lmem_swapping@smem-oom:
- shard-glk: NOTRUN -> [SKIP][4] ([fdo#109271] / [i915#4613])
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_111876v8/shard-glk5/igt@[email protected]

* igt@kms_big_fb@4-tiled-max-hw-stride-32bpp-rotate-0-hflip-async-flip:
- shard-glk: NOTRUN -> [SKIP][5] ([fdo#109271]) +39 similar issues
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_111876v8/shard-glk5/igt@kms_big_fb@4-tiled-max-hw-stride-32bpp-rotate-0-hflip-async-flip.html

* igt@kms_ccs@pipe-a-crc-sprite-planes-basic-y_tiled_gen12_rc_ccs_cc:
- shard-glk: NOTRUN -> [SKIP][6] ([fdo#109271] / [i915#3886]) +4 similar issues
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_111876v8/shard-glk5/igt@kms_ccs@pipe-a-crc-sprite-planes-basic-y_tiled_gen12_rc_ccs_cc.html

#### Possible fixes ####

* igt@drm_fdinfo@most-busy-idle-check-all@rcs0:
- {shard-rkl}: [FAIL][7] ([i915#7742]) -> [PASS][8]
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12627/shard-rkl-1/igt@drm_fdinfo@[email protected]
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_111876v8/shard-rkl-2/igt@drm_fdinfo@[email protected]

* igt@fbdev@info:
- {shard-rkl}: [SKIP][9] ([i915#2582]) -> [PASS][10] +1 similar issue
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12627/shard-rkl-3/igt@[email protected]
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_111876v8/shard-rkl-6/igt@[email protected]

* igt@gem_exec_fair@basic-none-share@rcs0:
- {shard-rkl}: [FAIL][11] ([i915#2842]) -> [PASS][12]
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12627/shard-rkl-5/igt@gem_exec_fair@[email protected]
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_111876v8/shard-rkl-5/igt@gem_exec_fair@[email protected]

* igt@gem_exec_reloc@basic-gtt-cpu-noreloc:
- {shard-rkl}: [SKIP][13] ([i915#3281]) -> [PASS][14] +2 similar issues
[13]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12627/shard-rkl-1/igt@[email protected]
[14]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_111876v8/shard-rkl-5/igt@[email protected]

* igt@gem_pread@bench:
- {shard-rkl}: [SKIP][15] ([i915#3282]) -> [PASS][16] +1 similar issue
[15]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12627/shard-rkl-1/igt@[email protected]
[16]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_111876v8/shard-rkl-5/igt@[email protected]

* igt@i915_pm_rpm@modeset-lpsp-stress:
- {shard-rkl}: [SKIP][17] ([i915#1397]) -> [PASS][18]
[17]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12627/shard-rkl-2/igt@[email protected]
[18]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_111876v8/shard-rkl-6/igt@[email protected]

* igt@i915_pm_rpm@modeset-lpsp-stress-no-wait:
- {shard-dg1}: [SKIP][19] ([i915#1397]) -> [PASS][20]
[19]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12627/shard-dg1-13/igt@[email protected]
[20]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_111876v8/shard-dg1-14/igt@[email protected]

* igt@i915_suspend@fence-restore-tiled2untiled:
- {shard-rkl}: [FAIL][21] ([fdo#103375]) -> [PASS][22]
[21]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12627/shard-rkl-3/igt@[email protected]
[22]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_111876v8/shard-rkl-6/igt@[email protected]

* igt@kms_atomic@plane-overlay-legacy:
- {shard-rkl}: [SKIP][23] ([i915#1845] / [i915#4098]) -> [PASS][24] +25 similar issues
[23]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12627/shard-rkl-3/igt@[email protected]
[24]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_111876v8/shard-rkl-6/igt@[email protected]

* igt@kms_frontbuffer_tracking@fbc-1p-primscrn-cur-indfb-draw-pwrite:
- {shard-rkl}: [SKIP][25] ([i915#1849] / [i915#4098]) -> [PASS][26] +16 similar issues
[25]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12627/shard-rkl-3/igt@kms_frontbuffer_tracking@fbc-1p-primscrn-cur-indfb-draw-pwrite.html
[26]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_111876v8/shard-rkl-6/igt@kms_frontbuffer_tracking@fbc-1p-primscrn-cur-indfb-draw-pwrite.html

* igt@kms_plane@plane-panning-bottom-right@pipe-a-planes:
- {shard-rkl}: [SKIP][27] ([i915#1849]) -> [PASS][28] +1 similar issue
[27]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12627/shard-rkl-2/igt@kms_plane@[email protected]
[28]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_111876v8/shard-rkl-6/igt@kms_plane@[email protected]

* igt@kms_psr@cursor_mmap_cpu:
- {shard-rkl}: [SKIP][29] ([i915#1072]) -> [PASS][30] +2 similar issues
[29]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12627/shard-rkl-3/igt@kms_psr@cursor_mmap_cpu.html
[30]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_111876v8/shard-rkl-6/igt@kms_psr@cursor_mmap_cpu.html

* igt@kms_universal_plane@universal-plane-pipe-a-functional:
- {shard-rkl}: [SKIP][31] ([i915#1845] / [i915#4070] / [i915#4098]) -> [PASS][32]
[31]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12627/shard-rkl-1/igt@[email protected]
[32]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_111876v8/shard-rkl-6/igt@[email protected]

* igt@perf_pmu@idle@rcs0:
- {shard-rkl}: [FAIL][33] ([i915#4349]) -> [PASS][34]
[33]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12627/shard-rkl-1/igt@perf_pmu@[email protected]
[34]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_111876v8/shard-rkl-3/igt@perf_pmu@[email protected]

* igt@sysfs_heartbeat_interval@precise@vcs1:
- {shard-dg1}: [FAIL][35] ([i915#1755]) -> [PASS][36]
[35]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12627/shard-dg1-17/igt@sysfs_heartbeat_interval@[email protected]
[36]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_111876v8/shard-dg1-18/igt@sysfs_heartbeat_interval@[email protected]

{name}: This element is suppressed. This means it is ignored when computing
the status of the difference (SUCCESS, WARNING, or FAILURE).

[fdo#103375]: https://bugs.freedesktop.org/show_bug.cgi?id=103375
[fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
[fdo#109274]: https://bugs.freedesktop.org/show_bug.cgi?id=109274
[fdo#109279]: https://bugs.freedesktop.org/show_bug.cgi?id=109279
[fdo#109280]: https://bugs.freedesktop.org/show_bug.cgi?id=109280
[fdo#109283]: https://bugs.freedesktop.org/show_bug.cgi?id=109283
[fdo#109285]: https://bugs.freedesktop.org/show_bug.cgi?id=109285
[fdo#109289]: https://bugs.freedesktop.org/show_bug.cgi?id=109289
[fdo#109295]: https://bugs.freedesktop.org/show_bug.cgi?id=109295
[fdo#109307]: https://bugs.freedesktop.org/show_bug.cgi?id=109307
[fdo#109309]: https://bugs.freedesktop.org/show_bug.cgi?id=109309
[fdo#109312]: https://bugs.freedesktop.org/show_bug.cgi?id=109312
[fdo#109313]: https://bugs.freedesktop.org/show_bug.cgi?id=109313
[fdo#109314]: https://bugs.freedesktop.org/show_bug.cgi?id=109314
[fdo#109315]: https://bugs.freedesktop.org/show_bug.cgi?id=109315
[fdo#109506]: https://bugs.freedesktop.org/show_bug.cgi?id=109506
[fdo#109642]: https://bugs.freedesktop.org/show_bug.cgi?id=109642
[fdo#110189]: https://bugs.freedesktop.org/show_bug.cgi?id=110189
[fdo#110542]: https://bugs.freedesktop.org/show_bug.cgi?id=110542
[fdo#110723]: https://bugs.freedesktop.org/show_bug.cgi?id=110723
[fdo#111068]: https://bugs.freedesktop.org/show_bug.cgi?id=111068
[fdo#111614]: https://bugs.freedesktop.org/show_bug.cgi?id=111614
[fdo#111615]: https://bugs.freedesktop.org/show_bug.cgi?id=111615
[fdo#111644]: https://bugs.freedesktop.org/show_bug.cgi?id=111644
[fdo#111656]: https://bugs.freedesktop.org/show_bug.cgi?id=111656
[fdo#111825]: https://bugs.freedesktop.org/show_bug.cgi?id=111825
[fdo#111827]: https://bugs.freedesktop.org/show_bug.cgi?id=111827
[fdo#112054]: https://bugs.freedesktop.org/show_bug.cgi?id=112054
[fdo#112283]: https://bugs.freedesktop.org/show_bug.cgi?id=112283
[i915#1072]: https://gitlab.freedesktop.org/drm/intel/issues/1072
[i915#132]: https://gitlab.freedesktop.org/drm/intel/issues/132
[i915#1397]: https://gitlab.freedesktop.org/drm/intel/issues/1397
[i915#1755]: https://gitlab.freedesktop.org/drm/intel/issues/1755
[i915#1825]: https://gitlab.freedesktop.org/drm/intel/issues/1825
[i915#1839]: https://gitlab.freedesktop.org/drm/intel/issues/1839
[i915#1845]: https://gitlab.freedesktop.org/drm/intel/issues/1845
[i915#1849]: https://gitlab.freedesktop.org/drm/intel/issues/1849
[i915#2433]: https://gitlab.freedesktop.org/drm/intel/issues/2433
[i915#2434]: https://gitlab.freedesktop.org/drm/intel/issues/2434
[i915#2436]: https://gitlab.freedesktop.org/drm/intel/issues/2436
[i915#2437]: https://gitlab.freedesktop.org/drm/intel/issues/2437
[i915#2527]: https://gitlab.freedesktop.org/drm/intel/issues/2527
[i915#2532]: https://gitlab.freedesktop.org/drm/intel/issues/2532
[i915#2575]: https://gitlab.freedesktop.org/drm/intel/issues/2575
[i915#2582]: https://gitlab.freedesktop.org/drm/intel/issues/2582
[i915#2587]: https://gitlab.freedesktop.org/drm/intel/issues/2587
[i915#2658]: https://gitlab.freedesktop.org/drm/intel/issues/2658
[i915#2672]: https://gitlab.freedesktop.org/drm/intel/issues/2672
[i915#2681]: https://gitlab.freedesktop.org/drm/intel/issues/2681
[i915#2705]: https://gitlab.freedesktop.org/drm/intel/issues/2705
[i915#280]: https://gitlab.freedesktop.org/drm/intel/issues/280
[i915#2842]: https://gitlab.freedesktop.org/drm/intel/issues/2842
[i915#2856]: https://gitlab.freedesktop.org/drm/intel/issues/2856
[i915#2920]: https://gitlab.freedesktop.org/drm/intel/issues/2920
[i915#3116]: https://gitlab.freedesktop.org/drm/intel/issues/3116
[i915#3281]: https://gitlab.freedesktop.org/drm/intel/issues/3281
[i915#3282]: https://gitlab.freedesktop.org/drm/intel/issues/3282
[i915#3297]: https://gitlab.freedesktop.org/drm/intel/issues/3297
[i915#3299]: https://gitlab.freedesktop.org/drm/intel/issues/3299
[i915#3301]: https://gitlab.freedesktop.org/drm/intel/issues/3301
[i915#3359]: https://gitlab.freedesktop.org/drm/intel/issues/3359
[i915#3458]: https://gitlab.freedesktop.org/drm/intel/issues/3458
[i915#3469]: https://gitlab.freedesktop.org/drm/intel/issues/3469
[i915#3539]: https://gitlab.freedesktop.org/drm/intel/issues/3539
[i915#3546]: https://gitlab.freedesktop.org/drm/intel/issues/3546
[i915#3555]: https://gitlab.freedesktop.org/drm/intel/issues/3555
[i915#3591]: https://gitlab.freedesktop.org/drm/intel/issues/3591
[i915#3637]: https://gitlab.freedesktop.org/drm/intel/issues/3637
[i915#3638]: https://gitlab.freedesktop.org/drm/intel/issues/3638
[i915#3689]: https://gitlab.freedesktop.org/drm/intel/issues/3689
[i915#3734]: https://gitlab.freedesktop.org/drm/intel/issues/3734
[i915#3742]: https://gitlab.freedesktop.org/drm/intel/issues/3742
[i915#3804]: https://gitlab.freedesktop.org/drm/intel/issues/3804
[i915#3826]: https://gitlab.freedesktop.org/drm/intel/issues/3826
[i915#3840]: https://gitlab.freedesktop.org/drm/intel/issues/3840
[i915#3886]: https://gitlab.freedesktop.org/drm/intel/issues/3886
[i915#3952]: https://gitlab.freedesktop.org/drm/intel/issues/3952
[i915#3955]: https://gitlab.freedesktop.org/drm/intel/issues/3955
[i915#4036]: https://gitlab.freedesktop.org/drm/intel/issues/4036
[i915#404]: https://gitlab.freedesktop.org/drm/intel/issues/404
[i915#4070]: https://gitlab.freedesktop.org/drm/intel/issues/4070
[i915#4077]: https://gitlab.freedesktop.org/drm/intel/issues/4077
[i915#4083]: https://gitlab.freedesktop.org/drm/intel/issues/4083
[i915#4098]: https://gitlab.freedesktop.org/drm/intel/issues/4098
[i915#4212]: https://gitlab.freedesktop.org/drm/intel/issues/4212
[i915#426]: https://gitlab.freedesktop.org/drm/intel/issues/426
[i915#4270]: https://gitlab.freedesktop.org/drm/intel/issues/4270
[i915#4312]: https://gitlab.freedesktop.org/drm/intel/issues/4312
[i915#433]: https://gitlab.freedesktop.org/drm/intel/issues/433
[i915#4349]: https://gitlab.freedesktop.org/drm/intel/issues/4349
[i915#4538]: https://gitlab.freedesktop.org/drm/intel/issues/4538
[i915#4565]: https://gitlab.freedesktop.org/drm/intel/issues/4565
[i915#4613]: https://gitlab.freedesktop.org/drm/intel/issues/4613
[i915#4767]: https://gitlab.freedesktop.org/drm/intel/issues/4767
[i915#4771]: https://gitlab.freedesktop.org/drm/intel/issues/4771
[i915#4812]: https://gitlab.freedesktop.org/drm/intel/issues/4812
[i915#4833]: https://gitlab.freedesktop.org/drm/intel/issues/4833
[i915#4852]: https://gitlab.freedesktop.org/drm/intel/issues/4852
[i915#4880]: https://gitlab.freedesktop.org/drm/intel/issues/4880
[i915#4983]: https://gitlab.freedesktop.org/drm/intel/issues/4983
[i915#5176]: https://gitlab.freedesktop.org/drm/intel/issues/5176
[i915#5235]: https://gitlab.freedesktop.org/drm/intel/issues/5235
[i915#5286]: https://gitlab.freedesktop.org/drm/intel/issues/5286
[i915#5288]: https://gitlab.freedesktop.org/drm/intel/issues/5288
[i915#5289]: https://gitlab.freedesktop.org/drm/intel/issues/5289
[i915#5325]: https://gitlab.freedesktop.org/drm/intel/issues/5325
[i915#533]: https://gitlab.freedesktop.org/drm/intel/issues/533
[i915#5439]: https://gitlab.freedesktop.org/drm/intel/issues/5439
[i915#5461]: https://gitlab.freedesktop.org/drm/intel/issues/5461
[i915#5563]: https://gitlab.freedesktop.org/drm/intel/issues/5563
[i915#5784]: https://gitlab.freedesktop.org/drm/intel/issues/5784
[i915#6095]: https://gitlab.freedesktop.org/drm/intel/issues/6095
[i915#6117]: https://gitlab.freedesktop.org/drm/intel/issues/6117
[i915#6227]: https://gitlab.freedesktop.org/drm/intel/issues/6227
[i915#6230]: https://gitlab.freedesktop.org/drm/intel/issues/6230
[i915#6245]: https://gitlab.freedesktop.org/drm/intel/issues/6245
[i915#6248]: https://gitlab.freedesktop.org/drm/intel/issues/6248
[i915#6334]: https://gitlab.freedesktop.org/drm/intel/issues/6334
[i915#6335]: https://gitlab.freedesktop.org/drm/intel/issues/6335
[i915#6355]: https://gitlab.freedesktop.org/drm/intel/issues/6355
[i915#6433]: https://gitlab.freedesktop.org/drm/intel/issues/6433
[i915#6463]: https://gitlab.freedesktop.org/drm/intel/issues/6463
[i915#6497]: https://gitlab.freedesktop.org/drm/intel/issues/6497
[i915#6524]: https://gitlab.freedesktop.org/drm/intel/issues/6524
[i915#658]: https://gitlab.freedesktop.org/drm/intel/issues/658
[i915#6590]: https://gitlab.freedesktop.org/drm/intel/issues/6590
[i915#6621]: https://gitlab.freedesktop.org/drm/intel/issues/6621
[i915#6768]: https://gitlab.freedesktop.org/drm/intel/issues/6768
[i915#6944]: https://gitlab.freedesktop.org/drm/intel/issues/6944
[i915#6946]: https://gitlab.freedesktop.org/drm/intel/issues/6946
[i915#6953]: https://gitlab.freedesktop.org/drm/intel/issues/6953
[i915#7052]: https://gitlab.freedesktop.org/drm/intel/issues/7052
[i915#7116]: https://gitlab.freedesktop.org/drm/intel/issues/7116
[i915#7118]: https://gitlab.freedesktop.org/drm/intel/issues/7118
[i915#7128]: https://gitlab.freedesktop.org/drm/intel/issues/7128
[i915#7178]: https://gitlab.freedesktop.org/drm/intel/issues/7178
[i915#7294]: https://gitlab.freedesktop.org/drm/intel/issues/7294
[i915#7456]: https://gitlab.freedesktop.org/drm/intel/issues/7456
[i915#7561]: https://gitlab.freedesktop.org/drm/intel/issues/7561
[i915#7651]: https://gitlab.freedesktop.org/drm/intel/issues/7651
[i915#7697]: https://gitlab.freedesktop.org/drm/intel/issues/7697
[i915#7701]: https://gitlab.freedesktop.org/drm/intel/issues/7701
[i915#7707]: https://gitlab.freedesktop.org/drm/intel/issues/7707
[i915#7711]: https://gitlab.freedesktop.org/drm/intel/issues/7711
[i915#7742]: https://gitlab.freedesktop.org/drm/intel/issues/7742
[i915#7828]: https://gitlab.freedesktop.org/drm/intel/issues/7828

Build changes
-------------

* Linux: CI_DRM_12627 -> Patchwork_111876v8
* Piglit: piglit_4509 -> None

CI-20190529: 20190529
CI_DRM_12627: a89114c496133077159d90f4ffc0ab3a5e6e89c0 @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_7136: 31b6af91747ad8c705399c9006cdb81cb1864146 @ https://gitlab.freedesktop.org/drm/igt-gpu-tools.git
Patchwork_111876v8: a89114c496133077159d90f4ffc0ab3a5e6e89c0 @ git://anongit.freedesktop.org/gfx-ci/linux
piglit_4509: fdc5a4ca11124ab8413c7988896eec4c97336694 @ git://anongit.freedesktop.org/piglit

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_111876v8/index.html