mirror of
https://github.com/torvalds/linux.git
synced 2024-11-05 03:21:32 +00:00
drm/i915: Workaround erratum on i830 for TAIL pointer within last 2 cachelines
On i830 if the tail pointer is set to within 2 cachelines of the end of the buffer, the chip may hang. So instead if the tail were to land in that location, we pad the end of the buffer with NOPs, and start again at the beginning. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
parent
35c3047ad1
commit
55249baaa5
@ -785,6 +785,14 @@ int intel_init_ring_buffer(struct drm_device *dev,
|
|||||||
if (ret)
|
if (ret)
|
||||||
goto err_unmap;
|
goto err_unmap;
|
||||||
|
|
||||||
|
/* Workaround an erratum on the i830 which causes a hang if
|
||||||
|
* the TAIL pointer points to within the last 2 cachelines
|
||||||
|
* of the buffer.
|
||||||
|
*/
|
||||||
|
ring->effective_size = ring->size;
|
||||||
|
if (IS_I830(ring->dev))
|
||||||
|
ring->effective_size -= 128;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
err_unmap:
|
err_unmap:
|
||||||
@ -827,8 +835,7 @@ void intel_cleanup_ring_buffer(struct intel_ring_buffer *ring)
|
|||||||
static int intel_wrap_ring_buffer(struct intel_ring_buffer *ring)
|
static int intel_wrap_ring_buffer(struct intel_ring_buffer *ring)
|
||||||
{
|
{
|
||||||
unsigned int *virt;
|
unsigned int *virt;
|
||||||
int rem;
|
int rem = ring->size - ring->tail;
|
||||||
rem = ring->size - ring->tail;
|
|
||||||
|
|
||||||
if (ring->space < rem) {
|
if (ring->space < rem) {
|
||||||
int ret = intel_wait_ring_buffer(ring, rem);
|
int ret = intel_wait_ring_buffer(ring, rem);
|
||||||
@ -895,7 +902,7 @@ int intel_ring_begin(struct intel_ring_buffer *ring,
|
|||||||
int n = 4*num_dwords;
|
int n = 4*num_dwords;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if (unlikely(ring->tail + n > ring->size)) {
|
if (unlikely(ring->tail + n > ring->effective_size)) {
|
||||||
ret = intel_wrap_ring_buffer(ring);
|
ret = intel_wrap_ring_buffer(ring);
|
||||||
if (unlikely(ret))
|
if (unlikely(ret))
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -49,6 +49,7 @@ struct intel_ring_buffer {
|
|||||||
u32 tail;
|
u32 tail;
|
||||||
int space;
|
int space;
|
||||||
int size;
|
int size;
|
||||||
|
int effective_size;
|
||||||
struct intel_hw_status_page status_page;
|
struct intel_hw_status_page status_page;
|
||||||
|
|
||||||
u32 irq_seqno; /* last seq seem at irq time */
|
u32 irq_seqno; /* last seq seem at irq time */
|
||||||
|
Loading…
Reference in New Issue
Block a user