tree: git://people.freedesktop.org/~airlied/linux.git drm-intel-display-refactor head: 57c0bb98bd7351cfb13403dd854cc9a0fc9ad5df commit: 0f3c35589c8c2924d384164482aa273def8aaf1a [7/9] drm/i915/display: refactor fbdev pin/unpin out into functions. config: i386-randconfig-s001-20211010 (attached as .config) compiler: gcc-9 (Debian 9.3.0-22) 9.3.0 reproduce: # apt-get install sparse # sparse version: v0.6.4-dirty git remote add airlied git://people.freedesktop.org/~airlied/linux.git git fetch --no-tags airlied drm-intel-display-refactor git checkout 0f3c35589c8c2924d384164482aa273def8aaf1a # save the attached .config to linux build tree make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=i386 If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot <lkp@xxxxxxxxx> sparse warnings: (new ones prefixed by >>) drivers/gpu/drm/i915/display/intel_fbdev.c:188:16: sparse: sparse: incorrect type in assignment (different address spaces) @@ expected void * @@ got void [noderef] __iomem * @@ drivers/gpu/drm/i915/display/intel_fbdev.c:188:16: sparse: expected void * drivers/gpu/drm/i915/display/intel_fbdev.c:188:16: sparse: got void [noderef] __iomem * >> drivers/gpu/drm/i915/display/intel_fbdev.c:251:60: sparse: sparse: incorrect type in argument 3 (different address spaces) @@ expected void **vaddr @@ got void [noderef] __iomem ** @@ drivers/gpu/drm/i915/display/intel_fbdev.c:251:60: sparse: expected void **vaddr drivers/gpu/drm/i915/display/intel_fbdev.c:251:60: sparse: got void [noderef] __iomem ** vim +251 drivers/gpu/drm/i915/display/intel_fbdev.c 173 174 static int intel_fbdev_pin_and_fence(struct drm_i915_private *dev_priv, 175 struct intel_fbdev *ifbdev, 176 void **vaddr) 177 { 178 const struct i915_ggtt_view view = { 179 .type = I915_GGTT_VIEW_NORMAL, 180 }; 181 ifbdev->vma = intel_pin_and_fence_fb_obj(&ifbdev->fb->base, false, 182 &view, false, &ifbdev->vma_flags); 183 184 if (IS_ERR(ifbdev->vma)) { 185 return PTR_ERR(ifbdev->vma); 186 } 187 > 188 *vaddr = i915_vma_pin_iomap(ifbdev->vma); 189 if (IS_ERR(*vaddr)) { 190 drm_err(&dev_priv->drm, 191 "Failed to remap framebuffer into virtual memory\n"); 192 return PTR_ERR(vaddr); 193 } 194 return 0; 195 } 196 197 static void intel_fbdev_unpin(struct intel_fbdev *ifbdev) 198 { 199 if (ifbdev->vma) 200 intel_unpin_fb_vma(ifbdev->vma, ifbdev->vma_flags); 201 } 202 203 static int intelfb_create(struct drm_fb_helper *helper, 204 struct drm_fb_helper_surface_size *sizes) 205 { 206 struct intel_fbdev *ifbdev = 207 container_of(helper, struct intel_fbdev, helper); 208 struct intel_framebuffer *intel_fb = ifbdev->fb; 209 struct drm_device *dev = helper->dev; 210 struct drm_i915_private *dev_priv = to_i915(dev); 211 struct pci_dev *pdev = to_pci_dev(dev_priv->drm.dev); 212 struct i915_ggtt *ggtt = &dev_priv->ggtt; 213 intel_wakeref_t wakeref; 214 struct fb_info *info; 215 bool prealloc = false; 216 void __iomem *vaddr; 217 struct drm_i915_gem_object *obj; 218 int ret; 219 220 if (intel_fb && 221 (sizes->fb_width > intel_fb->base.width || 222 sizes->fb_height > intel_fb->base.height)) { 223 drm_dbg_kms(&dev_priv->drm, 224 "BIOS fb too small (%dx%d), we require (%dx%d)," 225 " releasing it\n", 226 intel_fb->base.width, intel_fb->base.height, 227 sizes->fb_width, sizes->fb_height); 228 drm_framebuffer_put(&intel_fb->base); 229 intel_fb = ifbdev->fb = NULL; 230 } 231 if (!intel_fb || drm_WARN_ON(dev, !intel_fb_obj(&intel_fb->base))) { 232 drm_dbg_kms(&dev_priv->drm, 233 "no BIOS fb, allocating a new one\n"); 234 ret = intelfb_alloc(helper, sizes); 235 if (ret) 236 return ret; 237 intel_fb = ifbdev->fb; 238 } else { 239 drm_dbg_kms(&dev_priv->drm, "re-using BIOS fb\n"); 240 prealloc = true; 241 sizes->fb_width = intel_fb->base.width; 242 sizes->fb_height = intel_fb->base.height; 243 } 244 245 wakeref = intel_runtime_pm_get(&dev_priv->runtime_pm); 246 247 /* Pin the GGTT vma for our access via info->screen_base. 248 * This also validates that any existing fb inherited from the 249 * BIOS is suitable for own access. 250 */ > 251 ret = intel_fbdev_pin_and_fence(dev_priv, ifbdev, &vaddr); 252 if (ret) { 253 goto out_unlock; 254 } 255 256 info = drm_fb_helper_alloc_fbi(helper); 257 if (IS_ERR(info)) { 258 drm_err(&dev_priv->drm, "Failed to allocate fb_info\n"); 259 ret = PTR_ERR(info); 260 goto out_unpin; 261 } 262 263 ifbdev->helper.fb = &ifbdev->fb->base; 264 265 info->fbops = &intelfb_ops; 266 267 /* setup aperture base/size for vesafb takeover */ 268 obj = intel_fb_obj(&intel_fb->base); 269 if (i915_gem_object_is_lmem(obj)) { 270 struct intel_memory_region *mem = obj->mm.region; 271 272 info->apertures->ranges[0].base = mem->io_start; 273 info->apertures->ranges[0].size = mem->total; 274 275 /* Use fbdev's framebuffer from lmem for discrete */ 276 info->fix.smem_start = 277 (unsigned long)(mem->io_start + 278 i915_gem_object_get_dma_address(obj, 0)); 279 info->fix.smem_len = obj->base.size; 280 } else { 281 info->apertures->ranges[0].base = ggtt->gmadr.start; 282 info->apertures->ranges[0].size = ggtt->mappable_end; 283 284 /* Our framebuffer is the entirety of fbdev's system memory */ 285 info->fix.smem_start = 286 (unsigned long)(ggtt->gmadr.start + ifbdev->vma->node.start); 287 info->fix.smem_len = ifbdev->vma->node.size; 288 } 289 290 info->screen_base = vaddr; 291 info->screen_size = ifbdev->vma->node.size; 292 293 drm_fb_helper_fill_info(info, &ifbdev->helper, sizes); 294 295 /* If the object is shmemfs backed, it will have given us zeroed pages. 296 * If the object is stolen however, it will be full of whatever 297 * garbage was left in there. 298 */ 299 if (!i915_gem_object_is_shmem(ifbdev->vma->obj) && !prealloc) 300 memset_io(info->screen_base, 0, info->screen_size); 301 302 /* Use default scratch pixmap (info->pixmap.flags = FB_PIXMAP_SYSTEM) */ 303 304 drm_dbg_kms(&dev_priv->drm, "allocated %dx%d fb: 0x%08x\n", 305 ifbdev->fb->base.width, ifbdev->fb->base.height, 306 i915_ggtt_offset(ifbdev->vma)); 307 308 intel_runtime_pm_put(&dev_priv->runtime_pm, wakeref); 309 vga_switcheroo_client_fb_set(pdev, info); 310 return 0; 311 312 out_unpin: 313 intel_fbdev_unpin(ifbdev); 314 out_unlock: 315 intel_runtime_pm_put(&dev_priv->runtime_pm, wakeref); 316 return ret; 317 } 318 --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx
Attachment:
.config.gz
Description: application/gzip