Sun Apr 19 19:12:38 2020 UTC ()
Add missing BUS_DMA_COHERENT hints


(jmcneill)
diff -r1.11 -r1.12 src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_nv50_display.c
diff -r1.3 -r1.4 src/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/mmu/nouveau_nvkm_subdev_mmu_nv44.c

cvs diff -r1.11 -r1.12 src/sys/external/bsd/drm2/dist/drm/nouveau/Attic/nouveau_nv50_display.c (expand / switch to unified diff)

--- src/sys/external/bsd/drm2/dist/drm/nouveau/Attic/nouveau_nv50_display.c 2020/02/14 14:34:58 1.11
+++ src/sys/external/bsd/drm2/dist/drm/nouveau/Attic/nouveau_nv50_display.c 2020/04/19 19:12:37 1.12
@@ -1,41 +1,41 @@ @@ -1,41 +1,41 @@
1/* $NetBSD: nouveau_nv50_display.c,v 1.11 2020/02/14 14:34:58 maya Exp $ */ 1/* $NetBSD: nouveau_nv50_display.c,v 1.12 2020/04/19 19:12:37 jmcneill Exp $ */
2 2
3/* 3/*
4 * Copyright 2011 Red Hat Inc. 4 * Copyright 2011 Red Hat Inc.
5 * 5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a 6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the "Software"), 7 * copy of this software and associated documentation files (the "Software"),
8 * to deal in the Software without restriction, including without limitation 8 * to deal in the Software without restriction, including without limitation
9 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 9 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 * and/or sell copies of the Software, and to permit persons to whom the 10 * and/or sell copies of the Software, and to permit persons to whom the
11 * Software is furnished to do so, subject to the following conditions: 11 * Software is furnished to do so, subject to the following conditions:
12 * 12 *
13 * The above copyright notice and this permission notice shall be included in 13 * The above copyright notice and this permission notice shall be included in
14 * all copies or substantial portions of the Software. 14 * all copies or substantial portions of the Software.
15 * 15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR 19 * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
20 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 20 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
21 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 21 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22 * OTHER DEALINGS IN THE SOFTWARE. 22 * OTHER DEALINGS IN THE SOFTWARE.
23 * 23 *
24 * Authors: Ben Skeggs 24 * Authors: Ben Skeggs
25 */ 25 */
26 26
27#include <sys/cdefs.h> 27#include <sys/cdefs.h>
28__KERNEL_RCSID(0, "$NetBSD: nouveau_nv50_display.c,v 1.11 2020/02/14 14:34:58 maya Exp $"); 28__KERNEL_RCSID(0, "$NetBSD: nouveau_nv50_display.c,v 1.12 2020/04/19 19:12:37 jmcneill Exp $");
29 29
30#include <linux/dma-mapping.h> 30#include <linux/dma-mapping.h>
31 31
32#include <drm/drmP.h> 32#include <drm/drmP.h>
33#include <drm/drm_crtc_helper.h> 33#include <drm/drm_crtc_helper.h>
34#include <drm/drm_plane_helper.h> 34#include <drm/drm_plane_helper.h>
35#include <drm/drm_dp_helper.h> 35#include <drm/drm_dp_helper.h>
36 36
37#include <nvif/class.h> 37#include <nvif/class.h>
38 38
39#include "nouveau_drm.h" 39#include "nouveau_drm.h"
40#include "nouveau_dma.h" 40#include "nouveau_dma.h"
41#include "nouveau_gem.h" 41#include "nouveau_gem.h"
@@ -287,27 +287,27 @@ nv50_dmac_create(struct nvif_device *dev @@ -287,27 +287,27 @@ nv50_dmac_create(struct nvif_device *dev
287 1, &rsegs, BUS_DMA_WAITOK); 287 1, &rsegs, BUS_DMA_WAITOK);
288 if (ret) 288 if (ret)
289 return ret; 289 return ret;
290 KASSERT(rsegs == 1); 290 KASSERT(rsegs == 1);
291 /* XXX errno NetBSD->Linux */ 291 /* XXX errno NetBSD->Linux */
292 ret = -bus_dmamap_create(dmat, PAGE_SIZE, 1, PAGE_SIZE, 0, 292 ret = -bus_dmamap_create(dmat, PAGE_SIZE, 1, PAGE_SIZE, 0,
293 BUS_DMA_WAITOK, &dmac->dmamap); 293 BUS_DMA_WAITOK, &dmac->dmamap);
294 if (ret) { 294 if (ret) {
295 bus_dmamem_free(dmat, &dmac->dmaseg, 1); 295 bus_dmamem_free(dmat, &dmac->dmaseg, 1);
296 return ret; 296 return ret;
297 } 297 }
298 /* XXX errno NetBSD->Linux */ 298 /* XXX errno NetBSD->Linux */
299 ret = -bus_dmamem_map(dmat, &dmac->dmaseg, 1, PAGE_SIZE, &dmac->dmakva, 299 ret = -bus_dmamem_map(dmat, &dmac->dmaseg, 1, PAGE_SIZE, &dmac->dmakva,
300 BUS_DMA_WAITOK); 300 BUS_DMA_WAITOK | BUS_DMA_COHERENT);
301 if (ret) { 301 if (ret) {
302 bus_dmamap_destroy(dmat, dmac->dmamap); 302 bus_dmamap_destroy(dmat, dmac->dmamap);
303 bus_dmamem_free(dmat, &dmac->dmaseg, 1); 303 bus_dmamem_free(dmat, &dmac->dmaseg, 1);
304 return ret; 304 return ret;
305 } 305 }
306 ret = -bus_dmamap_load(dmat, dmac->dmamap, dmac->dmakva, PAGE_SIZE, 306 ret = -bus_dmamap_load(dmat, dmac->dmamap, dmac->dmakva, PAGE_SIZE,
307 NULL, BUS_DMA_WAITOK); 307 NULL, BUS_DMA_WAITOK);
308 if (ret) { 308 if (ret) {
309 bus_dmamem_unmap(dmat, dmac->dmakva, PAGE_SIZE); 309 bus_dmamem_unmap(dmat, dmac->dmakva, PAGE_SIZE);
310 bus_dmamap_destroy(dmat, dmac->dmamap); 310 bus_dmamap_destroy(dmat, dmac->dmamap);
311 bus_dmamem_free(dmat, &dmac->dmaseg, 1); 311 bus_dmamem_free(dmat, &dmac->dmaseg, 1);
312 return ret; 312 return ret;
313 } 313 }

cvs diff -r1.3 -r1.4 src/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/mmu/nouveau_nvkm_subdev_mmu_nv44.c (expand / switch to unified diff)

--- src/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/mmu/nouveau_nvkm_subdev_mmu_nv44.c 2018/08/27 07:41:09 1.3
+++ src/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/mmu/nouveau_nvkm_subdev_mmu_nv44.c 2020/04/19 19:12:37 1.4
@@ -1,40 +1,40 @@ @@ -1,40 +1,40 @@
1/* $NetBSD: nouveau_nvkm_subdev_mmu_nv44.c,v 1.3 2018/08/27 07:41:09 riastradh Exp $ */ 1/* $NetBSD: nouveau_nvkm_subdev_mmu_nv44.c,v 1.4 2020/04/19 19:12:37 jmcneill Exp $ */
2 2
3/* 3/*
4 * Copyright 2012 Red Hat Inc. 4 * Copyright 2012 Red Hat Inc.
5 * 5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a 6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the "Software"), 7 * copy of this software and associated documentation files (the "Software"),
8 * to deal in the Software without restriction, including without limitation 8 * to deal in the Software without restriction, including without limitation
9 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 9 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 * and/or sell copies of the Software, and to permit persons to whom the 10 * and/or sell copies of the Software, and to permit persons to whom the
11 * Software is furnished to do so, subject to the following conditions: 11 * Software is furnished to do so, subject to the following conditions:
12 * 12 *
13 * The above copyright notice and this permission notice shall be included in 13 * The above copyright notice and this permission notice shall be included in
14 * all copies or substantial portions of the Software. 14 * all copies or substantial portions of the Software.
15 * 15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR 19 * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
20 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 20 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
21 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 21 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22 * OTHER DEALINGS IN THE SOFTWARE. 22 * OTHER DEALINGS IN THE SOFTWARE.
23 * 23 *
24 * Authors: Ben Skeggs 24 * Authors: Ben Skeggs
25 */ 25 */
26#include <sys/cdefs.h> 26#include <sys/cdefs.h>
27__KERNEL_RCSID(0, "$NetBSD: nouveau_nvkm_subdev_mmu_nv44.c,v 1.3 2018/08/27 07:41:09 riastradh Exp $"); 27__KERNEL_RCSID(0, "$NetBSD: nouveau_nvkm_subdev_mmu_nv44.c,v 1.4 2020/04/19 19:12:37 jmcneill Exp $");
28 28
29#include "nv04.h" 29#include "nv04.h"
30 30
31#include <core/gpuobj.h> 31#include <core/gpuobj.h>
32#include <core/option.h> 32#include <core/option.h>
33#include <subdev/timer.h> 33#include <subdev/timer.h>
34 34
35#define NV44_GART_SIZE (512 * 1024 * 1024) 35#define NV44_GART_SIZE (512 * 1024 * 1024)
36#define NV44_GART_PAGE ( 4 * 1024) 36#define NV44_GART_PAGE ( 4 * 1024)
37 37
38/******************************************************************************* 38/*******************************************************************************
39 * VM map/unmap callbacks 39 * VM map/unmap callbacks
40 ******************************************************************************/ 40 ******************************************************************************/
@@ -183,27 +183,27 @@ nv44_mmu_oneinit(struct nvkm_mmu *base) @@ -183,27 +183,27 @@ nv44_mmu_oneinit(struct nvkm_mmu *base)
183fail0: break; 183fail0: break;
184 KASSERT(nsegs == 1); 184 KASSERT(nsegs == 1);
185 185
186 /* XXX errno NetBSD->Linux */ 186 /* XXX errno NetBSD->Linux */
187 ret = -bus_dmamap_create(dmat, nullsz /* size */, 1 /* maxnseg */, 187 ret = -bus_dmamap_create(dmat, nullsz /* size */, 1 /* maxnseg */,
188 nullsz /* maxsegsz */, 0, BUS_DMA_WAITOK, &mmu->nullmap); 188 nullsz /* maxsegsz */, 0, BUS_DMA_WAITOK, &mmu->nullmap);
189 if (ret) { 189 if (ret) {
190fail1: bus_dmamem_free(dmat, &mmu->nullseg, 1); 190fail1: bus_dmamem_free(dmat, &mmu->nullseg, 1);
191 goto fail0; 191 goto fail0;
192 } 192 }
193 193
194 /* XXX errno NetBSD->Linux */ 194 /* XXX errno NetBSD->Linux */
195 ret = -bus_dmamem_map(dmat, &mmu->nullseg, 1, nullsz, 195 ret = -bus_dmamem_map(dmat, &mmu->nullseg, 1, nullsz,
196 &mmu->nullp, BUS_DMA_WAITOK); 196 &mmu->nullp, BUS_DMA_WAITOK | BUS_DMA_COHERENT);
197 if (ret) { 197 if (ret) {
198fail2: bus_dmamap_destroy(dmat, mmu->nullmap); 198fail2: bus_dmamap_destroy(dmat, mmu->nullmap);
199 goto fail1; 199 goto fail1;
200 } 200 }
201 201
202 /* XXX errno NetBSD->Linux */ 202 /* XXX errno NetBSD->Linux */
203 ret = -bus_dmamap_load(dmat, mmu->nullmap, mmu->nullp, nullsz, 203 ret = -bus_dmamap_load(dmat, mmu->nullmap, mmu->nullp, nullsz,
204 NULL, BUS_DMA_WAITOK); 204 NULL, BUS_DMA_WAITOK);
205 if (ret) { 205 if (ret) {
206fail3: __unused bus_dmamem_unmap(dmat, mmu->nullp, nullsz); 206fail3: __unused bus_dmamem_unmap(dmat, mmu->nullp, nullsz);
207 goto fail2; 207 goto fail2;
208 } 208 }
209 mmu->null = mmu->nullmap->dm_segs[0].ds_addr; 209 mmu->null = mmu->nullmap->dm_segs[0].ds_addr;