Skip to contentSkip to conversation

drm/i915/huc: Avoid attempting to authenticate non-existent fw

PATCH Superseded Michał Winiarski 4 participants 9 messages Jan 20, 2017

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/2 drm/i915/huc: Avoid attempting to authenticate non-existent fw

HuC authentication is called even if HuC firmware is not present in the system, leading to NULL ptr dereference on not allocated gem_object. Let's avoid trying to authenticate HuC if its firmware is not loaded successfully.

Fixes dac84a388528 ("drm/i915/huc: Support HuC authentication")

v2: Check inside the auth function, split the assert (Michał)

Cc Anusha Srivatsa <[email protected]>
Cc Arkadiusz Hiler <[email protected]>
Cc Chris Wilson <[email protected]>
Cc Michal Wajdeczko <[email protected]>
---
 drivers/gpu/drm/i915/intel_huc.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/gpu/drm/i915/intel_huc.c +3 -0
index 897ef31..d1e65fa 100644
@@ -299,6 +299,9 @@ void intel_guc_auth_huc(struct drm_i915_private *dev_priv)
 	int ret;
 	u32 data[2];
 
+	if (huc_fw->load_status != INTEL_UC_FIRMWARE_SUCCESS)
+		return;
+
 	vma = i915_gem_object_ggtt_pin(huc->fw.obj, NULL, 0, 0,
 				PIN_OFFSET_BIAS | GUC_WOPCM_TOP);
 	if (IS_ERR(vma)) {
Signature · 6 lines
2.9.3

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

PATCH v2 2/2 drm/i915/huc: Assert that HuC vma is placed in GuC accessible range

HuC firmware is mapped at GuC accessible range. Let's add an assert to verify that.

Cc Anusha Srivatsa <[email protected]>
Cc Arkadiusz Hiler <[email protected]>
Cc Chris Wilson <[email protected]>
Cc Michal Wajdeczko <[email protected]>
---
 drivers/gpu/drm/i915/intel_huc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_huc.c +1 -1
index d1e65fa..43789a8 100644
@@ -312,7 +312,7 @@ void intel_guc_auth_huc(struct drm_i915_private *dev_priv)
 
 	/* Specify auth action and where public signature is. */
 	data[0] = INTEL_GUC_ACTION_AUTHENTICATE_HUC;
-	data[1] = i915_ggtt_offset(vma) + huc->fw.rsa_offset;
+	data[1] = guc_ggtt_offset(vma) + huc->fw.rsa_offset;
 
 	ret = intel_guc_send(guc, data, ARRAY_SIZE(data));
 	if (ret) {
Signature · 6 lines
2.9.3

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Reviewed-by on v2 2/2
#2 lore raw

Re: [PATCH v2 2/2] drm/i915/huc: Assert that HuC vma is placed in GuC accessible range

Quoted 8 lines · Michał Winiarski

HuC firmware is mapped at GuC accessible range. Let's add an assert to verify that.

Cc Anusha Srivatsa <[email protected]>
Cc Arkadiusz Hiler <[email protected]>
Cc Chris Wilson <[email protected]>
Cc Michal Wajdeczko <[email protected]>
Quoted 20 lines
---
 drivers/gpu/drm/i915/intel_huc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_huc.c +1 -1
index d1e65fa..43789a8 100644
@@ -312,7 +312,7 @@ void intel_guc_auth_huc(struct drm_i915_private *dev_priv)
 
 	/* Specify auth action and where public signature is. */
 	data[0] = INTEL_GUC_ACTION_AUTHENTICATE_HUC;
-	data[1] = i915_ggtt_offset(vma) + huc->fw.rsa_offset;
+	data[1] = guc_ggtt_offset(vma) + huc->fw.rsa_offset;
 
 	ret = intel_guc_send(guc, data, ARRAY_SIZE(data));
 	if (ret) {
Signature · 1 line
2.9.3

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

#3 lore raw

PATCH v3 1/1 drm/i915/huc: Assert that HuC vma is placed in GuC accessible range

In reply to Michał Winiarski

HuC firmware is mapped at GuC accessible range. Let's add an assert to verify that.

v2: Split from previous commit (Michał)
v3: Oops, hit send before compiling, s/huc_fw/huc->fw

Cc Anusha Srivatsa <[email protected]>
Cc Arkadiusz Hiler <[email protected]>
Cc Chris Wilson <[email protected]>
Cc Michal Wajdeczko <[email protected]>
---
 drivers/gpu/drm/i915/intel_huc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/intel_huc.c +2 -2
index d1e65fa..c144609 100644
@@ -299,7 +299,7 @@ void intel_guc_auth_huc(struct drm_i915_private *dev_priv)
 	int ret;
 	u32 data[2];
 
-	if (huc_fw->load_status != INTEL_UC_FIRMWARE_SUCCESS)
+	if (huc->fw.load_status != INTEL_UC_FIRMWARE_SUCCESS)
 		return;
 
 	vma = i915_gem_object_ggtt_pin(huc->fw.obj, NULL, 0, 0,
@@ -312,7 +312,7 @@ void intel_guc_auth_huc(struct drm_i915_private *dev_priv)
 
 	/* Specify auth action and where public signature is. */
 	data[0] = INTEL_GUC_ACTION_AUTHENTICATE_HUC;
-	data[1] = i915_ggtt_offset(vma) + huc->fw.rsa_offset;
+	data[1] = guc_ggtt_offset(vma) + huc->fw.rsa_offset;
 
 	ret = intel_guc_send(guc, data, ARRAY_SIZE(data));
 	if (ret) {
Signature · 6 lines
2.9.3

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

Re: [PATCH v3] drm/i915/huc: Assert that HuC vma is placed in GuC accessible range

Quoted 5 lines · Michał Winiarski

HuC firmware is mapped at GuC accessible range. Let's add an assert to verify that.

v2: Split from previous commit (Michał)
v3: Oops, hit send before compiling, s/huc_fw/huc->fw

And now I've amended the wrong patch...
Ah, please ignore this one while I resend the first one

Quoted 8 lines
Cc Anusha Srivatsa <[email protected]>
Cc Arkadiusz Hiler <[email protected]>
Cc Chris Wilson <[email protected]>
Cc Michal Wajdeczko <[email protected]>
---
 drivers/gpu/drm/i915/intel_huc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

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

#5 lore raw

Re: [PATCH v3] drm/i915/huc: Assert that HuC vma is placed in GuC accessible range

Quoted 9 lines · Michał Winiarski
Quoted 5 lines · Michał Winiarski

HuC firmware is mapped at GuC accessible range. Let's add an assert to verify that.

v2: Split from previous commit (Michał)
v3: Oops, hit send before compiling, s/huc_fw/huc->fw

And now I've amended the wrong patch...
Ah, please ignore this one while I resend the first one

At this point the poor CI bot is thoroughly confused... -Chris

Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Reviewed-by on v2 1/2
#6 lore raw
In reply to Michał Winiarski
Quoted 7 lines · Michał Winiarski

HuC authentication is called even if HuC firmware is not present in the system, leading to NULL ptr dereference on not allocated gem_object. Let's avoid trying to authenticate HuC if its firmware is not loaded successfully.

Fixes dac84a388528 ("drm/i915/huc: Support HuC authentication")
Quoted 7 lines

v2: Check inside the auth function, split the assert (Michał)

Cc Anusha Srivatsa <[email protected]>
Cc Arkadiusz Hiler <[email protected]>
Cc Chris Wilson <[email protected]>
Cc Michal Wajdeczko <[email protected]>
Reviewed-by Michal Wajdeczko <michal.wajdeczko.intel.com>
Quoted 21 lines
---
 drivers/gpu/drm/i915/intel_huc.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/gpu/drm/i915/intel_huc.c +3 -0
index 897ef31..d1e65fa 100644
@@ -299,6 +299,9 @@ void intel_guc_auth_huc(struct drm_i915_private *dev_priv)
 	int ret;
 	u32 data[2];
 
+	if (huc_fw->load_status != INTEL_UC_FIRMWARE_SUCCESS)
+		return;
+
 	vma = i915_gem_object_ggtt_pin(huc->fw.obj, NULL, 0, 0,
 				PIN_OFFSET_BIAS | GUC_WOPCM_TOP);
 	if (IS_ERR(vma)) {
Signature · 1 line
2.9.3

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

#7 lore raw

PATCH v3 1/2 drm/i915/huc: Avoid attempting to authenticate non-existent fw

In reply to Michał Winiarski

HuC authentication is called even if HuC firmware is not present in the system, leading to NULL ptr dereference on not allocated gem_object. Let's avoid trying to authenticate HuC if its firmware is not loaded successfully.

Fixes dac84a388528 ("drm/i915/huc: Support HuC authentication")

v2: Check inside the auth function, split the assert (Michał)
v3: Oops, hit send before compiling, s/huc_fw/huc->fw

Cc Anusha Srivatsa <[email protected]>
Cc Arkadiusz Hiler <[email protected]>
Cc Chris Wilson <[email protected]>
---
 drivers/gpu/drm/i915/intel_huc.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/gpu/drm/i915/intel_huc.c +3 -0
index 897ef31..5edd4f7 100644
@@ -299,6 +299,9 @@ void intel_guc_auth_huc(struct drm_i915_private *dev_priv)
 	int ret;
 	u32 data[2];
 
+	if (huc->fw.load_status != INTEL_UC_FIRMWARE_SUCCESS)
+		return;
+
 	vma = i915_gem_object_ggtt_pin(huc->fw.obj, NULL, 0, 0,
 				PIN_OFFSET_BIAS | GUC_WOPCM_TOP);
 	if (IS_ERR(vma)) {
Signature · 6 lines
2.9.3

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

✗ Fi.CI.BAT: failure for series starting with [v3,1/2] drm/i915/huc: Avoid attempting to authenticate non-existent fw (rev3)

In reply to Michał Winiarski
== Series Details ==

== Series Details ==

Series: series starting with [v3,1/2] drm/i915/huc: Avoid attempting to authenticate non-existent fw (rev3)
URL : https://patchwork.freedesktop.org/series/18301/
State : failure

== Summary ==

Series 18301v3 Series without cover letter
https://patchwork.freedesktop.org/api/1.0/series/18301/revisions/3/mbox/

Test gem_busy:

        Subgroup basic-busy-default:
                pass       -> FAIL       (fi-ivb-3520m)
fi-bdw-5557u     total:246  pass:232  dwarn:0   dfail:0   fail:0   skip:14 
fi-bsw-n3050     total:246  pass:207  dwarn:0   dfail:0   fail:0   skip:39 
fi-bxt-j4205     total:246  pass:224  dwarn:0   dfail:0   fail:0   skip:22 
fi-bxt-t5700     total:79   pass:66   dwarn:0   dfail:0   fail:0   skip:12 
fi-byt-j1900     total:246  pass:219  dwarn:0   dfail:0   fail:0   skip:27 
fi-byt-n2820     total:246  pass:215  dwarn:0   dfail:0   fail:0   skip:31 
fi-hsw-4770      total:246  pass:227  dwarn:0   dfail:0   fail:0   skip:19 
fi-hsw-4770r     total:246  pass:227  dwarn:0   dfail:0   fail:0   skip:19 
fi-ivb-3520m     total:246  pass:224  dwarn:0   dfail:0   fail:1   skip:21 
fi-ivb-3770      total:246  pass:225  dwarn:0   dfail:0   fail:0   skip:21 
fi-skl-6260u     total:246  pass:233  dwarn:0   dfail:0   fail:0   skip:13 
fi-skl-6700hq    total:246  pass:226  dwarn:0   dfail:0   fail:0   skip:20 
fi-skl-6700k     total:246  pass:222  dwarn:3   dfail:0   fail:0   skip:21 
fi-skl-6770hq    total:246  pass:233  dwarn:0   dfail:0   fail:0   skip:13 
fi-snb-2520m     total:246  pass:215  dwarn:0   dfail:0   fail:0   skip:31 
fi-snb-2600      total:246  pass:214  dwarn:0   dfail:0   fail:0   skip:32 

aa012aa081f6a6d2dd5a1df0f3c3736017df0d56 drm-tip: 2017y-01m-20d-09h-33m-30s UTC integration manifest f4f14b3 drm/i915/huc: Avoid attempting to authenticate non-existent fw

== Logs ==

For more details see: https://intel-gfx-ci.01.org/CI/Patchwork_3562/
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx