Re: [PATCH v2 3/3] efi: earlycon: Add support for generic framebuffers and move to console subsystem

kernel test robot
2022-08-14T00:01:44Z

Hi Markuss,

I love your patch! Perhaps something to improve:

[auto build test WARNING on tty/tty-testing]
[also build test WARNING on efi/next staging/staging-testing usb/usb-testing linus/master v5.19 next-20220812]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url: https://github.com/intel-lab-lkp/linux/commits/Markuss-Broks/Add-generic-framebuffer-support-to-EFI-earlycon-driver/20220807-003646
base: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty.git tty-testing
config: loongarch-randconfig-s031-20220807 (https://download.01.org/0day-ci/archive/20220814/202208140705.bU9i1c1t-lkp@intel.com/config)
compiler: loongarch64-linux-gcc (GCC) 12.1.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# apt-get install sparse
# sparse version: v0.6.4-39-gce1a6720-dirty
# https://github.com/intel-lab-lkp/linux/commit/97dfc2aa69b065de769a191352afe2099c52fedb
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Markuss-Broks/Add-generic-framebuffer-support-to-EFI-earlycon-driver/20220807-003646
git checkout 97dfc2aa69b065de769a191352afe2099c52fedb
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=loongarch SHELL=/bin/bash drivers/video/console/

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

sparse warnings: (new ones prefixed by >>)
>> drivers/video/console/earlycon.c:43:24: sparse: sparse: incorrect type in assignment (different address spaces) @@ expected void [noderef] __iomem *static [toplevel] virt_base @@ got void * @@
drivers/video/console/earlycon.c:43:24: sparse: expected void [noderef] __iomem *static [toplevel] virt_base
drivers/video/console/earlycon.c:43:24: sparse: got void *
>> drivers/video/console/earlycon.c:53:30: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *addr @@ got void [noderef] __iomem *static [toplevel] virt_base @@
drivers/video/console/earlycon.c:53:30: sparse: expected void *addr
drivers/video/console/earlycon.c:53:30: sparse: got void [noderef] __iomem *static [toplevel] virt_base
>> drivers/video/console/earlycon.c:63:39: sparse: sparse: incorrect type in return expression (different address spaces) @@ expected void * @@ got void [noderef] __iomem * @@
drivers/video/console/earlycon.c:63:39: sparse: expected void *
drivers/video/console/earlycon.c:63:39: sparse: got void [noderef] __iomem *
>> drivers/video/console/earlycon.c:74:24: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void [noderef] __iomem *addr @@ got void *addr @@
drivers/video/console/earlycon.c:74:24: sparse: expected void [noderef] __iomem *addr
drivers/video/console/earlycon.c:74:24: sparse: got void *addr

vim +43 drivers/video/console/earlycon.c

29
30 static int __init simplefb_earlycon_remap_fb(void)
31 {
32 unsigned long mapping;
33 /* bail if there is no bootconsole or it has been disabled already */
34 if (!earlycon_console || !(earlycon_console->flags & CON_ENABLED))
35 return 0;
36
37 if (region_intersects(info.phys_base, info.size,
38 IORESOURCE_SYSTEM_RAM, IORES_DESC_NONE) == REGION_INTERSECTS)
39 mapping = MEMREMAP_WB;
40 else
41 mapping = MEMREMAP_WC;
42
> 43 info.virt_base = memremap(info.phys_base, info.size, mapping);
44
45 return info.virt_base ? 0 : -ENOMEM;
46 }
47 early_initcall(simplefb_earlycon_remap_fb);
48
49 static int __init simplefb_earlycon_unmap_fb(void)
50 {
51 /* unmap the bootconsole fb unless keep_bootcon has left it enabled */
52 if (info.virt_base && !(earlycon_console->flags & CON_ENABLED))
> 53 memunmap(info.virt_base);
54 return 0;
55 }
56 late_initcall(simplefb_earlycon_unmap_fb);
57
58 static __ref void *simplefb_earlycon_map(unsigned long start, unsigned long len)
59 {
60 pgprot_t fb_prot;
61
62 if (info.virt_base)
> 63 return info.virt_base + start;
64
65 fb_prot = PAGE_KERNEL;
66 return early_memremap_prot(info.phys_base + start, len, pgprot_val(fb_prot));
67 }
68
69 static __ref void simplefb_earlycon_unmap(void *addr, unsigned long len)
70 {
71 if (info.virt_base)
72 return;
73
> 74 early_memunmap(addr, len);
75 }
76

--
0-DAY CI Kernel Test Service