public inbox for igt-dev@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Ramalingam C <ramalingam.c@intel.com>
To: igt-dev <igt-dev@lists.freedesktop.org>
Cc: Daniel Vetter <daniel@ffwll.ch>
Subject: [igt-dev] [PATCH i-g-t v8 7/8] kms_content_protection: SRM Testing
Date: Wed,  3 Jul 2019 15:24:45 +0530	[thread overview]
Message-ID: <20190703095446.14092-8-ramalingam.c@intel.com> (raw)
In-Reply-To: <20190703095446.14092-1-ramalingam.c@intel.com>

Since we don't any uAPI to retrieve the downstream's device's ksv,
we can't check the real revocation through SRM.

This test just writes the facsimile SRM into the /lib/firmware/
and check the kernel parsing of it by invoking the hdcp authentication.

v2:
  typos in commit msg is fixed. [Uma]
  file mode is added. [GG]
  reset test flag. [Uma]

Signed-off-by: Ramalingam C <ramalingam.c@intel.com>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Reviewed-by: Uma Shankar <uma.shankar@intel.com>
---
 tests/kms_content_protection.c | 46 ++++++++++++++++++++++++++++++++++
 1 file changed, 46 insertions(+)

diff --git a/tests/kms_content_protection.c b/tests/kms_content_protection.c
index 97db0b7451c0..6dcd9938130d 100644
--- a/tests/kms_content_protection.c
+++ b/tests/kms_content_protection.c
@@ -65,6 +65,12 @@ struct data {
 #define KERNEL_DISABLE_TIME_ALLOWED_MSEC	(1 * 1000)
 #define FLIP_EVENT_POLLING_TIMEOUT_MSEC		1000
 
+__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 flip_handler(int fd, unsigned int sequence, unsigned int tv_sec,
 			 unsigned int tv_usec, void *_data)
@@ -419,6 +425,27 @@ 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, S_IRWXU);
+	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,
 					      int content_type)
@@ -646,6 +673,25 @@ igt_main
 		test_content_protection(COMMIT_ATOMIC, HDCP_CONTENT_TYPE_0);
 	}
 
+	/*
+	 *  Testing the revocation check through SRM needs a HDCP sink with
+	 *  programmable Ksvs or we need a uAPI from kernel to read the
+	 *  connected HDCP sink's Ksv. With that we would be able to add that
+	 *  Ksv into a SRM and send in for revocation check. Since we dont have
+	 *  either of these options, we test SRM writing from userspace and
+	 *  validation of the same at kernel. Something is better than nothing.
+	 */
+	igt_subtest("srm") {
+		bool ret;
+
+		igt_require(data.display.is_atomic);
+		data.cp_tests = 0;
+		ret = write_srm_as_fw((const __u8 *)facsimile_srm,
+				      sizeof(facsimile_srm));
+		igt_assert_f(ret, "SRM update failed");
+		test_content_protection(COMMIT_ATOMIC, HDCP_CONTENT_TYPE_0);
+	}
+
 	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

  parent reply	other threads:[~2019-07-03 16:53 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-03  9:54 [igt-dev] [PATCH i-g-t v8 0/8] HDCP2.2 Tests Ramalingam C
2019-07-03  9:54 ` [igt-dev] [PATCH i-g-t v8 1/8] kms_content_protection: Tests are defined by flags Ramalingam C
2019-07-03  9:54 ` [igt-dev] [PATCH i-g-t v8 2/8] kms_content_protection: Link Integrity Check subtest Ramalingam C
2019-07-03  9:54 ` [igt-dev] [PATCH i-g-t v8 3/8] kms_content_protection: Content type support Ramalingam C
2019-07-03  9:54 ` [igt-dev] [PATCH i-g-t v8 4/8] kms_content_protection: test teardown and rebuild of I915-mei I/F Ramalingam C
2019-07-03  9:54 ` [igt-dev] [PATCH i-g-t v8 5/8] kms_content_protection: test content type change Ramalingam C
2019-07-03  9:54 ` [igt-dev] [PATCH i-g-t v8 6/8] kms_content_protection: uevent for HDCP status change Ramalingam C
2019-07-12  4:29   ` [igt-dev] [PATCH i-g-t v9 " Ramalingam C
2019-07-03  9:54 ` Ramalingam C [this message]
2019-07-03  9:54 ` [igt-dev] [PATCH i-g-t v8 8/8] DO NOT MERGE: CP in fast feedback list Ramalingam C
2019-07-03 17:22 ` [igt-dev] ✓ Fi.CI.BAT: success for HDCP2.2 Tests (rev9) Patchwork
2019-07-04 19:12 ` [igt-dev] ✗ Fi.CI.IGT: failure " Patchwork
2019-07-08 11:56   ` Ramalingam C
2019-07-12 12:35 ` [igt-dev] ✓ Fi.CI.BAT: success for HDCP2.2 Tests (rev10) Patchwork
2019-07-13 21:30 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
2019-08-06 11:04 ` [igt-dev] [PATCH i-g-t v8 0/8] HDCP2.2 Tests Ramalingam C
  -- strict thread matches above, loose matches on Subject: below --
2019-07-03  8:02 Ramalingam C
2019-07-03  8:02 ` [igt-dev] [PATCH i-g-t v8 7/8] kms_content_protection: SRM Testing Ramalingam C

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190703095446.14092-8-ramalingam.c@intel.com \
    --to=ramalingam.c@intel.com \
    --cc=daniel@ffwll.ch \
    --cc=igt-dev@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox