Message ID | 20171010145135.3488-9-michal.wajdeczko@intel.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Quoting Michal Wajdeczko (2017-10-10 15:51:32) > Time to remove less important info and make messages clear > and consistent. > > Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com> > Cc: Sagar Arun Kamble <sagar.a.kamble@intel.com> > Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com> > --- > drivers/gpu/drm/i915/intel_uc_fw.c | 73 +++++++++++++++++++++++--------------- > 1 file changed, 44 insertions(+), 29 deletions(-) > > diff --git a/drivers/gpu/drm/i915/intel_uc_fw.c b/drivers/gpu/drm/i915/intel_uc_fw.c > index 482115b..b52d6b6 100644 > --- a/drivers/gpu/drm/i915/intel_uc_fw.c > +++ b/drivers/gpu/drm/i915/intel_uc_fw.c > @@ -45,26 +45,33 @@ void intel_uc_fw_fetch(struct drm_i915_private *dev_priv, > size_t size; > int err; > > + DRM_DEBUG_DRIVER("%s fw fetch %s\n", > + intel_uc_fw_type_repr(uc_fw->type), uc_fw->path); > + > if (!uc_fw->path) > return; > > uc_fw->fetch_status = INTEL_UC_FIRMWARE_PENDING; > - > - DRM_DEBUG_DRIVER("before requesting firmware: uC fw fetch status %s\n", > + DRM_DEBUG_DRIVER("%s fw fetch %s\n", > + intel_uc_fw_type_repr(uc_fw->type), > intel_uc_fw_status_repr(uc_fw->fetch_status)); > > err = request_firmware(&fw, uc_fw->path, &pdev->dev); > - if (err) > - goto fail; > - if (!fw) > + if (err) { > + DRM_NOTE("%s: Error while requesting firmware\n", > + intel_uc_fw_type_repr(uc_fw->type)); So what am I, the user, meant to do? Do I need to worry? What are the consequences of this? > goto fail; > + } ... fail: > + DRM_WARN("%s: Failed to fetch firmware %s (error %d)\n", > + intel_uc_fw_type_repr(uc_fw->type), uc_fw->path, err); And then my "significant but normal" message has suddenly become a warning the driver is crippled. Make up your mind, do I need to panic or not? -Chris
On Thu, 12 Oct 2017 11:07:21 +0200, Chris Wilson <chris@chris-wilson.co.uk> wrote: > Quoting Michal Wajdeczko (2017-10-10 15:51:32) >> Time to remove less important info and make messages clear >> and consistent. >> >> Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com> >> Cc: Sagar Arun Kamble <sagar.a.kamble@intel.com> >> Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com> >> --- >> drivers/gpu/drm/i915/intel_uc_fw.c | 73 >> +++++++++++++++++++++++--------------- >> 1 file changed, 44 insertions(+), 29 deletions(-) >> >> diff --git a/drivers/gpu/drm/i915/intel_uc_fw.c >> b/drivers/gpu/drm/i915/intel_uc_fw.c >> index 482115b..b52d6b6 100644 >> --- a/drivers/gpu/drm/i915/intel_uc_fw.c >> +++ b/drivers/gpu/drm/i915/intel_uc_fw.c >> @@ -45,26 +45,33 @@ void intel_uc_fw_fetch(struct drm_i915_private >> *dev_priv, >> size_t size; >> int err; >> >> + DRM_DEBUG_DRIVER("%s fw fetch %s\n", >> + intel_uc_fw_type_repr(uc_fw->type), >> uc_fw->path); >> + >> if (!uc_fw->path) >> return; >> >> uc_fw->fetch_status = INTEL_UC_FIRMWARE_PENDING; >> - >> - DRM_DEBUG_DRIVER("before requesting firmware: uC fw fetch >> status %s\n", >> + DRM_DEBUG_DRIVER("%s fw fetch %s\n", >> + intel_uc_fw_type_repr(uc_fw->type), >> intel_uc_fw_status_repr(uc_fw->fetch_status)); >> >> err = request_firmware(&fw, uc_fw->path, &pdev->dev); >> - if (err) >> - goto fail; >> - if (!fw) >> + if (err) { >> + DRM_NOTE("%s: Error while requesting firmware\n", >> + intel_uc_fw_type_repr(uc_fw->type)); > > So what am I, the user, meant to do? Do I need to worry? What are the > consequences of this? Yes, you can be little worried. Being here means that driver decided to install *desired* firmware. We don't know the consequences yet, as there might be a fallback scenario available (like execlist submission, huc not used) As we are jumping into fail label, which will start with similar message, I can downgrade this message into DRM_DEBUG_DRIVER to avoid duplication. > >> goto fail; >> + } > > ... > fail: >> + DRM_WARN("%s: Failed to fetch firmware %s (error %d)\n", >> + intel_uc_fw_type_repr(uc_fw->type), uc_fw->path, err); > > And then my "significant but normal" message has suddenly become a > warning the driver is crippled. Make up your mind, do I need to panic or > not? Good point. This can be DRM_NOTE. But maybe we should promote some other existing DRM_NOTEs into: DRM_WARN("%s: Unexpected firmware size (%zu, min %zu)\n", DRM_WARN("%s: Mismatched firmware header definition\n", DRM_WARN("%s: Mismatched firmware header definition\n", DRM_WARN("%s: Mismatched firmware RSA key size (%u)\n", DRM_WARN("%s: Truncated firmware (%zu, expected %zu)\n", as these indicates corrupted/mismatched data (and it's not normal) Michal
diff --git a/drivers/gpu/drm/i915/intel_uc_fw.c b/drivers/gpu/drm/i915/intel_uc_fw.c index 482115b..b52d6b6 100644 --- a/drivers/gpu/drm/i915/intel_uc_fw.c +++ b/drivers/gpu/drm/i915/intel_uc_fw.c @@ -45,26 +45,33 @@ void intel_uc_fw_fetch(struct drm_i915_private *dev_priv, size_t size; int err; + DRM_DEBUG_DRIVER("%s fw fetch %s\n", + intel_uc_fw_type_repr(uc_fw->type), uc_fw->path); + if (!uc_fw->path) return; uc_fw->fetch_status = INTEL_UC_FIRMWARE_PENDING; - - DRM_DEBUG_DRIVER("before requesting firmware: uC fw fetch status %s\n", + DRM_DEBUG_DRIVER("%s fw fetch %s\n", + intel_uc_fw_type_repr(uc_fw->type), intel_uc_fw_status_repr(uc_fw->fetch_status)); err = request_firmware(&fw, uc_fw->path, &pdev->dev); - if (err) - goto fail; - if (!fw) + if (err) { + DRM_NOTE("%s: Error while requesting firmware\n", + intel_uc_fw_type_repr(uc_fw->type)); goto fail; + } - DRM_DEBUG_DRIVER("fetch uC fw from %s succeeded, fw %p\n", - uc_fw->path, fw); + DRM_DEBUG_DRIVER("%s fw size %zu ptr %p\n", + intel_uc_fw_type_repr(uc_fw->type), fw->size, fw); /* Check the size of the blob before examining buffer contents */ if (fw->size < sizeof(struct uc_css_header)) { - DRM_NOTE("Firmware header is missing\n"); + DRM_NOTE("%s: Unexpected firmware size (%zu, min %zu)\n", + intel_uc_fw_type_repr(uc_fw->type), + fw->size, sizeof(struct uc_css_header)); + err = -ENODATA; goto fail; } @@ -77,7 +84,9 @@ void intel_uc_fw_fetch(struct drm_i915_private *dev_priv, sizeof(u32); if (uc_fw->header_size != sizeof(struct uc_css_header)) { - DRM_NOTE("CSS header definition mismatch\n"); + DRM_NOTE("%s: Mismatched firmware header definition\n", + intel_uc_fw_type_repr(uc_fw->type)); + err = -ENOEXEC; goto fail; } @@ -87,7 +96,9 @@ void intel_uc_fw_fetch(struct drm_i915_private *dev_priv, /* now RSA */ if (css->key_size_dw != UOS_RSA_SCRATCH_MAX_COUNT) { - DRM_NOTE("RSA key size is bad\n"); + DRM_NOTE("%s: Mismatched firmware RSA key size (%u)\n", + intel_uc_fw_type_repr(uc_fw->type), css->key_size_dw); + err = -ENOEXEC; goto fail; } uc_fw->rsa_offset = uc_fw->ucode_offset + uc_fw->ucode_size; @@ -96,7 +107,9 @@ void intel_uc_fw_fetch(struct drm_i915_private *dev_priv, /* 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; if (fw->size < size) { - DRM_NOTE("Missing firmware components\n"); + DRM_NOTE("%s: Truncated firmware (%zu, expected %zu)\n", + intel_uc_fw_type_repr(uc_fw->type), fw->size, size); + err = -ENOEXEC; goto fail; } @@ -118,17 +131,21 @@ void intel_uc_fw_fetch(struct drm_i915_private *dev_priv, break; default: - DRM_ERROR("Unknown firmware type %d\n", uc_fw->type); - err = -ENOEXEC; - goto fail; + MISSING_CASE(uc_fw->type); + break; } + DRM_DEBUG_DRIVER("%s fw version %u.%u (wanted %u.%u)\n", + intel_uc_fw_type_repr(uc_fw->type), + uc_fw->major_ver_found, uc_fw->minor_ver_found, + uc_fw->major_ver_wanted, uc_fw->minor_ver_wanted); + if (uc_fw->major_ver_wanted == 0 && uc_fw->minor_ver_wanted == 0) { - DRM_NOTE("Skipping %s firmware version check\n", + DRM_NOTE("%s: Skipping firmware version check\n", intel_uc_fw_type_repr(uc_fw->type)); } else if (uc_fw->major_ver_found != uc_fw->major_ver_wanted || uc_fw->minor_ver_found < uc_fw->minor_ver_wanted) { - DRM_NOTE("%s firmware version %d.%d, required %d.%d\n", + DRM_NOTE("%s: Wrong firmware version (%u.%u, required %u.%u)\n", intel_uc_fw_type_repr(uc_fw->type), uc_fw->major_ver_found, uc_fw->minor_ver_found, uc_fw->major_ver_wanted, uc_fw->minor_ver_wanted); @@ -136,10 +153,6 @@ void intel_uc_fw_fetch(struct drm_i915_private *dev_priv, goto fail; } - DRM_DEBUG_DRIVER("firmware version %d.%d OK (minimum %d.%d)\n", - uc_fw->major_ver_found, uc_fw->minor_ver_found, - uc_fw->major_ver_wanted, uc_fw->minor_ver_wanted); - obj = i915_gem_object_create_from_data(dev_priv, fw->data, fw->size); if (IS_ERR(obj)) { err = PTR_ERR(obj); @@ -148,22 +161,24 @@ void intel_uc_fw_fetch(struct drm_i915_private *dev_priv, uc_fw->obj = obj; uc_fw->size = fw->size; - - DRM_DEBUG_DRIVER("uC fw fetch status SUCCESS, obj %p\n", - uc_fw->obj); + uc_fw->fetch_status = INTEL_UC_FIRMWARE_SUCCESS; + DRM_DEBUG_DRIVER("%s fw fetch %s\n", + intel_uc_fw_type_repr(uc_fw->type), + intel_uc_fw_status_repr(uc_fw->fetch_status)); release_firmware(fw); - uc_fw->fetch_status = INTEL_UC_FIRMWARE_SUCCESS; return; fail: - DRM_WARN("Failed to fetch valid uC firmware from %s (error %d)\n", - uc_fw->path, err); - DRM_DEBUG_DRIVER("uC fw fetch status FAIL; err %d, fw %p, obj %p\n", - err, fw, uc_fw->obj); + uc_fw->fetch_status = INTEL_UC_FIRMWARE_FAIL; + DRM_DEBUG_DRIVER("%s fw fetch %s\n", + intel_uc_fw_type_repr(uc_fw->type), + intel_uc_fw_status_repr(uc_fw->fetch_status)); + + DRM_WARN("%s: Failed to fetch firmware %s (error %d)\n", + intel_uc_fw_type_repr(uc_fw->type), uc_fw->path, err); release_firmware(fw); /* OK even if fw is NULL */ - uc_fw->fetch_status = INTEL_UC_FIRMWARE_FAIL; } /**
Time to remove less important info and make messages clear and consistent. Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com> Cc: Sagar Arun Kamble <sagar.a.kamble@intel.com> Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com> --- drivers/gpu/drm/i915/intel_uc_fw.c | 73 +++++++++++++++++++++++--------------- 1 file changed, 44 insertions(+), 29 deletions(-)