All of lore.kernel.org
 help / color / mirror / Atom feed
* [igt-dev] [PATCH i-g-t v5 0/6] HDCP2.2 Tests
@ 2019-04-18  8:48 Ramalingam C
  2019-04-18  8:48 ` [igt-dev] [PATCH i-g-t v5 1/6] kms_content_protection: Content type support Ramalingam C
                   ` (8 more replies)
  0 siblings, 9 replies; 15+ messages in thread
From: Ramalingam C @ 2019-04-18  8:48 UTC (permalink / raw)
  To: igt-dev, daniel.vetter, arkadiusz.hiler

This series adds tests for:
	1. content_type which is added for HDCP2.2.
	     Adds a new test for Type1.
	     Adds another test for Type1 -> Type0.
	2. teardown and rebuild of i915-mei interface.
	     Removes the mei_hdcp and reloads it and test for HDCP2.2.
	3. downstream info gathering and SRM revocation.
	     Retrieves the receivers ID from downstream_info
	     fabricates a SRM and test for the revocation of the device.

Wait for HDCP state change is implemented through the uevent handler.

v5:
  srm is written into /lib/firmware/display_hdcp_srm.bin [Danvet]

Ramalingam C (6):
  kms_content_protection: Content type support
  kms_content_protection: test teardown and rebuild of I915-mei I/F
  kms_content_protection: test content type change
  kms_content_protection: uevent for HDCP status change
  kms_content_protection: srm and topology_info test
  DO NOT MERGE: CP in fast feedback list

 lib/igt_kms.c                         |   2 +
 lib/igt_kms.h                         |   2 +
 tests/intel-ci/fast-feedback.testlist |   3 +
 tests/kms_content_protection.c        | 498 ++++++++++++++++++++++++--
 4 files changed, 477 insertions(+), 28 deletions(-)

-- 
2.19.1

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [igt-dev] [PATCH i-g-t v5 1/6] kms_content_protection: Content type support
  2019-04-18  8:48 [igt-dev] [PATCH i-g-t v5 0/6] HDCP2.2 Tests Ramalingam C
@ 2019-04-18  8:48 ` Ramalingam C
  2019-04-18  8:48 ` [igt-dev] [PATCH i-g-t v5 2/6] kms_content_protection: test teardown and rebuild of I915-mei I/F Ramalingam C
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 15+ messages in thread
From: Ramalingam C @ 2019-04-18  8:48 UTC (permalink / raw)
  To: igt-dev, daniel.vetter, arkadiusz.hiler

Adds a connector property called "CP_Content_Type"

Content Type takes two values which classifies the content stream:
	Type 0: Stream that can be tranmitted on HDCP1.4/HDCP2.2
	Type 1: Stream that needs HDCP2.2 encryption only.

So when Type 1 is set KMD is forced to enable HDCP2.2 only.

For Type 0 request, Kernel chooses the highest capable HDCP version
(v2.2) first. If that fails, then it fall back to the next availble
version(v1.4) before abondoning HDCP autehntication attempts.

Please note content_type is allowed to be updated when "Content
Protection" is in UNDESIRED state.

v2:
  s/cp_content_type/content_ptotection_type [danvet]
v3:
  s/content_protection_type/HDCP Content Type [Pekka]

Signed-off-by: Ramalingam C <ramalingam.c@intel.com>
---
 lib/igt_kms.c                  |  1 +
 lib/igt_kms.h                  |  1 +
 tests/kms_content_protection.c | 77 ++++++++++++++++++++++++++++------
 3 files changed, 66 insertions(+), 13 deletions(-)

diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index df9aafd24bf8..18f0556687de 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -222,6 +222,7 @@ const char * const igt_connector_prop_names[IGT_NUM_CONNECTOR_PROPS] = {
 	[IGT_CONNECTOR_BROADCAST_RGB] = "Broadcast RGB",
 	[IGT_CONNECTOR_CONTENT_PROTECTION] = "Content Protection",
 	[IGT_CONNECTOR_VRR_CAPABLE] = "vrr_capable",
+	[IGT_CONNECTOR_HDCP_CONTENT_TYPE] = "HDCP Content Type",
 };
 
 /*
diff --git a/lib/igt_kms.h b/lib/igt_kms.h
index 38bdc08f3d50..b1430a517305 100644
--- a/lib/igt_kms.h
+++ b/lib/igt_kms.h
@@ -123,6 +123,7 @@ enum igt_atomic_connector_properties {
        IGT_CONNECTOR_BROADCAST_RGB,
        IGT_CONNECTOR_CONTENT_PROTECTION,
        IGT_CONNECTOR_VRR_CAPABLE,
+       IGT_CONNECTOR_HDCP_CONTENT_TYPE,
        IGT_NUM_CONNECTOR_PROPS
 };
 
diff --git a/tests/kms_content_protection.c b/tests/kms_content_protection.c
index ae6ab497ea21..8f0fca07c986 100644
--- a/tests/kms_content_protection.c
+++ b/tests/kms_content_protection.c
@@ -40,6 +40,13 @@ struct data {
 #define CP_DESIRED				1
 #define CP_ENABLED				2
 
+/*
+ * HDCP_CONTENT_TYPE_0 can be handled on both HDCP1.4 and HDCP2.2. Where as
+ * HDCP_CONTENT_TYPE_1 can be handled only through HDCP2.2.
+ */
+#define HDCP_CONTENT_TYPE_0				0
+#define HDCP_CONTENT_TYPE_1				1
+
 #define LIC_PERIOD_MSEC				(4 * 1000)
 /* Kernel retry count=3, Max time per authentication allowed = 6Sec */
 #define KERNEL_AUTH_TIME_ALLOWED_MSEC		(3 *  6 * 1000)
@@ -155,7 +162,8 @@ static void modeset_with_fb(const enum pipe pipe, igt_output_t *output,
 	commit_display_and_wait_for_flip(s);
 }
 
-static bool test_cp_enable(igt_output_t *output, enum igt_commit_style s)
+static bool test_cp_enable(igt_output_t *output, enum igt_commit_style s,
+			   int content_type)
 {
 	igt_display_t *display = &data.display;
 	igt_plane_t *primary;
@@ -165,6 +173,10 @@ static bool test_cp_enable(igt_output_t *output, enum igt_commit_style s)
 
 	igt_output_set_prop_value(output,
 				  IGT_CONNECTOR_CONTENT_PROTECTION, CP_DESIRED);
+	if (output->props[IGT_CONNECTOR_HDCP_CONTENT_TYPE])
+		igt_output_set_prop_value(output,
+					  IGT_CONNECTOR_HDCP_CONTENT_TYPE,
+					  content_type);
 	igt_display_commit2(display, s);
 
 	ret = wait_for_prop_value(output, CP_ENABLED,
@@ -201,13 +213,14 @@ static void test_cp_disable(igt_output_t *output, enum igt_commit_style s)
 }
 
 static void test_cp_enable_with_retry(igt_output_t *output,
-				      enum igt_commit_style s, int retry)
+				      enum igt_commit_style s, int retry,
+				      int content_type)
 {
 	bool ret;
 
 	do {
 		test_cp_disable(output, s);
-		ret = test_cp_enable(output, s);
+		ret = test_cp_enable(output, s, content_type);
 
 		if (!ret && --retry)
 			igt_debug("Retry (%d/2) ...\n", 3 - retry);
@@ -241,7 +254,7 @@ static void test_cp_lic(igt_output_t *output)
 
 static void test_content_protection_on_output(igt_output_t *output,
 					      enum igt_commit_style s,
-					      bool dpms_test)
+					      bool dpms_test, int content_type)
 {
 	igt_display_t *display = &data.display;
 	igt_plane_t *primary;
@@ -262,7 +275,7 @@ static void test_content_protection_on_output(igt_output_t *output,
 			continue;
 
 		modeset_with_fb(pipe, output, s);
-		test_cp_enable_with_retry(output, s, 3);
+		test_cp_enable_with_retry(output, s, 3, content_type);
 		test_cp_lic(output);
 
 		if (dpms_test) {
@@ -277,7 +290,8 @@ static void test_content_protection_on_output(igt_output_t *output,
 			ret = wait_for_prop_value(output, CP_ENABLED,
 						  KERNEL_AUTH_TIME_ALLOWED_MSEC);
 			if (!ret)
-				test_cp_enable_with_retry(output, s, 2);
+				test_cp_enable_with_retry(output, s,
+							  2, content_type);
 		}
 
 		test_cp_disable(output, s);
@@ -304,7 +318,8 @@ static void __debugfs_read(int fd, const char *param, char *buf, int len)
 
 #define debugfs_read(fd, p, arr) __debugfs_read(fd, p, arr, sizeof(arr))
 
-#define MAX_SINK_HDCP_CAP_BUF_LEN	500
+#define MAX_SINK_HDCP_CAP_BUF_LEN	5000
+
 static bool sink_hdcp_capable(igt_output_t *output)
 {
 	char buf[MAX_SINK_HDCP_CAP_BUF_LEN];
@@ -322,9 +337,26 @@ static bool sink_hdcp_capable(igt_output_t *output)
 	return strstr(buf, "HDCP1.4");
 }
 
+static bool sink_hdcp2_capable(igt_output_t *output)
+{
+	char buf[MAX_SINK_HDCP_CAP_BUF_LEN];
+	int fd;
+
+	fd = igt_debugfs_connector_dir(data.drm_fd, output->name, O_RDONLY);
+	if (fd < 0)
+		return false;
+
+	debugfs_read(fd, "i915_hdcp_sink_capability", buf);
+	close(fd);
+
+	igt_debug("Sink capability: %s\n", buf);
+
+	return strstr(buf, "HDCP2.2");
+}
 
 static void
-test_content_protection(enum igt_commit_style s, bool dpms_test)
+test_content_protection(enum igt_commit_style s, bool dpms_test,
+			int content_type)
 {
 	igt_display_t *display = &data.display;
 	igt_output_t *output;
@@ -334,14 +366,24 @@ test_content_protection(enum igt_commit_style s, bool dpms_test)
 		if (!output->props[IGT_CONNECTOR_CONTENT_PROTECTION])
 			continue;
 
+		if (!output->props[IGT_CONNECTOR_HDCP_CONTENT_TYPE] &&
+		    content_type)
+			continue;
+
 		igt_info("CP Test execution on %s\n", output->name);
-		if (!sink_hdcp_capable(output)) {
+
+		if (content_type && !sink_hdcp2_capable(output)) {
+			igt_info("\tSkip %s (Sink has no HDCP2.2 support)\n",
+				 output->name);
+			continue;
+		} else if (!sink_hdcp_capable(output)) {
 			igt_info("\tSkip %s (Sink has no HDCP support)\n",
 				 output->name);
 			continue;
 		}
 
-		test_content_protection_on_output(output, s, dpms_test);
+		test_content_protection_on_output(output, s, dpms_test,
+						  content_type);
 		valid_tests++;
 	}
 
@@ -359,16 +401,25 @@ igt_main
 	}
 
 	igt_subtest("legacy")
-		test_content_protection(COMMIT_LEGACY, false);
+		test_content_protection(COMMIT_LEGACY, false,
+					HDCP_CONTENT_TYPE_0);
 
 	igt_subtest("atomic") {
 		igt_require(data.display.is_atomic);
-		test_content_protection(COMMIT_ATOMIC, false);
+		test_content_protection(COMMIT_ATOMIC, false,
+					HDCP_CONTENT_TYPE_0);
 	}
 
 	igt_subtest("atomic-dpms") {
 		igt_require(data.display.is_atomic);
-		test_content_protection(COMMIT_ATOMIC, true);
+		test_content_protection(COMMIT_ATOMIC, true,
+					HDCP_CONTENT_TYPE_0);
+	}
+
+	igt_subtest("type1") {
+		igt_require(data.display.is_atomic);
+		test_content_protection(COMMIT_ATOMIC, false,
+					HDCP_CONTENT_TYPE_1);
 	}
 
 	igt_fixture
-- 
2.19.1

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [igt-dev] [PATCH i-g-t v5 2/6] kms_content_protection: test teardown and rebuild of I915-mei I/F
  2019-04-18  8:48 [igt-dev] [PATCH i-g-t v5 0/6] HDCP2.2 Tests Ramalingam C
  2019-04-18  8:48 ` [igt-dev] [PATCH i-g-t v5 1/6] kms_content_protection: Content type support Ramalingam C
@ 2019-04-18  8:48 ` Ramalingam C
  2019-04-18  8:48 ` [igt-dev] [PATCH i-g-t v5 3/6] kms_content_protection: test content type change Ramalingam C
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 15+ messages in thread
From: Ramalingam C @ 2019-04-18  8:48 UTC (permalink / raw)
  To: igt-dev, daniel.vetter, arkadiusz.hiler

To validate the teardown and rebuild of the interface between
I915 and mei hdcp this subtest execute the below sequence:
	1. Test HDCP2.2 Type 1 (expected to pass)
	2. Unload the mei_hdcp
	3. Test HDCP2.2 Type 1 (expected to fail)
	2. Reload the mei_hdcp
	1. Test HDCP2.2 Type 1 (expected to pass)

v2:
  Rebased.

Signed-off-by: Ramalingam C <ramalingam.c@intel.com>
---
 tests/kms_content_protection.c | 62 ++++++++++++++++++++++++++--------
 1 file changed, 48 insertions(+), 14 deletions(-)

diff --git a/tests/kms_content_protection.c b/tests/kms_content_protection.c
index 8f0fca07c986..b33b37b9379c 100644
--- a/tests/kms_content_protection.c
+++ b/tests/kms_content_protection.c
@@ -27,6 +27,7 @@
 #include "igt.h"
 #include "igt_sysfs.h"
 #include "igt_kms.h"
+#include "igt_kmod.h"
 
 IGT_TEST_DESCRIPTION("Test content protection (HDCP)");
 
@@ -214,7 +215,7 @@ static void test_cp_disable(igt_output_t *output, enum igt_commit_style s)
 
 static void test_cp_enable_with_retry(igt_output_t *output,
 				      enum igt_commit_style s, int retry,
-				      int content_type)
+				      int content_type, bool expect_failure)
 {
 	bool ret;
 
@@ -229,7 +230,11 @@ static void test_cp_enable_with_retry(igt_output_t *output,
 	if (!ret)
 		test_cp_disable(output, s);
 
-	igt_assert_f(ret, "Content Protection not enabled\n");
+	if (expect_failure)
+		igt_assert_f(!ret,
+			     "CP Enabled. Though it is expected to fail\n");
+	else
+		igt_assert_f(ret, "Content Protection not enabled\n");
 }
 
 static bool igt_pipe_is_free(igt_display_t *display, enum pipe pipe)
@@ -252,9 +257,10 @@ static void test_cp_lic(igt_output_t *output)
 	igt_assert_f(!ret, "Content Protection LIC Failed\n");
 }
 
-static void test_content_protection_on_output(igt_output_t *output,
-					      enum igt_commit_style s,
-					      bool dpms_test, int content_type)
+static void
+test_content_protection_on_output(igt_output_t *output, enum igt_commit_style s,
+				  bool dpms_test, int content_type,
+				  bool mei_reload_test)
 {
 	igt_display_t *display = &data.display;
 	igt_plane_t *primary;
@@ -275,7 +281,24 @@ static void test_content_protection_on_output(igt_output_t *output,
 			continue;
 
 		modeset_with_fb(pipe, output, s);
-		test_cp_enable_with_retry(output, s, 3, content_type);
+		test_cp_enable_with_retry(output, s, 3, content_type, false);
+
+		if (mei_reload_test) {
+			igt_assert_f(!igt_kmod_unload("mei_hdcp", 0),
+				     "mei_hdcp unload failed");
+
+			/* Expected to fail */
+			test_cp_enable_with_retry(output, s, 3,
+						  content_type, false, true);
+
+			igt_assert_f(!igt_kmod_load("mei_hdcp", NULL),
+				     "mei_hdcp load failed");
+
+			/* Expected to pass */
+			test_cp_enable_with_retry(output, s, 3,
+						  content_type, false, false);
+		}
+
 		test_cp_lic(output);
 
 		if (dpms_test) {
@@ -290,8 +313,8 @@ static void test_content_protection_on_output(igt_output_t *output,
 			ret = wait_for_prop_value(output, CP_ENABLED,
 						  KERNEL_AUTH_TIME_ALLOWED_MSEC);
 			if (!ret)
-				test_cp_enable_with_retry(output, s,
-							  2, content_type);
+				test_cp_enable_with_retry(output, s, 2,
+							  content_type, false);
 		}
 
 		test_cp_disable(output, s);
@@ -356,12 +379,16 @@ static bool sink_hdcp2_capable(igt_output_t *output)
 
 static void
 test_content_protection(enum igt_commit_style s, bool dpms_test,
-			int content_type)
+			int content_type, bool mei_reload_test)
 {
 	igt_display_t *display = &data.display;
 	igt_output_t *output;
 	int valid_tests = 0;
 
+	if (mei_reload_test)
+		igt_require_f(igt_kmod_is_loaded("mei_hdcp"),
+			      "mei_hdcp module is not loaded\n");
+
 	for_each_connected_output(display, output) {
 		if (!output->props[IGT_CONNECTOR_CONTENT_PROTECTION])
 			continue;
@@ -383,7 +410,8 @@ test_content_protection(enum igt_commit_style s, bool dpms_test,
 		}
 
 		test_content_protection_on_output(output, s, dpms_test,
-						  content_type);
+						  content_type,
+						  mei_reload_test);
 		valid_tests++;
 	}
 
@@ -402,24 +430,30 @@ igt_main
 
 	igt_subtest("legacy")
 		test_content_protection(COMMIT_LEGACY, false,
-					HDCP_CONTENT_TYPE_0);
+					HDCP_CONTENT_TYPE_0, false);
 
 	igt_subtest("atomic") {
 		igt_require(data.display.is_atomic);
 		test_content_protection(COMMIT_ATOMIC, false,
-					HDCP_CONTENT_TYPE_0);
+					HDCP_CONTENT_TYPE_0, false);
 	}
 
 	igt_subtest("atomic-dpms") {
 		igt_require(data.display.is_atomic);
 		test_content_protection(COMMIT_ATOMIC, true,
-					HDCP_CONTENT_TYPE_0);
+					HDCP_CONTENT_TYPE_0, false);
 	}
 
 	igt_subtest("type1") {
 		igt_require(data.display.is_atomic);
 		test_content_protection(COMMIT_ATOMIC, false,
-					HDCP_CONTENT_TYPE_1);
+					HDCP_CONTENT_TYPE_1, false);
+	}
+
+	igt_subtest("type1_mei_interface") {
+		igt_require(data.display.is_atomic);
+		test_content_protection(COMMIT_ATOMIC, false,
+					HDCP_CONTENT_TYPE_1, true);
 	}
 
 	igt_fixture
-- 
2.19.1

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [igt-dev] [PATCH i-g-t v5 3/6] kms_content_protection: test content type change
  2019-04-18  8:48 [igt-dev] [PATCH i-g-t v5 0/6] HDCP2.2 Tests Ramalingam C
  2019-04-18  8:48 ` [igt-dev] [PATCH i-g-t v5 1/6] kms_content_protection: Content type support Ramalingam C
  2019-04-18  8:48 ` [igt-dev] [PATCH i-g-t v5 2/6] kms_content_protection: test teardown and rebuild of I915-mei I/F Ramalingam C
@ 2019-04-18  8:48 ` Ramalingam C
  2019-04-29 14:40   ` Daniel Vetter
  2019-04-18  8:48 ` [igt-dev] [PATCH i-g-t v5 4/6] kms_content_protection: uevent for HDCP status change Ramalingam C
                   ` (5 subsequent siblings)
  8 siblings, 1 reply; 15+ messages in thread
From: Ramalingam C @ 2019-04-18  8:48 UTC (permalink / raw)
  To: igt-dev, daniel.vetter, arkadiusz.hiler

Testing the content type change when the content protection already
enabled.

Signed-off-by: Ramalingam C <ramalingam.c@intel.com>
---
 tests/kms_content_protection.c | 61 ++++++++++++++++++++++++----------
 1 file changed, 44 insertions(+), 17 deletions(-)

diff --git a/tests/kms_content_protection.c b/tests/kms_content_protection.c
index b33b37b9379c..754ce996640d 100644
--- a/tests/kms_content_protection.c
+++ b/tests/kms_content_protection.c
@@ -164,7 +164,7 @@ static void modeset_with_fb(const enum pipe pipe, igt_output_t *output,
 }
 
 static bool test_cp_enable(igt_output_t *output, enum igt_commit_style s,
-			   int content_type)
+			   int content_type, bool test_type_change)
 {
 	igt_display_t *display = &data.display;
 	igt_plane_t *primary;
@@ -172,8 +172,11 @@ static bool test_cp_enable(igt_output_t *output, enum igt_commit_style s,
 
 	primary = igt_output_get_plane_type(output, DRM_PLANE_TYPE_PRIMARY);
 
-	igt_output_set_prop_value(output,
-				  IGT_CONNECTOR_CONTENT_PROTECTION, CP_DESIRED);
+	if (!test_type_change)
+		igt_output_set_prop_value(output,
+					  IGT_CONNECTOR_CONTENT_PROTECTION,
+					  CP_DESIRED);
+
 	if (output->props[IGT_CONNECTOR_HDCP_CONTENT_TYPE])
 		igt_output_set_prop_value(output,
 					  IGT_CONNECTOR_HDCP_CONTENT_TYPE,
@@ -215,13 +218,17 @@ static void test_cp_disable(igt_output_t *output, enum igt_commit_style s)
 
 static void test_cp_enable_with_retry(igt_output_t *output,
 				      enum igt_commit_style s, int retry,
-				      int content_type, bool expect_failure)
+				      int content_type, bool expect_failure,
+				      bool test_type_change)
 {
+	int retry_orig = retry;
 	bool ret;
 
 	do {
-		test_cp_disable(output, s);
-		ret = test_cp_enable(output, s, content_type);
+		if (!test_type_change || retry_orig != retry)
+			test_cp_disable(output, s);
+
+		ret = test_cp_enable(output, s, content_type, test_type_change);
 
 		if (!ret && --retry)
 			igt_debug("Retry (%d/2) ...\n", 3 - retry);
@@ -260,7 +267,7 @@ static void test_cp_lic(igt_output_t *output)
 static void
 test_content_protection_on_output(igt_output_t *output, enum igt_commit_style s,
 				  bool dpms_test, int content_type,
-				  bool mei_reload_test)
+				  bool mei_reload_test, bool test_type_change)
 {
 	igt_display_t *display = &data.display;
 	igt_plane_t *primary;
@@ -281,7 +288,12 @@ test_content_protection_on_output(igt_output_t *output, enum igt_commit_style s,
 			continue;
 
 		modeset_with_fb(pipe, output, s);
-		test_cp_enable_with_retry(output, s, 3, content_type, false);
+		test_cp_enable_with_retry(output, s, 3, content_type, false,
+					  false);
+		if (test_type_change && content_type == HDCP_CONTENT_TYPE_1)
+			test_cp_enable_with_retry(output, s, 3,
+						  HDCP_CONTENT_TYPE_0, false,
+						  test_type_change);
 
 		if (mei_reload_test) {
 			igt_assert_f(!igt_kmod_unload("mei_hdcp", 0),
@@ -289,7 +301,7 @@ test_content_protection_on_output(igt_output_t *output, enum igt_commit_style s,
 
 			/* Expected to fail */
 			test_cp_enable_with_retry(output, s, 3,
-						  content_type, false, true);
+						  content_type, true, false);
 
 			igt_assert_f(!igt_kmod_load("mei_hdcp", NULL),
 				     "mei_hdcp load failed");
@@ -314,7 +326,8 @@ test_content_protection_on_output(igt_output_t *output, enum igt_commit_style s,
 						  KERNEL_AUTH_TIME_ALLOWED_MSEC);
 			if (!ret)
 				test_cp_enable_with_retry(output, s, 2,
-							  content_type, false);
+							  content_type, false,
+							  false);
 		}
 
 		test_cp_disable(output, s);
@@ -379,7 +392,8 @@ static bool sink_hdcp2_capable(igt_output_t *output)
 
 static void
 test_content_protection(enum igt_commit_style s, bool dpms_test,
-			int content_type, bool mei_reload_test)
+			int content_type, bool mei_reload_test,
+			bool test_type_change)
 {
 	igt_display_t *display = &data.display;
 	igt_output_t *output;
@@ -411,7 +425,8 @@ test_content_protection(enum igt_commit_style s, bool dpms_test,
 
 		test_content_protection_on_output(output, s, dpms_test,
 						  content_type,
-						  mei_reload_test);
+						  mei_reload_test,
+						  test_type_change);
 		valid_tests++;
 	}
 
@@ -430,30 +445,42 @@ igt_main
 
 	igt_subtest("legacy")
 		test_content_protection(COMMIT_LEGACY, false,
-					HDCP_CONTENT_TYPE_0, false);
+					HDCP_CONTENT_TYPE_0, false,
+					false);
 
 	igt_subtest("atomic") {
 		igt_require(data.display.is_atomic);
 		test_content_protection(COMMIT_ATOMIC, false,
-					HDCP_CONTENT_TYPE_0, false);
+					HDCP_CONTENT_TYPE_0, false,
+					false);
 	}
 
 	igt_subtest("atomic-dpms") {
 		igt_require(data.display.is_atomic);
 		test_content_protection(COMMIT_ATOMIC, true,
-					HDCP_CONTENT_TYPE_0, false);
+					HDCP_CONTENT_TYPE_0, false,
+					false);
 	}
 
 	igt_subtest("type1") {
 		igt_require(data.display.is_atomic);
 		test_content_protection(COMMIT_ATOMIC, false,
-					HDCP_CONTENT_TYPE_1, false);
+					HDCP_CONTENT_TYPE_1, false,
+					false);
 	}
 
 	igt_subtest("type1_mei_interface") {
 		igt_require(data.display.is_atomic);
 		test_content_protection(COMMIT_ATOMIC, false,
-					HDCP_CONTENT_TYPE_1, true);
+					HDCP_CONTENT_TYPE_1, true,
+					false);
+	}
+
+	igt_subtest("content_type_change") {
+		igt_require(data.display.is_atomic);
+		test_content_protection(COMMIT_ATOMIC, false,
+					HDCP_CONTENT_TYPE_1, false,
+					true);
 	}
 
 	igt_fixture
-- 
2.19.1

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [igt-dev] [PATCH i-g-t v5 4/6] kms_content_protection: uevent for HDCP status change
  2019-04-18  8:48 [igt-dev] [PATCH i-g-t v5 0/6] HDCP2.2 Tests Ramalingam C
                   ` (2 preceding siblings ...)
  2019-04-18  8:48 ` [igt-dev] [PATCH i-g-t v5 3/6] kms_content_protection: test content type change Ramalingam C
@ 2019-04-18  8:48 ` Ramalingam C
  2019-04-29 15:17   ` Daniel Vetter
  2019-04-18  8:48 ` [igt-dev] [PATCH i-g-t v5 5/6] kms_content_protection: srm and topology_info test Ramalingam C
                   ` (4 subsequent siblings)
  8 siblings, 1 reply; 15+ messages in thread
From: Ramalingam C @ 2019-04-18  8:48 UTC (permalink / raw)
  To: igt-dev, daniel.vetter, arkadiusz.hiler

To detect the HDCP status change we are reading the uevent sent with the
corresponding connector id and property id.

This avoids the polling of the property every mSec.

Signed-off-by: Ramalingam C <ramalingam.c@intel.com>
---
 tests/kms_content_protection.c | 152 +++++++++++++++++++++++++++++++--
 1 file changed, 144 insertions(+), 8 deletions(-)

diff --git a/tests/kms_content_protection.c b/tests/kms_content_protection.c
index 754ce996640d..48f89571dcff 100644
--- a/tests/kms_content_protection.c
+++ b/tests/kms_content_protection.c
@@ -24,6 +24,9 @@
 
 #include <poll.h>
 #include <fcntl.h>
+#include <sys/epoll.h>
+#include <sys/stat.h>
+#include <libudev.h>
 #include "igt.h"
 #include "igt_sysfs.h"
 #include "igt_kms.h"
@@ -95,20 +98,153 @@ static int wait_flip_event(void)
 	return rc;
 }
 
+static bool hdcp_event(struct udev_monitor *uevent_monitor,
+		       struct udev *udev, uint32_t conn_id, uint32_t prop_id)
+{
+	struct udev_device *dev;
+	dev_t udev_devnum;
+	struct stat s;
+	const char *hotplug, *connector, *property;
+	bool ret = false;
+
+	dev = udev_monitor_receive_device(uevent_monitor);
+	if (!dev)
+		goto out;
+
+	udev_devnum = udev_device_get_devnum(dev);
+	fstat(data.display.drm_fd, &s);
+
+	hotplug = udev_device_get_property_value(dev, "HOTPLUG");
+	if (!(memcmp(&s.st_rdev, &udev_devnum, sizeof(dev_t)) == 0 &&
+	    hotplug && atoi(hotplug) == 1)) {
+		igt_debug("Not a Hotplug event\n");
+		goto out_dev;
+	}
+
+	connector = udev_device_get_property_value(dev, "CONNECTOR");
+	if (!(memcmp(&s.st_rdev, &udev_devnum, sizeof(dev_t)) == 0 &&
+	    connector && atoi(connector) == conn_id)) {
+		igt_debug("Not for connector id: %u\n", conn_id);
+		goto out_dev;
+	}
+
+	property = udev_device_get_property_value(dev, "PROPERTY");
+	if (!(memcmp(&s.st_rdev, &udev_devnum, sizeof(dev_t)) == 0 &&
+	    property && atoi(property) == prop_id)) {
+		igt_debug("Not for property id: %u\n", prop_id);
+		goto out_dev;
+	}
+	ret = true;
+
+out_dev:
+	udev_device_unref(dev);
+out:
+	return ret;
+}
+
+static void hdcp_udev_fini(struct udev_monitor *uevent_monitor,
+			   struct udev *udev)
+{
+	if (uevent_monitor)
+		udev_monitor_unref(uevent_monitor);
+	if (udev)
+		udev_unref(udev);
+}
+
+static int hdcp_udev_init(struct udev_monitor *uevent_monitor,
+			  struct udev *udev)
+{
+	int ret = -EINVAL;
+
+	udev = udev_new();
+	if (!udev) {
+		igt_info("failed to create udev object\n");
+		goto out;
+	}
+
+	uevent_monitor = udev_monitor_new_from_netlink(udev, "udev");
+	if (!uevent_monitor) {
+		igt_info("failed to create udev event monitor\n");
+		goto out;
+	}
+
+	ret = udev_monitor_filter_add_match_subsystem_devtype(uevent_monitor,
+							      "drm",
+							      "drm_minor");
+	if (ret < 0) {
+		igt_info("failed to filter for drm events\n");
+		goto out;
+	}
+
+	ret = udev_monitor_enable_receiving(uevent_monitor);
+	if (ret < 0) {
+		igt_info("failed to enable udev event reception\n");
+		goto out;
+	}
+
+	return udev_monitor_get_fd(uevent_monitor);
+
+out:
+	hdcp_udev_fini(uevent_monitor, udev);
+	return ret;
+}
+
+#define MAX_EVENTS	10
+static bool wait_for_hdcp_event(uint32_t conn_id, uint32_t prop_id,
+				uint32_t timeout_mSec)
+{
+
+	struct udev_monitor *uevent_monitor = NULL;
+	struct udev *udev = NULL;
+	int udev_fd, epoll_fd;
+	struct epoll_event event, events[MAX_EVENTS];
+	bool ret = false;
+
+	udev_fd = hdcp_udev_init(uevent_monitor, udev);
+	if (udev_fd < 0)
+		return false;
+
+	epoll_fd = epoll_create1(0);
+	if (epoll_fd == -1) {
+		igt_info("Failed to create epoll fd. %d\n", epoll_fd);
+		goto out_ep_create;
+	}
+
+	event.events = EPOLLIN | EPOLLERR;
+	event.data.fd = 0;
+
+	if (epoll_ctl(epoll_fd, EPOLL_CTL_ADD, udev_fd, &event))
+	{
+		igt_info("failed to fd into epoll\n");
+		goto out_ep_ctl;
+	}
+
+	if (epoll_wait(epoll_fd, events, MAX_EVENTS, timeout_mSec))
+		ret = hdcp_event(uevent_monitor, udev, conn_id, prop_id);
+
+out_ep_ctl:
+	if (close(epoll_fd))
+		igt_info("failed to close the epoll fd\n");
+out_ep_create:
+	hdcp_udev_fini(uevent_monitor, udev);
+	return ret;
+}
+
 static bool
 wait_for_prop_value(igt_output_t *output, uint64_t expected,
 		    uint32_t timeout_mSec)
 {
 	uint64_t val;
-	int i;
 
-	for (i = 0; i < timeout_mSec; i++) {
-		val = igt_output_get_prop(output,
-					  IGT_CONNECTOR_CONTENT_PROTECTION);
-		if (val == expected)
-			return true;
-		usleep(1000);
-	}
+	if (wait_for_hdcp_event(output->id,
+				output->props[IGT_CONNECTOR_CONTENT_PROTECTION],
+				timeout_mSec))
+		igt_debug("hdcp event received\n");
+
+	val = igt_output_get_prop(output, IGT_CONNECTOR_CONTENT_PROTECTION);
+	if (val == expected)
+		return true;
+
 	igt_info("prop_value mismatch %" PRId64 " != %" PRId64 "\n",
 		 val, expected);
 
-- 
2.19.1

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [igt-dev] [PATCH i-g-t v5 5/6] kms_content_protection: srm and topology_info test
  2019-04-18  8:48 [igt-dev] [PATCH i-g-t v5 0/6] HDCP2.2 Tests Ramalingam C
                   ` (3 preceding siblings ...)
  2019-04-18  8:48 ` [igt-dev] [PATCH i-g-t v5 4/6] kms_content_protection: uevent for HDCP status change Ramalingam C
@ 2019-04-18  8:48 ` Ramalingam C
  2019-04-29 15:24   ` Daniel Vetter
  2019-04-18  8:48 ` [igt-dev] [PATCH i-g-t v5 6/6] DO NOT MERGE: CP in fast feedback list Ramalingam C
                   ` (3 subsequent siblings)
  8 siblings, 1 reply; 15+ messages in thread
From: Ramalingam C @ 2019-04-18  8:48 UTC (permalink / raw)
  To: igt-dev, daniel.vetter, arkadiusz.hiler

Retrieve the topology info and use that to stitch a srm and
verify the revocation process.

Adds a connector properties called "HDCP Topology"

SRM stitched here is polluted. Kernel trusts the userspace to validate
the SRM integrity through DCP signature. Actually this test exploits
that trust to test SRM and downstream_info features.

HDCP1.4 BKSV and HDCP2.2 receiver id of a HDCP sink is different. So we
need to force the KMD to use a single HDCP version across
downstream_info gathering and SRM setting and verifying teh revocation
process. So Type 1 is used.

v2:
  binary sysfs is used to write the srm into kernel [Daniel]
v3:
  s/CP_downstream_info/HDCP Topology
v4:
  srm sysfs is moved to /sys/class/drm as per kernel changes.
  explicit padding is added for topology struct, in sync with kernel.
v5:
  SRM is written into /lib/firmware/ instead of srm sysfs [Daniel]

Signed-off-by: Ramalingam C <ramalingam.c@intel.com>
---
 lib/igt_kms.c                  |   1 +
 lib/igt_kms.h                  |   1 +
 tests/kms_content_protection.c | 230 ++++++++++++++++++++++++++++++---
 3 files changed, 214 insertions(+), 18 deletions(-)

diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index 18f0556687de..7d4080cb1b60 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -223,6 +223,7 @@ const char * const igt_connector_prop_names[IGT_NUM_CONNECTOR_PROPS] = {
 	[IGT_CONNECTOR_CONTENT_PROTECTION] = "Content Protection",
 	[IGT_CONNECTOR_VRR_CAPABLE] = "vrr_capable",
 	[IGT_CONNECTOR_HDCP_CONTENT_TYPE] = "HDCP Content Type",
+	[IGT_CONNECTOR_HDCP_TOPOLOGY_INFO] = "HDCP Topology",
 };
 
 /*
diff --git a/lib/igt_kms.h b/lib/igt_kms.h
index b1430a517305..90154e85b699 100644
--- a/lib/igt_kms.h
+++ b/lib/igt_kms.h
@@ -124,6 +124,7 @@ enum igt_atomic_connector_properties {
        IGT_CONNECTOR_CONTENT_PROTECTION,
        IGT_CONNECTOR_VRR_CAPABLE,
        IGT_CONNECTOR_HDCP_CONTENT_TYPE,
+       IGT_CONNECTOR_HDCP_TOPOLOGY_INFO,
        IGT_NUM_CONNECTOR_PROPS
 };
 
diff --git a/tests/kms_content_protection.c b/tests/kms_content_protection.c
index 48f89571dcff..b48915eb3d73 100644
--- a/tests/kms_content_protection.c
+++ b/tests/kms_content_protection.c
@@ -58,6 +58,118 @@ struct data {
 #define FLIP_EVENT_POLLING_TIMEOUT_MSEC		1000
 
 
+#define DRM_MODE_HDCP_KSV_LEN			5
+#define DRM_MODE_HDCP_MAX_DEVICE_CNT		127
+
+#define DRM_MODE_HDCP14_IN_FORCE		(1<<0)
+#define DRM_MODE_HDCP22_IN_FORCE		(1<<1)
+
+struct hdcp_topology_info {
+	/* Version of HDCP authenticated (1.4/2.2) */
+	__u32 ver_in_force;
+
+	/* Applicable only for HDCP2.2 */
+	__u32 content_type;
+
+	/* KSV of immediate HDCP Sink. In Little-Endian Format. */
+	__u8 bksv[DRM_MODE_HDCP_KSV_LEN];
+
+	/* Whether Immediate HDCP sink is a repeater? */
+	__u8 is_repeater;
+
+	/* Depth received from immediate downstream repeater */
+	__u8 depth;
+	__u8 pad1;
+
+	/* Device count received from immediate downstream repeater */
+	__u32 device_count;
+
+	/*
+	 * Max buffer required to hold ksv list received from immediate
+	 * repeater. In this array first device_count * DRM_MODE_HDCP_KSV_LEN
+	 * will hold the valid ksv bytes.
+	 * If authentication specification is
+	 *      HDCP1.4 - each KSV's Bytes will be in Little-Endian format.
+	 *      HDCP2.2 - each KSV's Bytes will be in Big-Endian format.
+	 */
+	__u8 ksv_list[DRM_MODE_HDCP_KSV_LEN * DRM_MODE_HDCP_MAX_DEVICE_CNT];
+	__u8 pad2[5];
+} __packed;
+
+__u8 facsimile_srm[] = {
+	0x80, 0x0, 0x0, 0x05, 0x01, 0x0, 0x0, 0x36, 0x02, 0x51, 0x1E, 0xF2,
+	0x1A, 0xCD, 0xE7, 0x26, 0x97, 0xF4, 0x01, 0x97, 0x10, 0x19, 0x92, 0x53,
+	0xE9, 0xF0, 0x59, 0x95, 0xA3, 0x7A, 0x3B, 0xFE, 0xE0, 0x9C, 0x76, 0xDD,
+	0x83, 0xAA, 0xC2, 0x5B, 0x24, 0xB3, 0x36, 0x84, 0x94, 0x75, 0x34, 0xDB,
+	0x10, 0x9E, 0x3B, 0x23, 0x13, 0xD8, 0x7A, 0xC2, 0x30, 0x79, 0x84};
+
+static void parse_topology_info(struct hdcp_topology_info *ds_info)
+{
+	__u8 *ksvs;
+	int i;
+
+	if (ds_info->ver_in_force & DRM_MODE_HDCP14_IN_FORCE)
+		igt_info("HDCP1.4 is Enabled\n");
+	else if (ds_info->ver_in_force & DRM_MODE_HDCP22_IN_FORCE)
+		igt_info("HDCP2.2 is Enabled. Type%d\n",
+			 ds_info->content_type & HDCP_CONTENT_TYPE_1 ?
+			 1 : 0);
+	else
+		return;
+
+	igt_info("\tReceiver ID: %#04x %#04x %#04x %#04x %#04x\n",
+			ds_info->bksv[0] & 0xFF, ds_info->bksv[1] & 0xFF,
+			ds_info->bksv[2] & 0xFF, ds_info->bksv[3] & 0xFF,
+			ds_info->bksv[4] & 0xFF);
+
+	if (ds_info->is_repeater) {
+		igt_info("\tHDCP sink is a Repeater\n");
+
+		igt_info("\tDepth: %d, Device count: %d\n", ds_info->depth,
+							ds_info->device_count);
+		ksvs = ds_info->ksv_list;
+
+		for (i = 0; i < ds_info->device_count; i++) {
+			igt_info("\tksv-%d: %#04x %#04x %#04x %#04x %#04x\n", i,
+					ksvs[0] & 0xFF, ksvs[1] & 0xFF,
+					ksvs[2] & 0xFF, ksvs[3] & 0xFF,
+					ksvs[4] & 0xFF);
+			ksvs += DRM_MODE_HDCP_KSV_LEN;
+		}
+	} else {
+		igt_info("\tHDCP sink is a Receiver\n");
+	}
+}
+
+static void retrieve_topology_info_prepare_srm(igt_output_t *output)
+{
+	drmModePropertyBlobRes *ds_info_prop = NULL;
+	uint64_t topology_blob_id;
+	struct hdcp_topology_info *ds_info;
+	int i;
+
+	igt_info("HDCP topology property is attached\n");
+
+	topology_blob_id = igt_output_get_prop(output,
+				IGT_CONNECTOR_HDCP_TOPOLOGY_INFO);
+
+	igt_assert_f(topology_blob_id,
+				"Invalid topology blob id\n");
+
+	ds_info_prop = drmModeGetPropertyBlob(data.drm_fd,
+						topology_blob_id);
+
+	igt_assert(ds_info_prop);
+	igt_assert_eq(ds_info_prop->length,
+				sizeof(struct hdcp_topology_info));
+	ds_info = ds_info_prop->data;
+
+	parse_topology_info(ds_info);
+
+	for (i = 0; i < 5; i++)
+		facsimile_srm[i + 9] = ds_info->bksv[i];
+}
+
 static void flip_handler(int fd, unsigned int sequence, unsigned int tv_sec,
 			 unsigned int tv_usec, void *_data)
 {
@@ -355,7 +467,7 @@ static void test_cp_disable(igt_output_t *output, enum igt_commit_style s)
 static void test_cp_enable_with_retry(igt_output_t *output,
 				      enum igt_commit_style s, int retry,
 				      int content_type, bool expect_failure,
-				      bool test_type_change)
+				      bool test_type_change, bool test_srm)
 {
 	int retry_orig = retry;
 	bool ret;
@@ -376,6 +488,9 @@ static void test_cp_enable_with_retry(igt_output_t *output,
 	if (expect_failure)
 		igt_assert_f(!ret,
 			     "CP Enabled. Though it is expected to fail\n");
+	else if (test_srm)
+		igt_assert_f(!ret,
+			     "CP Enabled. Though ID is revoked through SRM\n");
 	else
 		igt_assert_f(ret, "Content Protection not enabled\n");
 }
@@ -400,15 +515,37 @@ static void test_cp_lic(igt_output_t *output)
 	igt_assert_f(!ret, "Content Protection LIC Failed\n");
 }
 
+static bool write_srm_as_fw(const __u8 *srm, int len)
+{
+	int fd, ret, total = 0;
+
+	fd = open("/lib/firmware/display_hdcp_srm.bin", O_WRONLY | O_CREAT);
+	do {
+		ret = write(fd, srm + total, len - total);
+		if (ret < 0)
+			ret = -errno;
+		if (ret == -EINTR || ret == -EAGAIN)
+			continue;
+		if (ret <= 0)
+			break;
+		total += ret;
+	} while (total != len);
+	close(fd);
+
+	return total < len ? false : true;
+}
+
 static void
 test_content_protection_on_output(igt_output_t *output, enum igt_commit_style s,
 				  bool dpms_test, int content_type,
-				  bool mei_reload_test, bool test_type_change)
+				  bool mei_reload_test, bool test_type_change,
+				  bool test_srm)
 {
 	igt_display_t *display = &data.display;
 	igt_plane_t *primary;
 	enum pipe pipe;
-	bool ret;
+	bool ret, srm_modified = false;
+	int i;
 
 	for_each_pipe(display, pipe) {
 		if (!igt_pipe_connector_valid(pipe, output))
@@ -423,13 +560,15 @@ test_content_protection_on_output(igt_output_t *output, enum igt_commit_style s,
 		if (!igt_pipe_is_free(display, pipe))
 			continue;
 
+		srm_modified = false;
 		modeset_with_fb(pipe, output, s);
 		test_cp_enable_with_retry(output, s, 3, content_type, false,
-					  false);
+					  false, false);
+
 		if (test_type_change && content_type == HDCP_CONTENT_TYPE_1)
 			test_cp_enable_with_retry(output, s, 3,
 						  HDCP_CONTENT_TYPE_0, false,
-						  test_type_change);
+						  test_type_change, false);
 
 		if (mei_reload_test) {
 			igt_assert_f(!igt_kmod_unload("mei_hdcp", 0),
@@ -437,18 +576,47 @@ test_content_protection_on_output(igt_output_t *output, enum igt_commit_style s,
 
 			/* Expected to fail */
 			test_cp_enable_with_retry(output, s, 3,
-						  content_type, true, false);
+						  content_type, true, false,
+						  false);
 
 			igt_assert_f(!igt_kmod_load("mei_hdcp", NULL),
 				     "mei_hdcp load failed");
 
 			/* Expected to pass */
 			test_cp_enable_with_retry(output, s, 3,
-						  content_type, false, false);
+						  content_type, false, false,
+						  false);
 		}
 
 		test_cp_lic(output);
 
+		if (output->props[IGT_CONNECTOR_HDCP_TOPOLOGY_INFO] &&
+		    test_srm) {
+			retrieve_topology_info_prepare_srm(output);
+			srm_modified =
+				write_srm_as_fw((const __u8 *)facsimile_srm,
+						sizeof(facsimile_srm));
+			igt_assert_f(srm_modified, "SRM update failed");
+		}
+
+		if (test_srm && srm_modified) {
+			test_cp_disable(output, s);
+			test_cp_enable_with_retry(output, s, 3, content_type,
+						  false, false, test_srm);
+
+			/* Removing the sink's Receiver ID from SRM Blob */
+			for (i = 0; i < 5; i++)
+				facsimile_srm[i + 9] = 0;
+
+			srm_modified =
+				write_srm_as_fw((const __u8 *)facsimile_srm,
+						sizeof(facsimile_srm));
+			igt_assert_f(srm_modified, "SRM update failed");
+
+			test_cp_enable_with_retry(output, s, 1, content_type,
+						  false, false, false);
+		}
+
 		if (dpms_test) {
 			igt_pipe_set_prop_value(display, pipe,
 						IGT_CRTC_ACTIVE, 0);
@@ -463,7 +631,7 @@ test_content_protection_on_output(igt_output_t *output, enum igt_commit_style s,
 			if (!ret)
 				test_cp_enable_with_retry(output, s, 2,
 							  content_type, false,
-							  false);
+							  false, false);
 		}
 
 		test_cp_disable(output, s);
@@ -529,7 +697,7 @@ static bool sink_hdcp2_capable(igt_output_t *output)
 static void
 test_content_protection(enum igt_commit_style s, bool dpms_test,
 			int content_type, bool mei_reload_test,
-			bool test_type_change)
+			bool test_type_change, bool test_srm)
 {
 	igt_display_t *display = &data.display;
 	igt_output_t *output;
@@ -560,9 +728,8 @@ test_content_protection(enum igt_commit_style s, bool dpms_test,
 		}
 
 		test_content_protection_on_output(output, s, dpms_test,
-						  content_type,
-						  mei_reload_test,
-						  test_type_change);
+						  content_type, mei_reload_test,
+						  test_type_change, test_srm);
 		valid_tests++;
 	}
 
@@ -582,33 +749,33 @@ igt_main
 	igt_subtest("legacy")
 		test_content_protection(COMMIT_LEGACY, false,
 					HDCP_CONTENT_TYPE_0, false,
-					false);
+					false, false);
 
 	igt_subtest("atomic") {
 		igt_require(data.display.is_atomic);
 		test_content_protection(COMMIT_ATOMIC, false,
-					HDCP_CONTENT_TYPE_0, false,
+					HDCP_CONTENT_TYPE_0, false, false,
 					false);
 	}
 
 	igt_subtest("atomic-dpms") {
 		igt_require(data.display.is_atomic);
 		test_content_protection(COMMIT_ATOMIC, true,
-					HDCP_CONTENT_TYPE_0, false,
+					HDCP_CONTENT_TYPE_0, false, false,
 					false);
 	}
 
 	igt_subtest("type1") {
 		igt_require(data.display.is_atomic);
 		test_content_protection(COMMIT_ATOMIC, false,
-					HDCP_CONTENT_TYPE_1, false,
+					HDCP_CONTENT_TYPE_1, false, false,
 					false);
 	}
 
 	igt_subtest("type1_mei_interface") {
 		igt_require(data.display.is_atomic);
 		test_content_protection(COMMIT_ATOMIC, false,
-					HDCP_CONTENT_TYPE_1, true,
+					HDCP_CONTENT_TYPE_1, true, false,
 					false);
 	}
 
@@ -616,9 +783,36 @@ igt_main
 		igt_require(data.display.is_atomic);
 		test_content_protection(COMMIT_ATOMIC, false,
 					HDCP_CONTENT_TYPE_1, false,
-					true);
+					true, false);
 	}
 
+	/*
+	 * SRM subtest perform the HDCP authentication, and then retrive the
+	 * receiver id through topology info.
+	 *
+	 * Using the receiver ID, facsimile SRM table is modified with
+	 * receiver ID retrieved from teh topology info. After modification
+	 * SRM table is not intact as per DCP Signature.
+	 *
+	 * But Kernel believes userspace and doesn't verify the DCP signature.
+	 * So we can exploite that trust to test the SRM and topology info
+	 * features.
+	 *
+	 * So when modified SRM is applied Authentication will fail due to
+	 * receiver ID revocation.
+	 *
+	 * And Kernel attempts HDCP2.2 always and on failure of it HDCP1.4
+	 * will be attempted. But their ID of the sink varies between 1.4 and
+	 * 2.2 versions. So we need to stick to one version. Hence HDCP2.2 is
+	 * choosen using Type 1.
+	 */
+	igt_subtest("srm") {
+		igt_require(data.display.is_atomic);
+		test_content_protection(COMMIT_ATOMIC, false,
+					HDCP_CONTENT_TYPE_1, false, false, true);
+	}
+
+
 	igt_fixture
 		igt_display_fini(&data.display);
 }
-- 
2.19.1

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [igt-dev] [PATCH i-g-t v5 6/6] DO NOT MERGE: CP in fast feedback list
  2019-04-18  8:48 [igt-dev] [PATCH i-g-t v5 0/6] HDCP2.2 Tests Ramalingam C
                   ` (4 preceding siblings ...)
  2019-04-18  8:48 ` [igt-dev] [PATCH i-g-t v5 5/6] kms_content_protection: srm and topology_info test Ramalingam C
@ 2019-04-18  8:48 ` Ramalingam C
  2019-04-18  9:54 ` [igt-dev] ✓ Fi.CI.BAT: success for HDCP2.2 Tests (rev5) Patchwork
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 15+ messages in thread
From: Ramalingam C @ 2019-04-18  8:48 UTC (permalink / raw)
  To: igt-dev, daniel.vetter, arkadiusz.hiler

For adding the HDCP tests into fastfeedback list

Signed-off-by: Ramalingam C <ramalingam.c@intel.com>
---
 tests/intel-ci/fast-feedback.testlist | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/tests/intel-ci/fast-feedback.testlist b/tests/intel-ci/fast-feedback.testlist
index 40475b1ab361..7a6fd3b1058e 100644
--- a/tests/intel-ci/fast-feedback.testlist
+++ b/tests/intel-ci/fast-feedback.testlist
@@ -184,6 +184,9 @@ igt@kms_chamelium@hdmi-crc-fast
 igt@kms_chamelium@vga-hpd-fast
 igt@kms_chamelium@vga-edid-read
 igt@kms_chamelium@common-hpd-after-suspend
+igt@kms_content_protection@legacy
+igt@kms_content_protection@atomic
+igt@kms_content_protection@srm
 igt@kms_prop_blob@basic
 igt@kms_cursor_legacy@basic-busy-flip-before-cursor-atomic
 igt@kms_cursor_legacy@basic-busy-flip-before-cursor-legacy
-- 
2.19.1

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [igt-dev] ✓ Fi.CI.BAT: success for HDCP2.2 Tests (rev5)
  2019-04-18  8:48 [igt-dev] [PATCH i-g-t v5 0/6] HDCP2.2 Tests Ramalingam C
                   ` (5 preceding siblings ...)
  2019-04-18  8:48 ` [igt-dev] [PATCH i-g-t v5 6/6] DO NOT MERGE: CP in fast feedback list Ramalingam C
@ 2019-04-18  9:54 ` Patchwork
  2019-04-18 11:38 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
  2019-04-29 15:24 ` [igt-dev] [PATCH i-g-t v5 0/6] HDCP2.2 Tests Daniel Vetter
  8 siblings, 0 replies; 15+ messages in thread
From: Patchwork @ 2019-04-18  9:54 UTC (permalink / raw)
  To: Ramalingam C; +Cc: igt-dev

== Series Details ==

Series: HDCP2.2 Tests (rev5)
URL   : https://patchwork.freedesktop.org/series/57756/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_5952 -> IGTPW_2890
====================================================

Summary
-------

  **SUCCESS**

  No regressions found.

  External URL: https://patchwork.freedesktop.org/api/1.0/series/57756/revisions/5/mbox/

Possible new issues
-------------------

  Here are the unknown changes that may have been introduced in IGTPW_2890:

### IGT changes ###

#### Possible regressions ####

  * {igt@kms_content_protection@srm} (NEW):
    - fi-icl-y:           NOTRUN -> SKIP
    - fi-icl-u3:          NOTRUN -> SKIP
    - {fi-icl-u2}:        NOTRUN -> SKIP

  
New tests
---------

  New tests have been introduced between CI_DRM_5952 and IGTPW_2890:

### New IGT tests (1) ###

  * igt@kms_content_protection@srm:
    - Statuses : 43 skip(s)
    - Exec time: [0.0, 0.00] s

  

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

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

### IGT changes ###

#### Issues hit ####

  * igt@amdgpu/amd_basic@query-info:
    - fi-bsw-kefka:       NOTRUN -> SKIP [fdo#109271] +53

  * igt@gem_exec_basic@gtt-bsd2:
    - fi-byt-clapper:     NOTRUN -> SKIP [fdo#109271] +55

  * igt@i915_module_load@reload-with-fault-injection:
    - fi-skl-6770hq:      PASS -> DMESG-WARN [fdo#108529] +2

  * igt@kms_addfb_basic@addfb25-y-tiled-small:
    - fi-byt-n2820:       NOTRUN -> SKIP [fdo#109271] +54

  * igt@kms_busy@basic-flip-c:
    - fi-byt-clapper:     NOTRUN -> SKIP [fdo#109271] / [fdo#109278]
    - fi-bsw-kefka:       NOTRUN -> SKIP [fdo#109271] / [fdo#109278]
    - fi-byt-n2820:       NOTRUN -> SKIP [fdo#109271] / [fdo#109278]

  * igt@kms_chamelium@hdmi-edid-read:
    - fi-hsw-peppy:       NOTRUN -> SKIP [fdo#109271] +49

  * igt@kms_content_protection@atomic:
    - fi-icl-u3:          NOTRUN -> FAIL [fdo#110322] +1
    - fi-skl-gvtdvm:      NOTRUN -> FAIL [fdo#110325] / [fdo#110336] +1
    - fi-glk-dsi:         NOTRUN -> SKIP [fdo#109271] +2
    - fi-skl-iommu:       NOTRUN -> SKIP [fdo#109271] +2
    - fi-elk-e7500:       NOTRUN -> SKIP [fdo#109271] +2
    - fi-whl-u:           NOTRUN -> SKIP [fdo#109271] +2
    - fi-cfl-8700k:       NOTRUN -> SKIP [fdo#109271] +2
    - fi-pnv-d510:        NOTRUN -> SKIP [fdo#109271] +2
    - fi-snb-2520m:       NOTRUN -> SKIP [fdo#109271] +2
    - fi-skl-guc:         NOTRUN -> SKIP [fdo#109271] +2
    - fi-skl-lmem:        NOTRUN -> FAIL [fdo#110336] +1
    - fi-apl-guc:         NOTRUN -> FAIL [fdo#110321] / [fdo#110336] +1

  * igt@kms_content_protection@legacy:
    - fi-cfl-guc:         NOTRUN -> SKIP [fdo#109271] +2
    - fi-snb-2600:        NOTRUN -> SKIP [fdo#109271] +2
    - fi-skl-6770hq:      NOTRUN -> FAIL [fdo#110336]
    - fi-bxt-j4205:       NOTRUN -> SKIP [fdo#109271] +2
    - fi-kbl-r:           NOTRUN -> SKIP [fdo#109271] +2
    - fi-cfl-8109u:       NOTRUN -> FAIL [fdo#110336] +1
    - fi-kbl-guc:         NOTRUN -> SKIP [fdo#109271] +2
    - fi-bdw-gvtdvm:      NOTRUN -> SKIP [fdo#109271] +2
    - fi-gdg-551:         NOTRUN -> SKIP [fdo#109271] +2
    - fi-bwr-2160:        NOTRUN -> SKIP [fdo#109271] +2
    - fi-hsw-4770:        NOTRUN -> SKIP [fdo#109271] +2
    - fi-bxt-dsi:         NOTRUN -> SKIP [fdo#109271] +2
    - fi-ivb-3770:        NOTRUN -> SKIP [fdo#109271] +2
    - fi-kbl-8809g:       NOTRUN -> SKIP [fdo#109271] +2
    - fi-icl-y:           NOTRUN -> SKIP [fdo#109300] +1

  * {igt@kms_content_protection@srm} (NEW):
    - fi-ilk-650:         NOTRUN -> SKIP [fdo#109271] +2
    - fi-bsw-n3050:       NOTRUN -> SKIP [fdo#109271] +2
    - fi-hsw-4770r:       NOTRUN -> SKIP [fdo#109271] +2
    - fi-cfl-8109u:       NOTRUN -> SKIP [fdo#109271]
    - fi-blb-e6850:       NOTRUN -> SKIP [fdo#109271] +2
    - fi-bdw-5557u:       NOTRUN -> SKIP [fdo#109271] +2
    - {fi-kbl-7567u}:     NOTRUN -> SKIP [fdo#109271]
    - fi-skl-6600u:       NOTRUN -> SKIP [fdo#109271] +2
    - fi-byt-j1900:       NOTRUN -> SKIP [fdo#109271] +2
    - fi-skl-lmem:        NOTRUN -> SKIP [fdo#109271]
    - fi-apl-guc:         NOTRUN -> SKIP [fdo#109271]
    - fi-skl-6770hq:      NOTRUN -> SKIP [fdo#109271] +1
    - fi-skl-6700k2:      NOTRUN -> SKIP [fdo#109271]
    - fi-skl-6260u:       NOTRUN -> SKIP [fdo#109271]
    - fi-skl-gvtdvm:      NOTRUN -> SKIP [fdo#109271]
    - fi-kbl-x1275:       NOTRUN -> SKIP [fdo#109271]

  * igt@kms_flip@basic-flip-vs-dpms:
    - fi-skl-6770hq:      PASS -> SKIP [fdo#109271] +23

  * igt@kms_frontbuffer_tracking@basic:
    - fi-hsw-peppy:       NOTRUN -> DMESG-FAIL [fdo#102614] / [fdo#107814]

  
#### Possible fixes ####

  * igt@i915_selftest@live_execlists:
    - fi-apl-guc:         INCOMPLETE [fdo#103927] / [fdo#109720] -> PASS

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

  [fdo#102614]: https://bugs.freedesktop.org/show_bug.cgi?id=102614
  [fdo#103927]: https://bugs.freedesktop.org/show_bug.cgi?id=103927
  [fdo#107814]: https://bugs.freedesktop.org/show_bug.cgi?id=107814
  [fdo#108529]: https://bugs.freedesktop.org/show_bug.cgi?id=108529
  [fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
  [fdo#109276]: https://bugs.freedesktop.org/show_bug.cgi?id=109276
  [fdo#109278]: https://bugs.freedesktop.org/show_bug.cgi?id=109278
  [fdo#109285]: https://bugs.freedesktop.org/show_bug.cgi?id=109285
  [fdo#109289]: https://bugs.freedesktop.org/show_bug.cgi?id=109289
  [fdo#109300]: https://bugs.freedesktop.org/show_bug.cgi?id=109300
  [fdo#109309]: https://bugs.freedesktop.org/show_bug.cgi?id=109309
  [fdo#109315]: https://bugs.freedesktop.org/show_bug.cgi?id=109315
  [fdo#109316]: https://bugs.freedesktop.org/show_bug.cgi?id=109316
  [fdo#109593]: https://bugs.freedesktop.org/show_bug.cgi?id=109593
  [fdo#109720]: https://bugs.freedesktop.org/show_bug.cgi?id=109720
  [fdo#110321]: https://bugs.freedesktop.org/show_bug.cgi?id=110321
  [fdo#110322]: https://bugs.freedesktop.org/show_bug.cgi?id=110322
  [fdo#110325]: https://bugs.freedesktop.org/show_bug.cgi?id=110325
  [fdo#110336]: https://bugs.freedesktop.org/show_bug.cgi?id=110336


Participating hosts (44 -> 45)
------------------------------

  Additional (6): fi-hsw-peppy fi-icl-u2 fi-byt-clapper fi-bsw-kefka fi-byt-n2820 fi-icl-dsi 
  Missing    (5): fi-ilk-m540 fi-byt-squawks fi-bsw-cyan fi-ctg-p8600 fi-bdw-samus 


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

    * IGT: IGT_4956 -> IGTPW_2890

  CI_DRM_5952: 65305a057be0e155321a0765a3a24115063f3a32 @ git://anongit.freedesktop.org/gfx-ci/linux
  IGTPW_2890: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2890/
  IGT_4956: 1d921615b0b706f25c856aa0eb096f274380c199 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools



== Testlist changes ==

+igt@audio@hdmi-integrity
+igt@audio@hdmi-integrity-after-hibernate
+igt@audio@hdmi-integrity-after-suspend
+igt@kms_content_protection@content_type_change
+igt@kms_content_protection@srm
+igt@kms_content_protection@type1
+igt@kms_content_protection@type1_mei_interface

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2890/
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [igt-dev] ✓ Fi.CI.IGT: success for HDCP2.2 Tests (rev5)
  2019-04-18  8:48 [igt-dev] [PATCH i-g-t v5 0/6] HDCP2.2 Tests Ramalingam C
                   ` (6 preceding siblings ...)
  2019-04-18  9:54 ` [igt-dev] ✓ Fi.CI.BAT: success for HDCP2.2 Tests (rev5) Patchwork
@ 2019-04-18 11:38 ` Patchwork
  2019-04-29 15:24 ` [igt-dev] [PATCH i-g-t v5 0/6] HDCP2.2 Tests Daniel Vetter
  8 siblings, 0 replies; 15+ messages in thread
From: Patchwork @ 2019-04-18 11:38 UTC (permalink / raw)
  To: Ramalingam C; +Cc: igt-dev

== Series Details ==

Series: HDCP2.2 Tests (rev5)
URL   : https://patchwork.freedesktop.org/series/57756/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_5952_full -> IGTPW_2890_full
====================================================

Summary
-------

  **SUCCESS**

  No regressions found.

  External URL: https://patchwork.freedesktop.org/api/1.0/series/57756/revisions/5/mbox/

Possible new issues
-------------------

  Here are the unknown changes that may have been introduced in IGTPW_2890_full:

### IGT changes ###

#### Possible regressions ####

  * {igt@audio@hdmi-integrity} (NEW):
    - shard-kbl:          NOTRUN -> FAIL +1
    - shard-hsw:          NOTRUN -> FAIL
    - shard-glk:          NOTRUN -> FAIL +1
    - shard-iclb:         NOTRUN -> FAIL +1
    - shard-snb:          NOTRUN -> FAIL +1

  * {igt@audio@hdmi-integrity-after-suspend} (NEW):
    - shard-apl:          NOTRUN -> FAIL +1

  * {igt@kms_content_protection@type1} (NEW):
    - shard-iclb:         NOTRUN -> SKIP +3

  
New tests
---------

  New tests have been introduced between CI_DRM_5952_full and IGTPW_2890_full:

### New IGT tests (6) ###

  * igt@audio@hdmi-integrity:
    - Statuses : 6 fail(s)
    - Exec time: [0.13, 5.15] s

  * igt@audio@hdmi-integrity-after-suspend:
    - Statuses : 5 fail(s)
    - Exec time: [2.07, 3.10] s

  * igt@kms_content_protection@content_type_change:
    - Statuses : 6 skip(s)
    - Exec time: [0.0] s

  * igt@kms_content_protection@srm:
    - Statuses : 6 skip(s)
    - Exec time: [0.0] s

  * igt@kms_content_protection@type1:
    - Statuses : 5 skip(s)
    - Exec time: [0.0] s

  * igt@kms_content_protection@type1_mei_interface:
    - Statuses : 6 skip(s)
    - Exec time: [0.00] s

  

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

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

### IGT changes ###

#### Issues hit ####

  * igt@gem_mocs_settings@mocs-reset-bsd2:
    - shard-snb:          NOTRUN -> SKIP [fdo#109271] +38

  * igt@i915_pm_rc6_residency@rc6-accuracy:
    - shard-snb:          PASS -> SKIP [fdo#109271]

  * igt@kms_busy@extended-modeset-hang-oldfb-with-reset-render-f:
    - shard-kbl:          NOTRUN -> SKIP [fdo#109271] / [fdo#109278]

  * {igt@kms_content_protection@srm} (NEW):
    - shard-glk:          NOTRUN -> SKIP [fdo#109271] +3
    - shard-hsw:          NOTRUN -> SKIP [fdo#109271] +2

  * {igt@kms_content_protection@type1_mei_interface} (NEW):
    - shard-kbl:          NOTRUN -> SKIP [fdo#109271] +6
    - shard-apl:          NOTRUN -> SKIP [fdo#109271] +3

  * igt@kms_cursor_crc@cursor-128x42-onscreen:
    - shard-apl:          PASS -> FAIL [fdo#103232]

  * igt@kms_frontbuffer_tracking@fbc-1p-primscrn-cur-indfb-draw-blt:
    - shard-iclb:         PASS -> FAIL [fdo#103167] +2

  * igt@kms_frontbuffer_tracking@fbc-2p-scndscrn-shrfb-msflip-blt:
    - shard-glk:          PASS -> FAIL [fdo#103167]

  * igt@kms_lease@cursor_implicit_plane:
    - shard-snb:          NOTRUN -> FAIL [fdo#110278]

  * igt@kms_pipe_crc_basic@hang-read-crc-pipe-f:
    - shard-snb:          NOTRUN -> SKIP [fdo#109271] / [fdo#109278] +4

  * igt@kms_plane_scaling@pipe-b-scaler-with-pixel-format:
    - shard-glk:          PASS -> SKIP [fdo#109271] / [fdo#109278]

  * igt@kms_psr@psr2_cursor_render:
    - shard-iclb:         PASS -> SKIP [fdo#109441] +2

  * igt@kms_rotation_crc@multiplane-rotation:
    - shard-kbl:          PASS -> FAIL [fdo#109016]

  * igt@kms_sysfs_edid_timing:
    - shard-iclb:         PASS -> FAIL [fdo#100047]

  * igt@kms_vblank@pipe-c-ts-continuation-suspend:
    - shard-apl:          PASS -> DMESG-WARN [fdo#108566] +5

  
#### Possible fixes ####

  * igt@gem_eio@unwedge-stress:
    - shard-glk:          FAIL [fdo#109661] -> PASS

  * igt@gem_exec_suspend@basic-s3:
    - shard-kbl:          INCOMPLETE [fdo#103665] -> PASS

  * igt@kms_dp_dsc@basic-dsc-enable-edp:
    - shard-iclb:         SKIP [fdo#109349] -> PASS

  * igt@kms_frontbuffer_tracking@basic:
    - shard-snb:          SKIP [fdo#109271] -> PASS +1

  * igt@kms_frontbuffer_tracking@fbc-suspend:
    - shard-kbl:          DMESG-WARN [fdo#103313] -> PASS
    - shard-apl:          DMESG-WARN [fdo#108566] -> PASS +5

  * igt@kms_frontbuffer_tracking@fbcpsr-1p-primscrn-cur-indfb-draw-render:
    - shard-iclb:         FAIL [fdo#103167] -> PASS +6

  * igt@kms_plane_scaling@pipe-b-scaler-with-rotation:
    - shard-glk:          SKIP [fdo#109271] / [fdo#109278] -> PASS

  * igt@kms_psr2_su@frontbuffer:
    - shard-iclb:         SKIP [fdo#109642] -> PASS +1

  * igt@kms_rotation_crc@multiplane-rotation-cropping-bottom:
    - shard-kbl:          DMESG-FAIL [fdo#105763] -> PASS

  * igt@kms_setmode@basic:
    - shard-kbl:          FAIL [fdo#99912] -> PASS

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

  [fdo#100047]: https://bugs.freedesktop.org/show_bug.cgi?id=100047
  [fdo#103167]: https://bugs.freedesktop.org/show_bug.cgi?id=103167
  [fdo#103232]: https://bugs.freedesktop.org/show_bug.cgi?id=103232
  [fdo#103313]: https://bugs.freedesktop.org/show_bug.cgi?id=103313
  [fdo#103665]: https://bugs.freedesktop.org/show_bug.cgi?id=103665
  [fdo#105763]: https://bugs.freedesktop.org/show_bug.cgi?id=105763
  [fdo#108566]: https://bugs.freedesktop.org/show_bug.cgi?id=108566
  [fdo#109016]: https://bugs.freedesktop.org/show_bug.cgi?id=109016
  [fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
  [fdo#109278]: https://bugs.freedesktop.org/show_bug.cgi?id=109278
  [fdo#109349]: https://bugs.freedesktop.org/show_bug.cgi?id=109349
  [fdo#109441]: https://bugs.freedesktop.org/show_bug.cgi?id=109441
  [fdo#109642]: https://bugs.freedesktop.org/show_bug.cgi?id=109642
  [fdo#109661]: https://bugs.freedesktop.org/show_bug.cgi?id=109661
  [fdo#110278]: https://bugs.freedesktop.org/show_bug.cgi?id=110278
  [fdo#99912]: https://bugs.freedesktop.org/show_bug.cgi?id=99912


Participating hosts (10 -> 6)
------------------------------

  Missing    (4): pig-skl-6260u shard-skl pig-hsw-4770r pig-glk-j5005 


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

  * IGT: IGT_4956 -> IGTPW_2890
  * Piglit: piglit_4509 -> None

  CI_DRM_5952: 65305a057be0e155321a0765a3a24115063f3a32 @ git://anongit.freedesktop.org/gfx-ci/linux
  IGTPW_2890: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2890/
  IGT_4956: 1d921615b0b706f25c856aa0eb096f274380c199 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
  piglit_4509: fdc5a4ca11124ab8413c7988896eec4c97336694 @ git://anongit.freedesktop.org/piglit

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2890/
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [igt-dev] [PATCH i-g-t v5 3/6] kms_content_protection: test content type change
  2019-04-18  8:48 ` [igt-dev] [PATCH i-g-t v5 3/6] kms_content_protection: test content type change Ramalingam C
@ 2019-04-29 14:40   ` Daniel Vetter
  2019-04-30 12:41     ` Ramalingam C
  0 siblings, 1 reply; 15+ messages in thread
From: Daniel Vetter @ 2019-04-29 14:40 UTC (permalink / raw)
  To: Ramalingam C; +Cc: igt-dev, daniel.vetter

On Thu, Apr 18, 2019 at 02:18:39PM +0530, Ramalingam C wrote:
> Testing the content type change when the content protection already
> enabled.
> 
> Signed-off-by: Ramalingam C <ramalingam.c@intel.com>
> ---
>  tests/kms_content_protection.c | 61 ++++++++++++++++++++++++----------
>  1 file changed, 44 insertions(+), 17 deletions(-)
> 
> diff --git a/tests/kms_content_protection.c b/tests/kms_content_protection.c
> index b33b37b9379c..754ce996640d 100644
> --- a/tests/kms_content_protection.c
> +++ b/tests/kms_content_protection.c
> @@ -164,7 +164,7 @@ static void modeset_with_fb(const enum pipe pipe, igt_output_t *output,
>  }
>  
>  static bool test_cp_enable(igt_output_t *output, enum igt_commit_style s,
> -			   int content_type)
> +			   int content_type, bool test_type_change)
>  {
>  	igt_display_t *display = &data.display;
>  	igt_plane_t *primary;
> @@ -172,8 +172,11 @@ static bool test_cp_enable(igt_output_t *output, enum igt_commit_style s,
>  
>  	primary = igt_output_get_plane_type(output, DRM_PLANE_TYPE_PRIMARY);
>  
> -	igt_output_set_prop_value(output,
> -				  IGT_CONNECTOR_CONTENT_PROTECTION, CP_DESIRED);
> +	if (!test_type_change)
> +		igt_output_set_prop_value(output,
> +					  IGT_CONNECTOR_CONTENT_PROTECTION,
> +					  CP_DESIRED);
> +
>  	if (output->props[IGT_CONNECTOR_HDCP_CONTENT_TYPE])
>  		igt_output_set_prop_value(output,
>  					  IGT_CONNECTOR_HDCP_CONTENT_TYPE,
> @@ -215,13 +218,17 @@ static void test_cp_disable(igt_output_t *output, enum igt_commit_style s)
>  
>  static void test_cp_enable_with_retry(igt_output_t *output,
>  				      enum igt_commit_style s, int retry,
> -				      int content_type, bool expect_failure)
> +				      int content_type, bool expect_failure,
> +				      bool test_type_change)
>  {
> +	int retry_orig = retry;
>  	bool ret;
>  
>  	do {
> -		test_cp_disable(output, s);
> -		ret = test_cp_enable(output, s, content_type);
> +		if (!test_type_change || retry_orig != retry)
> +			test_cp_disable(output, s);
> +
> +		ret = test_cp_enable(output, s, content_type, test_type_change);
>  
>  		if (!ret && --retry)
>  			igt_debug("Retry (%d/2) ...\n", 3 - retry);
> @@ -260,7 +267,7 @@ static void test_cp_lic(igt_output_t *output)
>  static void
>  test_content_protection_on_output(igt_output_t *output, enum igt_commit_style s,
>  				  bool dpms_test, int content_type,
> -				  bool mei_reload_test)
> +				  bool mei_reload_test, bool test_type_change)
>  {
>  	igt_display_t *display = &data.display;
>  	igt_plane_t *primary;
> @@ -281,7 +288,12 @@ test_content_protection_on_output(igt_output_t *output, enum igt_commit_style s,
>  			continue;
>  
>  		modeset_with_fb(pipe, output, s);
> -		test_cp_enable_with_retry(output, s, 3, content_type, false);
> +		test_cp_enable_with_retry(output, s, 3, content_type, false,
> +					  false);
> +		if (test_type_change && content_type == HDCP_CONTENT_TYPE_1)
> +			test_cp_enable_with_retry(output, s, 3,
> +						  HDCP_CONTENT_TYPE_0, false,
> +						  test_type_change);
>  
>  		if (mei_reload_test) {
>  			igt_assert_f(!igt_kmod_unload("mei_hdcp", 0),
> @@ -289,7 +301,7 @@ test_content_protection_on_output(igt_output_t *output, enum igt_commit_style s,
>  
>  			/* Expected to fail */
>  			test_cp_enable_with_retry(output, s, 3,
> -						  content_type, false, true);
> +						  content_type, true, false);
>  
>  			igt_assert_f(!igt_kmod_load("mei_hdcp", NULL),
>  				     "mei_hdcp load failed");
> @@ -314,7 +326,8 @@ test_content_protection_on_output(igt_output_t *output, enum igt_commit_style s,
>  						  KERNEL_AUTH_TIME_ALLOWED_MSEC);
>  			if (!ret)
>  				test_cp_enable_with_retry(output, s, 2,
> -							  content_type, false);
> +							  content_type, false,
> +							  false);
>  		}
>  
>  		test_cp_disable(output, s);
> @@ -379,7 +392,8 @@ static bool sink_hdcp2_capable(igt_output_t *output)
>  
>  static void
>  test_content_protection(enum igt_commit_style s, bool dpms_test,
> -			int content_type, bool mei_reload_test)
> +			int content_type, bool mei_reload_test,
> +			bool test_type_change)

Hm this is getting a bit too much I think, usually we create a new usigned
flags and a pile of bitmask defines for this. Then you have checks like

	if (flags & TEST_USE_ATOMIC_COMMIT)

or	if (flags & TEST_TYPE1)

or similar. A long list of various bool arguments is pretty hard to read
on the caller side, since no one can remember what 0/true/false stands for
in each case, and it's easy to screw up.

Looks all good to me otherwise.
-Daniel

>  {
>  	igt_display_t *display = &data.display;
>  	igt_output_t *output;
> @@ -411,7 +425,8 @@ test_content_protection(enum igt_commit_style s, bool dpms_test,
>  
>  		test_content_protection_on_output(output, s, dpms_test,
>  						  content_type,
> -						  mei_reload_test);
> +						  mei_reload_test,
> +						  test_type_change);
>  		valid_tests++;
>  	}
>  
> @@ -430,30 +445,42 @@ igt_main
>  
>  	igt_subtest("legacy")
>  		test_content_protection(COMMIT_LEGACY, false,
> -					HDCP_CONTENT_TYPE_0, false);
> +					HDCP_CONTENT_TYPE_0, false,
> +					false);
>  
>  	igt_subtest("atomic") {
>  		igt_require(data.display.is_atomic);
>  		test_content_protection(COMMIT_ATOMIC, false,
> -					HDCP_CONTENT_TYPE_0, false);
> +					HDCP_CONTENT_TYPE_0, false,
> +					false);
>  	}
>  
>  	igt_subtest("atomic-dpms") {
>  		igt_require(data.display.is_atomic);
>  		test_content_protection(COMMIT_ATOMIC, true,
> -					HDCP_CONTENT_TYPE_0, false);
> +					HDCP_CONTENT_TYPE_0, false,
> +					false);
>  	}
>  
>  	igt_subtest("type1") {
>  		igt_require(data.display.is_atomic);
>  		test_content_protection(COMMIT_ATOMIC, false,
> -					HDCP_CONTENT_TYPE_1, false);
> +					HDCP_CONTENT_TYPE_1, false,
> +					false);
>  	}
>  
>  	igt_subtest("type1_mei_interface") {
>  		igt_require(data.display.is_atomic);
>  		test_content_protection(COMMIT_ATOMIC, false,
> -					HDCP_CONTENT_TYPE_1, true);
> +					HDCP_CONTENT_TYPE_1, true,
> +					false);
> +	}
> +
> +	igt_subtest("content_type_change") {
> +		igt_require(data.display.is_atomic);
> +		test_content_protection(COMMIT_ATOMIC, false,
> +					HDCP_CONTENT_TYPE_1, false,
> +					true);
>  	}
>  
>  	igt_fixture
> -- 
> 2.19.1
> 
> _______________________________________________
> igt-dev mailing list
> igt-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/igt-dev

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [igt-dev] [PATCH i-g-t v5 4/6] kms_content_protection: uevent for HDCP status change
  2019-04-18  8:48 ` [igt-dev] [PATCH i-g-t v5 4/6] kms_content_protection: uevent for HDCP status change Ramalingam C
@ 2019-04-29 15:17   ` Daniel Vetter
  0 siblings, 0 replies; 15+ messages in thread
From: Daniel Vetter @ 2019-04-29 15:17 UTC (permalink / raw)
  To: Ramalingam C; +Cc: igt-dev, daniel.vetter

On Thu, Apr 18, 2019 at 02:18:40PM +0530, Ramalingam C wrote:
> To detect the HDCP status change we are reading the uevent sent with the
> corresponding connector id and property id.
> 
> This avoids the polling of the property every mSec.
> 
> Signed-off-by: Ramalingam C <ramalingam.c@intel.com>

We have a lot of kernels without the uevent. Given that I think we need a
new subtest for this, so that existing tests keep working on existing
kernels. So another test flag to control this.

Otherwise looks good, you already have the retry loop for udev events
(which is somehow needed, because netlink sometimes takes forever to
deliver an event).
-Daniel


> ---
>  tests/kms_content_protection.c | 152 +++++++++++++++++++++++++++++++--
>  1 file changed, 144 insertions(+), 8 deletions(-)
> 
> diff --git a/tests/kms_content_protection.c b/tests/kms_content_protection.c
> index 754ce996640d..48f89571dcff 100644
> --- a/tests/kms_content_protection.c
> +++ b/tests/kms_content_protection.c
> @@ -24,6 +24,9 @@
>  
>  #include <poll.h>
>  #include <fcntl.h>
> +#include <sys/epoll.h>
> +#include <sys/stat.h>
> +#include <libudev.h>
>  #include "igt.h"
>  #include "igt_sysfs.h"
>  #include "igt_kms.h"
> @@ -95,20 +98,153 @@ static int wait_flip_event(void)
>  	return rc;
>  }
>  
> +static bool hdcp_event(struct udev_monitor *uevent_monitor,
> +		       struct udev *udev, uint32_t conn_id, uint32_t prop_id)
> +{
> +	struct udev_device *dev;
> +	dev_t udev_devnum;
> +	struct stat s;
> +	const char *hotplug, *connector, *property;
> +	bool ret = false;
> +
> +	dev = udev_monitor_receive_device(uevent_monitor);
> +	if (!dev)
> +		goto out;
> +
> +	udev_devnum = udev_device_get_devnum(dev);
> +	fstat(data.display.drm_fd, &s);
> +
> +	hotplug = udev_device_get_property_value(dev, "HOTPLUG");
> +	if (!(memcmp(&s.st_rdev, &udev_devnum, sizeof(dev_t)) == 0 &&
> +	    hotplug && atoi(hotplug) == 1)) {
> +		igt_debug("Not a Hotplug event\n");
> +		goto out_dev;
> +	}
> +
> +	connector = udev_device_get_property_value(dev, "CONNECTOR");
> +	if (!(memcmp(&s.st_rdev, &udev_devnum, sizeof(dev_t)) == 0 &&
> +	    connector && atoi(connector) == conn_id)) {
> +		igt_debug("Not for connector id: %u\n", conn_id);
> +		goto out_dev;
> +	}
> +
> +	property = udev_device_get_property_value(dev, "PROPERTY");
> +	if (!(memcmp(&s.st_rdev, &udev_devnum, sizeof(dev_t)) == 0 &&
> +	    property && atoi(property) == prop_id)) {
> +		igt_debug("Not for property id: %u\n", prop_id);
> +		goto out_dev;
> +	}
> +	ret = true;
> +
> +out_dev:
> +	udev_device_unref(dev);
> +out:
> +	return ret;
> +}
> +
> +static void hdcp_udev_fini(struct udev_monitor *uevent_monitor,
> +			   struct udev *udev)
> +{
> +	if (uevent_monitor)
> +		udev_monitor_unref(uevent_monitor);
> +	if (udev)
> +		udev_unref(udev);
> +}
> +
> +static int hdcp_udev_init(struct udev_monitor *uevent_monitor,
> +			  struct udev *udev)
> +{
> +	int ret = -EINVAL;
> +
> +	udev = udev_new();
> +	if (!udev) {
> +		igt_info("failed to create udev object\n");
> +		goto out;
> +	}
> +
> +	uevent_monitor = udev_monitor_new_from_netlink(udev, "udev");
> +	if (!uevent_monitor) {
> +		igt_info("failed to create udev event monitor\n");
> +		goto out;
> +	}
> +
> +	ret = udev_monitor_filter_add_match_subsystem_devtype(uevent_monitor,
> +							      "drm",
> +							      "drm_minor");
> +	if (ret < 0) {
> +		igt_info("failed to filter for drm events\n");
> +		goto out;
> +	}
> +
> +	ret = udev_monitor_enable_receiving(uevent_monitor);
> +	if (ret < 0) {
> +		igt_info("failed to enable udev event reception\n");
> +		goto out;
> +	}
> +
> +	return udev_monitor_get_fd(uevent_monitor);
> +
> +out:
> +	hdcp_udev_fini(uevent_monitor, udev);
> +	return ret;
> +}
> +
> +#define MAX_EVENTS	10
> +static bool wait_for_hdcp_event(uint32_t conn_id, uint32_t prop_id,
> +				uint32_t timeout_mSec)
> +{
> +
> +	struct udev_monitor *uevent_monitor = NULL;
> +	struct udev *udev = NULL;
> +	int udev_fd, epoll_fd;
> +	struct epoll_event event, events[MAX_EVENTS];
> +	bool ret = false;
> +
> +	udev_fd = hdcp_udev_init(uevent_monitor, udev);
> +	if (udev_fd < 0)
> +		return false;
> +
> +	epoll_fd = epoll_create1(0);
> +	if (epoll_fd == -1) {
> +		igt_info("Failed to create epoll fd. %d\n", epoll_fd);
> +		goto out_ep_create;
> +	}
> +
> +	event.events = EPOLLIN | EPOLLERR;
> +	event.data.fd = 0;
> +
> +	if (epoll_ctl(epoll_fd, EPOLL_CTL_ADD, udev_fd, &event))
> +	{
> +		igt_info("failed to fd into epoll\n");
> +		goto out_ep_ctl;
> +	}
> +
> +	if (epoll_wait(epoll_fd, events, MAX_EVENTS, timeout_mSec))
> +		ret = hdcp_event(uevent_monitor, udev, conn_id, prop_id);
> +
> +out_ep_ctl:
> +	if (close(epoll_fd))
> +		igt_info("failed to close the epoll fd\n");
> +out_ep_create:
> +	hdcp_udev_fini(uevent_monitor, udev);
> +	return ret;
> +}
> +
>  static bool
>  wait_for_prop_value(igt_output_t *output, uint64_t expected,
>  		    uint32_t timeout_mSec)
>  {
>  	uint64_t val;
> -	int i;
>  
> -	for (i = 0; i < timeout_mSec; i++) {
> -		val = igt_output_get_prop(output,
> -					  IGT_CONNECTOR_CONTENT_PROTECTION);
> -		if (val == expected)
> -			return true;
> -		usleep(1000);
> -	}
> +	if (wait_for_hdcp_event(output->id,
> +				output->props[IGT_CONNECTOR_CONTENT_PROTECTION],
> +				timeout_mSec))
> +		igt_debug("hdcp event received\n");
> +
> +	val = igt_output_get_prop(output, IGT_CONNECTOR_CONTENT_PROTECTION);
> +	if (val == expected)
> +		return true;
> +
>  	igt_info("prop_value mismatch %" PRId64 " != %" PRId64 "\n",
>  		 val, expected);
>  
> -- 
> 2.19.1
> 
> _______________________________________________
> igt-dev mailing list
> igt-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/igt-dev

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [igt-dev] [PATCH i-g-t v5 5/6] kms_content_protection: srm and topology_info test
  2019-04-18  8:48 ` [igt-dev] [PATCH i-g-t v5 5/6] kms_content_protection: srm and topology_info test Ramalingam C
@ 2019-04-29 15:24   ` Daniel Vetter
  2019-04-30 12:33     ` Ramalingam C
  0 siblings, 1 reply; 15+ messages in thread
From: Daniel Vetter @ 2019-04-29 15:24 UTC (permalink / raw)
  To: Ramalingam C; +Cc: igt-dev, daniel.vetter

On Thu, Apr 18, 2019 at 02:18:41PM +0530, Ramalingam C wrote:
> Retrieve the topology info and use that to stitch a srm and
> verify the revocation process.
> 
> Adds a connector properties called "HDCP Topology"
> 
> SRM stitched here is polluted. Kernel trusts the userspace to validate
> the SRM integrity through DCP signature. Actually this test exploits
> that trust to test SRM and downstream_info features.
> 
> HDCP1.4 BKSV and HDCP2.2 receiver id of a HDCP sink is different. So we
> need to force the KMD to use a single HDCP version across
> downstream_info gathering and SRM setting and verifying teh revocation
> process. So Type 1 is used.
> 
> v2:
>   binary sysfs is used to write the srm into kernel [Daniel]
> v3:
>   s/CP_downstream_info/HDCP Topology
> v4:
>   srm sysfs is moved to /sys/class/drm as per kernel changes.
>   explicit padding is added for topology struct, in sync with kernel.
> v5:
>   SRM is written into /lib/firmware/ instead of srm sysfs [Daniel]
> 
> Signed-off-by: Ramalingam C <ramalingam.c@intel.com>
> ---
>  lib/igt_kms.c                  |   1 +
>  lib/igt_kms.h                  |   1 +
>  tests/kms_content_protection.c | 230 ++++++++++++++++++++++++++++++---
>  3 files changed, 214 insertions(+), 18 deletions(-)
> 
> diff --git a/lib/igt_kms.c b/lib/igt_kms.c
> index 18f0556687de..7d4080cb1b60 100644
> --- a/lib/igt_kms.c
> +++ b/lib/igt_kms.c
> @@ -223,6 +223,7 @@ const char * const igt_connector_prop_names[IGT_NUM_CONNECTOR_PROPS] = {
>  	[IGT_CONNECTOR_CONTENT_PROTECTION] = "Content Protection",
>  	[IGT_CONNECTOR_VRR_CAPABLE] = "vrr_capable",
>  	[IGT_CONNECTOR_HDCP_CONTENT_TYPE] = "HDCP Content Type",
> +	[IGT_CONNECTOR_HDCP_TOPOLOGY_INFO] = "HDCP Topology",
>  };
>  
>  /*
> diff --git a/lib/igt_kms.h b/lib/igt_kms.h
> index b1430a517305..90154e85b699 100644
> --- a/lib/igt_kms.h
> +++ b/lib/igt_kms.h
> @@ -124,6 +124,7 @@ enum igt_atomic_connector_properties {
>         IGT_CONNECTOR_CONTENT_PROTECTION,
>         IGT_CONNECTOR_VRR_CAPABLE,
>         IGT_CONNECTOR_HDCP_CONTENT_TYPE,
> +       IGT_CONNECTOR_HDCP_TOPOLOGY_INFO,
>         IGT_NUM_CONNECTOR_PROPS
>  };
>  
> diff --git a/tests/kms_content_protection.c b/tests/kms_content_protection.c
> index 48f89571dcff..b48915eb3d73 100644
> --- a/tests/kms_content_protection.c
> +++ b/tests/kms_content_protection.c
> @@ -58,6 +58,118 @@ struct data {
>  #define FLIP_EVENT_POLLING_TIMEOUT_MSEC		1000
>  
>  
> +#define DRM_MODE_HDCP_KSV_LEN			5
> +#define DRM_MODE_HDCP_MAX_DEVICE_CNT		127
> +
> +#define DRM_MODE_HDCP14_IN_FORCE		(1<<0)
> +#define DRM_MODE_HDCP22_IN_FORCE		(1<<1)
> +
> +struct hdcp_topology_info {
> +	/* Version of HDCP authenticated (1.4/2.2) */
> +	__u32 ver_in_force;
> +
> +	/* Applicable only for HDCP2.2 */
> +	__u32 content_type;
> +
> +	/* KSV of immediate HDCP Sink. In Little-Endian Format. */
> +	__u8 bksv[DRM_MODE_HDCP_KSV_LEN];
> +
> +	/* Whether Immediate HDCP sink is a repeater? */
> +	__u8 is_repeater;
> +
> +	/* Depth received from immediate downstream repeater */
> +	__u8 depth;
> +	__u8 pad1;
> +
> +	/* Device count received from immediate downstream repeater */
> +	__u32 device_count;
> +
> +	/*
> +	 * Max buffer required to hold ksv list received from immediate
> +	 * repeater. In this array first device_count * DRM_MODE_HDCP_KSV_LEN
> +	 * will hold the valid ksv bytes.
> +	 * If authentication specification is
> +	 *      HDCP1.4 - each KSV's Bytes will be in Little-Endian format.
> +	 *      HDCP2.2 - each KSV's Bytes will be in Big-Endian format.
> +	 */
> +	__u8 ksv_list[DRM_MODE_HDCP_KSV_LEN * DRM_MODE_HDCP_MAX_DEVICE_CNT];
> +	__u8 pad2[5];
> +} __packed;
> +
> +__u8 facsimile_srm[] = {
> +	0x80, 0x0, 0x0, 0x05, 0x01, 0x0, 0x0, 0x36, 0x02, 0x51, 0x1E, 0xF2,
> +	0x1A, 0xCD, 0xE7, 0x26, 0x97, 0xF4, 0x01, 0x97, 0x10, 0x19, 0x92, 0x53,
> +	0xE9, 0xF0, 0x59, 0x95, 0xA3, 0x7A, 0x3B, 0xFE, 0xE0, 0x9C, 0x76, 0xDD,
> +	0x83, 0xAA, 0xC2, 0x5B, 0x24, 0xB3, 0x36, 0x84, 0x94, 0x75, 0x34, 0xDB,
> +	0x10, 0x9E, 0x3B, 0x23, 0x13, 0xD8, 0x7A, 0xC2, 0x30, 0x79, 0x84};
> +
> +static void parse_topology_info(struct hdcp_topology_info *ds_info)
> +{
> +	__u8 *ksvs;
> +	int i;
> +
> +	if (ds_info->ver_in_force & DRM_MODE_HDCP14_IN_FORCE)
> +		igt_info("HDCP1.4 is Enabled\n");
> +	else if (ds_info->ver_in_force & DRM_MODE_HDCP22_IN_FORCE)
> +		igt_info("HDCP2.2 is Enabled. Type%d\n",
> +			 ds_info->content_type & HDCP_CONTENT_TYPE_1 ?
> +			 1 : 0);
> +	else
> +		return;
> +
> +	igt_info("\tReceiver ID: %#04x %#04x %#04x %#04x %#04x\n",
> +			ds_info->bksv[0] & 0xFF, ds_info->bksv[1] & 0xFF,
> +			ds_info->bksv[2] & 0xFF, ds_info->bksv[3] & 0xFF,
> +			ds_info->bksv[4] & 0xFF);
> +
> +	if (ds_info->is_repeater) {
> +		igt_info("\tHDCP sink is a Repeater\n");
> +
> +		igt_info("\tDepth: %d, Device count: %d\n", ds_info->depth,
> +							ds_info->device_count);
> +		ksvs = ds_info->ksv_list;
> +
> +		for (i = 0; i < ds_info->device_count; i++) {
> +			igt_info("\tksv-%d: %#04x %#04x %#04x %#04x %#04x\n", i,
> +					ksvs[0] & 0xFF, ksvs[1] & 0xFF,
> +					ksvs[2] & 0xFF, ksvs[3] & 0xFF,
> +					ksvs[4] & 0xFF);
> +			ksvs += DRM_MODE_HDCP_KSV_LEN;
> +		}
> +	} else {
> +		igt_info("\tHDCP sink is a Receiver\n");
> +	}
> +}
> +
> +static void retrieve_topology_info_prepare_srm(igt_output_t *output)
> +{
> +	drmModePropertyBlobRes *ds_info_prop = NULL;
> +	uint64_t topology_blob_id;
> +	struct hdcp_topology_info *ds_info;
> +	int i;
> +
> +	igt_info("HDCP topology property is attached\n");
> +
> +	topology_blob_id = igt_output_get_prop(output,
> +				IGT_CONNECTOR_HDCP_TOPOLOGY_INFO);
> +
> +	igt_assert_f(topology_blob_id,
> +				"Invalid topology blob id\n");
> +
> +	ds_info_prop = drmModeGetPropertyBlob(data.drm_fd,
> +						topology_blob_id);
> +
> +	igt_assert(ds_info_prop);
> +	igt_assert_eq(ds_info_prop->length,
> +				sizeof(struct hdcp_topology_info));
> +	ds_info = ds_info_prop->data;
> +
> +	parse_topology_info(ds_info);
> +
> +	for (i = 0; i < 5; i++)
> +		facsimile_srm[i + 9] = ds_info->bksv[i];
> +}
> +
>  static void flip_handler(int fd, unsigned int sequence, unsigned int tv_sec,
>  			 unsigned int tv_usec, void *_data)
>  {
> @@ -355,7 +467,7 @@ static void test_cp_disable(igt_output_t *output, enum igt_commit_style s)
>  static void test_cp_enable_with_retry(igt_output_t *output,
>  				      enum igt_commit_style s, int retry,
>  				      int content_type, bool expect_failure,
> -				      bool test_type_change)
> +				      bool test_type_change, bool test_srm)
>  {
>  	int retry_orig = retry;
>  	bool ret;
> @@ -376,6 +488,9 @@ static void test_cp_enable_with_retry(igt_output_t *output,
>  	if (expect_failure)
>  		igt_assert_f(!ret,
>  			     "CP Enabled. Though it is expected to fail\n");
> +	else if (test_srm)
> +		igt_assert_f(!ret,
> +			     "CP Enabled. Though ID is revoked through SRM\n");
>  	else
>  		igt_assert_f(ret, "Content Protection not enabled\n");
>  }
> @@ -400,15 +515,37 @@ static void test_cp_lic(igt_output_t *output)
>  	igt_assert_f(!ret, "Content Protection LIC Failed\n");
>  }
>  
> +static bool write_srm_as_fw(const __u8 *srm, int len)
> +{
> +	int fd, ret, total = 0;
> +
> +	fd = open("/lib/firmware/display_hdcp_srm.bin", O_WRONLY | O_CREAT);
> +	do {
> +		ret = write(fd, srm + total, len - total);
> +		if (ret < 0)
> +			ret = -errno;
> +		if (ret == -EINTR || ret == -EAGAIN)
> +			continue;
> +		if (ret <= 0)
> +			break;
> +		total += ret;
> +	} while (total != len);
> +	close(fd);
> +
> +	return total < len ? false : true;
> +}
> +
>  static void
>  test_content_protection_on_output(igt_output_t *output, enum igt_commit_style s,
>  				  bool dpms_test, int content_type,
> -				  bool mei_reload_test, bool test_type_change)
> +				  bool mei_reload_test, bool test_type_change,
> +				  bool test_srm)
>  {
>  	igt_display_t *display = &data.display;
>  	igt_plane_t *primary;
>  	enum pipe pipe;
> -	bool ret;
> +	bool ret, srm_modified = false;
> +	int i;
>  
>  	for_each_pipe(display, pipe) {
>  		if (!igt_pipe_connector_valid(pipe, output))
> @@ -423,13 +560,15 @@ test_content_protection_on_output(igt_output_t *output, enum igt_commit_style s,
>  		if (!igt_pipe_is_free(display, pipe))
>  			continue;
>  
> +		srm_modified = false;
>  		modeset_with_fb(pipe, output, s);
>  		test_cp_enable_with_retry(output, s, 3, content_type, false,
> -					  false);
> +					  false, false);
> +
>  		if (test_type_change && content_type == HDCP_CONTENT_TYPE_1)
>  			test_cp_enable_with_retry(output, s, 3,
>  						  HDCP_CONTENT_TYPE_0, false,
> -						  test_type_change);
> +						  test_type_change, false);
>  
>  		if (mei_reload_test) {
>  			igt_assert_f(!igt_kmod_unload("mei_hdcp", 0),
> @@ -437,18 +576,47 @@ test_content_protection_on_output(igt_output_t *output, enum igt_commit_style s,
>  
>  			/* Expected to fail */
>  			test_cp_enable_with_retry(output, s, 3,
> -						  content_type, true, false);
> +						  content_type, true, false,
> +						  false);
>  
>  			igt_assert_f(!igt_kmod_load("mei_hdcp", NULL),
>  				     "mei_hdcp load failed");
>  
>  			/* Expected to pass */
>  			test_cp_enable_with_retry(output, s, 3,
> -						  content_type, false, false);
> +						  content_type, false, false,
> +						  false);
>  		}
>  
>  		test_cp_lic(output);
>  
> +		if (output->props[IGT_CONNECTOR_HDCP_TOPOLOGY_INFO] &&
> +		    test_srm) {
> +			retrieve_topology_info_prepare_srm(output);
> +			srm_modified =
> +				write_srm_as_fw((const __u8 *)facsimile_srm,
> +						sizeof(facsimile_srm));
> +			igt_assert_f(srm_modified, "SRM update failed");
> +		}
> +
> +		if (test_srm && srm_modified) {
> +			test_cp_disable(output, s);
> +			test_cp_enable_with_retry(output, s, 3, content_type,
> +						  false, false, test_srm);
> +
> +			/* Removing the sink's Receiver ID from SRM Blob */
> +			for (i = 0; i < 5; i++)
> +				facsimile_srm[i + 9] = 0;
> +
> +			srm_modified =
> +				write_srm_as_fw((const __u8 *)facsimile_srm,
> +						sizeof(facsimile_srm));
> +			igt_assert_f(srm_modified, "SRM update failed");
> +
> +			test_cp_enable_with_retry(output, s, 1, content_type,
> +						  false, false, false);
> +		}
> +
>  		if (dpms_test) {
>  			igt_pipe_set_prop_value(display, pipe,
>  						IGT_CRTC_ACTIVE, 0);
> @@ -463,7 +631,7 @@ test_content_protection_on_output(igt_output_t *output, enum igt_commit_style s,
>  			if (!ret)
>  				test_cp_enable_with_retry(output, s, 2,
>  							  content_type, false,
> -							  false);
> +							  false, false);
>  		}
>  
>  		test_cp_disable(output, s);
> @@ -529,7 +697,7 @@ static bool sink_hdcp2_capable(igt_output_t *output)
>  static void
>  test_content_protection(enum igt_commit_style s, bool dpms_test,
>  			int content_type, bool mei_reload_test,
> -			bool test_type_change)
> +			bool test_type_change, bool test_srm)
>  {
>  	igt_display_t *display = &data.display;
>  	igt_output_t *output;
> @@ -560,9 +728,8 @@ test_content_protection(enum igt_commit_style s, bool dpms_test,
>  		}
>  
>  		test_content_protection_on_output(output, s, dpms_test,
> -						  content_type,
> -						  mei_reload_test,
> -						  test_type_change);
> +						  content_type, mei_reload_test,
> +						  test_type_change, test_srm);
>  		valid_tests++;
>  	}
>  
> @@ -582,33 +749,33 @@ igt_main
>  	igt_subtest("legacy")
>  		test_content_protection(COMMIT_LEGACY, false,
>  					HDCP_CONTENT_TYPE_0, false,
> -					false);
> +					false, false);
>  
>  	igt_subtest("atomic") {
>  		igt_require(data.display.is_atomic);
>  		test_content_protection(COMMIT_ATOMIC, false,
> -					HDCP_CONTENT_TYPE_0, false,
> +					HDCP_CONTENT_TYPE_0, false, false,
>  					false);
>  	}
>  
>  	igt_subtest("atomic-dpms") {
>  		igt_require(data.display.is_atomic);
>  		test_content_protection(COMMIT_ATOMIC, true,
> -					HDCP_CONTENT_TYPE_0, false,
> +					HDCP_CONTENT_TYPE_0, false, false,
>  					false);
>  	}
>  
>  	igt_subtest("type1") {
>  		igt_require(data.display.is_atomic);
>  		test_content_protection(COMMIT_ATOMIC, false,
> -					HDCP_CONTENT_TYPE_1, false,
> +					HDCP_CONTENT_TYPE_1, false, false,
>  					false);
>  	}
>  
>  	igt_subtest("type1_mei_interface") {
>  		igt_require(data.display.is_atomic);
>  		test_content_protection(COMMIT_ATOMIC, false,
> -					HDCP_CONTENT_TYPE_1, true,
> +					HDCP_CONTENT_TYPE_1, true, false,
>  					false);
>  	}
>  
> @@ -616,9 +783,36 @@ igt_main
>  		igt_require(data.display.is_atomic);
>  		test_content_protection(COMMIT_ATOMIC, false,
>  					HDCP_CONTENT_TYPE_1, false,
> -					true);
> +					true, false);
>  	}
>  
> +	/*
> +	 * SRM subtest perform the HDCP authentication, and then retrive the
> +	 * receiver id through topology info.
> +	 *
> +	 * Using the receiver ID, facsimile SRM table is modified with
> +	 * receiver ID retrieved from teh topology info. After modification
> +	 * SRM table is not intact as per DCP Signature.
> +	 *
> +	 * But Kernel believes userspace and doesn't verify the DCP signature.
> +	 * So we can exploite that trust to test the SRM and topology info
> +	 * features.
> +	 *
> +	 * So when modified SRM is applied Authentication will fail due to
> +	 * receiver ID revocation.
> +	 *
> +	 * And Kernel attempts HDCP2.2 always and on failure of it HDCP1.4
> +	 * will be attempted. But their ID of the sink varies between 1.4 and
> +	 * 2.2 versions. So we need to stick to one version. Hence HDCP2.2 is
> +	 * choosen using Type 1.

Oops, just realized that this is a bug in the kernel. Here's the slightly
nasty attack:

- create a fake SRM with no revocations but really high revision number
- kernel will reject updates from here on.

Or do we just shrug and say userspace needs to validate the SRM fully
before it drops it into /lib/firmware?

Plan B for SRM testing would be that we simply drop an SRM into
/lib/firmware (a valid one) and make sure the kernel doesn't blow up. Not
a great testcase, but better than nothing.

I guess proper SRM testing needs some kind of hdcp validation (special
dongle that can optionally use a blacklisted ksv), but we don't have that
stuff in igt or our CI.

There's also the issue that I'm not sure we can merge the topolgoy info
prop, so for now I'd split out a really simple subtest that checks the
kernel doesn't blow up when loading the facsimile srm.
-Daniel

> +	 */
> +	igt_subtest("srm") {
> +		igt_require(data.display.is_atomic);
> +		test_content_protection(COMMIT_ATOMIC, false,
> +					HDCP_CONTENT_TYPE_1, false, false, true);
> +	}
> +
> +
>  	igt_fixture
>  		igt_display_fini(&data.display);
>  }
> -- 
> 2.19.1
> 
> _______________________________________________
> igt-dev mailing list
> igt-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/igt-dev

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [igt-dev] [PATCH i-g-t v5 0/6] HDCP2.2 Tests
  2019-04-18  8:48 [igt-dev] [PATCH i-g-t v5 0/6] HDCP2.2 Tests Ramalingam C
                   ` (7 preceding siblings ...)
  2019-04-18 11:38 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
@ 2019-04-29 15:24 ` Daniel Vetter
  8 siblings, 0 replies; 15+ messages in thread
From: Daniel Vetter @ 2019-04-29 15:24 UTC (permalink / raw)
  To: Ramalingam C; +Cc: igt-dev, daniel.vetter

On Thu, Apr 18, 2019 at 02:18:36PM +0530, Ramalingam C wrote:
> This series adds tests for:
> 	1. content_type which is added for HDCP2.2.
> 	     Adds a new test for Type1.
> 	     Adds another test for Type1 -> Type0.
> 	2. teardown and rebuild of i915-mei interface.
> 	     Removes the mei_hdcp and reloads it and test for HDCP2.2.
> 	3. downstream info gathering and SRM revocation.
> 	     Retrieves the receivers ID from downstream_info
> 	     fabricates a SRM and test for the revocation of the device.
> 
> Wait for HDCP state change is implemented through the uevent handler.
> 
> v5:
>   srm is written into /lib/firmware/display_hdcp_srm.bin [Danvet]
> 
> Ramalingam C (6):
>   kms_content_protection: Content type support
>   kms_content_protection: test teardown and rebuild of I915-mei I/F
>   kms_content_protection: test content type change
>   kms_content_protection: uevent for HDCP status change
>   kms_content_protection: srm and topology_info test

Looks good, made some comments, with those addressed entire series has my

Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
>   DO NOT MERGE: CP in fast feedback list
> 
>  lib/igt_kms.c                         |   2 +
>  lib/igt_kms.h                         |   2 +
>  tests/intel-ci/fast-feedback.testlist |   3 +
>  tests/kms_content_protection.c        | 498 ++++++++++++++++++++++++--
>  4 files changed, 477 insertions(+), 28 deletions(-)
> 
> -- 
> 2.19.1
> 
> _______________________________________________
> igt-dev mailing list
> igt-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/igt-dev

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [igt-dev] [PATCH i-g-t v5 5/6] kms_content_protection: srm and topology_info test
  2019-04-29 15:24   ` Daniel Vetter
@ 2019-04-30 12:33     ` Ramalingam C
  0 siblings, 0 replies; 15+ messages in thread
From: Ramalingam C @ 2019-04-30 12:33 UTC (permalink / raw)
  To: Daniel Vetter; +Cc: igt-dev, daniel.vetter

On 2019-04-29 at 17:24:29 +0200, Daniel Vetter wrote:
> On Thu, Apr 18, 2019 at 02:18:41PM +0530, Ramalingam C wrote:
> > Retrieve the topology info and use that to stitch a srm and
> > verify the revocation process.
> > 
> > Adds a connector properties called "HDCP Topology"
> > 
> > SRM stitched here is polluted. Kernel trusts the userspace to validate
> > the SRM integrity through DCP signature. Actually this test exploits
> > that trust to test SRM and downstream_info features.
> > 
> > HDCP1.4 BKSV and HDCP2.2 receiver id of a HDCP sink is different. So we
> > need to force the KMD to use a single HDCP version across
> > downstream_info gathering and SRM setting and verifying teh revocation
> > process. So Type 1 is used.
> > 
> > v2:
> >   binary sysfs is used to write the srm into kernel [Daniel]
> > v3:
> >   s/CP_downstream_info/HDCP Topology
> > v4:
> >   srm sysfs is moved to /sys/class/drm as per kernel changes.
> >   explicit padding is added for topology struct, in sync with kernel.
> > v5:
> >   SRM is written into /lib/firmware/ instead of srm sysfs [Daniel]
> > 
> > Signed-off-by: Ramalingam C <ramalingam.c@intel.com>
> > ---
> >  lib/igt_kms.c                  |   1 +
> >  lib/igt_kms.h                  |   1 +
> >  tests/kms_content_protection.c | 230 ++++++++++++++++++++++++++++++---
> >  3 files changed, 214 insertions(+), 18 deletions(-)
> > 
> > diff --git a/lib/igt_kms.c b/lib/igt_kms.c
> > index 18f0556687de..7d4080cb1b60 100644
> > --- a/lib/igt_kms.c
> > +++ b/lib/igt_kms.c
> > @@ -223,6 +223,7 @@ const char * const igt_connector_prop_names[IGT_NUM_CONNECTOR_PROPS] = {
> >  	[IGT_CONNECTOR_CONTENT_PROTECTION] = "Content Protection",
> >  	[IGT_CONNECTOR_VRR_CAPABLE] = "vrr_capable",
> >  	[IGT_CONNECTOR_HDCP_CONTENT_TYPE] = "HDCP Content Type",
> > +	[IGT_CONNECTOR_HDCP_TOPOLOGY_INFO] = "HDCP Topology",
> >  };
> >  
> >  /*
> > diff --git a/lib/igt_kms.h b/lib/igt_kms.h
> > index b1430a517305..90154e85b699 100644
> > --- a/lib/igt_kms.h
> > +++ b/lib/igt_kms.h
> > @@ -124,6 +124,7 @@ enum igt_atomic_connector_properties {
> >         IGT_CONNECTOR_CONTENT_PROTECTION,
> >         IGT_CONNECTOR_VRR_CAPABLE,
> >         IGT_CONNECTOR_HDCP_CONTENT_TYPE,
> > +       IGT_CONNECTOR_HDCP_TOPOLOGY_INFO,
> >         IGT_NUM_CONNECTOR_PROPS
> >  };
> >  
> > diff --git a/tests/kms_content_protection.c b/tests/kms_content_protection.c
> > index 48f89571dcff..b48915eb3d73 100644
> > --- a/tests/kms_content_protection.c
> > +++ b/tests/kms_content_protection.c
> > @@ -58,6 +58,118 @@ struct data {
> >  #define FLIP_EVENT_POLLING_TIMEOUT_MSEC		1000
> >  
> >  
> > +#define DRM_MODE_HDCP_KSV_LEN			5
> > +#define DRM_MODE_HDCP_MAX_DEVICE_CNT		127
> > +
> > +#define DRM_MODE_HDCP14_IN_FORCE		(1<<0)
> > +#define DRM_MODE_HDCP22_IN_FORCE		(1<<1)
> > +
> > +struct hdcp_topology_info {
> > +	/* Version of HDCP authenticated (1.4/2.2) */
> > +	__u32 ver_in_force;
> > +
> > +	/* Applicable only for HDCP2.2 */
> > +	__u32 content_type;
> > +
> > +	/* KSV of immediate HDCP Sink. In Little-Endian Format. */
> > +	__u8 bksv[DRM_MODE_HDCP_KSV_LEN];
> > +
> > +	/* Whether Immediate HDCP sink is a repeater? */
> > +	__u8 is_repeater;
> > +
> > +	/* Depth received from immediate downstream repeater */
> > +	__u8 depth;
> > +	__u8 pad1;
> > +
> > +	/* Device count received from immediate downstream repeater */
> > +	__u32 device_count;
> > +
> > +	/*
> > +	 * Max buffer required to hold ksv list received from immediate
> > +	 * repeater. In this array first device_count * DRM_MODE_HDCP_KSV_LEN
> > +	 * will hold the valid ksv bytes.
> > +	 * If authentication specification is
> > +	 *      HDCP1.4 - each KSV's Bytes will be in Little-Endian format.
> > +	 *      HDCP2.2 - each KSV's Bytes will be in Big-Endian format.
> > +	 */
> > +	__u8 ksv_list[DRM_MODE_HDCP_KSV_LEN * DRM_MODE_HDCP_MAX_DEVICE_CNT];
> > +	__u8 pad2[5];
> > +} __packed;
> > +
> > +__u8 facsimile_srm[] = {
> > +	0x80, 0x0, 0x0, 0x05, 0x01, 0x0, 0x0, 0x36, 0x02, 0x51, 0x1E, 0xF2,
> > +	0x1A, 0xCD, 0xE7, 0x26, 0x97, 0xF4, 0x01, 0x97, 0x10, 0x19, 0x92, 0x53,
> > +	0xE9, 0xF0, 0x59, 0x95, 0xA3, 0x7A, 0x3B, 0xFE, 0xE0, 0x9C, 0x76, 0xDD,
> > +	0x83, 0xAA, 0xC2, 0x5B, 0x24, 0xB3, 0x36, 0x84, 0x94, 0x75, 0x34, 0xDB,
> > +	0x10, 0x9E, 0x3B, 0x23, 0x13, 0xD8, 0x7A, 0xC2, 0x30, 0x79, 0x84};
> > +
> > +static void parse_topology_info(struct hdcp_topology_info *ds_info)
> > +{
> > +	__u8 *ksvs;
> > +	int i;
> > +
> > +	if (ds_info->ver_in_force & DRM_MODE_HDCP14_IN_FORCE)
> > +		igt_info("HDCP1.4 is Enabled\n");
> > +	else if (ds_info->ver_in_force & DRM_MODE_HDCP22_IN_FORCE)
> > +		igt_info("HDCP2.2 is Enabled. Type%d\n",
> > +			 ds_info->content_type & HDCP_CONTENT_TYPE_1 ?
> > +			 1 : 0);
> > +	else
> > +		return;
> > +
> > +	igt_info("\tReceiver ID: %#04x %#04x %#04x %#04x %#04x\n",
> > +			ds_info->bksv[0] & 0xFF, ds_info->bksv[1] & 0xFF,
> > +			ds_info->bksv[2] & 0xFF, ds_info->bksv[3] & 0xFF,
> > +			ds_info->bksv[4] & 0xFF);
> > +
> > +	if (ds_info->is_repeater) {
> > +		igt_info("\tHDCP sink is a Repeater\n");
> > +
> > +		igt_info("\tDepth: %d, Device count: %d\n", ds_info->depth,
> > +							ds_info->device_count);
> > +		ksvs = ds_info->ksv_list;
> > +
> > +		for (i = 0; i < ds_info->device_count; i++) {
> > +			igt_info("\tksv-%d: %#04x %#04x %#04x %#04x %#04x\n", i,
> > +					ksvs[0] & 0xFF, ksvs[1] & 0xFF,
> > +					ksvs[2] & 0xFF, ksvs[3] & 0xFF,
> > +					ksvs[4] & 0xFF);
> > +			ksvs += DRM_MODE_HDCP_KSV_LEN;
> > +		}
> > +	} else {
> > +		igt_info("\tHDCP sink is a Receiver\n");
> > +	}
> > +}
> > +
> > +static void retrieve_topology_info_prepare_srm(igt_output_t *output)
> > +{
> > +	drmModePropertyBlobRes *ds_info_prop = NULL;
> > +	uint64_t topology_blob_id;
> > +	struct hdcp_topology_info *ds_info;
> > +	int i;
> > +
> > +	igt_info("HDCP topology property is attached\n");
> > +
> > +	topology_blob_id = igt_output_get_prop(output,
> > +				IGT_CONNECTOR_HDCP_TOPOLOGY_INFO);
> > +
> > +	igt_assert_f(topology_blob_id,
> > +				"Invalid topology blob id\n");
> > +
> > +	ds_info_prop = drmModeGetPropertyBlob(data.drm_fd,
> > +						topology_blob_id);
> > +
> > +	igt_assert(ds_info_prop);
> > +	igt_assert_eq(ds_info_prop->length,
> > +				sizeof(struct hdcp_topology_info));
> > +	ds_info = ds_info_prop->data;
> > +
> > +	parse_topology_info(ds_info);
> > +
> > +	for (i = 0; i < 5; i++)
> > +		facsimile_srm[i + 9] = ds_info->bksv[i];
> > +}
> > +
> >  static void flip_handler(int fd, unsigned int sequence, unsigned int tv_sec,
> >  			 unsigned int tv_usec, void *_data)
> >  {
> > @@ -355,7 +467,7 @@ static void test_cp_disable(igt_output_t *output, enum igt_commit_style s)
> >  static void test_cp_enable_with_retry(igt_output_t *output,
> >  				      enum igt_commit_style s, int retry,
> >  				      int content_type, bool expect_failure,
> > -				      bool test_type_change)
> > +				      bool test_type_change, bool test_srm)
> >  {
> >  	int retry_orig = retry;
> >  	bool ret;
> > @@ -376,6 +488,9 @@ static void test_cp_enable_with_retry(igt_output_t *output,
> >  	if (expect_failure)
> >  		igt_assert_f(!ret,
> >  			     "CP Enabled. Though it is expected to fail\n");
> > +	else if (test_srm)
> > +		igt_assert_f(!ret,
> > +			     "CP Enabled. Though ID is revoked through SRM\n");
> >  	else
> >  		igt_assert_f(ret, "Content Protection not enabled\n");
> >  }
> > @@ -400,15 +515,37 @@ static void test_cp_lic(igt_output_t *output)
> >  	igt_assert_f(!ret, "Content Protection LIC Failed\n");
> >  }
> >  
> > +static bool write_srm_as_fw(const __u8 *srm, int len)
> > +{
> > +	int fd, ret, total = 0;
> > +
> > +	fd = open("/lib/firmware/display_hdcp_srm.bin", O_WRONLY | O_CREAT);
> > +	do {
> > +		ret = write(fd, srm + total, len - total);
> > +		if (ret < 0)
> > +			ret = -errno;
> > +		if (ret == -EINTR || ret == -EAGAIN)
> > +			continue;
> > +		if (ret <= 0)
> > +			break;
> > +		total += ret;
> > +	} while (total != len);
> > +	close(fd);
> > +
> > +	return total < len ? false : true;
> > +}
> > +
> >  static void
> >  test_content_protection_on_output(igt_output_t *output, enum igt_commit_style s,
> >  				  bool dpms_test, int content_type,
> > -				  bool mei_reload_test, bool test_type_change)
> > +				  bool mei_reload_test, bool test_type_change,
> > +				  bool test_srm)
> >  {
> >  	igt_display_t *display = &data.display;
> >  	igt_plane_t *primary;
> >  	enum pipe pipe;
> > -	bool ret;
> > +	bool ret, srm_modified = false;
> > +	int i;
> >  
> >  	for_each_pipe(display, pipe) {
> >  		if (!igt_pipe_connector_valid(pipe, output))
> > @@ -423,13 +560,15 @@ test_content_protection_on_output(igt_output_t *output, enum igt_commit_style s,
> >  		if (!igt_pipe_is_free(display, pipe))
> >  			continue;
> >  
> > +		srm_modified = false;
> >  		modeset_with_fb(pipe, output, s);
> >  		test_cp_enable_with_retry(output, s, 3, content_type, false,
> > -					  false);
> > +					  false, false);
> > +
> >  		if (test_type_change && content_type == HDCP_CONTENT_TYPE_1)
> >  			test_cp_enable_with_retry(output, s, 3,
> >  						  HDCP_CONTENT_TYPE_0, false,
> > -						  test_type_change);
> > +						  test_type_change, false);
> >  
> >  		if (mei_reload_test) {
> >  			igt_assert_f(!igt_kmod_unload("mei_hdcp", 0),
> > @@ -437,18 +576,47 @@ test_content_protection_on_output(igt_output_t *output, enum igt_commit_style s,
> >  
> >  			/* Expected to fail */
> >  			test_cp_enable_with_retry(output, s, 3,
> > -						  content_type, true, false);
> > +						  content_type, true, false,
> > +						  false);
> >  
> >  			igt_assert_f(!igt_kmod_load("mei_hdcp", NULL),
> >  				     "mei_hdcp load failed");
> >  
> >  			/* Expected to pass */
> >  			test_cp_enable_with_retry(output, s, 3,
> > -						  content_type, false, false);
> > +						  content_type, false, false,
> > +						  false);
> >  		}
> >  
> >  		test_cp_lic(output);
> >  
> > +		if (output->props[IGT_CONNECTOR_HDCP_TOPOLOGY_INFO] &&
> > +		    test_srm) {
> > +			retrieve_topology_info_prepare_srm(output);
> > +			srm_modified =
> > +				write_srm_as_fw((const __u8 *)facsimile_srm,
> > +						sizeof(facsimile_srm));
> > +			igt_assert_f(srm_modified, "SRM update failed");
> > +		}
> > +
> > +		if (test_srm && srm_modified) {
> > +			test_cp_disable(output, s);
> > +			test_cp_enable_with_retry(output, s, 3, content_type,
> > +						  false, false, test_srm);
> > +
> > +			/* Removing the sink's Receiver ID from SRM Blob */
> > +			for (i = 0; i < 5; i++)
> > +				facsimile_srm[i + 9] = 0;
> > +
> > +			srm_modified =
> > +				write_srm_as_fw((const __u8 *)facsimile_srm,
> > +						sizeof(facsimile_srm));
> > +			igt_assert_f(srm_modified, "SRM update failed");
> > +
> > +			test_cp_enable_with_retry(output, s, 1, content_type,
> > +						  false, false, false);
> > +		}
> > +
> >  		if (dpms_test) {
> >  			igt_pipe_set_prop_value(display, pipe,
> >  						IGT_CRTC_ACTIVE, 0);
> > @@ -463,7 +631,7 @@ test_content_protection_on_output(igt_output_t *output, enum igt_commit_style s,
> >  			if (!ret)
> >  				test_cp_enable_with_retry(output, s, 2,
> >  							  content_type, false,
> > -							  false);
> > +							  false, false);
> >  		}
> >  
> >  		test_cp_disable(output, s);
> > @@ -529,7 +697,7 @@ static bool sink_hdcp2_capable(igt_output_t *output)
> >  static void
> >  test_content_protection(enum igt_commit_style s, bool dpms_test,
> >  			int content_type, bool mei_reload_test,
> > -			bool test_type_change)
> > +			bool test_type_change, bool test_srm)
> >  {
> >  	igt_display_t *display = &data.display;
> >  	igt_output_t *output;
> > @@ -560,9 +728,8 @@ test_content_protection(enum igt_commit_style s, bool dpms_test,
> >  		}
> >  
> >  		test_content_protection_on_output(output, s, dpms_test,
> > -						  content_type,
> > -						  mei_reload_test,
> > -						  test_type_change);
> > +						  content_type, mei_reload_test,
> > +						  test_type_change, test_srm);
> >  		valid_tests++;
> >  	}
> >  
> > @@ -582,33 +749,33 @@ igt_main
> >  	igt_subtest("legacy")
> >  		test_content_protection(COMMIT_LEGACY, false,
> >  					HDCP_CONTENT_TYPE_0, false,
> > -					false);
> > +					false, false);
> >  
> >  	igt_subtest("atomic") {
> >  		igt_require(data.display.is_atomic);
> >  		test_content_protection(COMMIT_ATOMIC, false,
> > -					HDCP_CONTENT_TYPE_0, false,
> > +					HDCP_CONTENT_TYPE_0, false, false,
> >  					false);
> >  	}
> >  
> >  	igt_subtest("atomic-dpms") {
> >  		igt_require(data.display.is_atomic);
> >  		test_content_protection(COMMIT_ATOMIC, true,
> > -					HDCP_CONTENT_TYPE_0, false,
> > +					HDCP_CONTENT_TYPE_0, false, false,
> >  					false);
> >  	}
> >  
> >  	igt_subtest("type1") {
> >  		igt_require(data.display.is_atomic);
> >  		test_content_protection(COMMIT_ATOMIC, false,
> > -					HDCP_CONTENT_TYPE_1, false,
> > +					HDCP_CONTENT_TYPE_1, false, false,
> >  					false);
> >  	}
> >  
> >  	igt_subtest("type1_mei_interface") {
> >  		igt_require(data.display.is_atomic);
> >  		test_content_protection(COMMIT_ATOMIC, false,
> > -					HDCP_CONTENT_TYPE_1, true,
> > +					HDCP_CONTENT_TYPE_1, true, false,
> >  					false);
> >  	}
> >  
> > @@ -616,9 +783,36 @@ igt_main
> >  		igt_require(data.display.is_atomic);
> >  		test_content_protection(COMMIT_ATOMIC, false,
> >  					HDCP_CONTENT_TYPE_1, false,
> > -					true);
> > +					true, false);
> >  	}
> >  
> > +	/*
> > +	 * SRM subtest perform the HDCP authentication, and then retrive the
> > +	 * receiver id through topology info.
> > +	 *
> > +	 * Using the receiver ID, facsimile SRM table is modified with
> > +	 * receiver ID retrieved from teh topology info. After modification
> > +	 * SRM table is not intact as per DCP Signature.
> > +	 *
> > +	 * But Kernel believes userspace and doesn't verify the DCP signature.
> > +	 * So we can exploite that trust to test the SRM and topology info
> > +	 * features.
> > +	 *
> > +	 * So when modified SRM is applied Authentication will fail due to
> > +	 * receiver ID revocation.
> > +	 *
> > +	 * And Kernel attempts HDCP2.2 always and on failure of it HDCP1.4
> > +	 * will be attempted. But their ID of the sink varies between 1.4 and
> > +	 * 2.2 versions. So we need to stick to one version. Hence HDCP2.2 is
> > +	 * choosen using Type 1.
> 
> Oops, just realized that this is a bug in the kernel. Here's the slightly
> nasty attack:
> 
> - create a fake SRM with no revocations but really high revision number
> - kernel will reject updates from here on.
No. Kernel reads the SRM from /lib/firmware everytime written by
userspace. And SRM Signature is validated by userspace and written there
for kernel consumption.
> 
> Or do we just shrug and say userspace needs to validate the SRM fully
> before it drops it into /lib/firmware?
Yes we heavely rely on userspace to provide the latest signature validated SRM.
Kernel just checks the validness of SRM table structure and consumes it.
> 
> Plan B for SRM testing would be that we simply drop an SRM into
> /lib/firmware (a valid one) and make sure the kernel doesn't blow up. Not
> a great testcase, but better than nothing.
> 
> I guess proper SRM testing needs some kind of hdcp validation (special
> dongle that can optionally use a blacklisted ksv), but we don't have that
> stuff in igt or our CI.
> 
> There's also the issue that I'm not sure we can merge the topolgoy info
> prop, so for now I'd split out a really simple subtest that checks the
> kernel doesn't blow up when loading the facsimile srm.

Yes without topology patch in upstream we can't upstream this test. As
you mentioned we can just right SRM into kernel and validate the success
of write as a subtest.

-Ram
> -Daniel
> 
> > +	 */
> > +	igt_subtest("srm") {
> > +		igt_require(data.display.is_atomic);
> > +		test_content_protection(COMMIT_ATOMIC, false,
> > +					HDCP_CONTENT_TYPE_1, false, false, true);
> > +	}
> > +
> > +
> >  	igt_fixture
> >  		igt_display_fini(&data.display);
> >  }
> > -- 
> > 2.19.1
> > 
> > _______________________________________________
> > igt-dev mailing list
> > igt-dev@lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/igt-dev
> 
> -- 
> Daniel Vetter
> Software Engineer, Intel Corporation
> http://blog.ffwll.ch
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [igt-dev] [PATCH i-g-t v5 3/6] kms_content_protection: test content type change
  2019-04-29 14:40   ` Daniel Vetter
@ 2019-04-30 12:41     ` Ramalingam C
  0 siblings, 0 replies; 15+ messages in thread
From: Ramalingam C @ 2019-04-30 12:41 UTC (permalink / raw)
  To: Daniel Vetter; +Cc: igt-dev, daniel.vetter

On 2019-04-29 at 16:40:16 +0200, Daniel Vetter wrote:
> On Thu, Apr 18, 2019 at 02:18:39PM +0530, Ramalingam C wrote:
> > Testing the content type change when the content protection already
> > enabled.
> > 
> > Signed-off-by: Ramalingam C <ramalingam.c@intel.com>
> > ---
> >  tests/kms_content_protection.c | 61 ++++++++++++++++++++++++----------
> >  1 file changed, 44 insertions(+), 17 deletions(-)
> > 
> > diff --git a/tests/kms_content_protection.c b/tests/kms_content_protection.c
> > index b33b37b9379c..754ce996640d 100644
> > --- a/tests/kms_content_protection.c
> > +++ b/tests/kms_content_protection.c
> > @@ -164,7 +164,7 @@ static void modeset_with_fb(const enum pipe pipe, igt_output_t *output,
> >  }
> >  
> >  static bool test_cp_enable(igt_output_t *output, enum igt_commit_style s,
> > -			   int content_type)
> > +			   int content_type, bool test_type_change)
> >  {
> >  	igt_display_t *display = &data.display;
> >  	igt_plane_t *primary;
> > @@ -172,8 +172,11 @@ static bool test_cp_enable(igt_output_t *output, enum igt_commit_style s,
> >  
> >  	primary = igt_output_get_plane_type(output, DRM_PLANE_TYPE_PRIMARY);
> >  
> > -	igt_output_set_prop_value(output,
> > -				  IGT_CONNECTOR_CONTENT_PROTECTION, CP_DESIRED);
> > +	if (!test_type_change)
> > +		igt_output_set_prop_value(output,
> > +					  IGT_CONNECTOR_CONTENT_PROTECTION,
> > +					  CP_DESIRED);
> > +
> >  	if (output->props[IGT_CONNECTOR_HDCP_CONTENT_TYPE])
> >  		igt_output_set_prop_value(output,
> >  					  IGT_CONNECTOR_HDCP_CONTENT_TYPE,
> > @@ -215,13 +218,17 @@ static void test_cp_disable(igt_output_t *output, enum igt_commit_style s)
> >  
> >  static void test_cp_enable_with_retry(igt_output_t *output,
> >  				      enum igt_commit_style s, int retry,
> > -				      int content_type, bool expect_failure)
> > +				      int content_type, bool expect_failure,
> > +				      bool test_type_change)
> >  {
> > +	int retry_orig = retry;
> >  	bool ret;
> >  
> >  	do {
> > -		test_cp_disable(output, s);
> > -		ret = test_cp_enable(output, s, content_type);
> > +		if (!test_type_change || retry_orig != retry)
> > +			test_cp_disable(output, s);
> > +
> > +		ret = test_cp_enable(output, s, content_type, test_type_change);
> >  
> >  		if (!ret && --retry)
> >  			igt_debug("Retry (%d/2) ...\n", 3 - retry);
> > @@ -260,7 +267,7 @@ static void test_cp_lic(igt_output_t *output)
> >  static void
> >  test_content_protection_on_output(igt_output_t *output, enum igt_commit_style s,
> >  				  bool dpms_test, int content_type,
> > -				  bool mei_reload_test)
> > +				  bool mei_reload_test, bool test_type_change)
> >  {
> >  	igt_display_t *display = &data.display;
> >  	igt_plane_t *primary;
> > @@ -281,7 +288,12 @@ test_content_protection_on_output(igt_output_t *output, enum igt_commit_style s,
> >  			continue;
> >  
> >  		modeset_with_fb(pipe, output, s);
> > -		test_cp_enable_with_retry(output, s, 3, content_type, false);
> > +		test_cp_enable_with_retry(output, s, 3, content_type, false,
> > +					  false);
> > +		if (test_type_change && content_type == HDCP_CONTENT_TYPE_1)
> > +			test_cp_enable_with_retry(output, s, 3,
> > +						  HDCP_CONTENT_TYPE_0, false,
> > +						  test_type_change);
> >  
> >  		if (mei_reload_test) {
> >  			igt_assert_f(!igt_kmod_unload("mei_hdcp", 0),
> > @@ -289,7 +301,7 @@ test_content_protection_on_output(igt_output_t *output, enum igt_commit_style s,
> >  
> >  			/* Expected to fail */
> >  			test_cp_enable_with_retry(output, s, 3,
> > -						  content_type, false, true);
> > +						  content_type, true, false);
> >  
> >  			igt_assert_f(!igt_kmod_load("mei_hdcp", NULL),
> >  				     "mei_hdcp load failed");
> > @@ -314,7 +326,8 @@ test_content_protection_on_output(igt_output_t *output, enum igt_commit_style s,
> >  						  KERNEL_AUTH_TIME_ALLOWED_MSEC);
> >  			if (!ret)
> >  				test_cp_enable_with_retry(output, s, 2,
> > -							  content_type, false);
> > +							  content_type, false,
> > +							  false);
> >  		}
> >  
> >  		test_cp_disable(output, s);
> > @@ -379,7 +392,8 @@ static bool sink_hdcp2_capable(igt_output_t *output)
> >  
> >  static void
> >  test_content_protection(enum igt_commit_style s, bool dpms_test,
> > -			int content_type, bool mei_reload_test)
> > +			int content_type, bool mei_reload_test,
> > +			bool test_type_change)
> 
> Hm this is getting a bit too much I think, usually we create a new usigned
> flags and a pile of bitmask defines for this. Then you have checks like
> 
> 	if (flags & TEST_USE_ATOMIC_COMMIT)
> 
> or	if (flags & TEST_TYPE1)
> 
> or similar. A long list of various bool arguments is pretty hard to read
> on the caller side, since no one can remember what 0/true/false stands for
> in each case, and it's easy to screw up.

I will introduce the test flags. more readable.

-Ram
> Looks all good to me otherwise.
> -Daniel
> 
> >  {
> >  	igt_display_t *display = &data.display;
> >  	igt_output_t *output;
> > @@ -411,7 +425,8 @@ test_content_protection(enum igt_commit_style s, bool dpms_test,
> >  
> >  		test_content_protection_on_output(output, s, dpms_test,
> >  						  content_type,
> > -						  mei_reload_test);
> > +						  mei_reload_test,
> > +						  test_type_change);
> >  		valid_tests++;
> >  	}
> >  
> > @@ -430,30 +445,42 @@ igt_main
> >  
> >  	igt_subtest("legacy")
> >  		test_content_protection(COMMIT_LEGACY, false,
> > -					HDCP_CONTENT_TYPE_0, false);
> > +					HDCP_CONTENT_TYPE_0, false,
> > +					false);
> >  
> >  	igt_subtest("atomic") {
> >  		igt_require(data.display.is_atomic);
> >  		test_content_protection(COMMIT_ATOMIC, false,
> > -					HDCP_CONTENT_TYPE_0, false);
> > +					HDCP_CONTENT_TYPE_0, false,
> > +					false);
> >  	}
> >  
> >  	igt_subtest("atomic-dpms") {
> >  		igt_require(data.display.is_atomic);
> >  		test_content_protection(COMMIT_ATOMIC, true,
> > -					HDCP_CONTENT_TYPE_0, false);
> > +					HDCP_CONTENT_TYPE_0, false,
> > +					false);
> >  	}
> >  
> >  	igt_subtest("type1") {
> >  		igt_require(data.display.is_atomic);
> >  		test_content_protection(COMMIT_ATOMIC, false,
> > -					HDCP_CONTENT_TYPE_1, false);
> > +					HDCP_CONTENT_TYPE_1, false,
> > +					false);
> >  	}
> >  
> >  	igt_subtest("type1_mei_interface") {
> >  		igt_require(data.display.is_atomic);
> >  		test_content_protection(COMMIT_ATOMIC, false,
> > -					HDCP_CONTENT_TYPE_1, true);
> > +					HDCP_CONTENT_TYPE_1, true,
> > +					false);
> > +	}
> > +
> > +	igt_subtest("content_type_change") {
> > +		igt_require(data.display.is_atomic);
> > +		test_content_protection(COMMIT_ATOMIC, false,
> > +					HDCP_CONTENT_TYPE_1, false,
> > +					true);
> >  	}
> >  
> >  	igt_fixture
> > -- 
> > 2.19.1
> > 
> > _______________________________________________
> > igt-dev mailing list
> > igt-dev@lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/igt-dev
> 
> -- 
> Daniel Vetter
> Software Engineer, Intel Corporation
> http://blog.ffwll.ch
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2019-04-30 12:39 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-18  8:48 [igt-dev] [PATCH i-g-t v5 0/6] HDCP2.2 Tests Ramalingam C
2019-04-18  8:48 ` [igt-dev] [PATCH i-g-t v5 1/6] kms_content_protection: Content type support Ramalingam C
2019-04-18  8:48 ` [igt-dev] [PATCH i-g-t v5 2/6] kms_content_protection: test teardown and rebuild of I915-mei I/F Ramalingam C
2019-04-18  8:48 ` [igt-dev] [PATCH i-g-t v5 3/6] kms_content_protection: test content type change Ramalingam C
2019-04-29 14:40   ` Daniel Vetter
2019-04-30 12:41     ` Ramalingam C
2019-04-18  8:48 ` [igt-dev] [PATCH i-g-t v5 4/6] kms_content_protection: uevent for HDCP status change Ramalingam C
2019-04-29 15:17   ` Daniel Vetter
2019-04-18  8:48 ` [igt-dev] [PATCH i-g-t v5 5/6] kms_content_protection: srm and topology_info test Ramalingam C
2019-04-29 15:24   ` Daniel Vetter
2019-04-30 12:33     ` Ramalingam C
2019-04-18  8:48 ` [igt-dev] [PATCH i-g-t v5 6/6] DO NOT MERGE: CP in fast feedback list Ramalingam C
2019-04-18  9:54 ` [igt-dev] ✓ Fi.CI.BAT: success for HDCP2.2 Tests (rev5) Patchwork
2019-04-18 11:38 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
2019-04-29 15:24 ` [igt-dev] [PATCH i-g-t v5 0/6] HDCP2.2 Tests Daniel Vetter

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.