Message ID | 20190108125621.26640-1-chris@chris-wilson.co.uk (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | [v2] drm/i915: Downgrade scare message for unknown HuC firmware | expand |
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
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-s3-201901 (attached as .config) compiler: gcc-6 (Debian 6.4.0-9) 6.4.0 20171026 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) 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 +/i915 +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
diff --git a/drivers/gpu/drm/i915/intel_guc_fw.c b/drivers/gpu/drm/i915/intel_guc_fw.c index 4b437e05e2cd..13ff7003c6be 100644 --- a/drivers/gpu/drm/i915/intel_guc_fw.c +++ b/drivers/gpu/drm/i915/intel_guc_fw.c @@ -77,10 +77,6 @@ static void guc_fw_select(struct intel_uc_fw *guc_fw) guc_fw->path = I915_KBL_GUC_UCODE; guc_fw->major_ver_wanted = KBL_FW_MAJOR; guc_fw->minor_ver_wanted = KBL_FW_MINOR; - } else { - dev_info(dev_priv->drm.dev, - "%s: No firmware known for this platform!\n", - intel_uc_fw_type_repr(guc_fw->type)); } } diff --git a/drivers/gpu/drm/i915/intel_huc_fw.c b/drivers/gpu/drm/i915/intel_huc_fw.c index 9612227b3c44..7d7bfc7f7ca7 100644 --- a/drivers/gpu/drm/i915/intel_huc_fw.c +++ b/drivers/gpu/drm/i915/intel_huc_fw.c @@ -76,9 +76,6 @@ static void huc_fw_select(struct intel_uc_fw *huc_fw) huc_fw->path = I915_KBL_HUC_UCODE; huc_fw->major_ver_wanted = KBL_HUC_FW_MAJOR; huc_fw->minor_ver_wanted = KBL_HUC_FW_MINOR; - } else { - DRM_WARN("%s: No firmware known for this platform!\n", - intel_uc_fw_type_repr(huc_fw->type)); } } diff --git a/drivers/gpu/drm/i915/intel_uc_fw.c b/drivers/gpu/drm/i915/intel_uc_fw.c index fd496416087c..46a933db2eb6 100644 --- a/drivers/gpu/drm/i915/intel_uc_fw.c +++ b/drivers/gpu/drm/i915/intel_uc_fw.c @@ -46,12 +46,17 @@ void intel_uc_fw_fetch(struct drm_i915_private *dev_priv, size_t size; int err; + if (!uc_fw->path) { + dev_info(i915->drm.dev, + "%s: No firmware was defined for %s!\n", + intel_uc_fw_type_repr(fw->type), + intel_platform_name(INTEL_INFO(i915)->platform)); + return; + } + 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("%s fw fetch %s\n", intel_uc_fw_type_repr(uc_fw->type),
If we haven't shipped and enabled firmware for a particular platform, there is nothing the user can do about it. Don't scare the user with an unactionable, unidentifiable warning! <6> [310.769452] i915 0000:00:02.0: GuC: No firmware known for this platform! <4> [310.769458] [drm] HuC: No firmware known for this platform! Unify both GuC/HuC messages to include the device for which we lack the firmware, and provide the platform name as an aide-memoire. v2: Move and refine the message to common site of intel_uc_fw_fetch. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Cc: Michal Wajdeczko <michal.wajdeczko@intel.com> --- drivers/gpu/drm/i915/intel_guc_fw.c | 4 ---- drivers/gpu/drm/i915/intel_huc_fw.c | 3 --- drivers/gpu/drm/i915/intel_uc_fw.c | 11 ++++++++--- 3 files changed, 8 insertions(+), 10 deletions(-)