mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net.git/
synced 2026-04-18 06:33:43 -04:00
drm/i915: Pin timeline map after first timeline pin, v4.
We're starting to require the reservation lock for pinning, so wait until we have that. Update the selftests to handle this correctly, and ensure pin is called in live_hwsp_rollover_user() and mock_hwsp_freelist(). Changes since v1: - Fix NULL + XX arithmatic, use casts. (kbuild) Changes since v2: - Clear entire cacheline when pinning. Changes since v3: - CACHELINE_BYTES -> TIMELINE_SEQNO_BYTES. (jekstrand) Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Reported-by: kernel test robot <lkp@intel.com> Reviewed-by: Thomas Hellström <thomas.hellstrom@linux.intel.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch> Link: https://patchwork.freedesktop.org/patch/msgid/20210323155059.628690-3-maarten.lankhorst@linux.intel.com
This commit is contained in:
committed by
Daniel Vetter
parent
12ca695d2c
commit
2c8ab3339e
@@ -32,9 +32,20 @@
|
||||
#include "mock_engine.h"
|
||||
#include "selftests/mock_request.h"
|
||||
|
||||
static void mock_timeline_pin(struct intel_timeline *tl)
|
||||
static int mock_timeline_pin(struct intel_timeline *tl)
|
||||
{
|
||||
int err;
|
||||
|
||||
if (WARN_ON(!i915_gem_object_trylock(tl->hwsp_ggtt->obj)))
|
||||
return -EBUSY;
|
||||
|
||||
err = intel_timeline_pin_map(tl);
|
||||
i915_gem_object_unlock(tl->hwsp_ggtt->obj);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
atomic_inc(&tl->pin_count);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void mock_timeline_unpin(struct intel_timeline *tl)
|
||||
@@ -152,6 +163,8 @@ static void mock_context_destroy(struct kref *ref)
|
||||
|
||||
static int mock_context_alloc(struct intel_context *ce)
|
||||
{
|
||||
int err;
|
||||
|
||||
ce->ring = mock_ring(ce->engine);
|
||||
if (!ce->ring)
|
||||
return -ENOMEM;
|
||||
@@ -162,7 +175,12 @@ static int mock_context_alloc(struct intel_context *ce)
|
||||
return PTR_ERR(ce->timeline);
|
||||
}
|
||||
|
||||
mock_timeline_pin(ce->timeline);
|
||||
err = mock_timeline_pin(ce->timeline);
|
||||
if (err) {
|
||||
intel_timeline_put(ce->timeline);
|
||||
ce->timeline = NULL;
|
||||
return err;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user