[Intel-gfx] [PATCH v2] drm/i915: Downgrade scare message for unknown HuC firmware

kbuild test robot lkp at intel.com
Tue Jan 8 16:14:21 UTC 2019


Hi Chris,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on drm-intel/for-linux-next]
[also build test ERROR on v5.0-rc1 next-20190108]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Chris-Wilson/drm-i915-Downgrade-scare-message-for-unknown-HuC-firmware/20190108-232025
base:   git://anongit.freedesktop.org/drm-intel for-linux-next
config: i386-randconfig-x073-201901 (attached as .config)
compiler: gcc-7 (Debian 7.3.0-1) 7.3.0
reproduce:
        # save the attached .config to linux build tree
        make ARCH=i386 

All errors (new ones prefixed by >>):

   In file included from include/drm/drm_print.h:32:0,
                    from drivers/gpu//drm/i915/intel_uc_fw.c:26:
   drivers/gpu//drm/i915/intel_uc_fw.c: In function 'intel_uc_fw_fetch':
>> drivers/gpu//drm/i915/intel_uc_fw.c:50:12: error: 'i915' undeclared (first use in this function); did you mean 'to_i915'?
      dev_info(i915->drm.dev,
               ^
   include/linux/device.h:1469:12: note: in definition of macro 'dev_info'
     _dev_info(dev, dev_fmt(fmt), ##__VA_ARGS__)
               ^~~
   drivers/gpu//drm/i915/intel_uc_fw.c:50:12: note: each undeclared identifier is reported only once for each function it appears in
      dev_info(i915->drm.dev,
               ^
   include/linux/device.h:1469:12: note: in definition of macro 'dev_info'
     _dev_info(dev, dev_fmt(fmt), ##__VA_ARGS__)
               ^~~
>> drivers/gpu//drm/i915/intel_uc_fw.c:52:29: error: 'const struct firmware' has no member named 'type'
        intel_uc_fw_type_repr(fw->type),
                                ^
   include/linux/device.h:1469:33: note: in definition of macro 'dev_info'
     _dev_info(dev, dev_fmt(fmt), ##__VA_ARGS__)
                                    ^~~~~~~~~~~

vim +50 drivers/gpu//drm/i915/intel_uc_fw.c

  > 26	#include <drm/drm_print.h>
    27	
    28	#include "intel_uc_fw.h"
    29	#include "i915_drv.h"
    30	
    31	/**
    32	 * intel_uc_fw_fetch - fetch uC firmware
    33	 *
    34	 * @dev_priv: device private
    35	 * @uc_fw: uC firmware
    36	 *
    37	 * Fetch uC firmware into GEM obj.
    38	 */
    39	void intel_uc_fw_fetch(struct drm_i915_private *dev_priv,
    40			       struct intel_uc_fw *uc_fw)
    41	{
    42		struct pci_dev *pdev = dev_priv->drm.pdev;
    43		struct drm_i915_gem_object *obj;
    44		const struct firmware *fw = NULL;
    45		struct uc_css_header *css;
    46		size_t size;
    47		int err;
    48	
    49		if (!uc_fw->path) {
  > 50			dev_info(i915->drm.dev,
    51				 "%s: No firmware was defined for %s!\n",
  > 52				 intel_uc_fw_type_repr(fw->type),
    53				 intel_platform_name(INTEL_INFO(i915)->platform));
    54			return;
    55		}
    56	
    57		DRM_DEBUG_DRIVER("%s fw fetch %s\n",
    58				 intel_uc_fw_type_repr(uc_fw->type), uc_fw->path);
    59	
    60		uc_fw->fetch_status = INTEL_UC_FIRMWARE_PENDING;
    61		DRM_DEBUG_DRIVER("%s fw fetch %s\n",
    62				 intel_uc_fw_type_repr(uc_fw->type),
    63				 intel_uc_fw_status_repr(uc_fw->fetch_status));
    64	
    65		err = request_firmware(&fw, uc_fw->path, &pdev->dev);
    66		if (err) {
    67			DRM_DEBUG_DRIVER("%s fw request_firmware err=%d\n",
    68					 intel_uc_fw_type_repr(uc_fw->type), err);
    69			goto fail;
    70		}
    71	
    72		DRM_DEBUG_DRIVER("%s fw size %zu ptr %p\n",
    73				 intel_uc_fw_type_repr(uc_fw->type), fw->size, fw);
    74	
    75		/* Check the size of the blob before examining buffer contents */
    76		if (fw->size < sizeof(struct uc_css_header)) {
    77			DRM_WARN("%s: Unexpected firmware size (%zu, min %zu)\n",
    78				 intel_uc_fw_type_repr(uc_fw->type),
    79				 fw->size, sizeof(struct uc_css_header));
    80			err = -ENODATA;
    81			goto fail;
    82		}
    83	
    84		css = (struct uc_css_header *)fw->data;
    85	
    86		/* Firmware bits always start from header */
    87		uc_fw->header_offset = 0;
    88		uc_fw->header_size = (css->header_size_dw - css->modulus_size_dw -
    89				      css->key_size_dw - css->exponent_size_dw) *
    90				     sizeof(u32);
    91	
    92		if (uc_fw->header_size != sizeof(struct uc_css_header)) {
    93			DRM_WARN("%s: Mismatched firmware header definition\n",
    94				 intel_uc_fw_type_repr(uc_fw->type));
    95			err = -ENOEXEC;
    96			goto fail;
    97		}
    98	
    99		/* then, uCode */
   100		uc_fw->ucode_offset = uc_fw->header_offset + uc_fw->header_size;
   101		uc_fw->ucode_size = (css->size_dw - css->header_size_dw) * sizeof(u32);
   102	
   103		/* now RSA */
   104		if (css->key_size_dw != UOS_RSA_SCRATCH_COUNT) {
   105			DRM_WARN("%s: Mismatched firmware RSA key size (%u)\n",
   106				 intel_uc_fw_type_repr(uc_fw->type), css->key_size_dw);
   107			err = -ENOEXEC;
   108			goto fail;
   109		}
   110		uc_fw->rsa_offset = uc_fw->ucode_offset + uc_fw->ucode_size;
   111		uc_fw->rsa_size = css->key_size_dw * sizeof(u32);
   112	
   113		/* At least, it should have header, uCode and RSA. Size of all three. */
   114		size = uc_fw->header_size + uc_fw->ucode_size + uc_fw->rsa_size;
   115		if (fw->size < size) {
   116			DRM_WARN("%s: Truncated firmware (%zu, expected %zu)\n",
   117				 intel_uc_fw_type_repr(uc_fw->type), fw->size, size);
   118			err = -ENOEXEC;
   119			goto fail;
   120		}
   121	
   122		/*
   123		 * The GuC firmware image has the version number embedded at a
   124		 * well-known offset within the firmware blob; note that major / minor
   125		 * version are TWO bytes each (i.e. u16), although all pointers and
   126		 * offsets are defined in terms of bytes (u8).
   127		 */
   128		switch (uc_fw->type) {
   129		case INTEL_UC_FW_TYPE_GUC:
   130			uc_fw->major_ver_found = css->guc.sw_version >> 16;
   131			uc_fw->minor_ver_found = css->guc.sw_version & 0xFFFF;
   132			break;
   133	
   134		case INTEL_UC_FW_TYPE_HUC:
   135			uc_fw->major_ver_found = css->huc.sw_version >> 16;
   136			uc_fw->minor_ver_found = css->huc.sw_version & 0xFFFF;
   137			break;
   138	
   139		default:
   140			MISSING_CASE(uc_fw->type);
   141			break;
   142		}
   143	
   144		DRM_DEBUG_DRIVER("%s fw version %u.%u (wanted %u.%u)\n",
   145				 intel_uc_fw_type_repr(uc_fw->type),
   146				 uc_fw->major_ver_found, uc_fw->minor_ver_found,
   147				 uc_fw->major_ver_wanted, uc_fw->minor_ver_wanted);
   148	
   149		if (uc_fw->major_ver_wanted == 0 && uc_fw->minor_ver_wanted == 0) {
   150			DRM_NOTE("%s: Skipping firmware version check\n",
   151				 intel_uc_fw_type_repr(uc_fw->type));
   152		} else if (uc_fw->major_ver_found != uc_fw->major_ver_wanted ||
   153			   uc_fw->minor_ver_found < uc_fw->minor_ver_wanted) {
   154			DRM_NOTE("%s: Wrong firmware version (%u.%u, required %u.%u)\n",
   155				 intel_uc_fw_type_repr(uc_fw->type),
   156				 uc_fw->major_ver_found, uc_fw->minor_ver_found,
   157				 uc_fw->major_ver_wanted, uc_fw->minor_ver_wanted);
   158			err = -ENOEXEC;
   159			goto fail;
   160		}
   161	
   162		obj = i915_gem_object_create_from_data(dev_priv, fw->data, fw->size);
   163		if (IS_ERR(obj)) {
   164			err = PTR_ERR(obj);
   165			DRM_DEBUG_DRIVER("%s fw object_create err=%d\n",
   166					 intel_uc_fw_type_repr(uc_fw->type), err);
   167			goto fail;
   168		}
   169	
   170		uc_fw->obj = obj;
   171		uc_fw->size = fw->size;
   172		uc_fw->fetch_status = INTEL_UC_FIRMWARE_SUCCESS;
   173		DRM_DEBUG_DRIVER("%s fw fetch %s\n",
   174				 intel_uc_fw_type_repr(uc_fw->type),
   175				 intel_uc_fw_status_repr(uc_fw->fetch_status));
   176	
   177		release_firmware(fw);
   178		return;
   179	
   180	fail:
   181		uc_fw->fetch_status = INTEL_UC_FIRMWARE_FAIL;
   182		DRM_DEBUG_DRIVER("%s fw fetch %s\n",
   183				 intel_uc_fw_type_repr(uc_fw->type),
   184				 intel_uc_fw_status_repr(uc_fw->fetch_status));
   185	
   186		DRM_WARN("%s: Failed to fetch firmware %s (error %d)\n",
   187			 intel_uc_fw_type_repr(uc_fw->type), uc_fw->path, err);
   188		DRM_INFO("%s: Firmware can be downloaded from %s\n",
   189			 intel_uc_fw_type_repr(uc_fw->type), INTEL_UC_FIRMWARE_URL);
   190	
   191		release_firmware(fw);		/* OK even if fw is NULL */
   192	}
   193	

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
-------------- next part --------------
A non-text attachment was scrubbed...
Name: .config.gz
Type: application/gzip
Size: 35235 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/intel-gfx/attachments/20190109/807fe957/attachment-0001.gz>


More information about the Intel-gfx mailing list