Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/external/bsd/drm2/dist/drm/radeon Fix ordering of bus_dm...



details:   https://anonhg.NetBSD.org/src/rev/116e374bb9bc
branches:  trunk
changeset: 366212:116e374bb9bc
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Mon Aug 27 13:56:22 2018 +0000

description:
Fix ordering of bus_dmamap_sync.

The ordering is:

...
- driver writes to kernel pointer
- sync
- driver triggers device use of newly written data (*)
- sync
- driver writes to kernel pointer
- sync
...

The operation (*) is a DMA write.  Hence the syncs should be:

...
- driver writes to kernel pointer
- bus_dmamap_sync(BUS_DMASYNC_PREWRITE)
- driver triggers device use of newly written data
- bus_dmamap_sync(BUS_DMASYNC_POSTWRITE)
- bus_dmamap_sync(BUS_DMASYNC_PREWRITE)
- driver writes to kernel pointer
- bus_dmamap_sync(BUS_DMASYNC_POSTWRITE)
- bus_dmamap_sync(BUS_DMASYNC_PREWRITE)
...

diffstat:

 sys/external/bsd/drm2/dist/drm/radeon/radeon_gart.c |  8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diffs (36 lines):

diff -r 67dfaa180168 -r 116e374bb9bc sys/external/bsd/drm2/dist/drm/radeon/radeon_gart.c
--- a/sys/external/bsd/drm2/dist/drm/radeon/radeon_gart.c       Mon Aug 27 13:56:09 2018 +0000
+++ b/sys/external/bsd/drm2/dist/drm/radeon/radeon_gart.c       Mon Aug 27 13:56:22 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: radeon_gart.c,v 1.9 2018/08/27 13:56:09 riastradh Exp $        */
+/*     $NetBSD: radeon_gart.c,v 1.10 2018/08/27 13:56:22 riastradh Exp $       */
 
 /*
  * Copyright 2008 Advanced Micro Devices, Inc.
@@ -28,7 +28,7 @@
  *          Jerome Glisse
  */
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: radeon_gart.c,v 1.9 2018/08/27 13:56:09 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: radeon_gart.c,v 1.10 2018/08/27 13:56:22 riastradh Exp $");
 
 #include <drm/drmP.h>
 #include <drm/radeon_drm.h>
@@ -286,7 +286,7 @@
 
                bus_dmamap_sync(rdev->ddev->dmat, rdev->gart.rg_table_map,
                    gpu_pgstart*entsize, gpu_npages*entsize,
-                   BUS_DMASYNC_PREWRITE);
+                   BUS_DMASYNC_POSTWRITE);
        }
 }
 
@@ -301,7 +301,7 @@
 
                bus_dmamap_sync(rdev->ddev->dmat, rdev->gart.rg_table_map,
                    gpu_pgstart*entsize, gpu_npages*entsize,
-                   BUS_DMASYNC_POSTWRITE);
+                   BUS_DMASYNC_PREWRITE);
        }
        if (rdev->gart.ptr != NULL) {
                membar_sync();          /* XXX overkill */



Home | Main Index | Thread Index | Old Index