Re: [PATCH] LoongArch: Enable ACPI BGRT handling

From: kernel test robot
Date: Tue Sep 10 2024 - 09:06:52 EST


Hi Bibo,

kernel test robot noticed the following build warnings:

[auto build test WARNING on b31c4492884252a8360f312a0ac2049349ddf603]

url: https://github.com/intel-lab-lkp/linux/commits/Bibo-Mao/LoongArch-Enable-ACPI-BGRT-handling/20240909-095705
base: b31c4492884252a8360f312a0ac2049349ddf603
patch link: https://lore.kernel.org/r/20240909015514.597253-1-maobibo%40loongson.cn
patch subject: [PATCH] LoongArch: Enable ACPI BGRT handling
config: loongarch-randconfig-r133-20240910 (https://download.01.org/0day-ci/archive/20240910/202409102056.DNqh6zzA-lkp@xxxxxxxxx/config)
compiler: loongarch64-linux-gcc (GCC) 14.1.0
reproduce: (https://download.01.org/0day-ci/archive/20240910/202409102056.DNqh6zzA-lkp@xxxxxxxxx/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202409102056.DNqh6zzA-lkp@xxxxxxxxx/

sparse warnings: (new ones prefixed by >>)
>> drivers/firmware/efi/efi-bgrt.c:69:15: sparse: sparse: incorrect type in assignment (different address spaces) @@ expected void *image @@ got void [noderef] __iomem * @@
drivers/firmware/efi/efi-bgrt.c:69:15: sparse: expected void *image
drivers/firmware/efi/efi-bgrt.c:69:15: sparse: got void [noderef] __iomem *
>> drivers/firmware/efi/efi-bgrt.c:76:24: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void [noderef] __iomem *addr @@ got void *image @@
drivers/firmware/efi/efi-bgrt.c:76:24: sparse: expected void [noderef] __iomem *addr
drivers/firmware/efi/efi-bgrt.c:76:24: sparse: got void *image

vim +69 drivers/firmware/efi/efi-bgrt.c

2223af38903242 arch/x86/platform/efi/efi-bgrt.c Josh Triplett 2012-09-28 26
7b0a911478c74c arch/x86/platform/efi/efi-bgrt.c Dave Young 2017-01-31 27 void __init efi_bgrt_init(struct acpi_table_header *table)
2223af38903242 arch/x86/platform/efi/efi-bgrt.c Josh Triplett 2012-09-28 28 {
50a0cb565246f2 arch/x86/platform/efi/efi-bgrt.c Sai Praneeth 2015-12-09 29 void *image;
2223af38903242 arch/x86/platform/efi/efi-bgrt.c Josh Triplett 2012-09-28 30 struct bmp_header bmp_header;
7b0a911478c74c arch/x86/platform/efi/efi-bgrt.c Dave Young 2017-01-31 31 struct acpi_table_bgrt *bgrt = &bgrt_tab;
2223af38903242 arch/x86/platform/efi/efi-bgrt.c Josh Triplett 2012-09-28 32
2223af38903242 arch/x86/platform/efi/efi-bgrt.c Josh Triplett 2012-09-28 33 if (acpi_disabled)
2223af38903242 arch/x86/platform/efi/efi-bgrt.c Josh Triplett 2012-09-28 34 return;
2223af38903242 arch/x86/platform/efi/efi-bgrt.c Josh Triplett 2012-09-28 35
792ef14df5c585 drivers/firmware/efi/efi-bgrt.c Dave Young 2017-06-09 36 if (!efi_enabled(EFI_MEMMAP))
7425826f4f7ac6 drivers/firmware/efi/efi-bgrt.c Dave Young 2017-05-26 37 return;
7425826f4f7ac6 drivers/firmware/efi/efi-bgrt.c Dave Young 2017-05-26 38
7b0a911478c74c arch/x86/platform/efi/efi-bgrt.c Dave Young 2017-01-31 39 if (table->length < sizeof(bgrt_tab)) {
7f9b474c927130 arch/x86/platform/efi/efi-bgrt.c Josh Boyer 2016-05-03 40 pr_notice("Ignoring BGRT: invalid length %u (expected %zu)\n",
7b0a911478c74c arch/x86/platform/efi/efi-bgrt.c Dave Young 2017-01-31 41 table->length, sizeof(bgrt_tab));
5d6d578c170bb2 arch/x86/platform/efi/efi-bgrt.c Jan Beulich 2012-11-07 42 return;
1282278ee00b41 arch/x86/platform/efi/efi-bgrt.c Josh Triplett 2014-07-30 43 }
7b0a911478c74c arch/x86/platform/efi/efi-bgrt.c Dave Young 2017-01-31 44 *bgrt = *(struct acpi_table_bgrt *)table;
55087c5713dcf1 drivers/firmware/efi/efi-bgrt.c Hans de Goede 2020-01-31 45 /*
55087c5713dcf1 drivers/firmware/efi/efi-bgrt.c Hans de Goede 2020-01-31 46 * Only version 1 is defined but some older laptops (seen on Lenovo
55087c5713dcf1 drivers/firmware/efi/efi-bgrt.c Hans de Goede 2020-01-31 47 * Ivy Bridge models) have a correct version 1 BGRT table with the
55087c5713dcf1 drivers/firmware/efi/efi-bgrt.c Hans de Goede 2020-01-31 48 * version set to 0, so we accept version 0 and 1.
55087c5713dcf1 drivers/firmware/efi/efi-bgrt.c Hans de Goede 2020-01-31 49 */
55087c5713dcf1 drivers/firmware/efi/efi-bgrt.c Hans de Goede 2020-01-31 50 if (bgrt->version > 1) {
7f9b474c927130 arch/x86/platform/efi/efi-bgrt.c Josh Boyer 2016-05-03 51 pr_notice("Ignoring BGRT: invalid version %u (expected 1)\n",
7b0a911478c74c arch/x86/platform/efi/efi-bgrt.c Dave Young 2017-01-31 52 bgrt->version);
7b0a911478c74c arch/x86/platform/efi/efi-bgrt.c Dave Young 2017-01-31 53 goto out;
1282278ee00b41 arch/x86/platform/efi/efi-bgrt.c Josh Triplett 2014-07-30 54 }
7b0a911478c74c arch/x86/platform/efi/efi-bgrt.c Dave Young 2017-01-31 55 if (bgrt->image_type != 0) {
7f9b474c927130 arch/x86/platform/efi/efi-bgrt.c Josh Boyer 2016-05-03 56 pr_notice("Ignoring BGRT: invalid image type %u (expected 0)\n",
7b0a911478c74c arch/x86/platform/efi/efi-bgrt.c Dave Young 2017-01-31 57 bgrt->image_type);
7b0a911478c74c arch/x86/platform/efi/efi-bgrt.c Dave Young 2017-01-31 58 goto out;
1282278ee00b41 arch/x86/platform/efi/efi-bgrt.c Josh Triplett 2014-07-30 59 }
7b0a911478c74c arch/x86/platform/efi/efi-bgrt.c Dave Young 2017-01-31 60 if (!bgrt->image_address) {
7f9b474c927130 arch/x86/platform/efi/efi-bgrt.c Josh Boyer 2016-05-03 61 pr_notice("Ignoring BGRT: null image address\n");
7b0a911478c74c arch/x86/platform/efi/efi-bgrt.c Dave Young 2017-01-31 62 goto out;
1282278ee00b41 arch/x86/platform/efi/efi-bgrt.c Josh Triplett 2014-07-30 63 }
2223af38903242 arch/x86/platform/efi/efi-bgrt.c Josh Triplett 2012-09-28 64
6de47a5e371f75 drivers/firmware/efi/efi-bgrt.c Jan Beulich 2017-08-25 65 if (efi_mem_type(bgrt->image_address) != EFI_BOOT_SERVICES_DATA) {
792ef14df5c585 drivers/firmware/efi/efi-bgrt.c Dave Young 2017-06-09 66 pr_notice("Ignoring BGRT: invalid image address\n");
792ef14df5c585 drivers/firmware/efi/efi-bgrt.c Dave Young 2017-06-09 67 goto out;
792ef14df5c585 drivers/firmware/efi/efi-bgrt.c Dave Young 2017-06-09 68 }
7b0a911478c74c arch/x86/platform/efi/efi-bgrt.c Dave Young 2017-01-31 @69 image = early_memremap(bgrt->image_address, sizeof(bmp_header));
1282278ee00b41 arch/x86/platform/efi/efi-bgrt.c Josh Triplett 2014-07-30 70 if (!image) {
7f9b474c927130 arch/x86/platform/efi/efi-bgrt.c Josh Boyer 2016-05-03 71 pr_notice("Ignoring BGRT: failed to map image header memory\n");
7b0a911478c74c arch/x86/platform/efi/efi-bgrt.c Dave Young 2017-01-31 72 goto out;
2223af38903242 arch/x86/platform/efi/efi-bgrt.c Josh Triplett 2012-09-28 73 }
2223af38903242 arch/x86/platform/efi/efi-bgrt.c Josh Triplett 2012-09-28 74
50a0cb565246f2 arch/x86/platform/efi/efi-bgrt.c Sai Praneeth 2015-12-09 75 memcpy(&bmp_header, image, sizeof(bmp_header));
7b0a911478c74c arch/x86/platform/efi/efi-bgrt.c Dave Young 2017-01-31 @76 early_memunmap(image, sizeof(bmp_header));

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki