mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-23 23:08:42 +07:00
3ef7114982
A simple mutex used for guarding the flow of requests in and out of the timeline. In the short-term, it will be used only to guard the addition of requests into the timeline, taken on alloc and released on commit so that only one caller can construct a request into the timeline (important as the seqno and ring pointers must be serialised). This will be used by observers to ensure that the seqno/hwsp is stable. Later, when we have reduced retiring to only operate on a single timeline at a time, we can then use the mutex as the sole guard required for retiring. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20190301110547.14758-2-chris@chris-wilson.co.uk
32 lines
644 B
C
32 lines
644 B
C
/*
|
|
* SPDX-License-Identifier: MIT
|
|
*
|
|
* Copyright © 2017-2018 Intel Corporation
|
|
*/
|
|
|
|
#include "../i915_timeline.h"
|
|
|
|
#include "mock_timeline.h"
|
|
|
|
void mock_timeline_init(struct i915_timeline *timeline, u64 context)
|
|
{
|
|
timeline->i915 = NULL;
|
|
timeline->fence_context = context;
|
|
|
|
spin_lock_init(&timeline->lock);
|
|
mutex_init(&timeline->mutex);
|
|
|
|
INIT_ACTIVE_REQUEST(&timeline->barrier);
|
|
INIT_ACTIVE_REQUEST(&timeline->last_request);
|
|
INIT_LIST_HEAD(&timeline->requests);
|
|
|
|
i915_syncmap_init(&timeline->sync);
|
|
|
|
INIT_LIST_HEAD(&timeline->link);
|
|
}
|
|
|
|
void mock_timeline_fini(struct i915_timeline *timeline)
|
|
{
|
|
i915_syncmap_free(&timeline->sync);
|
|
}
|