drm/i915: Remove num_pages parameter to i915_error_object_create()
For cleanliness, i915_error_object_create() was written to handle the NULL pointer in a central location. The macro that wrapped it and passed it a num_pages to use, was not safe. As we now never limit the num_pages to use (we did so at one point to only capture the first page of the context), we can remove the redundant macro and be NULL safe again. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Cc: Jesse Barnes <jbarnes@virtuousgeek.org> Cc: John Harrison <John.C.Harrison@Intel.com> Reviewed-by: Mika Kuoppala <mika.kuoppala@intel.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
This commit is contained in:
committed by
Daniel Vetter
parent
b3c3f5e69e
commit
8ae62dc62b
@@ -558,12 +558,12 @@ static void i915_error_state_free(struct kref *error_ref)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static struct drm_i915_error_object *
|
static struct drm_i915_error_object *
|
||||||
i915_error_object_create_sized(struct drm_i915_private *dev_priv,
|
i915_error_object_create(struct drm_i915_private *dev_priv,
|
||||||
struct drm_i915_gem_object *src,
|
struct drm_i915_gem_object *src,
|
||||||
struct i915_address_space *vm,
|
struct i915_address_space *vm)
|
||||||
int num_pages)
|
|
||||||
{
|
{
|
||||||
struct drm_i915_error_object *dst;
|
struct drm_i915_error_object *dst;
|
||||||
|
int num_pages;
|
||||||
bool use_ggtt;
|
bool use_ggtt;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
u32 reloc_offset;
|
u32 reloc_offset;
|
||||||
@@ -571,6 +571,8 @@ i915_error_object_create_sized(struct drm_i915_private *dev_priv,
|
|||||||
if (src == NULL || src->pages == NULL)
|
if (src == NULL || src->pages == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
num_pages = src->base.size >> PAGE_SHIFT;
|
||||||
|
|
||||||
dst = kmalloc(sizeof(*dst) + num_pages * sizeof(u32 *), GFP_ATOMIC);
|
dst = kmalloc(sizeof(*dst) + num_pages * sizeof(u32 *), GFP_ATOMIC);
|
||||||
if (dst == NULL)
|
if (dst == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
@@ -649,13 +651,8 @@ unwind:
|
|||||||
kfree(dst);
|
kfree(dst);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
#define i915_error_object_create(dev_priv, src, vm) \
|
|
||||||
i915_error_object_create_sized((dev_priv), (src), (vm), \
|
|
||||||
(src)->base.size>>PAGE_SHIFT)
|
|
||||||
|
|
||||||
#define i915_error_ggtt_object_create(dev_priv, src) \
|
#define i915_error_ggtt_object_create(dev_priv, src) \
|
||||||
i915_error_object_create_sized((dev_priv), (src), &(dev_priv)->gtt.base, \
|
i915_error_object_create((dev_priv), (src), &(dev_priv)->gtt.base)
|
||||||
(src)->base.size>>PAGE_SHIFT)
|
|
||||||
|
|
||||||
static void capture_bo(struct drm_i915_error_buffer *err,
|
static void capture_bo(struct drm_i915_error_buffer *err,
|
||||||
struct i915_vma *vma)
|
struct i915_vma *vma)
|
||||||
@@ -1004,8 +1001,7 @@ static void i915_gem_record_rings(struct drm_device *dev,
|
|||||||
request->batch_obj,
|
request->batch_obj,
|
||||||
vm);
|
vm);
|
||||||
|
|
||||||
if (HAS_BROKEN_CS_TLB(dev_priv->dev) &&
|
if (HAS_BROKEN_CS_TLB(dev_priv->dev))
|
||||||
ring->scratch.obj)
|
|
||||||
error->ring[i].wa_batchbuffer =
|
error->ring[i].wa_batchbuffer =
|
||||||
i915_error_ggtt_object_create(dev_priv,
|
i915_error_ggtt_object_create(dev_priv,
|
||||||
ring->scratch.obj);
|
ring->scratch.obj);
|
||||||
@@ -1027,9 +1023,8 @@ static void i915_gem_record_rings(struct drm_device *dev,
|
|||||||
error->ring[i].ringbuffer =
|
error->ring[i].ringbuffer =
|
||||||
i915_error_ggtt_object_create(dev_priv, ring->buffer->obj);
|
i915_error_ggtt_object_create(dev_priv, ring->buffer->obj);
|
||||||
|
|
||||||
if (ring->status_page.obj)
|
error->ring[i].hws_page =
|
||||||
error->ring[i].hws_page =
|
i915_error_ggtt_object_create(dev_priv, ring->status_page.obj);
|
||||||
i915_error_ggtt_object_create(dev_priv, ring->status_page.obj);
|
|
||||||
|
|
||||||
i915_gem_record_active_context(ring, error, &error->ring[i]);
|
i915_gem_record_active_context(ring, error, &error->ring[i]);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user