Source-Changes-HG archive

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

[src/netbsd-9]: src/sys Pull up following revision(s) (requested by jmcneill ...



details:   https://anonhg.NetBSD.org/src/rev/27f0b7ea2569
branches:  netbsd-9
changeset: 1001089:27f0b7ea2569
user:      martin <martin%NetBSD.org@localhost>
date:      Wed Nov 06 09:43:19 2019 +0000

description:
Pull up following revision(s) (requested by jmcneill in ticket #399):

        sys/arch/arm/arm32/bus_dma.c: revision 1.117
        sys/arch/arm/arm32/bus_dma.c: revision 1.118
        sys/external/bsd/drm2/drm/drm_gem_cma_helper.c: revision 1.8

bus_dmamem_map: honour BUS_DMA_PREFETCHABLE hint

Map buffer objects with BUS_DMA_PREFETCHABLE.

Do not try to use direct map for prefetchable mappings

diffstat:

 sys/arch/arm/arm32/bus_dma.c                   |  15 +++++++++++----
 sys/external/bsd/drm2/drm/drm_gem_cma_helper.c |   7 ++++---
 2 files changed, 15 insertions(+), 7 deletions(-)

diffs (79 lines):

diff -r 002a92442d47 -r 27f0b7ea2569 sys/arch/arm/arm32/bus_dma.c
--- a/sys/arch/arm/arm32/bus_dma.c      Mon Nov 04 14:49:31 2019 +0000
+++ b/sys/arch/arm/arm32/bus_dma.c      Wed Nov 06 09:43:19 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: bus_dma.c,v 1.115.2.1 2019/09/24 02:52:09 martin Exp $ */
+/*     $NetBSD: bus_dma.c,v 1.115.2.2 2019/11/06 09:43:19 martin Exp $ */
 
 /*-
  * Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
 #include "opt_cputypes.h"
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.115.2.1 2019/09/24 02:52:09 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.115.2.2 2019/11/06 09:43:19 martin Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -1339,7 +1339,7 @@
         * contiguous area then this area is already mapped.  Let's see if we
         * avoid having a separate mapping for it.
         */
-       if (nsegs == 1) {
+       if (nsegs == 1 && (flags & BUS_DMA_PREFETCHABLE) == 0) {
                /*
                 * If this is a non-COHERENT mapping, then the existing kernel
                 * mapping is already compatible with it.
@@ -1426,6 +1426,7 @@
                    pa < (segs[curseg].ds_addr + segs[curseg].ds_len);
                    pa += PAGE_SIZE, va += PAGE_SIZE, size -= PAGE_SIZE) {
                        bool uncached = (flags & BUS_DMA_COHERENT);
+                       bool prefetchable = (flags & BUS_DMA_PREFETCHABLE);
 #ifdef DEBUG_DMA
                        printf("wiring p%lx to v%lx", pa, va);
 #endif /* DEBUG_DMA */
@@ -1443,8 +1444,14 @@
                                uncached = false;
                        }
 
+                       u_int pmap_flags = PMAP_WIRED;
+                       if (prefetchable)
+                               pmap_flags |= PMAP_WRITE_COMBINE;
+                       else if (uncached)
+                               pmap_flags |= PMAP_NOCACHE;
+
                        pmap_kenter_pa(va, pa, VM_PROT_READ | VM_PROT_WRITE,
-                           PMAP_WIRED | (uncached ? PMAP_NOCACHE : 0));
+                           pmap_flags);
                }
        }
        pmap_update(pmap_kernel());
diff -r 002a92442d47 -r 27f0b7ea2569 sys/external/bsd/drm2/drm/drm_gem_cma_helper.c
--- a/sys/external/bsd/drm2/drm/drm_gem_cma_helper.c    Mon Nov 04 14:49:31 2019 +0000
+++ b/sys/external/bsd/drm2/drm/drm_gem_cma_helper.c    Wed Nov 06 09:43:19 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: drm_gem_cma_helper.c,v 1.7 2019/03/08 02:53:22 mrg Exp $ */
+/* $NetBSD: drm_gem_cma_helper.c,v 1.7.4.1 2019/11/06 09:43:20 martin Exp $ */
 
 /*-
  * Copyright (c) 2015-2017 Jared McNeill <jmcneill%invisible.ca@localhost>
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: drm_gem_cma_helper.c,v 1.7 2019/03/08 02:53:22 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: drm_gem_cma_helper.c,v 1.7.4.1 2019/11/06 09:43:20 martin Exp $");
 
 #include <drm/drmP.h>
 #include <drm/drm_gem_cma_helper.h>
@@ -55,7 +55,8 @@
        if (error)
                goto failed;
        error = bus_dmamem_map(obj->dmat, obj->dmasegs, nsegs,
-           obj->dmasize, &obj->vaddr, BUS_DMA_WAITOK | BUS_DMA_COHERENT);
+           obj->dmasize, &obj->vaddr,
+           BUS_DMA_WAITOK | BUS_DMA_PREFETCHABLE);
        if (error)
                goto free;
        error = bus_dmamap_create(obj->dmat, obj->dmasize, 1,



Home | Main Index | Thread Index | Old Index