Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

drm/i915: Don't try to tear down the stolen drm_mm if it's not there

Every other place properly checks whether we've managed to set
up the stolen allocator at boot-up properly, with the exception
of the cleanup code. Which results in an ugly

*ERROR* Memory manager not clean. Delaying takedown

at module unload time since the drm_mm isn't initialized at all.

v2: While at it check whether the stolen drm_mm is initialized instead
of the more obscure stolen_base == 0 check.

v3: Fix up the logic. Also we need to keep the stolen_base check in
i915_gem_object_create_stolen_for_preallocated since that can be
called before stolen memory is fully set up. Spotted by Chris Wilson.

v4: Readd the conversion in i915_gem_object_create_stolen_for_preallocated,
the check is for the dev_priv->mm.gtt_space drm_mm, the stolen
allocatot must already be initialized when calling that function (if
we indeed have stolen memory).

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=65953
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Tested-by: lu hua <huax.lu@intel.com> (v3)
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>

+6 -3
+6 -3
drivers/gpu/drm/i915/i915_gem_stolen.c
··· 147 147 { 148 148 struct drm_i915_private *dev_priv = dev->dev_private; 149 149 150 - if (dev_priv->mm.stolen_base == 0) 150 + if (!drm_mm_initialized(&dev_priv->mm.stolen)) 151 151 return -ENODEV; 152 152 153 153 if (size < dev_priv->cfb_size) ··· 178 178 void i915_gem_cleanup_stolen(struct drm_device *dev) 179 179 { 180 180 struct drm_i915_private *dev_priv = dev->dev_private; 181 + 182 + if (!drm_mm_initialized(&dev_priv->mm.stolen)) 183 + return; 181 184 182 185 i915_gem_stolen_cleanup_compression(dev); 183 186 drm_mm_takedown(&dev_priv->mm.stolen); ··· 303 300 struct drm_i915_gem_object *obj; 304 301 struct drm_mm_node *stolen; 305 302 306 - if (dev_priv->mm.stolen_base == 0) 303 + if (!drm_mm_initialized(&dev_priv->mm.stolen)) 307 304 return NULL; 308 305 309 306 DRM_DEBUG_KMS("creating stolen object: size=%x\n", size); ··· 334 331 struct drm_i915_gem_object *obj; 335 332 struct drm_mm_node *stolen; 336 333 337 - if (dev_priv->mm.stolen_base == 0) 334 + if (!drm_mm_initialized(&dev_priv->mm.stolen)) 338 335 return NULL; 339 336 340 337 DRM_DEBUG_KMS("creating preallocated stolen object: stolen_offset=%x, gtt_offset=%x, size=%x\n",