mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-08 20:07:46 +09:00
drm/msm: Document and rename preempt_lock
[ Upstream commit77c406038e] Before adding another lock, give ring->lock a more descriptive name. Signed-off-by: Rob Clark <robdclark@chromium.org> Reviewed-by: Jordan Crouse <jcrouse@codeaurora.org> Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com> Signed-off-by: Rob Clark <robdclark@chromium.org> Stable-dep-of:b4fb748f0b("drm/msm/a5xx: fix the emptyness check in the preempt code") Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
00c2020b8b
commit
8dde1d9d6f
@@ -36,7 +36,7 @@ void a5xx_flush(struct msm_gpu *gpu, struct msm_ringbuffer *ring,
|
|||||||
OUT_RING(ring, upper_32_bits(shadowptr(a5xx_gpu, ring)));
|
OUT_RING(ring, upper_32_bits(shadowptr(a5xx_gpu, ring)));
|
||||||
}
|
}
|
||||||
|
|
||||||
spin_lock_irqsave(&ring->lock, flags);
|
spin_lock_irqsave(&ring->preempt_lock, flags);
|
||||||
|
|
||||||
/* Copy the shadow to the actual register */
|
/* Copy the shadow to the actual register */
|
||||||
ring->cur = ring->next;
|
ring->cur = ring->next;
|
||||||
@@ -44,7 +44,7 @@ void a5xx_flush(struct msm_gpu *gpu, struct msm_ringbuffer *ring,
|
|||||||
/* Make sure to wrap wptr if we need to */
|
/* Make sure to wrap wptr if we need to */
|
||||||
wptr = get_wptr(ring);
|
wptr = get_wptr(ring);
|
||||||
|
|
||||||
spin_unlock_irqrestore(&ring->lock, flags);
|
spin_unlock_irqrestore(&ring->preempt_lock, flags);
|
||||||
|
|
||||||
/* Make sure everything is posted before making a decision */
|
/* Make sure everything is posted before making a decision */
|
||||||
mb();
|
mb();
|
||||||
|
|||||||
@@ -45,9 +45,9 @@ static inline void update_wptr(struct msm_gpu *gpu, struct msm_ringbuffer *ring)
|
|||||||
if (!ring)
|
if (!ring)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
spin_lock_irqsave(&ring->lock, flags);
|
spin_lock_irqsave(&ring->preempt_lock, flags);
|
||||||
wptr = get_wptr(ring);
|
wptr = get_wptr(ring);
|
||||||
spin_unlock_irqrestore(&ring->lock, flags);
|
spin_unlock_irqrestore(&ring->preempt_lock, flags);
|
||||||
|
|
||||||
gpu_write(gpu, REG_A5XX_CP_RB_WPTR, wptr);
|
gpu_write(gpu, REG_A5XX_CP_RB_WPTR, wptr);
|
||||||
}
|
}
|
||||||
@@ -62,9 +62,9 @@ static struct msm_ringbuffer *get_next_ring(struct msm_gpu *gpu)
|
|||||||
bool empty;
|
bool empty;
|
||||||
struct msm_ringbuffer *ring = gpu->rb[i];
|
struct msm_ringbuffer *ring = gpu->rb[i];
|
||||||
|
|
||||||
spin_lock_irqsave(&ring->lock, flags);
|
spin_lock_irqsave(&ring->preempt_lock, flags);
|
||||||
empty = (get_wptr(ring) == ring->memptrs->rptr);
|
empty = (get_wptr(ring) == ring->memptrs->rptr);
|
||||||
spin_unlock_irqrestore(&ring->lock, flags);
|
spin_unlock_irqrestore(&ring->preempt_lock, flags);
|
||||||
|
|
||||||
if (!empty)
|
if (!empty)
|
||||||
return ring;
|
return ring;
|
||||||
@@ -132,9 +132,9 @@ void a5xx_preempt_trigger(struct msm_gpu *gpu)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Make sure the wptr doesn't update while we're in motion */
|
/* Make sure the wptr doesn't update while we're in motion */
|
||||||
spin_lock_irqsave(&ring->lock, flags);
|
spin_lock_irqsave(&ring->preempt_lock, flags);
|
||||||
a5xx_gpu->preempt[ring->id]->wptr = get_wptr(ring);
|
a5xx_gpu->preempt[ring->id]->wptr = get_wptr(ring);
|
||||||
spin_unlock_irqrestore(&ring->lock, flags);
|
spin_unlock_irqrestore(&ring->preempt_lock, flags);
|
||||||
|
|
||||||
/* Set the address of the incoming preemption record */
|
/* Set the address of the incoming preemption record */
|
||||||
gpu_write64(gpu, REG_A5XX_CP_CONTEXT_SWITCH_RESTORE_ADDR_LO,
|
gpu_write64(gpu, REG_A5XX_CP_CONTEXT_SWITCH_RESTORE_ADDR_LO,
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ static void a6xx_flush(struct msm_gpu *gpu, struct msm_ringbuffer *ring)
|
|||||||
OUT_RING(ring, upper_32_bits(shadowptr(a6xx_gpu, ring)));
|
OUT_RING(ring, upper_32_bits(shadowptr(a6xx_gpu, ring)));
|
||||||
}
|
}
|
||||||
|
|
||||||
spin_lock_irqsave(&ring->lock, flags);
|
spin_lock_irqsave(&ring->preempt_lock, flags);
|
||||||
|
|
||||||
/* Copy the shadow to the actual register */
|
/* Copy the shadow to the actual register */
|
||||||
ring->cur = ring->next;
|
ring->cur = ring->next;
|
||||||
@@ -73,7 +73,7 @@ static void a6xx_flush(struct msm_gpu *gpu, struct msm_ringbuffer *ring)
|
|||||||
/* Make sure to wrap wptr if we need to */
|
/* Make sure to wrap wptr if we need to */
|
||||||
wptr = get_wptr(ring);
|
wptr = get_wptr(ring);
|
||||||
|
|
||||||
spin_unlock_irqrestore(&ring->lock, flags);
|
spin_unlock_irqrestore(&ring->preempt_lock, flags);
|
||||||
|
|
||||||
/* Make sure everything is posted before making a decision */
|
/* Make sure everything is posted before making a decision */
|
||||||
mb();
|
mb();
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ struct msm_ringbuffer *msm_ringbuffer_new(struct msm_gpu *gpu, int id,
|
|||||||
ring->memptrs_iova = memptrs_iova;
|
ring->memptrs_iova = memptrs_iova;
|
||||||
|
|
||||||
INIT_LIST_HEAD(&ring->submits);
|
INIT_LIST_HEAD(&ring->submits);
|
||||||
spin_lock_init(&ring->lock);
|
spin_lock_init(&ring->preempt_lock);
|
||||||
|
|
||||||
snprintf(name, sizeof(name), "gpu-ring-%d", ring->id);
|
snprintf(name, sizeof(name), "gpu-ring-%d", ring->id);
|
||||||
|
|
||||||
|
|||||||
@@ -46,7 +46,12 @@ struct msm_ringbuffer {
|
|||||||
struct msm_rbmemptrs *memptrs;
|
struct msm_rbmemptrs *memptrs;
|
||||||
uint64_t memptrs_iova;
|
uint64_t memptrs_iova;
|
||||||
struct msm_fence_context *fctx;
|
struct msm_fence_context *fctx;
|
||||||
spinlock_t lock;
|
|
||||||
|
/*
|
||||||
|
* preempt_lock protects preemption and serializes wptr updates against
|
||||||
|
* preemption. Can be aquired from irq context.
|
||||||
|
*/
|
||||||
|
spinlock_t preempt_lock;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct msm_ringbuffer *msm_ringbuffer_new(struct msm_gpu *gpu, int id,
|
struct msm_ringbuffer *msm_ringbuffer_new(struct msm_gpu *gpu, int id,
|
||||||
|
|||||||
Reference in New Issue
Block a user