Hi Thomas, FYI, the error/warning was bisected to this commit, please ignore it if it's irrelevant. tree: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master head: 382d2f9e739bc6f151c718b38537ae522ff848cd commit: 8ab59da26bc0ae0abfcaabc4218c74827d154256 [5168/7046] drm/fb-helper: Move generic fbdev emulation into separate source file config: mips-randconfig-r001-20221110 compiler: clang version 16.0.0 (https://github.com/llvm/llvm-project 463da45892e2d2a262277b91b96f5f8c05dc25d0) reproduce (this is a W=1 build): wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # install mips cross compiling tool for clang build # apt-get install binutils-mipsel-linux-gnu # https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=8ab59da26bc0ae0abfcaabc4218c74827d154256 git remote add linux-next https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git git fetch --no-tags linux-next master git checkout 8ab59da26bc0ae0abfcaabc4218c74827d154256 # save the config file mkdir build_dir && cp config build_dir/.config COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=mips SHELL=/bin/bash drivers/gpu/drm/ If you fix the issue, kindly add following tag where applicable | Reported-by: kernel test robot Note: the linux-next/master HEAD 382d2f9e739bc6f151c718b38537ae522ff848cd builds fine. It may have been fixed somewhere. All errors (new ones prefixed by >>): >> drivers/gpu/drm/drm_fbdev_generic.c:63:3: error: call to undeclared function 'vfree'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration] vfree(shadow); ^ >> drivers/gpu/drm/drm_fbdev_generic.c:219:24: error: call to undeclared function 'vzalloc'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration] fbi->screen_buffer = vzalloc(fbi->screen_size); ^ >> drivers/gpu/drm/drm_fbdev_generic.c:219:22: error: incompatible integer to pointer conversion assigning to 'char *' from 'int' [-Wint-conversion] fbi->screen_buffer = vzalloc(fbi->screen_size); ^ ~~~~~~~~~~~~~~~~~~~~~~~~~ 3 errors generated. vim +/vfree +63 drivers/gpu/drm/drm_fbdev_generic.c 44 45 static void drm_fbdev_cleanup(struct drm_fb_helper *fb_helper) 46 { 47 struct fb_info *fbi = fb_helper->info; 48 void *shadow = NULL; 49 50 if (!fb_helper->dev) 51 return; 52 53 if (fbi) { 54 if (fbi->fbdefio) 55 fb_deferred_io_cleanup(fbi); 56 if (drm_fbdev_use_shadow_fb(fb_helper)) 57 shadow = fbi->screen_buffer; 58 } 59 60 drm_fb_helper_fini(fb_helper); 61 62 if (shadow) > 63 vfree(shadow); 64 else if (fb_helper->buffer) 65 drm_client_buffer_vunmap(fb_helper->buffer); 66 67 drm_client_framebuffer_delete(fb_helper->buffer); 68 } 69 70 static void drm_fbdev_release(struct drm_fb_helper *fb_helper) 71 { 72 drm_fbdev_cleanup(fb_helper); 73 drm_client_release(&fb_helper->client); 74 kfree(fb_helper); 75 } 76 77 /* 78 * fb_ops.fb_destroy is called by the last put_fb_info() call at the end of 79 * unregister_framebuffer() or fb_release(). 80 */ 81 static void drm_fbdev_fb_destroy(struct fb_info *info) 82 { 83 drm_fbdev_release(info->par); 84 } 85 86 static int drm_fbdev_fb_mmap(struct fb_info *info, struct vm_area_struct *vma) 87 { 88 struct drm_fb_helper *fb_helper = info->par; 89 90 if (drm_fbdev_use_shadow_fb(fb_helper)) 91 return fb_deferred_io_mmap(info, vma); 92 else if (fb_helper->dev->driver->gem_prime_mmap) 93 return fb_helper->dev->driver->gem_prime_mmap(fb_helper->buffer->gem, vma); 94 else 95 return -ENODEV; 96 } 97 98 static bool drm_fbdev_use_iomem(struct fb_info *info) 99 { 100 struct drm_fb_helper *fb_helper = info->par; 101 struct drm_client_buffer *buffer = fb_helper->buffer; 102 103 return !drm_fbdev_use_shadow_fb(fb_helper) && buffer->map.is_iomem; 104 } 105 106 static ssize_t drm_fbdev_fb_read(struct fb_info *info, char __user *buf, 107 size_t count, loff_t *ppos) 108 { 109 ssize_t ret; 110 111 if (drm_fbdev_use_iomem(info)) 112 ret = drm_fb_helper_cfb_read(info, buf, count, ppos); 113 else 114 ret = drm_fb_helper_sys_read(info, buf, count, ppos); 115 116 return ret; 117 } 118 119 static ssize_t drm_fbdev_fb_write(struct fb_info *info, const char __user *buf, 120 size_t count, loff_t *ppos) 121 { 122 ssize_t ret; 123 124 if (drm_fbdev_use_iomem(info)) 125 ret = drm_fb_helper_cfb_write(info, buf, count, ppos); 126 else 127 ret = drm_fb_helper_sys_write(info, buf, count, ppos); 128 129 return ret; 130 } 131 132 static void drm_fbdev_fb_fillrect(struct fb_info *info, 133 const struct fb_fillrect *rect) 134 { 135 if (drm_fbdev_use_iomem(info)) 136 drm_fb_helper_cfb_fillrect(info, rect); 137 else 138 drm_fb_helper_sys_fillrect(info, rect); 139 } 140 141 static void drm_fbdev_fb_copyarea(struct fb_info *info, 142 const struct fb_copyarea *area) 143 { 144 if (drm_fbdev_use_iomem(info)) 145 drm_fb_helper_cfb_copyarea(info, area); 146 else 147 drm_fb_helper_sys_copyarea(info, area); 148 } 149 150 static void drm_fbdev_fb_imageblit(struct fb_info *info, 151 const struct fb_image *image) 152 { 153 if (drm_fbdev_use_iomem(info)) 154 drm_fb_helper_cfb_imageblit(info, image); 155 else 156 drm_fb_helper_sys_imageblit(info, image); 157 } 158 159 static const struct fb_ops drm_fbdev_fb_ops = { 160 .owner = THIS_MODULE, 161 DRM_FB_HELPER_DEFAULT_OPS, 162 .fb_open = drm_fbdev_fb_open, 163 .fb_release = drm_fbdev_fb_release, 164 .fb_destroy = drm_fbdev_fb_destroy, 165 .fb_mmap = drm_fbdev_fb_mmap, 166 .fb_read = drm_fbdev_fb_read, 167 .fb_write = drm_fbdev_fb_write, 168 .fb_fillrect = drm_fbdev_fb_fillrect, 169 .fb_copyarea = drm_fbdev_fb_copyarea, 170 .fb_imageblit = drm_fbdev_fb_imageblit, 171 }; 172 173 static struct fb_deferred_io drm_fbdev_defio = { 174 .delay = HZ / 20, 175 .deferred_io = drm_fb_helper_deferred_io, 176 }; 177 178 /* 179 * This function uses the client API to create a framebuffer backed by a dumb buffer. 180 */ 181 static int drm_fbdev_fb_probe(struct drm_fb_helper *fb_helper, 182 struct drm_fb_helper_surface_size *sizes) 183 { 184 struct drm_client_dev *client = &fb_helper->client; 185 struct drm_device *dev = fb_helper->dev; 186 struct drm_client_buffer *buffer; 187 struct drm_framebuffer *fb; 188 struct fb_info *fbi; 189 u32 format; 190 struct iosys_map map; 191 int ret; 192 193 drm_dbg_kms(dev, "surface width(%d), height(%d) and bpp(%d)\n", 194 sizes->surface_width, sizes->surface_height, 195 sizes->surface_bpp); 196 197 format = drm_mode_legacy_fb_format(sizes->surface_bpp, sizes->surface_depth); 198 buffer = drm_client_framebuffer_create(client, sizes->surface_width, 199 sizes->surface_height, format); 200 if (IS_ERR(buffer)) 201 return PTR_ERR(buffer); 202 203 fb_helper->buffer = buffer; 204 fb_helper->fb = buffer->fb; 205 fb = buffer->fb; 206 207 fbi = drm_fb_helper_alloc_info(fb_helper); 208 if (IS_ERR(fbi)) 209 return PTR_ERR(fbi); 210 211 fbi->fbops = &drm_fbdev_fb_ops; 212 fbi->screen_size = sizes->surface_height * fb->pitches[0]; 213 fbi->fix.smem_len = fbi->screen_size; 214 fbi->flags = FBINFO_DEFAULT; 215 216 drm_fb_helper_fill_info(fbi, fb_helper, sizes); 217 218 if (drm_fbdev_use_shadow_fb(fb_helper)) { > 219 fbi->screen_buffer = vzalloc(fbi->screen_size); 220 if (!fbi->screen_buffer) 221 return -ENOMEM; 222 fbi->flags |= FBINFO_VIRTFB | FBINFO_READS_FAST; 223 224 fbi->fbdefio = &drm_fbdev_defio; 225 fb_deferred_io_init(fbi); 226 } else { 227 /* buffer is mapped for HW framebuffer */ 228 ret = drm_client_buffer_vmap(fb_helper->buffer, &map); 229 if (ret) 230 return ret; 231 if (map.is_iomem) { 232 fbi->screen_base = map.vaddr_iomem; 233 } else { 234 fbi->screen_buffer = map.vaddr; 235 fbi->flags |= FBINFO_VIRTFB; 236 } 237 238 /* 239 * Shamelessly leak the physical address to user-space. As 240 * page_to_phys() is undefined for I/O memory, warn in this 241 * case. 242 */ 243 #if IS_ENABLED(CONFIG_DRM_FBDEV_LEAK_PHYS_SMEM) 244 if (fb_helper->hint_leak_smem_start && fbi->fix.smem_start == 0 && 245 !drm_WARN_ON_ONCE(dev, map.is_iomem)) 246 fbi->fix.smem_start = 247 page_to_phys(virt_to_page(fbi->screen_buffer)); 248 #endif 249 } 250 251 return 0; 252 } 253 -- 0-DAY CI Kernel Test Service https://01.org/lkp