Skip to content

Commit ed00eba

Browse files
tejasupjnikula
authored andcommitted
drm/i915/fbdev: lock the fbdev obj before vma pin
lock the fbdev obj before calling into i915_vma_pin_iomap(). This helps to solve below : <7>[ 93.563308] i915 0000:00:02.0: [drm:intelfb_create [i915]] no BIOS fb, allocating a new one <4>[ 93.581844] ------------[ cut here ]------------ <4>[ 93.581855] WARNING: CPU: 12 PID: 625 at drivers/gpu/drm/i915/gem/i915_gem_pages.c:424 i915_gem_object_pin_map+0x152/0x1c0 [i915] Fixes: f0b6b01 ("drm/i915: Add ww context to intel_dpt_pin, v2.") Cc: Chris Wilson <[email protected]> Cc: Matthew Auld <[email protected]> Cc: Maarten Lankhorst <[email protected]> Signed-off-by: Tejas Upadhyay <[email protected]> Signed-off-by: Radhakrishna Sripada <[email protected]> Reviewed-by: Andi Shyti <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected] (cherry picked from commit 561b31a) Signed-off-by: Jani Nikula <[email protected]>
1 parent 364ac78 commit ed00eba

File tree

1 file changed

+18
-6
lines changed

1 file changed

+18
-6
lines changed

drivers/gpu/drm/i915/display/intel_fbdev.c

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,7 @@ static int intelfb_create(struct drm_fb_helper *helper,
210210
bool prealloc = false;
211211
void __iomem *vaddr;
212212
struct drm_i915_gem_object *obj;
213+
struct i915_gem_ww_ctx ww;
213214
int ret;
214215

215216
mutex_lock(&ifbdev->hpd_lock);
@@ -283,13 +284,24 @@ static int intelfb_create(struct drm_fb_helper *helper,
283284
info->fix.smem_len = vma->size;
284285
}
285286

286-
vaddr = i915_vma_pin_iomap(vma);
287-
if (IS_ERR(vaddr)) {
288-
drm_err(&dev_priv->drm,
289-
"Failed to remap framebuffer into virtual memory (%pe)\n", vaddr);
290-
ret = PTR_ERR(vaddr);
291-
goto out_unpin;
287+
for_i915_gem_ww(&ww, ret, false) {
288+
ret = i915_gem_object_lock(vma->obj, &ww);
289+
290+
if (ret)
291+
continue;
292+
293+
vaddr = i915_vma_pin_iomap(vma);
294+
if (IS_ERR(vaddr)) {
295+
drm_err(&dev_priv->drm,
296+
"Failed to remap framebuffer into virtual memory (%pe)\n", vaddr);
297+
ret = PTR_ERR(vaddr);
298+
continue;
299+
}
292300
}
301+
302+
if (ret)
303+
goto out_unpin;
304+
293305
info->screen_base = vaddr;
294306
info->screen_size = vma->size;
295307

0 commit comments

Comments
 (0)