summaryrefslogtreecommitdiff
path: root/tests/kms_content_protection.c
diff options
context:
space:
mode:
authorRamalingam C <ramalingam.c@intel.com>2019-07-03 15:24:45 +0530
committerRamalingam C <ramalingam.c@intel.com>2019-08-06 16:19:47 +0530
commita9d229327f512ee51d80b05325541f6f562a0f96 (patch)
tree95b18acc92d9c7b3894a1ec638ec56eceee0da0b /tests/kms_content_protection.c
parenta1590fcb9e1b2f2e42f7a23742acce970ef41356 (diff)
kms_content_protection: SRM Testing
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> Link: https://patchwork.freedesktop.org/patch/315470/?series=57756&rev=10
Diffstat (limited to 'tests/kms_content_protection.c')
-rw-r--r--tests/kms_content_protection.c46
1 files changed, 46 insertions, 0 deletions
diff --git a/tests/kms_content_protection.c b/tests/kms_content_protection.c
index eb0bde70..e676b60b 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);
}