|
@@ -135,6 +135,38 @@ int amdgpu_fence_emit(struct amdgpu_ring *ring, void *owner,
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+/**
|
|
|
|
+ * amdgpu_fence_recreate - recreate a fence from an user fence
|
|
|
|
+ *
|
|
|
|
+ * @ring: ring the fence is associated with
|
|
|
|
+ * @owner: creator of the fence
|
|
|
|
+ * @seq: user fence sequence number
|
|
|
|
+ * @fence: resulting amdgpu fence object
|
|
|
|
+ *
|
|
|
|
+ * Recreates a fence command from the user fence sequence number (all asics).
|
|
|
|
+ * Returns 0 on success, -ENOMEM on failure.
|
|
|
|
+ */
|
|
|
|
+int amdgpu_fence_recreate(struct amdgpu_ring *ring, void *owner,
|
|
|
|
+ uint64_t seq, struct amdgpu_fence **fence)
|
|
|
|
+{
|
|
|
|
+ struct amdgpu_device *adev = ring->adev;
|
|
|
|
+
|
|
|
|
+ if (seq > ring->fence_drv.sync_seq[ring->idx])
|
|
|
|
+ return -EINVAL;
|
|
|
|
+
|
|
|
|
+ *fence = kmalloc(sizeof(struct amdgpu_fence), GFP_KERNEL);
|
|
|
|
+ if ((*fence) == NULL)
|
|
|
|
+ return -ENOMEM;
|
|
|
|
+
|
|
|
|
+ (*fence)->seq = seq;
|
|
|
|
+ (*fence)->ring = ring;
|
|
|
|
+ (*fence)->owner = owner;
|
|
|
|
+ fence_init(&(*fence)->base, &amdgpu_fence_ops,
|
|
|
|
+ &adev->fence_queue.lock, adev->fence_context + ring->idx,
|
|
|
|
+ (*fence)->seq);
|
|
|
|
+ return 0;
|
|
|
|
+}
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* amdgpu_fence_check_signaled - callback from fence_queue
|
|
* amdgpu_fence_check_signaled - callback from fence_queue
|
|
*
|
|
*
|
|
@@ -517,8 +549,9 @@ static bool amdgpu_fence_any_seq_signaled(struct amdgpu_device *adev, u64 *seq)
|
|
* the wait timeout, or an error for all other cases.
|
|
* the wait timeout, or an error for all other cases.
|
|
* -EDEADLK is returned when a GPU lockup has been detected.
|
|
* -EDEADLK is returned when a GPU lockup has been detected.
|
|
*/
|
|
*/
|
|
-long amdgpu_fence_wait_seq_timeout(struct amdgpu_device *adev, u64 *target_seq,
|
|
|
|
- bool intr, long timeout)
|
|
|
|
|
|
+static long amdgpu_fence_wait_seq_timeout(struct amdgpu_device *adev,
|
|
|
|
+ u64 *target_seq, bool intr,
|
|
|
|
+ long timeout)
|
|
{
|
|
{
|
|
uint64_t last_seq[AMDGPU_MAX_RINGS];
|
|
uint64_t last_seq[AMDGPU_MAX_RINGS];
|
|
bool signaled;
|
|
bool signaled;
|