Skip to contentSkip to conversation

drm/i915/firmware: Load GuC and HuC firmware using async work.

RFC In review Joseph Garvey 3 participants 3 messages Aug 17, 2017 – Sep 14, 2017

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

RFC 1/1 drm/i915/firmware: Load GuC and HuC firmware using async work.

The DMC firmware is currently being loaded using async work. We can do the same for the GuC and HuC firmware. Also wait for the work to finish before the firmware transfer.

Cc Sagar Kamble <[email protected]>
Cc Rodrigo Vivi <[email protected]>
CC Oscar Mateo <[email protected]>
Cc Anusha Srivatsa <[email protected]>
Cc Daniel Vetter <[email protected]>
---
 drivers/gpu/drm/i915/i915_drv.h |  1 +
 drivers/gpu/drm/i915/intel_uc.c | 12 +++++++++++-
 2 files changed, 12 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_drv.h +1 -0
index 907603c..56998fa 100644
@@ -2167,6 +2167,7 @@ struct drm_i915_private {
 
 	struct intel_huc huc;
 	struct intel_guc guc;
+	struct work_struct uc_load_work;
 
 	struct intel_csr csr;
 
drivers/gpu/drm/i915/intel_uc.c +11 -1
index 27e072c..8d40e1d 100644
@@ -250,12 +250,21 @@ static void fetch_uc_fw(struct drm_i915_private *dev_priv,
 	uc_fw->fetch_status = INTEL_UC_FIRMWARE_FAIL;
 }
 
-void intel_uc_init_fw(struct drm_i915_private *dev_priv)
+static void load_uc_fw_work(struct work_struct *work)
 {
+	struct drm_i915_private *dev_priv;
+
+	dev_priv = container_of(work, typeof(*dev_priv), uc_load_work);
 	fetch_uc_fw(dev_priv, &dev_priv->huc.fw);
 	fetch_uc_fw(dev_priv, &dev_priv->guc.fw);
 }
 
+void intel_uc_init_fw(struct drm_i915_private *dev_priv)
+{
+	INIT_WORK(&dev_priv->uc_load_work, load_uc_fw_work);
+	schedule_work(&dev_priv->uc_load_work);
+}
+
 void intel_uc_fini_fw(struct drm_i915_private *dev_priv)
 {
 	__intel_uc_fw_fini(&dev_priv->guc.fw);
@@ -336,6 +345,7 @@ int intel_uc_init_hw(struct drm_i915_private *dev_priv)
 	if (!i915.enable_guc_loading)
 		return 0;
 
+	flush_work(&dev_priv->uc_load_work);
 	guc_disable_communication(guc);
 	gen9_reset_guc_interrupts(dev_priv);
 
Signature · 6 lines
2.7.4

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

✗ Fi.CI.BAT: failure for drm/i915/firmware: Load GuC and HuC firmware using async work.

== Series Details ==

== Series Details ==

Series: drm/i915/firmware: Load GuC and HuC firmware using async work.
URL : https://patchwork.freedesktop.org/series/28889/
State : failure

== Summary ==

Series 28889v1 drm/i915/firmware: Load GuC and HuC firmware using async work.
https://patchwork.freedesktop.org/api/1.0/series/28889/revisions/1/mbox/

Test kms_pipe_crc_basic:

        Subgroup suspend-read-crc-pipe-c:
                pass       -> INCOMPLETE (fi-skl-6260u)
fi-bdw-5557u     total:279  pass:268  dwarn:0   dfail:0   fail:0   skip:11  time:452s
fi-bdw-gvtdvm    total:279  pass:265  dwarn:0   dfail:0   fail:0   skip:14  time:438s
fi-blb-e6850     total:279  pass:224  dwarn:1   dfail:0   fail:0   skip:54  time:363s
fi-bsw-n3050     total:279  pass:243  dwarn:0   dfail:0   fail:0   skip:36  time:541s
fi-bxt-j4205     total:279  pass:260  dwarn:0   dfail:0   fail:0   skip:19  time:527s
fi-byt-j1900     total:279  pass:254  dwarn:1   dfail:0   fail:0   skip:24  time:522s
fi-byt-n2820     total:279  pass:251  dwarn:0   dfail:0   fail:0   skip:28  time:513s
fi-glk-2a        total:279  pass:260  dwarn:0   dfail:0   fail:0   skip:19  time:611s
fi-hsw-4770      total:279  pass:263  dwarn:0   dfail:0   fail:0   skip:16  time:441s
fi-hsw-4770r     total:279  pass:263  dwarn:0   dfail:0   fail:0   skip:16  time:425s
fi-ilk-650       total:279  pass:229  dwarn:0   dfail:0   fail:0   skip:50  time:421s
fi-ivb-3520m     total:279  pass:261  dwarn:0   dfail:0   fail:0   skip:18  time:494s
fi-ivb-3770      total:279  pass:261  dwarn:0   dfail:0   fail:0   skip:18  time:475s
fi-kbl-7500u     total:279  pass:261  dwarn:0   dfail:0   fail:0   skip:18  time:479s
fi-kbl-7560u     total:279  pass:269  dwarn:0   dfail:0   fail:0   skip:10  time:594s
fi-kbl-r         total:279  pass:261  dwarn:0   dfail:0   fail:0   skip:18  time:599s
fi-pnv-d510      total:279  pass:223  dwarn:1   dfail:0   fail:0   skip:55  time:524s
fi-skl-6260u     total:238  pass:230  dwarn:0   dfail:0   fail:0   skip:7  
fi-skl-6700k     total:279  pass:261  dwarn:0   dfail:0   fail:0   skip:18  time:481s
fi-skl-6770hq    total:279  pass:269  dwarn:0   dfail:0   fail:0   skip:10  time:488s
fi-skl-gvtdvm    total:279  pass:266  dwarn:0   dfail:0   fail:0   skip:13  time:445s
fi-skl-x1585l    total:279  pass:268  dwarn:0   dfail:0   fail:0   skip:11  time:488s
fi-snb-2520m     total:279  pass:251  dwarn:0   dfail:0   fail:0   skip:28  time:553s
fi-snb-2600      total:279  pass:250  dwarn:0   dfail:0   fail:0   skip:29  time:407s

ada53b43f81fe618f3f0f1dfbd3dd776bb277323 drm-tip: 2017y-08m-16d-15h-18m-56s UTC integration manifest 2d3a16c2e49d drm/i915/firmware: Load GuC and HuC firmware using async work.

== Logs ==

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

#2 lore raw
In reply to Joseph Garvey
Quoted 1 line · Joseph Garvey

The DMC firmware is currently being loaded using async work.

what would be the advantage?
why do we need to load asynchronously?

Quoted 2 lines

We can do the same for the GuC and HuC firmware. Also wait for the work to finish before the firmware transfer.

how are we waiting? I'm afraid I didn't understand that...

Quoted 6 lines
Cc Sagar Kamble <[email protected]>
Cc Rodrigo Vivi <[email protected]>
CC Oscar Mateo <[email protected]>
Cc Anusha Srivatsa <[email protected]>
Cc Daniel Vetter <[email protected]>
Cc Michal Wajdeczko <[email protected]>
Quoted 11 lines
---
 drivers/gpu/drm/i915/i915_drv.h |  1 +
 drivers/gpu/drm/i915/intel_uc.c | 12 +++++++++++-
 2 files changed, 12 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_drv.h +0 -0
index 907603c..56998fa 100644

drivers/gpu/drm/i915/i915_drv.h struct drm_i915_private { · line 2170

Quoted 4 lines
drivers/gpu/drm/i915/i915_drv.h +1 -0
@@ -2167,6 +2167,7 @@ struct drm_i915_private {
 
        struct intel_huc huc;
        struct intel_guc guc;
+       struct work_struct uc_load_work;

By looking to DMC I'm not sure we are doing the right thing with using own wq instead of the official nowait firmware interface... I believe nowait provides the advantage of loading the firmware without initrd... but I might be wrong..
maybe I'm expecting to much on the nowait interface...

Quoted 9 lines
drivers/gpu/drm/i915/i915_drv.h +0 -0
        struct intel_csr csr;
 
drivers/gpu/drm/i915/intel_uc.c +0 -0
index 27e072c..8d40e1d 100644
@@ -250,12 +250,21 @@ static void fetch_uc_fw(struct drm_i915_private *dev_priv,
        uc_fw->fetch_status = INTEL_UC_FIRMWARE_FAIL;

drivers/gpu/drm/i915/intel_uc.c static void fetch_uc_fw(struct drm_i915_private *dev_priv, · line 259

Quoted 10 lines
drivers/gpu/drm/i915/intel_uc.c +4 -1
 }
 
-void intel_uc_init_fw(struct drm_i915_private *dev_priv)
+static void load_uc_fw_work(struct work_struct *work)
 {
+       struct drm_i915_private *dev_priv;
+
+       dev_priv = container_of(work, typeof(*dev_priv), uc_load_work);
        fetch_uc_fw(dev_priv, &dev_priv->huc.fw);
        fetch_uc_fw(dev_priv, &dev_priv->guc.fw);

I believe this is handling on the wrong place....
I believe it should be inside fetch_uc_fw around firmrare_request, not here...

drivers/gpu/drm/i915/intel_uc.c static void fetch_uc_fw(struct drm_i915_private *dev_priv, · line 264

Quoted 5 lines
drivers/gpu/drm/i915/intel_uc.c +3 -0
 }
 
+void intel_uc_init_fw(struct drm_i915_private *dev_priv)
+{
+       INIT_WORK(&dev_priv->uc_load_work, load_uc_fw_work);

apparently init is on the right place, but please double check if ther is absolutelly no wai of flush being called on cases where this INIT_WORK was never ever executed or you get a oops..

drivers/gpu/drm/i915/intel_uc.c static void fetch_uc_fw(struct drm_i915_private *dev_priv, · line 265

Quoted 1 line
drivers/gpu/drm/i915/intel_uc.c +1 -0
+       schedule_work(&dev_priv->uc_load_work);

this should be on where currently request firmware is...

Quoted 16 lines
drivers/gpu/drm/i915/intel_uc.c +3 -1
+}
+
 void intel_uc_fini_fw(struct drm_i915_private *dev_priv)
 {
        __intel_uc_fw_fini(&dev_priv->guc.fw);
@@ -336,6 +345,7 @@ int intel_uc_init_hw(struct drm_i915_private *dev_priv)
        if (!i915.enable_guc_loading)
                return 0;
 
+       flush_work(&dev_priv->uc_load_work);
        guc_disable_communication(guc);
        gen9_reset_guc_interrupts(dev_priv);
 
--

2.7.4

Signature · 6 lines
Rodrigo Vivi
Blog: http://blog.vivi.eng.br
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx