[igt-dev] [PATCH i-g-t v6 7/8] kms_content_protection: SRM Testing
Mun, Gwan-gyeong
gwan-gyeong.mun at intel.com
Thu May 16 11:35:20 UTC 2019
On Thu, 2019-05-02 at 18:46 +0530, Ramalingam C wrote:
> Since we dont 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 hdc
> authentication.
>
> Signed-off-by: Ramalingam C <ramalingam.c at intel.com>
> Acked-by: Daniel Vetter <daniel.vetter at ffwll.ch>
> ---
> tests/kms_content_protection.c | 44
> ++++++++++++++++++++++++++++++++++
> 1 file changed, 44 insertions(+)
>
> diff --git a/tests/kms_content_protection.c
> b/tests/kms_content_protection.c
> index cc8abda48702..f440358c29c5 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)
> @@ -420,6 +426,26 @@ 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);
When I built it on Arch Linux, it shown below error message.
In file included from /usr/include/fcntl.h:328,
from ../tests/kms_content_protection.c:26:
In function ‘open’,
inlined from ‘write_srm_as_fw.constprop’ at
../tests/kms_content_protection.c:435:7,
inlined from ‘__real_main622’ at
../tests/kms_content_protection.c:687:9:
/usr/include/bits/fcntl2.h:50:4: error: call to ‘__open_missing_mode’
declared with attribute error: open with O_CREAT or O_TMPFILE in second
argument needs 3 arguments
__open_missing_mode ();
^~~~~~~~~~~~~~~~~~~~~~
> + 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)
> @@ -638,6 +664,24 @@ 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);
> + 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);
> }
More information about the igt-dev
mailing list