Skip to contentSkip to conversation

drm/i915/uc: Remove redundant header_offset/size definitions

PATCH In review Michal Wajdeczko 3 participants 11 messages Jul 26, 2019 – Jul 27, 2019

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

PATCH 1/3 drm/i915/uc: Remove redundant header_offset/size definitions

According to Firmware layout definition, CSS header is located in front of the firmware blob, so header offset is always 0. Similarly, size of the CSS header is constant and is 128.

While here, move type/status enums up and keep them together.

Cc Daniele Ceraolo Spurio <[email protected]>
---
 drivers/gpu/drm/i915/gt/uc/intel_uc_fw.c     | 23 ++++++++------------
 drivers/gpu/drm/i915/gt/uc/intel_uc_fw.h     |  9 ++++----
 drivers/gpu/drm/i915/gt/uc/intel_uc_fw_abi.h |  2 ++
 3 files changed, 15 insertions(+), 19 deletions(-)
drivers/gpu/drm/i915/gt/uc/intel_uc_fw.c +9 -14
index 5fbdd17a864b..66bda0c514a3 100644
@@ -218,21 +218,18 @@ void intel_uc_fw_fetch(struct intel_uc_fw *uc_fw, struct drm_i915_private *i915)
 
 	css = (struct uc_css_header *)fw->data;
 
-	/* Firmware bits always start from header */
-	uc_fw->header_offset = 0;
-	uc_fw->header_size = (css->header_size_dw - css->modulus_size_dw -
-			      css->key_size_dw - css->exponent_size_dw) *
-			     sizeof(u32);
-
-	if (uc_fw->header_size != sizeof(struct uc_css_header)) {
+	/* Check integrity of size values inside CSS header */
+	size = (css->header_size_dw - css->key_size_dw - css->modulus_size_dw -
+		css->exponent_size_dw) * sizeof(u32);
+	if (size != sizeof(struct uc_css_header)) {
 		DRM_WARN("%s: Mismatched firmware header definition\n",
 			 intel_uc_fw_type_repr(uc_fw->type));
 		err = -ENOEXEC;
 		goto fail;
 	}
 
-	/* then, uCode */
-	uc_fw->ucode_offset = uc_fw->header_offset + uc_fw->header_size;
+	/* Firmware blob always starts with the header, then uCode */
+	uc_fw->ucode_offset = sizeof(struct uc_css_header);
 	uc_fw->ucode_size = (css->size_dw - css->header_size_dw) * sizeof(u32);
 
 	/* now RSA */
@@ -246,7 +243,7 @@ void intel_uc_fw_fetch(struct intel_uc_fw *uc_fw, struct drm_i915_private *i915)
 	uc_fw->rsa_size = css->key_size_dw * sizeof(u32);
 
 	/* At least, it should have header, uCode and RSA. Size of all three. */
-	size = uc_fw->header_size + uc_fw->ucode_size + uc_fw->rsa_size;
+	size = sizeof(struct uc_css_header) + uc_fw->ucode_size + uc_fw->rsa_size;
 	if (fw->size < size) {
 		DRM_WARN("%s: Truncated firmware (%zu, expected %zu)\n",
 			 intel_uc_fw_type_repr(uc_fw->type), fw->size, size);
@@ -371,7 +368,7 @@ static int uc_fw_xfer(struct intel_uc_fw *uc_fw, struct intel_gt *gt,
 	intel_uncore_forcewake_get(uncore, FORCEWAKE_ALL);
 
 	/* Set the source address for the uCode */
-	offset = uc_fw_ggtt_offset(uc_fw, gt->ggtt) + uc_fw->header_offset;
+	offset = uc_fw_ggtt_offset(uc_fw, gt->ggtt);
 	GEM_BUG_ON(upper_32_bits(offset) & 0xFFFF0000);
 	intel_uncore_write_fw(uncore, DMA_ADDR_0_LOW, lower_32_bits(offset));
 	intel_uncore_write_fw(uncore, DMA_ADDR_0_HIGH, upper_32_bits(offset));
@@ -385,7 +382,7 @@ static int uc_fw_xfer(struct intel_uc_fw *uc_fw, struct intel_gt *gt,
 	 * via DMA, excluding any other components
 	 */
 	intel_uncore_write_fw(uncore, DMA_COPY_SIZE,
-			      uc_fw->header_size + uc_fw->ucode_size);
+			      uc_fw->ucode_offset + uc_fw->ucode_size);
 
 	/* Start the DMA */
 	intel_uncore_write_fw(uncore, DMA_CTRL,
@@ -539,8 +536,6 @@ void intel_uc_fw_dump(const struct intel_uc_fw *uc_fw, struct drm_printer *p)
 	drm_printf(p, "\tversion: wanted %u.%u, found %u.%u\n",
 		   uc_fw->major_ver_wanted, uc_fw->minor_ver_wanted,
 		   uc_fw->major_ver_found, uc_fw->minor_ver_found);
-	drm_printf(p, "\theader: offset %u, size %u\n",
-		   uc_fw->header_offset, uc_fw->header_size);
 	drm_printf(p, "\tuCode: offset %u, size %u\n",
 		   uc_fw->ucode_offset, uc_fw->ucode_size);
 	drm_printf(p, "\tRSA: offset %u, size %u\n",
drivers/gpu/drm/i915/gt/uc/intel_uc_fw.h +4 -5
index eddbb237fabe..a8048f91f0da 100644
@@ -26,6 +26,7 @@
 #define _INTEL_UC_FW_H_
 
 #include <linux/types.h>
+#include "intel_uc_fw_abi.h"
 #include "i915_gem.h"
 
 struct drm_printer;
@@ -57,10 +58,11 @@ enum intel_uc_fw_type {
  * of fetching, caching, and loading the firmware image into the uC.
  */
 struct intel_uc_fw {
+	enum intel_uc_fw_type type;
+	enum intel_uc_fw_status status;
 	const char *path;
 	size_t size;
 	struct drm_i915_gem_object *obj;
-	enum intel_uc_fw_status status;
 
 	/*
 	 * The firmware build process will generate a version header file with major and
@@ -72,9 +74,6 @@ struct intel_uc_fw {
 	u16 major_ver_found;
 	u16 minor_ver_found;
 
-	enum intel_uc_fw_type type;
-	u32 header_size;
-	u32 header_offset;
 	u32 rsa_size;
 	u32 rsa_offset;
 	u32 ucode_size;
@@ -163,7 +162,7 @@ static inline u32 intel_uc_fw_get_upload_size(struct intel_uc_fw *uc_fw)
 	if (!intel_uc_fw_is_available(uc_fw))
 		return 0;
 
-	return uc_fw->header_size + uc_fw->ucode_size;
+	return sizeof(struct uc_css_header) + uc_fw->ucode_size;
 }
 
 void intel_uc_fw_init_early(struct intel_uc_fw *uc_fw,
drivers/gpu/drm/i915/gt/uc/intel_uc_fw_abi.h +2 -0
index 545e86c52a9e..ae58e8a8c53b 100644
@@ -7,6 +7,7 @@
 #define _INTEL_UC_FW_ABI_H
 
 #include <linux/types.h>
+#include <linux/build_bug.h>
 
 /**
  * DOC: Firmware Layout
@@ -76,5 +77,6 @@ struct uc_css_header {
 	u32 reserved[14];
 	u32 header_info;
 } __packed;
+static_assert(sizeof(struct uc_css_header) == 128);
 
 #endif /* _INTEL_UC_FW_ABI_H */
Signature · 6 lines
2.19.2

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

PATCH 2/3 drm/i915/uc: Remove redundant ucode offset definition

According to Firmware layout definition, uCode is located right after CSS header, so ucode offset is always same as header size.

Cc Daniele Ceraolo Spurio <[email protected]>
---
 drivers/gpu/drm/i915/gt/uc/intel_uc_fw.c | 8 +++-----
 drivers/gpu/drm/i915/gt/uc/intel_uc_fw.h | 1 -
 2 files changed, 3 insertions(+), 6 deletions(-)
drivers/gpu/drm/i915/gt/uc/intel_uc_fw.c +3 -5
index 66bda0c514a3..05079c59ae04 100644
@@ -229,7 +229,6 @@ void intel_uc_fw_fetch(struct intel_uc_fw *uc_fw, struct drm_i915_private *i915)
 	}
 
 	/* Firmware blob always starts with the header, then uCode */
-	uc_fw->ucode_offset = sizeof(struct uc_css_header);
 	uc_fw->ucode_size = (css->size_dw - css->header_size_dw) * sizeof(u32);
 
 	/* now RSA */
@@ -239,7 +238,7 @@ void intel_uc_fw_fetch(struct intel_uc_fw *uc_fw, struct drm_i915_private *i915)
 		err = -ENOEXEC;
 		goto fail;
 	}
-	uc_fw->rsa_offset = uc_fw->ucode_offset + uc_fw->ucode_size;
+	uc_fw->rsa_offset = sizeof(struct uc_css_header) + uc_fw->ucode_size;
 	uc_fw->rsa_size = css->key_size_dw * sizeof(u32);
 
 	/* At least, it should have header, uCode and RSA. Size of all three. */
@@ -382,7 +381,7 @@ static int uc_fw_xfer(struct intel_uc_fw *uc_fw, struct intel_gt *gt,
 	 * via DMA, excluding any other components
 	 */
 	intel_uncore_write_fw(uncore, DMA_COPY_SIZE,
-			      uc_fw->ucode_offset + uc_fw->ucode_size);
+			      sizeof(struct uc_css_header) + uc_fw->ucode_size);
 
 	/* Start the DMA */
 	intel_uncore_write_fw(uncore, DMA_CTRL,
@@ -536,8 +535,7 @@ void intel_uc_fw_dump(const struct intel_uc_fw *uc_fw, struct drm_printer *p)
 	drm_printf(p, "\tversion: wanted %u.%u, found %u.%u\n",
 		   uc_fw->major_ver_wanted, uc_fw->minor_ver_wanted,
 		   uc_fw->major_ver_found, uc_fw->minor_ver_found);
-	drm_printf(p, "\tuCode: offset %u, size %u\n",
-		   uc_fw->ucode_offset, uc_fw->ucode_size);
+	drm_printf(p, "\tuCode: %u bytes\n", uc_fw->ucode_size);
 	drm_printf(p, "\tRSA: offset %u, size %u\n",
 		   uc_fw->rsa_offset, uc_fw->rsa_size);
 }
drivers/gpu/drm/i915/gt/uc/intel_uc_fw.h +0 -1
index a8048f91f0da..6a04bc6d419f 100644
@@ -77,7 +77,6 @@ struct intel_uc_fw {
 	u32 rsa_size;
 	u32 rsa_offset;
 	u32 ucode_size;
-	u32 ucode_offset;
 };
 
 static inline
Signature · 6 lines
2.19.2

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

Re: [PATCH 2/3] drm/i915/uc: Remove redundant ucode offset definition

Quoted 15 lines · Michal Wajdeczko

According to Firmware layout definition, uCode is located right after CSS header, so ucode offset is always same as header size.

Cc Daniele Ceraolo Spurio <[email protected]>
---
  drivers/gpu/drm/i915/gt/uc/intel_uc_fw.c | 8 +++-----
  drivers/gpu/drm/i915/gt/uc/intel_uc_fw.h | 1 -
  2 files changed, 3 insertions(+), 6 deletions(-)
drivers/gpu/drm/i915/gt/uc/intel_uc_fw.c +0 -0
index 66bda0c514a3..05079c59ae04 100644

drivers/gpu/drm/i915/gt/uc/intel_uc_fw.c void intel_uc_fw_fetch(struct intel_uc_fw *uc_fw, struct drm_i915_private *i915) · line 231

Quoted 3 lines
drivers/gpu/drm/i915/gt/uc/intel_uc_fw.c +0 -0
@@ -229,7 +229,6 @@ void intel_uc_fw_fetch(struct intel_uc_fw *uc_fw, struct drm_i915_private *i915)
  	}
 
  	/* Firmware blob always starts with the header, then uCode */

This comment should be updated (or removed) as well. With that:

Daniele

Quoted 38 lines
drivers/gpu/drm/i915/gt/uc/intel_uc_fw.c +3 -5
-	uc_fw->ucode_offset = sizeof(struct uc_css_header);
  	uc_fw->ucode_size = (css->size_dw - css->header_size_dw) * sizeof(u32);
 
  	/* now RSA */
@@ -239,7 +238,7 @@ void intel_uc_fw_fetch(struct intel_uc_fw *uc_fw, struct drm_i915_private *i915)
  		err = -ENOEXEC;
  		goto fail;
  	}
-	uc_fw->rsa_offset = uc_fw->ucode_offset + uc_fw->ucode_size;
+	uc_fw->rsa_offset = sizeof(struct uc_css_header) + uc_fw->ucode_size;
  	uc_fw->rsa_size = css->key_size_dw * sizeof(u32);
 
  	/* At least, it should have header, uCode and RSA. Size of all three. */
@@ -382,7 +381,7 @@ static int uc_fw_xfer(struct intel_uc_fw *uc_fw, struct intel_gt *gt,
  	 * via DMA, excluding any other components
  	 */
  	intel_uncore_write_fw(uncore, DMA_COPY_SIZE,
-			      uc_fw->ucode_offset + uc_fw->ucode_size);
+			      sizeof(struct uc_css_header) + uc_fw->ucode_size);
 
  	/* Start the DMA */
  	intel_uncore_write_fw(uncore, DMA_CTRL,
@@ -536,8 +535,7 @@ void intel_uc_fw_dump(const struct intel_uc_fw *uc_fw, struct drm_printer *p)
  	drm_printf(p, "\tversion: wanted %u.%u, found %u.%u\n",
  		   uc_fw->major_ver_wanted, uc_fw->minor_ver_wanted,
  		   uc_fw->major_ver_found, uc_fw->minor_ver_found);
-	drm_printf(p, "\tuCode: offset %u, size %u\n",
-		   uc_fw->ucode_offset, uc_fw->ucode_size);
+	drm_printf(p, "\tuCode: %u bytes\n", uc_fw->ucode_size);
  	drm_printf(p, "\tRSA: offset %u, size %u\n",
  		   uc_fw->rsa_offset, uc_fw->rsa_size);
  }
drivers/gpu/drm/i915/gt/uc/intel_uc_fw.h +0 -0
index a8048f91f0da..6a04bc6d419f 100644

drivers/gpu/drm/i915/gt/uc/intel_uc_fw.h struct intel_uc_fw { · line 82

Quoted 7 lines
drivers/gpu/drm/i915/gt/uc/intel_uc_fw.h +0 -1
@@ -77,7 +77,6 @@ struct intel_uc_fw {
  	u32 rsa_size;
  	u32 rsa_offset;
  	u32 ucode_size;
-	u32 ucode_offset;
  };
 
  static inline

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

#3 lore raw

PATCH 3/3 drm/i915/uc: Remove redundant RSA offset definition

In reply to Michal Wajdeczko

According to Firmware layout definition, RSA signature is located after CSS header and uCode so actual RSA offset in the blob can be easily calculated when needed (and we need it only once).

Cc Daniele Ceraolo Spurio <[email protected]>
---
 drivers/gpu/drm/i915/gt/uc/intel_uc_fw.c | 8 +++-----
 drivers/gpu/drm/i915/gt/uc/intel_uc_fw.h | 1 -
 2 files changed, 3 insertions(+), 6 deletions(-)
drivers/gpu/drm/i915/gt/uc/intel_uc_fw.c +3 -5
index 05079c59ae04..b0f2852dec41 100644
@@ -238,7 +238,6 @@ void intel_uc_fw_fetch(struct intel_uc_fw *uc_fw, struct drm_i915_private *i915)
 		err = -ENOEXEC;
 		goto fail;
 	}
-	uc_fw->rsa_offset = sizeof(struct uc_css_header) + uc_fw->ucode_size;
 	uc_fw->rsa_size = css->key_size_dw * sizeof(u32);
 
 	/* At least, it should have header, uCode and RSA. Size of all three. */
@@ -512,11 +511,11 @@ size_t intel_uc_fw_copy_rsa(struct intel_uc_fw *uc_fw, void *dst, u32 max_len)
 {
 	struct sg_table *pages = uc_fw->obj->mm.pages;
 	u32 size = min_t(u32, uc_fw->rsa_size, max_len);
+	u32 offset = sizeof(struct uc_css_header) + uc_fw->ucode_size;
 
 	GEM_BUG_ON(!intel_uc_fw_is_available(uc_fw));
 
-	return sg_pcopy_to_buffer(pages->sgl, pages->nents,
-				  dst, size, uc_fw->rsa_offset);
+	return sg_pcopy_to_buffer(pages->sgl, pages->nents, dst, size, offset);
 }
 
 /**
@@ -536,6 +535,5 @@ void intel_uc_fw_dump(const struct intel_uc_fw *uc_fw, struct drm_printer *p)
 		   uc_fw->major_ver_wanted, uc_fw->minor_ver_wanted,
 		   uc_fw->major_ver_found, uc_fw->minor_ver_found);
 	drm_printf(p, "\tuCode: %u bytes\n", uc_fw->ucode_size);
-	drm_printf(p, "\tRSA: offset %u, size %u\n",
-		   uc_fw->rsa_offset, uc_fw->rsa_size);
+	drm_printf(p, "\tRSA: %u bytes\n", uc_fw->rsa_size);
 }
drivers/gpu/drm/i915/gt/uc/intel_uc_fw.h +0 -1
index 6a04bc6d419f..c2ab2803715d 100644
@@ -75,7 +75,6 @@ struct intel_uc_fw {
 	u16 minor_ver_found;
 
 	u32 rsa_size;
-	u32 rsa_offset;
 	u32 ucode_size;
 };
 
Signature · 6 lines
2.19.2

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

Re: [PATCH 3/3] drm/i915/uc: Remove redundant RSA offset definition

Quoted 6 lines · Michal Wajdeczko

According to Firmware layout definition, RSA signature is located after CSS header and uCode so actual RSA offset in the blob can be easily calculated when needed (and we need it only once).

Cc Daniele Ceraolo Spurio <[email protected]>

Daniele

Quoted 45 lines
---
  drivers/gpu/drm/i915/gt/uc/intel_uc_fw.c | 8 +++-----
  drivers/gpu/drm/i915/gt/uc/intel_uc_fw.h | 1 -
  2 files changed, 3 insertions(+), 6 deletions(-)
drivers/gpu/drm/i915/gt/uc/intel_uc_fw.c +3 -5
index 05079c59ae04..b0f2852dec41 100644
@@ -238,7 +238,6 @@ void intel_uc_fw_fetch(struct intel_uc_fw *uc_fw, struct drm_i915_private *i915)
  		err = -ENOEXEC;
  		goto fail;
  	}
-	uc_fw->rsa_offset = sizeof(struct uc_css_header) + uc_fw->ucode_size;
  	uc_fw->rsa_size = css->key_size_dw * sizeof(u32);
 
  	/* At least, it should have header, uCode and RSA. Size of all three. */
@@ -512,11 +511,11 @@ size_t intel_uc_fw_copy_rsa(struct intel_uc_fw *uc_fw, void *dst, u32 max_len)
  {
  	struct sg_table *pages = uc_fw->obj->mm.pages;
  	u32 size = min_t(u32, uc_fw->rsa_size, max_len);
+	u32 offset = sizeof(struct uc_css_header) + uc_fw->ucode_size;
 
  	GEM_BUG_ON(!intel_uc_fw_is_available(uc_fw));
 
-	return sg_pcopy_to_buffer(pages->sgl, pages->nents,
-				  dst, size, uc_fw->rsa_offset);
+	return sg_pcopy_to_buffer(pages->sgl, pages->nents, dst, size, offset);
  }
 
  /**
@@ -536,6 +535,5 @@ void intel_uc_fw_dump(const struct intel_uc_fw *uc_fw, struct drm_printer *p)
  		   uc_fw->major_ver_wanted, uc_fw->minor_ver_wanted,
  		   uc_fw->major_ver_found, uc_fw->minor_ver_found);
  	drm_printf(p, "\tuCode: %u bytes\n", uc_fw->ucode_size);
-	drm_printf(p, "\tRSA: offset %u, size %u\n",
-		   uc_fw->rsa_offset, uc_fw->rsa_size);
+	drm_printf(p, "\tRSA: %u bytes\n", uc_fw->rsa_size);
  }
drivers/gpu/drm/i915/gt/uc/intel_uc_fw.h +0 -0
index 6a04bc6d419f..c2ab2803715d 100644

drivers/gpu/drm/i915/gt/uc/intel_uc_fw.h struct intel_uc_fw { · line 80

Quoted 7 lines
drivers/gpu/drm/i915/gt/uc/intel_uc_fw.h +0 -1
@@ -75,7 +75,6 @@ struct intel_uc_fw {
  	u16 minor_ver_found;
 
  	u32 rsa_size;
-	u32 rsa_offset;
  	u32 ucode_size;
  };
 

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

#5 lore raw

✗ Fi.CI.SPARSE: warning for series starting with [1/3] drm/i915/uc: Remove redundant header_offset/size definitions

In reply to Michal Wajdeczko
== Series Details ==

== Series Details ==

Series: series starting with [1/3] drm/i915/uc: Remove redundant header_offset/size definitions
URL : https://patchwork.freedesktop.org/series/64322/
State : warning

== Summary ==

$ dim sparse origin/drm-tip
Sparse version: v0.5.2
Commit: drm/i915/uc: Remove redundant header_offset/size definitions
Okay!

Commit: drm/i915/uc: Remove redundant ucode offset definition Okay!

Commit: drm/i915/uc: Remove redundant RSA offset definition -O:drivers/gpu/drm/i915/gt/uc/intel_uc_fw.c:514:20: warning: expression using sizeof(void) -O:drivers/gpu/drm/i915/gt/uc/intel_uc_fw.c:514:20: warning: expression using sizeof(void) +drivers/gpu/drm/i915/gt/uc/intel_uc_fw.c:513:20: warning: expression using sizeof(void) +drivers/gpu/drm/i915/gt/uc/intel_uc_fw.c:513:20: warning: expression using sizeof(void)

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

#6 lore raw

✓ Fi.CI.BAT: success for series starting with [1/3] drm/i915/uc: Remove redundant header_offset/size definitions

In reply to Michal Wajdeczko
== Series Details ==

== Series Details ==

Series: series starting with [1/3] drm/i915/uc: Remove redundant header_offset/size definitions
URL : https://patchwork.freedesktop.org/series/64322/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_6560 -> Patchwork_13771
====================================================

Summary
-------

**SUCCESS**

No regressions found.

External URL: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13771/

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

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

### IGT changes ###

#### Issues hit ####

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

* igt@i915_pm_rpm@module-reload:
- fi-icl-u3: [PASS][3] -> [DMESG-WARN][4] ([fdo#107724])
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6560/fi-icl-u3/igt@[email protected]
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13771/fi-icl-u3/igt@[email protected]

* igt@kms_frontbuffer_tracking@basic:
- fi-icl-dsi: [PASS][5] -> [FAIL][6] ([fdo#103167])
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6560/fi-icl-dsi/igt@[email protected]
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13771/fi-icl-dsi/igt@[email protected]

#### Possible fixes ####

* {igt@gem_ctx_switch@legacy-render}:
- {fi-icl-guc}: [INCOMPLETE][7] ([fdo#107713]) -> [PASS][8]
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6560/fi-icl-guc/igt@[email protected]
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13771/fi-icl-guc/igt@[email protected]

* igt@gem_exec_suspend@basic-s3:
- fi-blb-e6850: [INCOMPLETE][9] ([fdo#107718]) -> [PASS][10]
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6560/fi-blb-e6850/igt@[email protected]
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13771/fi-blb-e6850/igt@[email protected]

* igt@kms_chamelium@hdmi-hpd-fast:
- fi-kbl-7500u: [FAIL][11] ([fdo#109485]) -> [PASS][12]
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6560/fi-kbl-7500u/igt@[email protected]
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13771/fi-kbl-7500u/igt@[email protected]

* igt@kms_frontbuffer_tracking@basic:
- fi-icl-u3: [FAIL][13] ([fdo#103167]) -> [PASS][14]
[13]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6560/fi-icl-u3/igt@[email protected]
[14]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13771/fi-icl-u3/igt@[email protected]

{name}: This element is suppressed. This means it is ignored when computing
the status of the difference (SUCCESS, WARNING, or FAILURE).

[fdo#103167]: https://bugs.freedesktop.org/show_bug.cgi?id=103167
[fdo#105128]: https://bugs.freedesktop.org/show_bug.cgi?id=105128
[fdo#107139]: https://bugs.freedesktop.org/show_bug.cgi?id=107139
[fdo#107713]: https://bugs.freedesktop.org/show_bug.cgi?id=107713
[fdo#107718]: https://bugs.freedesktop.org/show_bug.cgi?id=107718
[fdo#107724]: https://bugs.freedesktop.org/show_bug.cgi?id=107724
[fdo#109485]: https://bugs.freedesktop.org/show_bug.cgi?id=109485

Participating hosts (54 -> 47)
------------------------------

Additional (2): fi-cfl-8109u fi-bsw-n3050
Missing (9): fi-kbl-soraka fi-ilk-m540 fi-hsw-4200u fi-byt-squawks fi-bsw-cyan fi-ctg-p8600 fi-icl-y fi-byt-clapper fi-bdw-samus

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

* CI: CI-20190529 -> None
* Linux: CI_DRM_6560 -> Patchwork_13771

CI-20190529: 20190529
CI_DRM_6560: 63b0088b62ff5e315330f3ed64ebde152e296fbf @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_5113: f8f1bfbd25559e01c59a55635477cb74b326ea0b @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
Patchwork_13771: fdf075e722b36ab2c2b4f1fe47fc1021e955075c @ git://anongit.freedesktop.org/gfx-ci/linux

== Linux commits ==

fdf075e722b3 drm/i915/uc: Remove redundant RSA offset definition 436777ce4a3b drm/i915/uc: Remove redundant ucode offset definition 7a6a878814e8 drm/i915/uc: Remove redundant header_offset/size definitions

== Logs ==

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

Reviewed-by on v1 1/3
#7 lore raw
In reply to Michal Wajdeczko
Quoted 65 lines · Michal Wajdeczko

According to Firmware layout definition, CSS header is located in front of the firmware blob, so header offset is always 0. Similarly, size of the CSS header is constant and is 128.

While here, move type/status enums up and keep them together.

Cc Daniele Ceraolo Spurio <[email protected]>
---
  drivers/gpu/drm/i915/gt/uc/intel_uc_fw.c     | 23 ++++++++------------
  drivers/gpu/drm/i915/gt/uc/intel_uc_fw.h     |  9 ++++----
  drivers/gpu/drm/i915/gt/uc/intel_uc_fw_abi.h |  2 ++
  3 files changed, 15 insertions(+), 19 deletions(-)
drivers/gpu/drm/i915/gt/uc/intel_uc_fw.c +8 -11
index 5fbdd17a864b..66bda0c514a3 100644
@@ -218,21 +218,18 @@ void intel_uc_fw_fetch(struct intel_uc_fw *uc_fw, struct drm_i915_private *i915)
 
  	css = (struct uc_css_header *)fw->data;
 
-	/* Firmware bits always start from header */
-	uc_fw->header_offset = 0;
-	uc_fw->header_size = (css->header_size_dw - css->modulus_size_dw -
-			      css->key_size_dw - css->exponent_size_dw) *
-			     sizeof(u32);
-
-	if (uc_fw->header_size != sizeof(struct uc_css_header)) {
+	/* Check integrity of size values inside CSS header */
+	size = (css->header_size_dw - css->key_size_dw - css->modulus_size_dw -
+		css->exponent_size_dw) * sizeof(u32);
+	if (size != sizeof(struct uc_css_header)) {
  		DRM_WARN("%s: Mismatched firmware header definition\n",
  			 intel_uc_fw_type_repr(uc_fw->type));
  		err = -ENOEXEC;
  		goto fail;
  	}
 
-	/* then, uCode */
-	uc_fw->ucode_offset = uc_fw->header_offset + uc_fw->header_size;
+	/* Firmware blob always starts with the header, then uCode */
+	uc_fw->ucode_offset = sizeof(struct uc_css_header);
  	uc_fw->ucode_size = (css->size_dw - css->header_size_dw) * sizeof(u32);
 
  	/* now RSA */
@@ -246,7 +243,7 @@ void intel_uc_fw_fetch(struct intel_uc_fw *uc_fw, struct drm_i915_private *i915)
  	uc_fw->rsa_size = css->key_size_dw * sizeof(u32);
 
  	/* At least, it should have header, uCode and RSA. Size of all three. */
-	size = uc_fw->header_size + uc_fw->ucode_size + uc_fw->rsa_size;
+	size = sizeof(struct uc_css_header) + uc_fw->ucode_size + uc_fw->rsa_size;
  	if (fw->size < size) {
  		DRM_WARN("%s: Truncated firmware (%zu, expected %zu)\n",
  			 intel_uc_fw_type_repr(uc_fw->type), fw->size, size);
@@ -371,7 +368,7 @@ static int uc_fw_xfer(struct intel_uc_fw *uc_fw, struct intel_gt *gt,
  	intel_uncore_forcewake_get(uncore, FORCEWAKE_ALL);
 
  	/* Set the source address for the uCode */
-	offset = uc_fw_ggtt_offset(uc_fw, gt->ggtt) + uc_fw->header_offset;
+	offset = uc_fw_ggtt_offset(uc_fw, gt->ggtt);
  	GEM_BUG_ON(upper_32_bits(offset) & 0xFFFF0000);
  	intel_uncore_write_fw(uncore, DMA_ADDR_0_LOW, lower_32_bits(offset));
  	intel_uncore_write_fw(uncore, DMA_ADDR_0_HIGH, upper_32_bits(offset));

drivers/gpu/drm/i915/gt/uc/intel_uc_fw.c static int uc_fw_xfer(struct intel_uc_fw *uc_fw, struct intel_gt *gt, · line 385

Quoted 5 lines
drivers/gpu/drm/i915/gt/uc/intel_uc_fw.c +1 -1
@@ -385,7 +382,7 @@ static int uc_fw_xfer(struct intel_uc_fw *uc_fw, struct intel_gt *gt,
  	 * via DMA, excluding any other components
  	 */
  	intel_uncore_write_fw(uncore, DMA_COPY_SIZE,
-			      uc_fw->header_size + uc_fw->ucode_size);
+			      uc_fw->ucode_offset + uc_fw->ucode_size);

in other places you've replaced uc_fw->header_size with sizeof(struct uc_css_header), I'd do the same here for consistency.

Quoted 69 lines
drivers/gpu/drm/i915/gt/uc/intel_uc_fw.c +0 -2
  	/* Start the DMA */
  	intel_uncore_write_fw(uncore, DMA_CTRL,
@@ -539,8 +536,6 @@ void intel_uc_fw_dump(const struct intel_uc_fw *uc_fw, struct drm_printer *p)
  	drm_printf(p, "\tversion: wanted %u.%u, found %u.%u\n",
  		   uc_fw->major_ver_wanted, uc_fw->minor_ver_wanted,
  		   uc_fw->major_ver_found, uc_fw->minor_ver_found);
-	drm_printf(p, "\theader: offset %u, size %u\n",
-		   uc_fw->header_offset, uc_fw->header_size);
  	drm_printf(p, "\tuCode: offset %u, size %u\n",
  		   uc_fw->ucode_offset, uc_fw->ucode_size);
  	drm_printf(p, "\tRSA: offset %u, size %u\n",
drivers/gpu/drm/i915/gt/uc/intel_uc_fw.h +4 -5
index eddbb237fabe..a8048f91f0da 100644
@@ -26,6 +26,7 @@
  #define _INTEL_UC_FW_H_
 
  #include <linux/types.h>
+#include "intel_uc_fw_abi.h"
  #include "i915_gem.h"
 
  struct drm_printer;
@@ -57,10 +58,11 @@ enum intel_uc_fw_type {
   * of fetching, caching, and loading the firmware image into the uC.
   */
  struct intel_uc_fw {
+	enum intel_uc_fw_type type;
+	enum intel_uc_fw_status status;
  	const char *path;
  	size_t size;
  	struct drm_i915_gem_object *obj;
-	enum intel_uc_fw_status status;
 
  	/*
  	 * The firmware build process will generate a version header file with major and
@@ -72,9 +74,6 @@ struct intel_uc_fw {
  	u16 major_ver_found;
  	u16 minor_ver_found;
 
-	enum intel_uc_fw_type type;
-	u32 header_size;
-	u32 header_offset;
  	u32 rsa_size;
  	u32 rsa_offset;
  	u32 ucode_size;
@@ -163,7 +162,7 @@ static inline u32 intel_uc_fw_get_upload_size(struct intel_uc_fw *uc_fw)
  	if (!intel_uc_fw_is_available(uc_fw))
  		return 0;
 
-	return uc_fw->header_size + uc_fw->ucode_size;
+	return sizeof(struct uc_css_header) + uc_fw->ucode_size;
  }
 
  void intel_uc_fw_init_early(struct intel_uc_fw *uc_fw,
drivers/gpu/drm/i915/gt/uc/intel_uc_fw_abi.h +1 -0
index 545e86c52a9e..ae58e8a8c53b 100644
@@ -7,6 +7,7 @@
  #define _INTEL_UC_FW_ABI_H
 
  #include <linux/types.h>
+#include <linux/build_bug.h>
 
  /**
   * DOC: Firmware Layout

drivers/gpu/drm/i915/gt/uc/intel_uc_fw_abi.h struct uc_css_header { · line 80

Quoted 4 lines
drivers/gpu/drm/i915/gt/uc/intel_uc_fw_abi.h +1 -0
@@ -76,5 +77,6 @@ struct uc_css_header {
  	u32 reserved[14];
  	u32 header_info;
  } __packed;
+static_assert(sizeof(struct uc_css_header) == 128);

Do we really care that the size of this is 128? the important thing is that it matches what the blob reports and you have a check for that already so we should be able to avoid this check.

With the 2 nits addressed:

Daniele

drivers/gpu/drm/i915/gt/uc/intel_uc_fw_abi.h struct uc_css_header { · line 82

Quoted 3 lines
drivers/gpu/drm/i915/gt/uc/intel_uc_fw_abi.h +0 -0
  #endif /* _INTEL_UC_FW_ABI_H */
 

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

#8 lore raw
Quoted 68 lines · Daniele Ceraolo Spurio
Quoted 65 lines · Michal Wajdeczko

According to Firmware layout definition, CSS header is located in front of the firmware blob, so header offset is always 0. Similarly, size of the CSS header is constant and is 128.
While here, move type/status enums up and keep them together.

Cc Daniele Ceraolo Spurio <[email protected]>
---
  drivers/gpu/drm/i915/gt/uc/intel_uc_fw.c     | 23 ++++++++------------
  drivers/gpu/drm/i915/gt/uc/intel_uc_fw.h     |  9 ++++----
  drivers/gpu/drm/i915/gt/uc/intel_uc_fw_abi.h |  2 ++
  3 files changed, 15 insertions(+), 19 deletions(-)

diff --git a/drivers/gpu/drm/i915/gt/uc/intel_uc_fw.c
b/drivers/gpu/drm/i915/gt/uc/intel_uc_fw.c index 5fbdd17a864b..66bda0c514a3 100644

drivers/gpu/drm/i915/gt/uc/intel_uc_fw.c +6 -8
@@ -218,21 +218,18 @@ void intel_uc_fw_fetch(struct intel_uc_fw *uc_fw,  
 struct drm_i915_private *i915)
    	css = (struct uc_css_header *)fw->data;
  -	/* Firmware bits always start from header */
-	uc_fw->header_offset = 0;
-	uc_fw->header_size = (css->header_size_dw - css->modulus_size_dw -
-			      css->key_size_dw - css->exponent_size_dw) *
-			     sizeof(u32);
-
-	if (uc_fw->header_size != sizeof(struct uc_css_header)) {
+	/* Check integrity of size values inside CSS header */
+	size = (css->header_size_dw - css->key_size_dw - css->modulus_size_dw  
-
+		css->exponent_size_dw) * sizeof(u32);
+	if (size != sizeof(struct uc_css_header)) {
  		DRM_WARN("%s: Mismatched firmware header definition\n",
  			 intel_uc_fw_type_repr(uc_fw->type));
  		err = -ENOEXEC;
  		goto fail;
  	}
  -	/* then, uCode */
-	uc_fw->ucode_offset = uc_fw->header_offset + uc_fw->header_size;
+	/* Firmware blob always starts with the header, then uCode */
+	uc_fw->ucode_offset = sizeof(struct uc_css_header);
  	uc_fw->ucode_size = (css->size_dw - css->header_size_dw) *  
 sizeof(u32);
    	/* now RSA */
@@ -246,7 +243,7 @@ void intel_uc_fw_fetch(struct intel_uc_fw *uc_fw,  
 struct drm_i915_private *i915)
  	uc_fw->rsa_size = css->key_size_dw * sizeof(u32);
    	/* At least, it should have header, uCode and RSA. Size of all  

three. */

drivers/gpu/drm/i915/gt/uc/intel_uc_fw.c +1 -1
-	size = uc_fw->header_size + uc_fw->ucode_size + uc_fw->rsa_size;
+	size = sizeof(struct uc_css_header) + uc_fw->ucode_size +  

uc_fw->rsa_size;
if (fw->size < size) {
DRM_WARN("%s: Truncated firmware (%zu, expected %zu)\n",
intel_uc_fw_type_repr(uc_fw->type), fw->size, size);

drivers/gpu/drm/i915/gt/uc/intel_uc_fw.c +1 -1
@@ -371,7 +368,7 @@ static int uc_fw_xfer(struct intel_uc_fw *uc_fw,  
 struct intel_gt *gt,
  	intel_uncore_forcewake_get(uncore, FORCEWAKE_ALL);
    	/* Set the source address for the uCode */
-	offset = uc_fw_ggtt_offset(uc_fw, gt->ggtt) + uc_fw->header_offset;
+	offset = uc_fw_ggtt_offset(uc_fw, gt->ggtt);
  	GEM_BUG_ON(upper_32_bits(offset) & 0xFFFF0000);
  	intel_uncore_write_fw(uncore, DMA_ADDR_0_LOW, lower_32_bits(offset));
  	intel_uncore_write_fw(uncore, DMA_ADDR_0_HIGH,  

upper_32_bits(offset));

drivers/gpu/drm/i915/gt/uc/intel_uc_fw.c +0 -0
@@ -385,7 +382,7 @@ static int uc_fw_xfer(struct intel_uc_fw *uc_fw,  
Quoted 8 lines

drivers/gpu/drm/i915/gt/uc/intel_uc_fw.c static int uc_fw_xfer(struct intel_uc_fw *uc_fw, struct intel_gt *gt, · line 385

Quoted 6 lines
drivers/gpu/drm/i915/gt/uc/intel_uc_fw.c +1 -1
 struct intel_gt *gt,
  	 * via DMA, excluding any other components
  	 */
  	intel_uncore_write_fw(uncore, DMA_COPY_SIZE,
-			      uc_fw->header_size + uc_fw->ucode_size);
+			      uc_fw->ucode_offset + uc_fw->ucode_size);

in other places you've replaced uc_fw->header_size with sizeof(struct uc_css_header), I'd do the same here for consistency.

ha! oops, this sneaked into patch 2 instead, will fix

Quoted 62 lines
Quoted 62 lines
drivers/gpu/drm/i915/gt/uc/intel_uc_fw.c +0 -2
    	/* Start the DMA */
  	intel_uncore_write_fw(uncore, DMA_CTRL,
@@ -539,8 +536,6 @@ void intel_uc_fw_dump(const struct intel_uc_fw  
 *uc_fw, struct drm_printer *p)
  	drm_printf(p, "\tversion: wanted %u.%u, found %u.%u\n",
  		   uc_fw->major_ver_wanted, uc_fw->minor_ver_wanted,
  		   uc_fw->major_ver_found, uc_fw->minor_ver_found);
-	drm_printf(p, "\theader: offset %u, size %u\n",
-		   uc_fw->header_offset, uc_fw->header_size);
  	drm_printf(p, "\tuCode: offset %u, size %u\n",
  		   uc_fw->ucode_offset, uc_fw->ucode_size);

drm_printf(p, "\tRSA: offset %u, size %u\n",

drivers/gpu/drm/i915/gt/uc/intel_uc_fw.h +3 -1
index eddbb237fabe..a8048f91f0da 100644
@@ -26,6 +26,7 @@
  #define _INTEL_UC_FW_H_
    #include <linux/types.h>
+#include "intel_uc_fw_abi.h"
  #include "i915_gem.h"
    struct drm_printer;
@@ -57,10 +58,11 @@ enum intel_uc_fw_type {
   * of fetching, caching, and loading the firmware image into the uC.
   */
  struct intel_uc_fw {
+	enum intel_uc_fw_type type;
+	enum intel_uc_fw_status status;
  	const char *path;
  	size_t size;
  	struct drm_i915_gem_object *obj;
-	enum intel_uc_fw_status status;
    	/*
  	 * The firmware build process will generate a version header file  

with major and

drivers/gpu/drm/i915/gt/uc/intel_uc_fw.h +1 -2
@@ -72,9 +74,6 @@ struct intel_uc_fw {
  	u16 major_ver_found;
  	u16 minor_ver_found;
  -	enum intel_uc_fw_type type;
-	u32 header_size;
-	u32 header_offset;
  	u32 rsa_size;
  	u32 rsa_offset;
  	u32 ucode_size;
@@ -163,7 +162,7 @@ static inline u32  
 intel_uc_fw_get_upload_size(struct intel_uc_fw *uc_fw)
  	if (!intel_uc_fw_is_available(uc_fw))
  		return 0;
  -	return uc_fw->header_size + uc_fw->ucode_size;
+	return sizeof(struct uc_css_header) + uc_fw->ucode_size;
  }
    void intel_uc_fw_init_early(struct intel_uc_fw *uc_fw,
drivers/gpu/drm/i915/gt/uc/intel_uc_fw_abi.h +1 -0
index 545e86c52a9e..ae58e8a8c53b 100644
@@ -7,6 +7,7 @@
  #define _INTEL_UC_FW_ABI_H
    #include <linux/types.h>
+#include <linux/build_bug.h>
    /**
Quoted 8 lines

drivers/gpu/drm/i915/gt/uc/intel_uc_fw_abi.h struct uc_css_header { · line 80

Quoted 6 lines
drivers/gpu/drm/i915/gt/uc/intel_uc_fw_abi.h +1 -0
   * DOC: Firmware Layout
@@ -76,5 +77,6 @@ struct uc_css_header {
  	u32 reserved[14];
  	u32 header_info;
  } __packed;
+static_assert(sizeof(struct uc_css_header) == 128);

Do we really care that the size of this is 128? the important thing is that it matches what the blob reports and you have a check for that already so we should be able to avoid this check.

Blob does not report header size directly, instead it provides set of sizes of other blob components and we are just verifying if that sums correctly, but we are using sizeof our definition of struct css.

Since CSS header is part of the fw ABI we should make sure that our definition is stable and its size matches fw definition (whis is 128)

I'm for keeping this check.

Quoted 8 lines

With the 2 nits addressed:

Daniele

Quoted 1 line
drivers/gpu/drm/i915/gt/uc/intel_uc_fw_abi.h +0 -0
    #endif /* _INTEL_UC_FW_ABI_H */

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

#9 lore raw
Quoted 147 lines · Michal Wajdeczko
Quoted 64 lines · Daniele Ceraolo Spurio
Quoted 61 lines · Michal Wajdeczko

According to Firmware layout definition, CSS header is located in front of the firmware blob, so header offset is always 0. Similarly, size of the CSS header is constant and is 128. While here, move type/status enums up and keep them together.

Cc Daniele Ceraolo Spurio <[email protected]>

---
  drivers/gpu/drm/i915/gt/uc/intel_uc_fw.c     | 23 ++++++++------------ drivers/gpu/drm/i915/gt/uc/intel_uc_fw.h     |  9 ++++---- drivers/gpu/drm/i915/gt/uc/intel_uc_fw_abi.h |  2 ++

  3 files changed, 15 insertions(+), 19 deletions(-)

 diff --git a/drivers/gpu/drm/i915/gt/uc/intel_uc_fw.c b/drivers/gpu/drm/i915/gt/uc/intel_uc_fw.c index 5fbdd17a864b..66bda0c514a3 100644

drivers/gpu/drm/i915/gt/uc/intel_uc_fw.c +0 -0
@@ -218,21 +218,18 @@ void intel_uc_fw_fetch(struct intel_uc_fw 
 *uc_fw, struct drm_i915_private *i915)
         css = (struct uc_css_header *)fw->data;

  -    /* Firmware bits always start from header */
-    uc_fw->header_offset = 0;
-    uc_fw->header_size = (css->header_size_dw - css->modulus_size_dw - -                  css->key_size_dw - css->exponent_size_dw) *
-                 sizeof(u32);
-
-    if (uc_fw->header_size != sizeof(struct uc_css_header)) {
+    /* Check integrity of size values inside CSS header */
+    size = (css->header_size_dw - css->key_size_dw - css->modulus_size_dw -
+        css->exponent_size_dw) * sizeof(u32);
+    if (size != sizeof(struct uc_css_header)) {
          DRM_WARN("%s: Mismatched firmware header definition\n", intel_uc_fw_type_repr(uc_fw->type));
          err = -ENOEXEC;
          goto fail;
      }
  -    /* then, uCode */
-    uc_fw->ucode_offset = uc_fw->header_offset + uc_fw->header_size; +    /* Firmware blob always starts with the header, then uCode */ +    uc_fw->ucode_offset = sizeof(struct uc_css_header); uc_fw->ucode_size = (css->size_dw - css->header_size_dw) * sizeof(u32); /* now RSA */

drivers/gpu/drm/i915/gt/uc/intel_uc_fw.c +1 -1
@@ -246,7 +243,7 @@ void intel_uc_fw_fetch(struct intel_uc_fw *uc_fw, 
 struct drm_i915_private *i915)
       uc_fw->rsa_size = css->key_size_dw * sizeof(u32);
         /* At least, it should have header, uCode and RSA. Size of all three. */
-    size = uc_fw->header_size + uc_fw->ucode_size + uc_fw->rsa_size;
+    size = sizeof(struct uc_css_header) + uc_fw->ucode_size + 
 uc_fw->rsa_size;
       if (fw->size < size) {
           DRM_WARN("%s: Truncated firmware (%zu, expected %zu)\n",

               intel_uc_fw_type_repr(uc_fw->type), fw->size, size);

drivers/gpu/drm/i915/gt/uc/intel_uc_fw.c +1 -1
@@ -371,7 +368,7 @@ static int uc_fw_xfer(struct intel_uc_fw *uc_fw, 
 struct intel_gt *gt,
       intel_uncore_forcewake_get(uncore, FORCEWAKE_ALL);
         /* Set the source address for the uCode */
-    offset = uc_fw_ggtt_offset(uc_fw, gt->ggtt) + uc_fw->header_offset;
+    offset = uc_fw_ggtt_offset(uc_fw, gt->ggtt);
       GEM_BUG_ON(upper_32_bits(offset) & 0xFFFF0000);
       intel_uncore_write_fw(uncore, DMA_ADDR_0_LOW, lower_32_bits(offset));
       intel_uncore_write_fw(uncore, DMA_ADDR_0_HIGH, upper_32_bits(offset));
@@ -385,7 +382,7 @@ static int uc_fw_xfer(struct intel_uc_fw *uc_fw, 
Quoted 8 lines

drivers/gpu/drm/i915/gt/uc/intel_uc_fw.c static int uc_fw_xfer(struct intel_uc_fw *uc_fw, struct intel_gt *gt, · line 385

Quoted 6 lines
drivers/gpu/drm/i915/gt/uc/intel_uc_fw.c +1 -1
 struct intel_gt *gt,
        * via DMA, excluding any other components
        */
       intel_uncore_write_fw(uncore, DMA_COPY_SIZE,
-                  uc_fw->header_size + uc_fw->ucode_size);
+                  uc_fw->ucode_offset + uc_fw->ucode_size);

in other places you've replaced uc_fw->header_size with sizeof(struct uc_css_header), I'd do the same here for consistency.

ha! oops, this sneaked into patch 2 instead, will fix

Quoted 61 lines
Quoted 61 lines
drivers/gpu/drm/i915/gt/uc/intel_uc_fw.c +0 -2
         /* Start the DMA */
       intel_uncore_write_fw(uncore, DMA_CTRL,
@@ -539,8 +536,6 @@ void intel_uc_fw_dump(const struct intel_uc_fw 
 *uc_fw, struct drm_printer *p)
       drm_printf(p, "\tversion: wanted %u.%u, found %u.%u\n",
              uc_fw->major_ver_wanted, uc_fw->minor_ver_wanted,
              uc_fw->major_ver_found, uc_fw->minor_ver_found);
-    drm_printf(p, "\theader: offset %u, size %u\n",
-           uc_fw->header_offset, uc_fw->header_size);
       drm_printf(p, "\tuCode: offset %u, size %u\n",
              uc_fw->ucode_offset, uc_fw->ucode_size);

      drm_printf(p, "\tRSA: offset %u, size %u\n",

drivers/gpu/drm/i915/gt/uc/intel_uc_fw.h +4 -3
index eddbb237fabe..a8048f91f0da 100644
@@ -26,6 +26,7 @@
   #define _INTEL_UC_FW_H_
     #include <linux/types.h>
+#include "intel_uc_fw_abi.h"
   #include "i915_gem.h"
     struct drm_printer;
@@ -57,10 +58,11 @@ enum intel_uc_fw_type {
    * of fetching, caching, and loading the firmware image into the uC.
    */
   struct intel_uc_fw {
+    enum intel_uc_fw_type type;
+    enum intel_uc_fw_status status;
       const char *path;
       size_t size;
       struct drm_i915_gem_object *obj;
-    enum intel_uc_fw_status status;
         /*
        * The firmware build process will generate a version header file with major and
@@ -72,9 +74,6 @@ struct intel_uc_fw {
       u16 major_ver_found;
       u16 minor_ver_found;
   -    enum intel_uc_fw_type type;
-    u32 header_size;
-    u32 header_offset;
       u32 rsa_size;
       u32 rsa_offset;
       u32 ucode_size;
@@ -163,7 +162,7 @@ static inline u32 
 intel_uc_fw_get_upload_size(struct intel_uc_fw *uc_fw)
       if (!intel_uc_fw_is_available(uc_fw))
           return 0;
   -    return uc_fw->header_size + uc_fw->ucode_size;
+    return sizeof(struct uc_css_header) + uc_fw->ucode_size;
   }
     void intel_uc_fw_init_early(struct intel_uc_fw *uc_fw,
drivers/gpu/drm/i915/gt/uc/intel_uc_fw_abi.h +1 -0
index 545e86c52a9e..ae58e8a8c53b 100644
@@ -7,6 +7,7 @@
   #define _INTEL_UC_FW_ABI_H
     #include <linux/types.h>
+#include <linux/build_bug.h>
     /**
Quoted 8 lines

drivers/gpu/drm/i915/gt/uc/intel_uc_fw_abi.h struct uc_css_header { · line 80

Quoted 6 lines
drivers/gpu/drm/i915/gt/uc/intel_uc_fw_abi.h +1 -0
    * DOC: Firmware Layout
@@ -76,5 +77,6 @@ struct uc_css_header {
       u32 reserved[14];
       u32 header_info;
   } __packed;
+static_assert(sizeof(struct uc_css_header) == 128);

Do we really care that the size of this is 128? the important thing is that it matches what the blob reports and you have a check for that already so we should be able to avoid this check.

Quoted 9 lines

Blob does not report header size directly, instead it provides set of sizes of other blob components and we are just verifying if that sums correctly, but we are using sizeof our definition of struct css.

Since CSS header is part of the fw ABI we should make sure that our definition is stable and its size matches fw definition (whis is 128)

I'm for keeping this check.

If the commitment from the uC team is that the size of this will be stable then I'm ok with keeping the check.

Daniele

Quoted 8 lines
Quoted 8 lines

With the 2 nits addressed:

Daniele

Quoted 1 line
drivers/gpu/drm/i915/gt/uc/intel_uc_fw_abi.h +0 -0
     #endif /* _INTEL_UC_FW_ABI_H */

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

#10 lore raw

✗ Fi.CI.IGT: failure for series starting with [1/3] drm/i915/uc: Remove redundant header_offset/size definitions

In reply to Michal Wajdeczko
== Series Details ==

== Series Details ==

Series: series starting with [1/3] drm/i915/uc: Remove redundant header_offset/size definitions
URL : https://patchwork.freedesktop.org/series/64322/
State : failure

== Summary ==

CI Bug Log - changes from CI_DRM_6560_full -> Patchwork_13771_full
====================================================

Summary
-------

**FAILURE**

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

If you think the reported changes have nothing to do with the changes introduced in Patchwork_13771_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_13771_full:

### IGT changes ###

#### Possible regressions ####

* igt@perf_pmu@multi-client-rcs0:
- shard-skl: [PASS][1] -> [INCOMPLETE][2]
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6560/shard-skl8/igt@[email protected]
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13771/shard-skl3/igt@[email protected]

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

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

### IGT changes ###

#### Issues hit ####

* igt@gem_softpin@noreloc-s3:
- shard-apl: [PASS][3] -> [DMESG-WARN][4] ([fdo#108566]) +1 similar issue
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6560/shard-apl3/igt@[email protected]
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13771/shard-apl5/igt@[email protected]
- shard-kbl: [PASS][5] -> [INCOMPLETE][6] ([fdo#103665])
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6560/shard-kbl2/igt@[email protected]
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13771/shard-kbl4/igt@[email protected]
- shard-snb: [PASS][7] -> [INCOMPLETE][8] ([fdo#105411])
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6560/shard-snb6/igt@[email protected]
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13771/shard-snb4/igt@[email protected]

* igt@gem_workarounds@suspend-resume-fd:
- shard-kbl: [PASS][9] -> [DMESG-WARN][10] ([fdo#108566])
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6560/shard-kbl2/igt@[email protected]
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13771/shard-kbl4/igt@[email protected]

* igt@i915_suspend@sysfs-reader:
- shard-skl: [PASS][11] -> [INCOMPLETE][12] ([fdo#104108])
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6560/shard-skl5/igt@[email protected]
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13771/shard-skl6/igt@[email protected]

* igt@kms_cursor_crc@pipe-c-cursor-64x21-random:
- shard-iclb: [PASS][13] -> [INCOMPLETE][14] ([fdo#107713])
[13]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6560/shard-iclb3/igt@[email protected]
[14]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13771/shard-iclb7/igt@[email protected]

* igt@kms_frontbuffer_tracking@fbc-1p-primscrn-pri-shrfb-draw-mmap-wc:
- shard-iclb: [PASS][15] -> [FAIL][16] ([fdo#103167]) +4 similar issues
[15]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6560/shard-iclb6/igt@kms_frontbuffer_tracking@fbc-1p-primscrn-pri-shrfb-draw-mmap-wc.html
[16]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13771/shard-iclb8/igt@kms_frontbuffer_tracking@fbc-1p-primscrn-pri-shrfb-draw-mmap-wc.html

* igt@kms_plane_alpha_blend@pipe-a-constant-alpha-min:
- shard-skl: [PASS][17] -> [FAIL][18] ([fdo#108145]) +1 similar issue
[17]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6560/shard-skl6/igt@[email protected]
[18]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13771/shard-skl6/igt@[email protected]

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

#### Possible fixes ####

* igt@i915_suspend@sysfs-reader:
- shard-apl: [DMESG-WARN][21] ([fdo#108566]) -> [PASS][22] +3 similar issues
[21]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6560/shard-apl6/igt@[email protected]
[22]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13771/shard-apl7/igt@[email protected]

* igt@kms_cursor_legacy@2x-long-nonblocking-modeset-vs-cursor-atomic:
- shard-glk: [FAIL][23] ([fdo#106509] / [fdo#107409]) -> [PASS][24]
[23]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6560/shard-glk4/igt@kms_cursor_legacy@2x-long-nonblocking-modeset-vs-cursor-atomic.html
[24]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13771/shard-glk9/igt@kms_cursor_legacy@2x-long-nonblocking-modeset-vs-cursor-atomic.html

* igt@kms_cursor_legacy@all-pipes-forked-move:
- shard-hsw: [INCOMPLETE][25] ([fdo#103540]) -> [PASS][26]
[25]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6560/shard-hsw2/igt@[email protected]
[26]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13771/shard-hsw5/igt@[email protected]

* igt@kms_flip@flip-vs-expired-vblank-interruptible:
- shard-glk: [FAIL][27] ([fdo#105363]) -> [PASS][28]
[27]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6560/shard-glk6/igt@[email protected]
[28]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13771/shard-glk5/igt@[email protected]

* igt@kms_frontbuffer_tracking@fbcpsr-1p-primscrn-cur-indfb-draw-render:
- shard-iclb: [FAIL][29] ([fdo#103167]) -> [PASS][30] +4 similar issues
[29]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6560/shard-iclb8/igt@kms_frontbuffer_tracking@fbcpsr-1p-primscrn-cur-indfb-draw-render.html
[30]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13771/shard-iclb4/igt@kms_frontbuffer_tracking@fbcpsr-1p-primscrn-cur-indfb-draw-render.html

* igt@kms_pipe_crc_basic@suspend-read-crc-pipe-a:
- shard-skl: [INCOMPLETE][31] ([fdo#104108]) -> [PASS][32]
[31]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6560/shard-skl6/igt@[email protected]
[32]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13771/shard-skl7/igt@[email protected]

* igt@kms_psr@psr2_primary_render:
- shard-iclb: [SKIP][33] ([fdo#109441]) -> [PASS][34]
[33]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6560/shard-iclb7/igt@kms_psr@psr2_primary_render.html
[34]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13771/shard-iclb2/igt@kms_psr@psr2_primary_render.html

* igt@kms_setmode@basic:
- shard-apl: [FAIL][35] ([fdo#99912]) -> [PASS][36]
[35]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6560/shard-apl7/igt@[email protected]
[36]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13771/shard-apl1/igt@[email protected]

* igt@kms_vblank@pipe-a-ts-continuation-suspend:
- shard-kbl: [DMESG-WARN][37] ([fdo#108566]) -> [PASS][38] +4 similar issues
[37]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6560/shard-kbl6/igt@[email protected]
[38]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_13771/shard-kbl6/igt@[email protected]

[fdo#103167]: https://bugs.freedesktop.org/show_bug.cgi?id=103167
[fdo#103540]: https://bugs.freedesktop.org/show_bug.cgi?id=103540
[fdo#103665]: https://bugs.freedesktop.org/show_bug.cgi?id=103665
[fdo#104108]: https://bugs.freedesktop.org/show_bug.cgi?id=104108
[fdo#105363]: https://bugs.freedesktop.org/show_bug.cgi?id=105363
[fdo#105411]: https://bugs.freedesktop.org/show_bug.cgi?id=105411
[fdo#106509]: https://bugs.freedesktop.org/show_bug.cgi?id=106509
[fdo#107409]: https://bugs.freedesktop.org/show_bug.cgi?id=107409
[fdo#107713]: https://bugs.freedesktop.org/show_bug.cgi?id=107713
[fdo#108145]: https://bugs.freedesktop.org/show_bug.cgi?id=108145
[fdo#108566]: https://bugs.freedesktop.org/show_bug.cgi?id=108566
[fdo#109441]: https://bugs.freedesktop.org/show_bug.cgi?id=109441
[fdo#99912]: https://bugs.freedesktop.org/show_bug.cgi?id=99912

Participating hosts (9 -> 9)
------------------------------

No changes in participating hosts

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

* CI: CI-20190529 -> None
* Linux: CI_DRM_6560 -> Patchwork_13771

CI-20190529: 20190529
CI_DRM_6560: 63b0088b62ff5e315330f3ed64ebde152e296fbf @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_5113: f8f1bfbd25559e01c59a55635477cb74b326ea0b @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
Patchwork_13771: fdf075e722b36ab2c2b4f1fe47fc1021e955075c @ 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_13771/
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx