drm/i915/guc: Move firmware size check out of generic code
Subsystems (2)
PATCH 1/1 drm/i915/guc: Move firmware size check out of generic code
Checking GuC firmware size can be done in GuC specific code right before DMA copy as it is unlikely to fail anyway.
--- drivers/gpu/drm/i915/intel_guc_loader.c | 14 +++++++++++--- drivers/gpu/drm/i915/intel_uc_fw.c | 8 -------- 2 files changed, 11 insertions(+), 11 deletions(-)
drivers/gpu/drm/i915/intel_guc_loader.c +11 -3
@@ -198,6 +198,7 @@ static int guc_ucode_xfer_dma(struct drm_i915_private *dev_priv,unsigned long offset;struct sg_table *sg = vma->pages;u32 status, rsa[UOS_RSA_SCRATCH_MAX_COUNT ]; +u32 size = guc_fw->header_size + guc_fw->ucode_size;int i, ret =0 ;/* where RSA signature starts */
@@ -208,9 +209,16 @@ static int guc_ucode_xfer_dma(struct drm_i915_private *dev_priv,for (i =0 ; i <UOS_RSA_SCRATCH_MAX_COUNT ; i++)I915_WRITE (UOS_RSA_SCRATCH (i), rsa[i]); -/* The header plus uCode will be copied to WOPCM via DMA, excluding any -* other components */ -I915_WRITE (DMA_COPY_SIZE , guc_fw->header_size + guc_fw->ucode_size); +/* +* The header plus uCode will be copied to WOPCM via DMA, excluding any +* other components. Make sure that firmware fits there. +*/ +if (unlikely (size >intel_guc_wopcm_size (dev_priv))) { +DRM_ERROR ("GuC: Firmware is too large (%dB) to fit in WOPCM\n" , + size); +return -EFBIG ; + } +I915_WRITE (DMA_COPY_SIZE , size);/* Set the source address for the new blob */ offset =guc_ggtt_offset (vma) + guc_fw->header_offset;
drivers/gpu/drm/i915/intel_uc_fw.c +0 -8
@@ -108,14 +108,6 @@ void intel_uc_fw_fetch(struct drm_i915_private *dev_priv,*/ switch (uc_fw->type) {case INTEL_UC_FW_TYPE_GUC : -/* Header and uCode will be loaded to WOPCM. Size of the two. */ - size = uc_fw->header_size + uc_fw->ucode_size; - -/* Top 32k of WOPCM is reserved (8K stack + 24k RC6 context). */ -if (size >intel_guc_wopcm_size (dev_priv)) { -DRM_ERROR ("Firmware is too large to fit in WOPCM\n" ); - goto fail; - } uc_fw->major_ver_found = css->guc.sw_version >>16 ; uc_fw->minor_ver_found = css->guc.sw_version &0xFFFF ;break ;
Signature · 6 lines
2.7.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 28 lines · Michal Wajdeczko
Checking GuC firmware size can be done in GuC specific code right before DMA copy as it is unlikely to fail anyway.
Signed-off-by Michal Wajdeczko <[email protected]>Cc Sagar Arun Kamble <[email protected]>Cc Joonas Lahtinen <[email protected]>--- drivers/gpu/drm/i915/intel_guc_loader.c | 14 +++++++++++--- drivers/gpu/drm/i915/intel_uc_fw.c | 8 -------- 2 files changed, 11 insertions(+), 11 deletions(-)drivers/gpu/drm/i915/intel_guc_loader.c +1
-1@@ -198,6 +198,7 @@ static int guc_ucode_xfer_dma(struct drm_i915_private *dev_priv,unsigned long offset;struct sg_table *sg = vma->pages;u32 status, rsa[UOS_RSA_SCRATCH_MAX_COUNT ]; +u32 size = guc_fw->header_size + guc_fw->ucode_size;int i, ret =0 ;/* where RSA signature starts */ @@ -208,9 +209,16 @@ static int guc_ucode_xfer_dma(struct drm_i915_private *dev_priv,for (i =0 ; i <UOS_RSA_SCRATCH_MAX_COUNT ; i++)I915_WRITE (UOS_RSA_SCRATCH (i), rsa[i]); -/* The header plus uCode will be copied to WOPCM via DMA, excluding any
drivers/gpu/drm/i915/intel_guc_loader.c static int guc_ucode_xfer_dma(struct drm_i915_private *dev_priv, · line 219
Quoted 10 lines
drivers/gpu/drm/i915/intel_guc_loader.c +8
-2-* other components */ -I915_WRITE (DMA_COPY_SIZE , guc_fw->header_size + guc_fw->ucode_size); +/* +* The header plus uCode will be copied to WOPCM via DMA, excluding any +* other components. Make sure that firmware fits there. +*/ +if (unlikely (size >intel_guc_wopcm_size (dev_priv))) { +DRM_ERROR ("GuC: Firmware is too large (%dB) to fit in WOPCM\n" , + size); +return -EFBIG ;
Top level function is converting this to -EAGAIN and would be unnecessary to retry in that case.
Quoted 10 lines
drivers/gpu/drm/i915/intel_guc_loader.c +2
-0+ } +I915_WRITE (DMA_COPY_SIZE , size);/* Set the source address for the new blob */ offset =guc_ggtt_offset (vma) + guc_fw->header_offset;drivers/gpu/drm/i915/intel_uc_fw.c +0
-0
drivers/gpu/drm/i915/intel_uc_fw.c void intel_uc_fw_fetch(struct drm_i915_private *dev_priv, · line 114
Quoted 7 lines
drivers/gpu/drm/i915/intel_uc_fw.c +0
-4@@ -108,14 +108,6 @@ void intel_uc_fw_fetch(struct drm_i915_private *dev_priv,*/ switch (uc_fw->type) {case INTEL_UC_FW_TYPE_GUC : -/* Header and uCode will be loaded to WOPCM. Size of the two. */ - size = uc_fw->header_size + uc_fw->ucode_size; - -/* Top 32k of WOPCM is reserved (8K stack + 24k RC6 context). */
This comment was not correct. So removal makes sense.
drivers/gpu/drm/i915/intel_uc_fw.c void intel_uc_fw_fetch(struct drm_i915_private *dev_priv, · line 113
Quoted 7 lines
drivers/gpu/drm/i915/intel_uc_fw.c +0
-4-if (size >intel_guc_wopcm_size (dev_priv)) { -DRM_ERROR ("Firmware is too large to fit in WOPCM\n" ); - goto fail; - } uc_fw->major_ver_found = css->guc.sw_version >>16 ; uc_fw->minor_ver_found = css->guc.sw_version &0xFFFF ;break ;
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 36 lines · Sagar Arun Kamble
Quoted 33 lines · Michal Wajdeczko
Checking GuC firmware size can be done in GuC specific code right before DMA copy as it is unlikely to fail anyway.
Signed-off-by Michal Wajdeczko <[email protected]>Cc Sagar Arun Kamble <[email protected]>Cc Joonas Lahtinen <[email protected]>--- drivers/gpu/drm/i915/intel_guc_loader.c | 14 +++++++++++--- drivers/gpu/drm/i915/intel_uc_fw.c | 8 -------- 2 files changed, 11 insertions(+), 11 deletions(-)drivers/gpu/drm/i915/intel_guc_loader.c +1
-0@@ -198,6 +198,7 @@ static int guc_ucode_xfer_dma(structdrm_i915_private *dev_priv, unsigned long offset;struct sg_table *sg = vma->pages;u32 status, rsa[UOS_RSA_SCRATCH_MAX_COUNT ]; +u32 size = guc_fw->header_size + guc_fw->ucode_size;int i, ret =0 ;/* where RSA signature starts */ @@ -208,9 +209,16 @@ static int guc_ucode_xfer_dma(struct drm_i915_private *dev_priv, for (i = 0; i < UOS_RSA_SCRATCH_MAX_COUNT; i++)I915_WRITE (UOS_RSA_SCRATCH (i), rsa[i]); - /* The header plus uCode will be copied to WOPCM via DMA, excludingany
drivers/gpu/drm/i915/intel_guc_loader.c +2
-2-* other components */ -I915_WRITE (DMA_COPY_SIZE , guc_fw->header_size + guc_fw->ucode_size); +/* +* The header plus uCode will be copied to WOPCM via DMA, excluding
Quoted 8 lines
drivers/gpu/drm/i915/intel_guc_loader.c static int guc_ucode_xfer_dma(struct drm_i915_private *dev_priv, · line 219
Quoted 7 lines
any
drivers/gpu/drm/i915/intel_guc_loader.c +6
-0+* other components. Make sure that firmware fits there. +*/ +if (unlikely (size >intel_guc_wopcm_size (dev_priv))) { +DRM_ERROR ("GuC: Firmware is too large (%dB) to fit in WOPCM\n" , + size); +return -EFBIG ;Top level function is converting this to
-EAGAINand would be unnecessary to retry in that case.
Hmm, top level function may receive following errors:-ETIMEDOUT-ENOEXEC (signature verification failed)
timeout > 0-EINTR-EFAULT-EINVAL-ENOMEM-EFBIG (not only from above case)-EEXIST-EIO-ENOSPC-E2BIG
...
and unconditionally converts all of them.
Note that there are other cases when retry will not help.
So maybe we should:
1) let guc_ucode_xfer[_dma] decide which failed step can be retried (by converting any transient error into -EAGAIN)
or,
2) let intel_uc_init_hw decide when to retry based on error codes (retry only on EAGAIN EINTR ETIMEDOUT)
or,
3) ignore any unlikely error duplications caused by retry (note that today we retry only due to WA)
Michal
Quoted 18 lines
Quoted 9 lines
drivers/gpu/drm/i915/intel_guc_loader.c +2
-0+ } +I915_WRITE (DMA_COPY_SIZE , size);/* Set the source address for the new blob */ offset =guc_ggtt_offset (vma) + guc_fw->header_offset;drivers/gpu/drm/i915/intel_uc_fw.c +0
-0drivers/gpu/drm/i915/intel_uc_fw.c void intel_uc_fw_fetch(struct drm_i915_private · line 115
Quoted 8 lines
drivers/gpu/drm/i915/intel_uc_fw.c +0
-4@@ -108,14 +108,6 @@ void intel_uc_fw_fetch(struct drm_i915_private*dev_priv, */ switch (uc_fw->type) {case INTEL_UC_FW_TYPE_GUC : -/* Header and uCode will be loaded to WOPCM. Size of the two. */ - size = uc_fw->header_size + uc_fw->ucode_size; - -/* Top 32k of WOPCM is reserved (8K stack + 24k RC6 context). */ This comment was not correct. So removal makes sense.
Quoted 7 lines
Quoted 7 lines
drivers/gpu/drm/i915/intel_uc_fw.c +0
-4-if (size >intel_guc_wopcm_size (dev_priv)) { -DRM_ERROR ("Firmware is too large to fit in WOPCM\n" ); - goto fail; - } uc_fw->major_ver_found = css->guc.sw_version >>16 ; uc_fw->minor_ver_found = css->guc.sw_version &0xFFFF ;break;
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Sagar Arun Kamble
Reviewed-byQuoted 75 lines · Michal Wajdeczko
Quoted 37 lines · Sagar Arun Kamble
Quoted 34 lines · Michal Wajdeczko
Checking GuC firmware size can be done in GuC specific code right before DMA copy as it is unlikely to fail anyway.
Signed-off-by Michal Wajdeczko <[email protected]>Cc Sagar Arun Kamble <[email protected]>Cc Joonas Lahtinen <[email protected]>---
drivers/gpu/drm/i915/intel_guc_loader.c| 14 +++++++++++--- drivers/gpu/drm/i915/intel_uc_fw.c | 8 --------2 files changed, 11 insertions(+), 11 deletions(-)drivers/gpu/drm/i915/intel_guc_loader.c +1
-0@@ -198,6 +198,7 @@ static int guc_ucode_xfer_dma(structdrm_i915_private *dev_priv, unsigned long offset; struct sg_table *sg = vma->pages; u32 status, rsa[UOS_RSA_SCRATCH_MAX_COUNT]; + u32 size = guc_fw->header_size + guc_fw->ucode_size; int i, ret = 0; /* where RSA signature starts */@@ -208,9 +209,16 @@ static int guc_ucode_xfer_dma(struct drm_i915_private *dev_priv, for (i = 0; i < UOS_RSA_SCRATCH_MAX_COUNT; i++) I915_WRITE(UOS_RSA_SCRATCH(i), rsa[i]);- /* The header plus uCode will be copied to WOPCM via DMA, excluding any - * other components */
-I915_WRITE(DMA_COPY_SIZE, guc_fw->header_size + guc_fw->ucode_size);
+ /*
+ * The header plus uCode will be copied to WOPCM via DMA, excluding anyQuoted 8 lines
Quoted 7 lines
+ * other components. Make sure that firmware fits there. + */
+ if (unlikely(size > intel_guc_wopcm_size(dev_priv))) { + DRM_ERROR("GuC: Firmware is too large (%dB) to fit in WOPCM\n",
+ size);
+ return-EFBIG;Top level function is converting this to
-EAGAINand would be unnecessary to retry in that case.Hmm, top level function may receive following errors:
(quoted diff) +0
-2-ETIMEDOUT -ENOEXEC (signature verification failed)timeout > 0
(quoted diff) +0
-9-EINTR -EFAULT -EINVAL -ENOMEM -EFBIG (not only from above case) -EEXIST -EIO -ENOSPC -E2BIGand unconditionally converts all of them.
Note that there are other cases when retry will not help.So maybe we should:
1) let guc_ucode_xfer[_dma] decide which failed step can be retried (by converting any transient error into-EAGAIN)
or,
2) letintel_uc_init_hwdecide when to retry based on error codes (retry only on EAGAIN EINTR ETIMEDOUT)
or,
3) ignore any unlikely error duplications caused by retry (note that today we retry only due to WA)
Quoted 1 line
Michal
Yes. We can settle for 3 for now and revisit if need to update arises. Patch looks good to me.
Quoted 21 lines
Quoted 21 lines
Quoted 13 lines
+ }
+I915_WRITE(DMA_COPY_SIZE, size);
/* Set the source address for the new blob */ offset =guc_ggtt_offset(vma)+guc_fw->header_offset;drivers/gpu/drm/i915/intel_uc_fw.c +0
-0@@ -108,14 +108,6 @@ void intel_uc_fw_fetch(struct drm_i915_private*dev_priv, */ switch (uc_fw->type) {Quoted 7 lines
case
INTEL_UC_FW_TYPE_GUC:
- /* Header and uCode will be loaded to WOPCM. Size of the two. */
- size =uc_fw->header_size+uc_fw->ucode_size; -
- /* Top 32k of WOPCM is reserved (8K stack + 24k RC6 context). */This comment was not correct. So removal makes sense.
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
- if (size >
intel_guc_wopcm_size(dev_priv)) {
-DRM_ERROR("Firmware is too large to fit in WOPCM\n"); - goto fail;
- }
uc_fw->major_ver_found=css->guc.sw_version>> 16;uc_fw->minor_ver_found=css->guc.sw_version&0xFFFF; break;
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI✓ Fi.CI.BAT: success for drm/i915/guc: Move firmware size check out of generic code
In reply to Michal Wajdeczko== Series Details ==
== Series Details ==
Series: drm/i915/guc: Move firmware size check out of generic code
URL : https://patchwork.freedesktop.org/series/31474/
State : success
== Summary ==
Series 31474v1 drm/i915/guc: Move firmware size check out of generic code
https://patchwork.freedesktop.org/api/1.0/series/31474/revisions/1/mbox/
Test chamelium:
Subgroup dp-crc-fast:
pass -> FAIL (fi-kbl-7500u) fdo#102514
Test kms_frontbuffer_tracking:
Subgroup basic:
dmesg-warn -> PASS (fi-bdw-5557u) fdo#102473
Test kms_pipe_crc_basic:
Subgroup suspend-read-crc-pipe-b:
pass -> DMESG-WARN (fi-byt-n2820) fdo#101705fdo#102514 https://bugs.freedesktop.org/show_bug.cgi?id=102514
fdo#102473 https://bugs.freedesktop.org/show_bug.cgi?id=102473
fdo#101705 https://bugs.freedesktop.org/show_bug.cgi?id=101705
fi-bdw-5557u total:289 pass:268 dwarn:0 dfail:0 fail:0 skip:21 time:456s fi-bdw-gvtdvm total:289 pass:265 dwarn:0 dfail:0 fail:0 skip:24 time:475s fi-blb-e6850 total:289 pass:223 dwarn:1 dfail:0 fail:0 skip:65 time:401s fi-bsw-n3050 total:289 pass:243 dwarn:0 dfail:0 fail:0 skip:46 time:569s fi-bwr-2160 total:289 pass:183 dwarn:0 dfail:0 fail:0 skip:106 time:288s fi-bxt-dsi total:289 pass:259 dwarn:0 dfail:0 fail:0 skip:30 time:528s fi-bxt-j4205 total:289 pass:260 dwarn:0 dfail:0 fail:0 skip:29 time:529s fi-byt-j1900 total:289 pass:253 dwarn:1 dfail:0 fail:0 skip:35 time:539s fi-byt-n2820 total:289 pass:249 dwarn:1 dfail:0 fail:0 skip:39 time:523s fi-cfl-s total:289 pass:256 dwarn:1 dfail:0 fail:0 skip:32 time:559s fi-cnl-y total:289 pass:262 dwarn:0 dfail:0 fail:0 skip:27 time:619s fi-elk-e7500 total:289 pass:229 dwarn:0 dfail:0 fail:0 skip:60 time:436s fi-glk-1 total:289 pass:261 dwarn:0 dfail:0 fail:0 skip:28 time:600s fi-hsw-4770 total:289 pass:262 dwarn:0 dfail:0 fail:0 skip:27 time:438s fi-hsw-4770r total:289 pass:262 dwarn:0 dfail:0 fail:0 skip:27 time:422s fi-ivb-3520m total:289 pass:260 dwarn:0 dfail:0 fail:0 skip:29 time:509s fi-ivb-3770 total:289 pass:260 dwarn:0 dfail:0 fail:0 skip:29 time:474s fi-kbl-7500u total:289 pass:263 dwarn:1 dfail:0 fail:1 skip:24 time:482s fi-kbl-7560u total:289 pass:270 dwarn:0 dfail:0 fail:0 skip:19 time:586s fi-kbl-7567u total:289 pass:265 dwarn:4 dfail:0 fail:0 skip:20 time:489s fi-kbl-r total:289 pass:262 dwarn:0 dfail:0 fail:0 skip:27 time:601s fi-pnv-d510 total:289 pass:222 dwarn:1 dfail:0 fail:0 skip:66 time:658s fi-skl-6260u total:289 pass:269 dwarn:0 dfail:0 fail:0 skip:20 time:477s fi-skl-6700hq total:289 pass:263 dwarn:0 dfail:0 fail:0 skip:26 time:655s fi-skl-6700k total:289 pass:265 dwarn:0 dfail:0 fail:0 skip:24 time:532s fi-skl-6770hq total:289 pass:269 dwarn:0 dfail:0 fail:0 skip:20 time:522s fi-snb-2520m total:289 pass:250 dwarn:0 dfail:0 fail:0 skip:39 time:586s fi-snb-2600 total:289 pass:249 dwarn:0 dfail:0 fail:0 skip:40 time:438s
f0ca28b3597bea929c1e58e05eb49a75881d9502 drm-tip: 2017y-10m-06d-11h-12m-22s UTC integration manifest 963a108285cc drm/i915/guc: Move firmware size check out of generic code
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_5924/
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI✗ Fi.CI.IGT: warning for drm/i915/guc: Move firmware size check out of generic code
In reply to Michal Wajdeczko== Series Details ==
== Series Details ==
Series: drm/i915/guc: Move firmware size check out of generic code
URL : https://patchwork.freedesktop.org/series/31474/
State : warning
== Summary ==
Test kms_cursor_legacy:
Subgroup cursorA-vs-flipA-atomic-transitions:
fail -> PASS (shard-hsw) fdo#102723
Subgroup short-flip-before-cursor-toggle:
pass -> SKIP (shard-hsw)fdo#102723 https://bugs.freedesktop.org/show_bug.cgi?id=102723
shard-hsw total:2446 pass:1327 dwarn:6 dfail:0 fail:9 skip:1104 time:10152s
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_5924/shards.html
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx