Skip to contentSkip to conversation

drm/hdcp: optimizing the srm handling

RFC Superseded Ramalingam C 3 participants 4 messages Jan 21, 2020 – Jan 22, 2020

Subsystems (2)

v1 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

RFC 1/1 drm/hdcp: optimizing the srm handling

As we are not using the sysfs infrastructure anymore, link to it is removed. And global srm data and mutex to protect it are removed, with required handling at revocation check function.

Yet to test hence RFC tag is added.

---
 drivers/gpu/drm/drm_hdcp.c     | 68 ++++++++++++++--------------------
 drivers/gpu/drm/drm_internal.h |  4 --
 drivers/gpu/drm/drm_sysfs.c    |  2 -
 3 files changed, 27 insertions(+), 47 deletions(-)
drivers/gpu/drm/drm_hdcp.c +27 -41
index 9191633a3c43..cc08d953eb53 100644
@@ -23,13 +23,10 @@
 
 #include "drm_internal.h"
 
-static struct hdcp_srm {
+struct hdcp_srm {
 	u32 revoked_ksv_cnt;
 	u8 *revoked_ksv_list;
-
-	/* Mutex to protect above struct member */
-	struct mutex mutex;
-} *srm_data;
+};
 
 static inline void drm_hdcp_print_ksv(const u8 *ksv)
 {
@@ -91,7 +88,8 @@ static inline u32 get_vrl_length(const u8 *buf)
 	return drm_hdcp_be24_to_cpu(buf);
 }
 
-static int drm_hdcp_parse_hdcp1_srm(const u8 *buf, size_t count)
+static int drm_hdcp_parse_hdcp1_srm(const u8 *buf, size_t count,
+				    struct hdcp_srm *srm_data)
 {
 	struct hdcp_srm_header *header;
 	u32 vrl_length, ksv_count;
@@ -153,7 +151,8 @@ static int drm_hdcp_parse_hdcp1_srm(const u8 *buf, size_t count)
 	return count;
 }
 
-static int drm_hdcp_parse_hdcp2_srm(const u8 *buf, size_t count)
+static int drm_hdcp_parse_hdcp2_srm(const u8 *buf, size_t count,
+				    struct hdcp_srm *srm_data)
 {
 	struct hdcp_srm_header *header;
 	u32 vrl_length, ksv_count, ksv_sz;
@@ -226,18 +225,20 @@ static inline bool is_srm_version_hdcp2(const u8 *buf)
 	return *buf == (u8)(DRM_HDCP_2_SRM_ID << 4 | DRM_HDCP_2_INDICATOR);
 }
 
-static void drm_hdcp_srm_update(const u8 *buf, size_t count)
+static void drm_hdcp_srm_update(const u8 *buf, size_t count,
+				struct hdcp_srm *srm_data)
 {
 	if (count < sizeof(struct hdcp_srm_header))
 		return;
 
 	if (is_srm_version_hdcp1(buf))
-		drm_hdcp_parse_hdcp1_srm(buf, count);
+		drm_hdcp_parse_hdcp1_srm(buf, count, srm_data);
 	else if (is_srm_version_hdcp2(buf))
-		drm_hdcp_parse_hdcp2_srm(buf, count);
+		drm_hdcp_parse_hdcp2_srm(buf, count, srm_data);
 }
 
-static void drm_hdcp_request_srm(struct drm_device *drm_dev)
+static void drm_hdcp_request_srm(struct drm_device *drm_dev,
+				 struct hdcp_srm *srm_data)
 {
 	char fw_name[36] = "display_hdcp_srm.bin";
 	const struct firmware *fw;
@@ -250,7 +251,7 @@ static void drm_hdcp_request_srm(struct drm_device *drm_dev)
 		goto exit;
 
 	if (fw->size && fw->data)
-		drm_hdcp_srm_update(fw->data, fw->size);
+		drm_hdcp_srm_update(fw->data, fw->size, srm_data);
 
 exit:
 	release_firmware(fw);
@@ -284,35 +285,33 @@ static void drm_hdcp_request_srm(struct drm_device *drm_dev)
 bool drm_hdcp_check_ksvs_revoked(struct drm_device *drm_dev, u8 *ksvs,
 				 u32 ksv_count)
 {
-	u32 rev_ksv_cnt, cnt, i, j;
+	struct hdcp_srm *srm_data;
 	u8 *rev_ksv_list;
+	bool ret = false;
+	u32 cnt, i, j;
 
+	srm_data = kzalloc(sizeof(*srm_data), GFP_KERNEL);
 	if (!srm_data)
-		return false;
+		return ret;
 
-	mutex_lock(&srm_data->mutex);
-	drm_hdcp_request_srm(drm_dev);
-
-	rev_ksv_cnt = srm_data->revoked_ksv_cnt;
+	drm_hdcp_request_srm(drm_dev, srm_data);
 	rev_ksv_list = srm_data->revoked_ksv_list;
 
 	/* If the Revoked ksv list is empty */
-	if (!rev_ksv_cnt || !rev_ksv_list) {
-		mutex_unlock(&srm_data->mutex);
-		return false;
-	}
+	if (!srm_data->revoked_ksv_cnt || !rev_ksv_list)
+		goto out;
 
 	for  (cnt = 0; cnt < ksv_count; cnt++) {
 		rev_ksv_list = srm_data->revoked_ksv_list;
-		for (i = 0; i < rev_ksv_cnt; i++) {
+		for (i = 0; i < srm_data->revoked_ksv_cnt; i++) {
 			for (j = 0; j < DRM_HDCP_KSV_LEN; j++)
 				if (ksvs[j] != rev_ksv_list[j]) {
 					break;
 				} else if (j == (DRM_HDCP_KSV_LEN - 1)) {
 					DRM_DEBUG("Revoked KSV is ");
 					drm_hdcp_print_ksv(ksvs);
-					mutex_unlock(&srm_data->mutex);
-					return true;
+					ret = true;
+					goto out;
 				}
 			/* Move the offset to next KSV in the revoked list */
 			rev_ksv_list += DRM_HDCP_KSV_LEN;
@@ -321,28 +320,15 @@ bool drm_hdcp_check_ksvs_revoked(struct drm_device *drm_dev, u8 *ksvs,
 		/* Iterate to next ksv_offset */
 		ksvs += DRM_HDCP_KSV_LEN;
 	}
-	mutex_unlock(&srm_data->mutex);
-	return false;
-}
-EXPORT_SYMBOL_GPL(drm_hdcp_check_ksvs_revoked);
 
-int drm_setup_hdcp_srm(struct class *drm_class)
-{
-	srm_data = kzalloc(sizeof(*srm_data), GFP_KERNEL);
-	if (!srm_data)
-		return -ENOMEM;
-	mutex_init(&srm_data->mutex);
-
-	return 0;
-}
-
-void drm_teardown_hdcp_srm(struct class *drm_class)
-{
+out:
 	if (srm_data) {
 		kfree(srm_data->revoked_ksv_list);
 		kfree(srm_data);
 	}
+	return ret;
 }
+EXPORT_SYMBOL_GPL(drm_hdcp_check_ksvs_revoked);
 
 static struct drm_prop_enum_list drm_cp_enum_list[] = {
 	{ DRM_MODE_CONTENT_PROTECTION_UNDESIRED, "Undesired" },
drivers/gpu/drm/drm_internal.h +0 -4
index 6937bf923f05..a34c7f8373fa 100644
@@ -235,7 +235,3 @@ int drm_syncobj_query_ioctl(struct drm_device *dev, void *data,
 void drm_framebuffer_print_info(struct drm_printer *p, unsigned int indent,
 				const struct drm_framebuffer *fb);
 int drm_framebuffer_debugfs_init(struct drm_minor *minor);
-
-/* drm_hdcp.c */
-int drm_setup_hdcp_srm(struct class *drm_class);
-void drm_teardown_hdcp_srm(struct class *drm_class);
drivers/gpu/drm/drm_sysfs.c +0 -2
index dd2bc85f43cc..2e83c3d72af9 100644
@@ -85,7 +85,6 @@ int drm_sysfs_init(void)
 	}
 
 	drm_class->devnode = drm_devnode;
-	drm_setup_hdcp_srm(drm_class);
 	return 0;
 }
 
@@ -98,7 +97,6 @@ void drm_sysfs_destroy(void)
 {
 	if (IS_ERR_OR_NULL(drm_class))
 		return;
-	drm_teardown_hdcp_srm(drm_class);
 	class_remove_file(drm_class, &class_attr_version.attr);
 	class_destroy(drm_class);
 	drm_class = NULL;
Signature · 6 lines
2.20.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#1 lore raw

[Intel-gfx] ✓ Fi.CI.BAT: success for drm/hdcp: optimizing the srm handling

== Series Details ==

== Series Details ==

Series: drm/hdcp: optimizing the srm handling
URL : https://patchwork.freedesktop.org/series/72312/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_7782 -> Patchwork_16182
====================================================

Summary
-------

**SUCCESS**

No regressions found.

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

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

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

### IGT changes ###

#### Issues hit ####

* igt@i915_module_load@reload-with-fault-injection:
- fi-skl-6600u: [PASS][1] -> [INCOMPLETE][2] ([i915#671] / [i915#69])
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7782/fi-skl-6600u/igt@[email protected]
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16182/fi-skl-6600u/igt@[email protected]
- fi-kbl-x1275: [PASS][3] -> [INCOMPLETE][4] ([i915#879])
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7782/fi-kbl-x1275/igt@[email protected]
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16182/fi-kbl-x1275/igt@[email protected]

* igt@i915_selftest@live_blt:
- fi-hsw-4770: [PASS][5] -> [DMESG-FAIL][6] ([i915#725])
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7782/fi-hsw-4770/igt@i915_selftest@live_blt.html
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16182/fi-hsw-4770/igt@i915_selftest@live_blt.html

* igt@i915_selftest@live_gem_contexts:
- fi-skl-lmem: [PASS][7] -> [INCOMPLETE][8] ([i915#424])
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7782/fi-skl-lmem/igt@i915_selftest@live_gem_contexts.html
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16182/fi-skl-lmem/igt@i915_selftest@live_gem_contexts.html

#### Possible fixes ####

* igt@gem_exec_parallel@contexts:
- fi-byt-j1900: [INCOMPLETE][9] ([i915#45]) -> [PASS][10]
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7782/fi-byt-j1900/igt@[email protected]
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16182/fi-byt-j1900/igt@[email protected]

* igt@gem_exec_suspend@basic-s4-devices:
- fi-kbl-7500u: [DMESG-WARN][11] ([fdo#107139]) -> [PASS][12]
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7782/fi-kbl-7500u/igt@[email protected]
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16182/fi-kbl-7500u/igt@[email protected]

[fdo#107139]: https://bugs.freedesktop.org/show_bug.cgi?id=107139
[i915#424]: https://gitlab.freedesktop.org/drm/intel/issues/424
[i915#45]: https://gitlab.freedesktop.org/drm/intel/issues/45
[i915#671]: https://gitlab.freedesktop.org/drm/intel/issues/671
[i915#69]: https://gitlab.freedesktop.org/drm/intel/issues/69
[i915#725]: https://gitlab.freedesktop.org/drm/intel/issues/725
[i915#879]: https://gitlab.freedesktop.org/drm/intel/issues/879

Participating hosts (48 -> 43)
------------------------------

Missing (5): fi-ilk-m540 fi-hsw-4200u fi-byt-squawks fi-bsw-cyan fi-byt-clapper

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

* CI: CI-20190529 -> None
* Linux: CI_DRM_7782 -> Patchwork_16182

CI-20190529: 20190529
CI_DRM_7782: 088c75b6c6f800c7c1f04c4b90a73a2c2eef7c96 @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_5375: 6a6f7a50c5b2a62f5294b37a810ec7458aaeb774 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
Patchwork_16182: 4f9d6fab8a62fa6965e3912cd5bfc3595be2f77e @ git://anongit.freedesktop.org/gfx-ci/linux

== Linux commits ==

4f9d6fab8a62 drm/hdcp: optimizing the srm handling

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16182/index.html
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#2 lore raw

[Intel-gfx] ✗ Fi.CI.IGT: failure for drm/hdcp: optimizing the srm handling

In reply to Ramalingam C
== Series Details ==

== Series Details ==

Series: drm/hdcp: optimizing the srm handling
URL : https://patchwork.freedesktop.org/series/72312/
State : failure

== Summary ==

CI Bug Log - changes from CI_DRM_7782_full -> Patchwork_16182_full
====================================================

Summary
-------

**FAILURE**

Serious unknown changes coming with Patchwork_16182_full absolutely need to be verified manually.

If you think the reported changes have nothing to do with the changes introduced in Patchwork_16182_full, please notify your bug team to allow them to document this new failure mode, which will reduce false positives in CI.

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

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

### IGT changes ###

#### Possible regressions ####

* igt@gem_ppgtt@flink-and-close-vma-leak:
- shard-hsw: [PASS][1] -> [FAIL][2]
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7782/shard-hsw5/igt@[email protected]
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16182/shard-hsw2/igt@[email protected]

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

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

### IGT changes ###

#### Issues hit ####

* igt@gem_busy@busy-vcs1:
- shard-iclb: [PASS][3] -> [SKIP][4] ([fdo#112080]) +7 similar issues
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7782/shard-iclb4/igt@[email protected]
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16182/shard-iclb8/igt@[email protected]

* igt@gem_ctx_persistence@vcs1-queued:
- shard-iclb: [PASS][5] -> [SKIP][6] ([fdo#109276] / [fdo#112080]) +1 similar issue
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7782/shard-iclb4/igt@[email protected]
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16182/shard-iclb6/igt@[email protected]

* igt@gem_ctx_shared@exec-single-timeline-bsd1:
- shard-iclb: [PASS][7] -> [SKIP][8] ([fdo#109276]) +17 similar issues
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7782/shard-iclb2/igt@[email protected]
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16182/shard-iclb7/igt@[email protected]

* igt@gem_exec_create@forked:
- shard-tglb: [PASS][9] -> [INCOMPLETE][10] ([fdo#108838] / [i915#472])
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7782/shard-tglb8/igt@[email protected]
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16182/shard-tglb5/igt@[email protected]

* igt@gem_exec_schedule@pi-common-bsd:
- shard-iclb: [PASS][11] -> [SKIP][12] ([i915#677])
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7782/shard-iclb7/igt@[email protected]
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16182/shard-iclb4/igt@[email protected]

* igt@gem_exec_schedule@preempt-bsd:
- shard-iclb: [PASS][13] -> [SKIP][14] ([fdo#112146]) +2 similar issues
[13]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7782/shard-iclb8/igt@[email protected]
[14]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16182/shard-iclb2/igt@[email protected]

* igt@gem_persistent_relocs@forked-interruptible-faulting-reloc-thrashing:
- shard-apl: [PASS][15] -> [TIMEOUT][16] ([fdo#112271] / [i915#530])
[15]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7782/shard-apl1/igt@gem_persistent_relocs@forked-interruptible-faulting-reloc-thrashing.html
[16]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16182/shard-apl7/igt@gem_persistent_relocs@forked-interruptible-faulting-reloc-thrashing.html
- shard-hsw: [PASS][17] -> [TIMEOUT][18] ([fdo#112271] / [i915#530])
[17]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7782/shard-hsw7/igt@gem_persistent_relocs@forked-interruptible-faulting-reloc-thrashing.html
[18]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16182/shard-hsw6/igt@gem_persistent_relocs@forked-interruptible-faulting-reloc-thrashing.html

* igt@gem_persistent_relocs@forked-interruptible-thrashing:
- shard-skl: [PASS][19] -> [TIMEOUT][20] ([fdo#112271] / [i915#530]) +1 similar issue
[19]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7782/shard-skl6/igt@[email protected]
[20]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16182/shard-skl9/igt@[email protected]

* igt@gem_persistent_relocs@forked-thrashing:
- shard-hsw: [PASS][21] -> [INCOMPLETE][22] ([i915#530] / [i915#61])
[21]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7782/shard-hsw1/igt@[email protected]
[22]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16182/shard-hsw7/igt@[email protected]
- shard-kbl: [PASS][23] -> [INCOMPLETE][24] ([fdo#103665] / [i915#530])
[23]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7782/shard-kbl3/igt@[email protected]
[24]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16182/shard-kbl6/igt@[email protected]

* igt@gem_sync@basic-store-each:
- shard-tglb: [PASS][25] -> [INCOMPLETE][26] ([i915#472])
[25]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7782/shard-tglb8/igt@[email protected]
[26]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16182/shard-tglb5/igt@[email protected]

* igt@i915_selftest@mock_requests:
- shard-apl: [PASS][27] -> [INCOMPLETE][28] ([fdo#103927])
[27]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7782/shard-apl4/igt@i915_selftest@mock_requests.html
[28]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16182/shard-apl4/igt@i915_selftest@mock_requests.html

* igt@kms_color@pipe-a-ctm-0-5:
- shard-skl: [PASS][29] -> [DMESG-WARN][30] ([i915#109]) +1 similar issue
[29]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7782/shard-skl6/igt@[email protected]
[30]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16182/shard-skl4/igt@[email protected]

* igt@kms_flip@2x-flip-vs-modeset-vs-hang:
- shard-hsw: [PASS][31] -> [INCOMPLETE][32] ([i915#61])
[31]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7782/shard-hsw6/igt@[email protected]
[32]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16182/shard-hsw6/igt@[email protected]

* igt@kms_flip@modeset-vs-vblank-race:
- shard-hsw: [PASS][33] -> [DMESG-WARN][34] ([i915#44])
[33]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7782/shard-hsw6/igt@[email protected]
[34]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16182/shard-hsw5/igt@[email protected]

* igt@kms_frontbuffer_tracking@fbc-suspend:
- shard-apl: [PASS][35] -> [DMESG-WARN][36] ([i915#180]) +4 similar issues
[35]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7782/shard-apl4/igt@[email protected]
[36]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16182/shard-apl3/igt@[email protected]

* igt@kms_frontbuffer_tracking@fbcpsr-1p-pri-indfb-multidraw:
- shard-tglb: [PASS][37] -> [FAIL][38] ([i915#49])
[37]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7782/shard-tglb5/igt@[email protected]
[38]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16182/shard-tglb1/igt@[email protected]

* igt@kms_plane@plane-panning-bottom-right-suspend-pipe-c-planes:
- shard-kbl: [PASS][39] -> [DMESG-WARN][40] ([i915#180]) +2 similar issues
[39]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7782/shard-kbl2/igt@[email protected]
[40]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16182/shard-kbl4/igt@[email protected]

* igt@kms_plane_alpha_blend@pipe-c-constant-alpha-min:
- shard-skl: [PASS][41] -> [FAIL][42] ([fdo#108145])
[41]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7782/shard-skl2/igt@[email protected]
[42]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16182/shard-skl4/igt@[email protected]

* igt@kms_psr@psr2_no_drrs:
- shard-iclb: [PASS][43] -> [SKIP][44] ([fdo#109441]) +1 similar issue
[43]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7782/shard-iclb2/igt@kms_psr@psr2_no_drrs.html
[44]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16182/shard-iclb3/igt@kms_psr@psr2_no_drrs.html

* igt@kms_vblank@pipe-b-ts-continuation-suspend:
- shard-skl: [PASS][45] -> [INCOMPLETE][46] ([i915#69])
[45]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7782/shard-skl4/igt@[email protected]
[46]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16182/shard-skl5/igt@[email protected]

* igt@kms_vblank@pipe-c-ts-continuation-suspend:
- shard-iclb: [PASS][47] -> [INCOMPLETE][48] ([i915#140])
[47]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7782/shard-iclb2/igt@[email protected]
[48]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16182/shard-iclb3/igt@[email protected]

#### Possible fixes ####

* igt@gem_ctx_persistence@vcs1-mixed-process:
- shard-iclb: [SKIP][49] ([fdo#109276] / [fdo#112080]) -> [PASS][50] +4 similar issues
[49]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7782/shard-iclb8/igt@[email protected]
[50]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16182/shard-iclb2/igt@[email protected]

* igt@gem_exec_create@forked:
- shard-kbl: [TIMEOUT][51] ([fdo#112271] / [i915#940]) -> [PASS][52]
[51]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7782/shard-kbl1/igt@[email protected]
[52]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16182/shard-kbl3/igt@[email protected]

* igt@gem_exec_parallel@basic:
- shard-tglb: [INCOMPLETE][53] ([i915#472] / [i915#476]) -> [PASS][54]
[53]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7782/shard-tglb7/igt@[email protected]
[54]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16182/shard-tglb6/igt@[email protected]

* igt@gem_exec_schedule@in-order-bsd:
- shard-iclb: [SKIP][55] ([fdo#112146]) -> [PASS][56] +4 similar issues
[55]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7782/shard-iclb4/igt@[email protected]
[56]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16182/shard-iclb6/igt@[email protected]

* igt@gem_exec_schedule@preempt-queue-bsd1:
- shard-iclb: [SKIP][57] ([fdo#109276]) -> [PASS][58] +15 similar issues
[57]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7782/shard-iclb6/igt@[email protected]
[58]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16182/shard-iclb4/igt@[email protected]

* igt@gem_persistent_relocs@forked-faulting-reloc-thrashing:
- shard-hsw: [INCOMPLETE][59] ([i915#530] / [i915#61]) -> [PASS][60]
[59]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7782/shard-hsw5/igt@[email protected]
[60]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16182/shard-hsw5/igt@[email protected]

* igt@gem_persistent_relocs@forked-interruptible:
- shard-skl: [FAIL][61] ([i915#520]) -> [PASS][62]
[61]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7782/shard-skl1/igt@[email protected]
[62]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16182/shard-skl5/igt@[email protected]

* igt@gem_persistent_relocs@forked-interruptible-faulting-reloc-thrashing:
- shard-skl: [TIMEOUT][63] ([fdo#112271] / [i915#530]) -> [PASS][64]
[63]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7782/shard-skl2/igt@gem_persistent_relocs@forked-interruptible-faulting-reloc-thrashing.html
[64]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16182/shard-skl7/igt@gem_persistent_relocs@forked-interruptible-faulting-reloc-thrashing.html
- shard-tglb: [TIMEOUT][65] ([fdo#112126] / [fdo#112271] / [i915#530]) -> [PASS][66]
[65]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7782/shard-tglb5/igt@gem_persistent_relocs@forked-interruptible-faulting-reloc-thrashing.html
[66]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16182/shard-tglb6/igt@gem_persistent_relocs@forked-interruptible-faulting-reloc-thrashing.html

* igt@gem_persistent_relocs@forked-interruptible-thrashing:
- shard-kbl: [TIMEOUT][67] ([fdo#112271] / [i915#530]) -> [PASS][68]
[67]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7782/shard-kbl1/igt@[email protected]
[68]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16182/shard-kbl3/igt@[email protected]

* igt@gem_ppgtt@blt-vs-render-ctxn:
- shard-tglb: [INCOMPLETE][69] ([i915#470] / [i915#472] / [i915#475]) -> [PASS][70]
[69]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7782/shard-tglb1/igt@[email protected]
[70]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16182/shard-tglb6/igt@[email protected]

* igt@i915_pm_dc@dc6-dpms:
- shard-iclb: [FAIL][71] ([i915#454]) -> [PASS][72]
[71]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7782/shard-iclb3/igt@[email protected]
[72]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16182/shard-iclb8/igt@[email protected]

* igt@i915_pm_rpm@universal-planes-dpms:
- shard-iclb: [INCOMPLETE][73] ([i915#140] / [i915#189]) -> [PASS][74]
[73]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7782/shard-iclb2/igt@[email protected]
[74]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16182/shard-iclb3/igt@[email protected]

* igt@i915_selftest@mock_requests:
- shard-tglb: [INCOMPLETE][75] ([i915#472]) -> [PASS][76]
[75]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7782/shard-tglb8/igt@i915_selftest@mock_requests.html
[76]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16182/shard-tglb6/igt@i915_selftest@mock_requests.html
- shard-kbl: [INCOMPLETE][77] ([fdo#103665]) -> [PASS][78]
[77]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7782/shard-kbl7/igt@i915_selftest@mock_requests.html
[78]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16182/shard-kbl1/igt@i915_selftest@mock_requests.html

* igt@kms_atomic_transition@plane-all-modeset-transition:
- shard-hsw: [DMESG-WARN][79] ([i915#44]) -> [PASS][80]
[79]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7782/shard-hsw5/igt@[email protected]
[80]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16182/shard-hsw2/igt@[email protected]

* igt@kms_color@pipe-b-ctm-0-5:
- shard-skl: [DMESG-WARN][81] ([i915#109]) -> [PASS][82]
[81]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7782/shard-skl7/igt@[email protected]
[82]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16182/shard-skl7/igt@[email protected]

* igt@kms_cursor_legacy@flip-vs-cursor-atomic-transitions-varying-size:
- shard-skl: [FAIL][83] ([IGT#5]) -> [PASS][84]
[83]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7782/shard-skl2/igt@kms_cursor_legacy@flip-vs-cursor-atomic-transitions-varying-size.html
[84]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16182/shard-skl4/igt@kms_cursor_legacy@flip-vs-cursor-atomic-transitions-varying-size.html

* igt@kms_draw_crc@draw-method-rgb565-mmap-wc-ytiled:
- shard-glk: [FAIL][85] ([i915#52] / [i915#54]) -> [PASS][86]
[85]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7782/shard-glk1/igt@[email protected]
[86]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16182/shard-glk6/igt@[email protected]

* igt@kms_flip@flip-vs-suspend-interruptible:
- shard-apl: [DMESG-WARN][87] ([i915#180]) -> [PASS][88] +2 similar issues
[87]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7782/shard-apl4/igt@[email protected]
[88]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16182/shard-apl3/igt@[email protected]

* igt@kms_frontbuffer_tracking@fbc-1p-pri-indfb-multidraw:
- shard-tglb: [FAIL][89] ([i915#49]) -> [PASS][90] +4 similar issues
[89]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7782/shard-tglb4/igt@[email protected]
[90]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16182/shard-tglb2/igt@[email protected]

* igt@kms_frontbuffer_tracking@fbc-suspend:
- shard-kbl: [DMESG-WARN][91] ([i915#180]) -> [PASS][92] +11 similar issues
[91]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7782/shard-kbl7/igt@[email protected]
[92]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16182/shard-kbl3/igt@[email protected]

* igt@kms_plane@plane-panning-bottom-right-suspend-pipe-b-planes:
- shard-skl: [INCOMPLETE][93] ([i915#69]) -> [PASS][94]
[93]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7782/shard-skl9/igt@[email protected]
[94]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16182/shard-skl3/igt@[email protected]

* igt@kms_plane_alpha_blend@pipe-a-coverage-7efc:
- shard-skl: [FAIL][95] ([fdo#108145]) -> [PASS][96]
[95]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7782/shard-skl4/igt@[email protected]
[96]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16182/shard-skl6/igt@[email protected]

* igt@kms_plane_alpha_blend@pipe-b-coverage-7efc:
- shard-skl: [FAIL][97] ([fdo#108145] / [i915#265]) -> [PASS][98]
[97]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7782/shard-skl2/igt@[email protected]
[98]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16182/shard-skl4/igt@[email protected]

* igt@kms_psr@psr2_cursor_mmap_cpu:
- shard-iclb: [SKIP][99] ([fdo#109441]) -> [PASS][100] +1 similar issue
[99]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7782/shard-iclb8/igt@kms_psr@psr2_cursor_mmap_cpu.html
[100]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16182/shard-iclb2/igt@kms_psr@psr2_cursor_mmap_cpu.html

* igt@perf_pmu@busy-no-semaphores-vcs1:
- shard-iclb: [SKIP][101] ([fdo#112080]) -> [PASS][102] +11 similar issues
[101]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7782/shard-iclb8/igt@[email protected]
[102]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16182/shard-iclb2/igt@[email protected]

#### Warnings ####

* igt@gem_persistent_relocs@forked-faulting-reloc-thrash-inactive:
- shard-hsw: [TIMEOUT][103] ([fdo#112271] / [i915#530]) -> [INCOMPLETE][104] ([i915#530] / [i915#61])
[103]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7782/shard-hsw2/igt@[email protected]
[104]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16182/shard-hsw1/igt@[email protected]

* igt@gem_tiled_blits@interruptible:
- shard-hsw: [FAIL][105] ([i915#818]) -> [FAIL][106] ([i915#694])
[105]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7782/shard-hsw5/igt@[email protected]
[106]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16182/shard-hsw5/igt@[email protected]

* igt@i915_pm_dc@dc6-dpms:
- shard-tglb: [SKIP][107] ([i915#468]) -> [FAIL][108] ([i915#454])
[107]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7782/shard-tglb1/igt@[email protected]
[108]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16182/shard-tglb8/igt@[email protected]

* igt@i915_pm_dc@dc6-psr:
- shard-tglb: [FAIL][109] ([i915#454]) -> [SKIP][110] ([i915#468])
[109]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7782/shard-tglb5/igt@[email protected]
[110]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16182/shard-tglb1/igt@[email protected]

[IGT#5]: https://gitlab.freedesktop.org/drm/igt-gpu-tools/issues/5
[fdo#103665]: https://bugs.freedesktop.org/show_bug.cgi?id=103665
[fdo#103927]: https://bugs.freedesktop.org/show_bug.cgi?id=103927
[fdo#108145]: https://bugs.freedesktop.org/show_bug.cgi?id=108145
[fdo#108838]: https://bugs.freedesktop.org/show_bug.cgi?id=108838
[fdo#109276]: https://bugs.freedesktop.org/show_bug.cgi?id=109276
[fdo#109441]: https://bugs.freedesktop.org/show_bug.cgi?id=109441
[fdo#112080]: https://bugs.freedesktop.org/show_bug.cgi?id=112080
[fdo#112126]: https://bugs.freedesktop.org/show_bug.cgi?id=112126
[fdo#112146]: https://bugs.freedesktop.org/show_bug.cgi?id=112146
[fdo#112271]: https://bugs.freedesktop.org/show_bug.cgi?id=112271
[i915#109]: https://gitlab.freedesktop.org/drm/intel/issues/109
[i915#140]: https://gitlab.freedesktop.org/drm/intel/issues/140
[i915#180]: https://gitlab.freedesktop.org/drm/intel/issues/180
[i915#189]: https://gitlab.freedesktop.org/drm/intel/issues/189
[i915#265]: https://gitlab.freedesktop.org/drm/intel/issues/265
[i915#44]: https://gitlab.freedesktop.org/drm/intel/issues/44
[i915#454]: https://gitlab.freedesktop.org/drm/intel/issues/454
[i915#468]: https://gitlab.freedesktop.org/drm/intel/issues/468
[i915#470]: https://gitlab.freedesktop.org/drm/intel/issues/470
[i915#472]: https://gitlab.freedesktop.org/drm/intel/issues/472
[i915#475]: https://gitlab.freedesktop.org/drm/intel/issues/475
[i915#476]: https://gitlab.freedesktop.org/drm/intel/issues/476
[i915#49]: https://gitlab.freedesktop.org/drm/intel/issues/49
[i915#52]: https://gitlab.freedesktop.org/drm/intel/issues/52
[i915#520]: https://gitlab.freedesktop.org/drm/intel/issues/520
[i915#530]: https://gitlab.freedesktop.org/drm/intel/issues/530
[i915#54]: https://gitlab.freedesktop.org/drm/intel/issues/54
[i915#61]: https://gitlab.freedesktop.org/drm/intel/issues/61
[i915#677]: https://gitlab.freedesktop.org/drm/intel/issues/677
[i915#69]: https://gitlab.freedesktop.org/drm/intel/issues/69
[i915#694]: https://gitlab.freedesktop.org/drm/intel/issues/694
[i915#818]: https://gitlab.freedesktop.org/drm/intel/issues/818
[i915#940]: https://gitlab.freedesktop.org/drm/intel/issues/940

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

No changes in participating hosts

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

* CI: CI-20190529 -> None
* Linux: CI_DRM_7782 -> Patchwork_16182

CI-20190529: 20190529
CI_DRM_7782: 088c75b6c6f800c7c1f04c4b90a73a2c2eef7c96 @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_5375: 6a6f7a50c5b2a62f5294b37a810ec7458aaeb774 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
Patchwork_16182: 4f9d6fab8a62fa6965e3912cd5bfc3595be2f77e @ git://anongit.freedesktop.org/gfx-ci/linux
piglit_4509: fdc5a4ca11124ab8413c7988896eec4c97336694 @ git://anongit.freedesktop.org/piglit

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16182/index.html
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#3 lore raw
In reply to Ramalingam C
Quoted 4 lines · Ramalingam C

As we are not using the sysfs infrastructure anymore, link to it is removed. And global srm data and mutex to protect it are removed, with required handling at revocation check function.

Hi Ram,
Thanks for taking this on. A few comments below..

Quoted 15 lines

Yet to test hence RFC tag is added.

---
 drivers/gpu/drm/drm_hdcp.c     | 68 ++++++++++++++--------------------
 drivers/gpu/drm/drm_internal.h |  4 --
 drivers/gpu/drm/drm_sysfs.c    |  2 -
 3 files changed, 27 insertions(+), 47 deletions(-)
drivers/gpu/drm/drm_hdcp.c +0 -0
index 9191633a3c43..cc08d953eb53 100644

drivers/gpu/drm/drm_hdcp.c line 26

Quoted 5 lines
drivers/gpu/drm/drm_hdcp.c +1 -1
@@ -23,13 +23,10 @@
 
 #include "drm_internal.h"
 
-static struct hdcp_srm {
+struct hdcp_srm {

struct drm_hdcp_srm

would be more consistent with the rest of the subsystem

Quoted 11 lines
drivers/gpu/drm/drm_hdcp.c +1 -4
 	u32 revoked_ksv_cnt;
 	u8 *revoked_ksv_list;
-
-	/* Mutex to protect above struct member */
-	struct mutex mutex;
-} *srm_data;
+};
 
 static inline void drm_hdcp_print_ksv(const u8 *ksv)
 {

drivers/gpu/drm/drm_hdcp.c static inline u32 get_vrl_length(const u8 *buf) · line 92

Quoted 6 lines
drivers/gpu/drm/drm_hdcp.c +2 -1
@@ -91,7 +88,8 @@ static inline u32 get_vrl_length(const u8 *buf)
 	return drm_hdcp_be24_to_cpu(buf);
 }
 
-static int drm_hdcp_parse_hdcp1_srm(const u8 *buf, size_t count)
+static int drm_hdcp_parse_hdcp1_srm(const u8 *buf, size_t count,
+				    struct hdcp_srm *srm_data)

Usually the drm structs are the first argument.

Quoted 48 lines
drivers/gpu/drm/drm_hdcp.c +9 -6
 {
 	struct hdcp_srm_header *header;
 	u32 vrl_length, ksv_count;
@@ -153,7 +151,8 @@ static int drm_hdcp_parse_hdcp1_srm(const u8 *buf, size_t count)
 	return count;
 }
 
-static int drm_hdcp_parse_hdcp2_srm(const u8 *buf, size_t count)
+static int drm_hdcp_parse_hdcp2_srm(const u8 *buf, size_t count,
+				    struct hdcp_srm *srm_data)
 {
 	struct hdcp_srm_header *header;
 	u32 vrl_length, ksv_count, ksv_sz;
@@ -226,18 +225,20 @@ static inline bool is_srm_version_hdcp2(const u8 *buf)
 	return *buf == (u8)(DRM_HDCP_2_SRM_ID << 4 | DRM_HDCP_2_INDICATOR);
 }
 
-static void drm_hdcp_srm_update(const u8 *buf, size_t count)
+static void drm_hdcp_srm_update(const u8 *buf, size_t count,
+				struct hdcp_srm *srm_data)
 {
 	if (count < sizeof(struct hdcp_srm_header))
 		return;
 
 	if (is_srm_version_hdcp1(buf))
-		drm_hdcp_parse_hdcp1_srm(buf, count);
+		drm_hdcp_parse_hdcp1_srm(buf, count, srm_data);
 	else if (is_srm_version_hdcp2(buf))
-		drm_hdcp_parse_hdcp2_srm(buf, count);
+		drm_hdcp_parse_hdcp2_srm(buf, count, srm_data);
 }
 
-static void drm_hdcp_request_srm(struct drm_device *drm_dev)
+static void drm_hdcp_request_srm(struct drm_device *drm_dev,
+				 struct hdcp_srm *srm_data)
 {
 	char fw_name[36] = "display_hdcp_srm.bin";
 	const struct firmware *fw;
@@ -250,7 +251,7 @@ static void drm_hdcp_request_srm(struct drm_device *drm_dev)
 		goto exit;
 
 	if (fw->size && fw->data)
-		drm_hdcp_srm_update(fw->data, fw->size);
+		drm_hdcp_srm_update(fw->data, fw->size, srm_data);
 
 exit:
 	release_firmware(fw);

drivers/gpu/drm/drm_hdcp.c static void drm_hdcp_request_srm(struct drm_device *drm_dev) · line 285

Quoted 1 line
drivers/gpu/drm/drm_hdcp.c +0 -0
@@ -284,35 +285,33 @@ static void drm_hdcp_request_srm(struct drm_device *drm_dev)
 bool drm_hdcp_check_ksvs_revoked(struct drm_device *drm_dev, u8 *ksvs,

Unrelated nit: This function should really return int and let the caller decide what to do with the result.

drivers/gpu/drm/drm_hdcp.c static void drm_hdcp_request_srm(struct drm_device *drm_dev) · line 293

Quoted 9 lines
drivers/gpu/drm/drm_hdcp.c +4 -1
 				 u32 ksv_count)
 {
-	u32 rev_ksv_cnt, cnt, i, j;
+	struct hdcp_srm *srm_data;
 	u8 *rev_ksv_list;
+	bool ret = false;
+	u32 cnt, i, j;
 
+	srm_data = kzalloc(sizeof(*srm_data), GFP_KERNEL);

No need to put srm_data on the heap, it's only a pointer and a u32.

Quoted 7 lines
drivers/gpu/drm/drm_hdcp.c +1 -4
 	if (!srm_data)
-		return false;
+		return ret;
 
-	mutex_lock(&srm_data->mutex);
-	drm_hdcp_request_srm(drm_dev);
-

drivers/gpu/drm/drm_hdcp.c static void drm_hdcp_request_srm(struct drm_device *drm_dev) · line 301

Quoted 10 lines
drivers/gpu/drm/drm_hdcp.c +2 -5
-	rev_ksv_cnt = srm_data->revoked_ksv_cnt;
+	drm_hdcp_request_srm(drm_dev, srm_data);
 	rev_ksv_list = srm_data->revoked_ksv_list;
 
 	/* If the Revoked ksv list is empty */
-	if (!rev_ksv_cnt || !rev_ksv_list) {
-		mutex_unlock(&srm_data->mutex);
-		return false;
-	}
+	if (!srm_data->revoked_ksv_cnt || !rev_ksv_list)

You can't have one of these true without the other, right?

I think you should just reverse the loops below and remove this condition entirely.

drivers/gpu/drm/drm_hdcp.c static void drm_hdcp_request_srm(struct drm_device *drm_dev) · line 307

Quoted 7 lines
drivers/gpu/drm/drm_hdcp.c +2 -1
+		goto out;
 
 	for  (cnt = 0; cnt < ksv_count; cnt++) {
 		rev_ksv_list = srm_data->revoked_ksv_list;
-		for (i = 0; i < rev_ksv_cnt; i++) {
+		for (i = 0; i < srm_data->revoked_ksv_cnt; i++) {
 			for (j = 0; j < DRM_HDCP_KSV_LEN; j++)

Multi-line loops should have braces.

drivers/gpu/drm/drm_hdcp.c static void drm_hdcp_request_srm(struct drm_device *drm_dev) · line 310

Quoted 3 lines
drivers/gpu/drm/drm_hdcp.c +0 -0
 				if (ksvs[j] != rev_ksv_list[j]) {
 					break;
 				} else if (j == (DRM_HDCP_KSV_LEN - 1)) {

This can be checked outside the 'j' loop (see below). but even better would be to replace this whole loop with a memcmp.

Quoted 23 lines
drivers/gpu/drm/drm_hdcp.c +2 -11
 					DRM_DEBUG("Revoked KSV is ");
 					drm_hdcp_print_ksv(ksvs);
-					mutex_unlock(&srm_data->mutex);
-					return true;
+					ret = true;
+					goto out;
 				}
 			/* Move the offset to next KSV in the revoked list */
 			rev_ksv_list += DRM_HDCP_KSV_LEN;
@@ -321,28 +320,15 @@ bool drm_hdcp_check_ksvs_revoked(struct drm_device *drm_dev, u8 *ksvs,
 		/* Iterate to next ksv_offset */
 		ksvs += DRM_HDCP_KSV_LEN;
 	}
-	mutex_unlock(&srm_data->mutex);
-	return false;
-}
-EXPORT_SYMBOL_GPL(drm_hdcp_check_ksvs_revoked);
 
-int drm_setup_hdcp_srm(struct class *drm_class)
-{
-	srm_data = kzalloc(sizeof(*srm_data), GFP_KERNEL);
-	if (!srm_data)
-		return -ENOMEM;

drivers/gpu/drm/drm_hdcp.c bool drm_hdcp_check_ksvs_revoked(struct drm_device *drm_dev, u8 *ksvs, · line 326

Quoted 10 lines
drivers/gpu/drm/drm_hdcp.c +1 -7
-	mutex_init(&srm_data->mutex);
-
-	return 0;
-}
-
-void drm_teardown_hdcp_srm(struct class *drm_class)
-{
+out:
 	if (srm_data) {
 		kfree(srm_data->revoked_ksv_list);

IMO, we shouldn't be reaching into the struct to clear it. The struct is so simple you could just pass the array and count around and get rid of it. The alternative is adding a drm_hdcp_srm_destroy helper function to do this.

Quoted 47 lines
drivers/gpu/drm/drm_hdcp.c +2 -0
 		kfree(srm_data);
 	}
+	return ret;
 }
+EXPORT_SYMBOL_GPL(drm_hdcp_check_ksvs_revoked);
 
 static struct drm_prop_enum_list drm_cp_enum_list[] = {
 	{ DRM_MODE_CONTENT_PROTECTION_UNDESIRED, "Undesired" },
drivers/gpu/drm/drm_internal.h +0 -4
index 6937bf923f05..a34c7f8373fa 100644
@@ -235,7 +235,3 @@ int drm_syncobj_query_ioctl(struct drm_device *dev, void *data,
 void drm_framebuffer_print_info(struct drm_printer *p, unsigned int indent,
 				const struct drm_framebuffer *fb);
 int drm_framebuffer_debugfs_init(struct drm_minor *minor);
-
-/* drm_hdcp.c */
-int drm_setup_hdcp_srm(struct class *drm_class);
-void drm_teardown_hdcp_srm(struct class *drm_class);
drivers/gpu/drm/drm_sysfs.c +0 -2
index dd2bc85f43cc..2e83c3d72af9 100644
@@ -85,7 +85,6 @@ int drm_sysfs_init(void)
 	}
 
 	drm_class->devnode = drm_devnode;
-	drm_setup_hdcp_srm(drm_class);
 	return 0;
 }
 
@@ -98,7 +97,6 @@ void drm_sysfs_destroy(void)
 {
 	if (IS_ERR_OR_NULL(drm_class))
 		return;
-	drm_teardown_hdcp_srm(drm_class);
 	class_remove_file(drm_class, &class_attr_version.attr);
 	class_destroy(drm_class);
 	drm_class = NULL;
Signature · 6 lines
2.20.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 5 lines
Sean Paul, Software Engineer, Google / Chromium OS
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel