summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/msm/msm_rd.c
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2017-11-02 12:40:41 +1000
committerDave Airlie <airlied@redhat.com>2017-11-02 12:40:41 +1000
commit7a88cbd8d65d622c00bd76ba4ae1d893b292c91c (patch)
tree826df7ac42ca13c33828d0142046186b91df686b /drivers/gpu/drm/msm/msm_rd.c
parent0a4334c9e5405f836c46375c6e279cfdda7da6b5 (diff)
parent0b07194bb55ed836c2cc7c22e866b87a14681984 (diff)
downloadlinux-7a88cbd8d65d622c00bd76ba4ae1d893b292c91c.tar.bz2
Backmerge tag 'v4.14-rc7' into drm-next
Linux 4.14-rc7 Requested by Ben Skeggs for nouveau to avoid major conflicts, and things were getting a bit conflicty already, esp around amdgpu reverts.
Diffstat (limited to 'drivers/gpu/drm/msm/msm_rd.c')
-rw-r--r--drivers/gpu/drm/msm/msm_rd.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/drivers/gpu/drm/msm/msm_rd.c b/drivers/gpu/drm/msm/msm_rd.c
index 96d678b582d9..3aa8a8576abe 100644
--- a/drivers/gpu/drm/msm/msm_rd.c
+++ b/drivers/gpu/drm/msm/msm_rd.c
@@ -117,10 +117,14 @@ static void rd_write(struct msm_rd_state *rd, const void *buf, int sz)
wait_event(rd->fifo_event, circ_space(&rd->fifo) > 0);
+ /* Note that smp_load_acquire() is not strictly required
+ * as CIRC_SPACE_TO_END() does not access the tail more
+ * than once.
+ */
n = min(sz, circ_space_to_end(&rd->fifo));
memcpy(fptr, ptr, n);
- fifo->head = (fifo->head + n) & (BUF_SZ - 1);
+ smp_store_release(&fifo->head, (fifo->head + n) & (BUF_SZ - 1));
sz -= n;
ptr += n;
@@ -151,13 +155,17 @@ static ssize_t rd_read(struct file *file, char __user *buf,
if (ret)
goto out;
+ /* Note that smp_load_acquire() is not strictly required
+ * as CIRC_CNT_TO_END() does not access the head more than
+ * once.
+ */
n = min_t(int, sz, circ_count_to_end(&rd->fifo));
if (copy_to_user(buf, fptr, n)) {
ret = -EFAULT;
goto out;
}
- fifo->tail = (fifo->tail + n) & (BUF_SZ - 1);
+ smp_store_release(&fifo->tail, (fifo->tail + n) & (BUF_SZ - 1));
*ppos += n;
wake_up_all(&rd->fifo_event);