Re: [PATCH v7 7/8] platform/x86: touchscreen_dmi: Add EFI embedded firmware info support

kbuild test robot
2019-10-05T03:06:36Z

[-- Attachment #1: Type: text/plain, Size: 6607 bytes --]

Hi Hans,

I love your patch! Yet something to improve:

[auto build test ERROR on efi/next]
[cannot apply to v5.4-rc1 next-20191004]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url: https://github.com/0day-ci/linux/commits/Hans-de-Goede/efi-firmware-platform-x86-Add-EFI-embedded-fw-support/20191005-021239
base: https://git.kernel.org/pub/scm/linux/kernel/git/efi/efi.git next
config: i386-allyesconfig (attached as .config)
compiler: gcc-7 (Debian 7.4.0-13) 7.4.0
reproduce:
# save the attached .config to linux build tree
make ARCH=i386

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

drivers/firmware/efi/embedded-firmware.c: In function 'efi_check_md_for_embedded_firmware':
>> drivers/firmware/efi/embedded-firmware.c:64:3: error: implicit declaration of function 'sha256_init'; did you mean 'sparse_init'? [-Werror=implicit-function-declaration]
sha256_init(&sctx);
^~~~~~~~~~~
sparse_init
>> drivers/firmware/efi/embedded-firmware.c:65:3: error: implicit declaration of function 'sha256_update'; did you mean 'key_update'? [-Werror=implicit-function-declaration]
sha256_update(&sctx, map + i, desc->length);
^~~~~~~~~~~~~
key_update
>> drivers/firmware/efi/embedded-firmware.c:66:3: error: implicit declaration of function 'sha256_final' [-Werror=implicit-function-declaration]
sha256_final(&sctx, sha256);
^~~~~~~~~~~~
cc1: some warnings being treated as errors

vim +64 drivers/firmware/efi/embedded-firmware.c

3977d46d946ae2 Hans de Goede 2019-10-04 32
3977d46d946ae2 Hans de Goede 2019-10-04 33 /*
3977d46d946ae2 Hans de Goede 2019-10-04 34 * Note the efi_check_for_embedded_firmwares() code currently makes the
3977d46d946ae2 Hans de Goede 2019-10-04 35 * following 2 assumptions. This may needs to be revisited if embedded firmware
3977d46d946ae2 Hans de Goede 2019-10-04 36 * is found where this is not true:
3977d46d946ae2 Hans de Goede 2019-10-04 37 * 1) The firmware is only found in EFI_BOOT_SERVICES_CODE memory segments
3977d46d946ae2 Hans de Goede 2019-10-04 38 * 2) The firmware always starts at an offset which is a multiple of 8 bytes
3977d46d946ae2 Hans de Goede 2019-10-04 39 */
3977d46d946ae2 Hans de Goede 2019-10-04 40 static int __init efi_check_md_for_embedded_firmware(
3977d46d946ae2 Hans de Goede 2019-10-04 41 efi_memory_desc_t *md, const struct efi_embedded_fw_desc *desc)
3977d46d946ae2 Hans de Goede 2019-10-04 42 {
3977d46d946ae2 Hans de Goede 2019-10-04 43 const u64 prefix = *((u64 *)desc->prefix);
3977d46d946ae2 Hans de Goede 2019-10-04 44 struct sha256_state sctx;
3977d46d946ae2 Hans de Goede 2019-10-04 45 struct embedded_fw *fw;
3977d46d946ae2 Hans de Goede 2019-10-04 46 u8 sha256[32];
3977d46d946ae2 Hans de Goede 2019-10-04 47 u64 i, size;
3977d46d946ae2 Hans de Goede 2019-10-04 48 void *map;
3977d46d946ae2 Hans de Goede 2019-10-04 49
3977d46d946ae2 Hans de Goede 2019-10-04 50 size = md->num_pages << EFI_PAGE_SHIFT;
3977d46d946ae2 Hans de Goede 2019-10-04 51 map = memremap(md->phys_addr, size, MEMREMAP_WB);
3977d46d946ae2 Hans de Goede 2019-10-04 52 if (!map) {
3977d46d946ae2 Hans de Goede 2019-10-04 53 pr_err("Error mapping EFI mem at %#llx\n", md->phys_addr);
3977d46d946ae2 Hans de Goede 2019-10-04 54 return -ENOMEM;
3977d46d946ae2 Hans de Goede 2019-10-04 55 }
3977d46d946ae2 Hans de Goede 2019-10-04 56
3977d46d946ae2 Hans de Goede 2019-10-04 57 size -= desc->length;
3977d46d946ae2 Hans de Goede 2019-10-04 58 for (i = 0; i < size; i += 8) {
3977d46d946ae2 Hans de Goede 2019-10-04 59 u64 *mem = map + i;
3977d46d946ae2 Hans de Goede 2019-10-04 60
3977d46d946ae2 Hans de Goede 2019-10-04 61 if (*mem != prefix)
3977d46d946ae2 Hans de Goede 2019-10-04 62 continue;
3977d46d946ae2 Hans de Goede 2019-10-04 63
3977d46d946ae2 Hans de Goede 2019-10-04 @64 sha256_init(&sctx);
3977d46d946ae2 Hans de Goede 2019-10-04 @65 sha256_update(&sctx, map + i, desc->length);
3977d46d946ae2 Hans de Goede 2019-10-04 @66 sha256_final(&sctx, sha256);
3977d46d946ae2 Hans de Goede 2019-10-04 67 if (memcmp(sha256, desc->sha256, 32) == 0)
3977d46d946ae2 Hans de Goede 2019-10-04 68 break;
3977d46d946ae2 Hans de Goede 2019-10-04 69 }
3977d46d946ae2 Hans de Goede 2019-10-04 70 if (i >= size) {
3977d46d946ae2 Hans de Goede 2019-10-04 71 memunmap(map);
3977d46d946ae2 Hans de Goede 2019-10-04 72 return -ENOENT;
3977d46d946ae2 Hans de Goede 2019-10-04 73 }
3977d46d946ae2 Hans de Goede 2019-10-04 74
3977d46d946ae2 Hans de Goede 2019-10-04 75 pr_info("Found EFI embedded fw '%s'\n", desc->name);
3977d46d946ae2 Hans de Goede 2019-10-04 76
3977d46d946ae2 Hans de Goede 2019-10-04 77 fw = kmalloc(sizeof(*fw), GFP_KERNEL);
3977d46d946ae2 Hans de Goede 2019-10-04 78 if (!fw) {
3977d46d946ae2 Hans de Goede 2019-10-04 79 memunmap(map);
3977d46d946ae2 Hans de Goede 2019-10-04 80 return -ENOMEM;
3977d46d946ae2 Hans de Goede 2019-10-04 81 }
3977d46d946ae2 Hans de Goede 2019-10-04 82
3977d46d946ae2 Hans de Goede 2019-10-04 83 fw->data = kmemdup(map + i, desc->length, GFP_KERNEL);
3977d46d946ae2 Hans de Goede 2019-10-04 84 memunmap(map);
3977d46d946ae2 Hans de Goede 2019-10-04 85 if (!fw->data) {
3977d46d946ae2 Hans de Goede 2019-10-04 86 kfree(fw);
3977d46d946ae2 Hans de Goede 2019-10-04 87 return -ENOMEM;
3977d46d946ae2 Hans de Goede 2019-10-04 88 }
3977d46d946ae2 Hans de Goede 2019-10-04 89
3977d46d946ae2 Hans de Goede 2019-10-04 90 fw->name = desc->name;
3977d46d946ae2 Hans de Goede 2019-10-04 91 fw->length = desc->length;
3977d46d946ae2 Hans de Goede 2019-10-04 92 list_add(&fw->list, &found_fw_list);
3977d46d946ae2 Hans de Goede 2019-10-04 93
3977d46d946ae2 Hans de Goede 2019-10-04 94 return 0;
3977d46d946ae2 Hans de Goede 2019-10-04 95 }
3977d46d946ae2 Hans de Goede 2019-10-04 96

:::::: The code at line 64 was first introduced by commit
:::::: 3977d46d946ae2699ac2c8196d52fb9b303909c9 efi: Add embedded peripheral firmware support

:::::: TO: Hans de Goede <hdegoede@redhat.com>
:::::: CC: 0day robot <lkp@intel.com>

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 68841 bytes --]