Module Name:    src
Committed By:   riastradh
Date:           Sat Jul 30 16:55:00 UTC 2022

Modified Files:
        src/sys/external/bsd/drm2/dist/drm/amd/amdgpu: amdgpu_gart.c

Log Message:
amdgpu: Make sure dummy page is zero-filled.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 \
    src/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_gart.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_gart.c
diff -u src/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_gart.c:1.8 src/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_gart.c:1.9
--- src/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_gart.c:1.8	Fri Dec 24 11:19:55 2021
+++ src/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_gart.c	Sat Jul 30 16:55:00 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: amdgpu_gart.c,v 1.8 2021/12/24 11:19:55 riastradh Exp $	*/
+/*	$NetBSD: amdgpu_gart.c,v 1.9 2022/07/30 16:55:00 riastradh Exp $	*/
 
 /*
  * Copyright 2008 Advanced Micro Devices, Inc.
@@ -29,7 +29,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: amdgpu_gart.c,v 1.8 2021/12/24 11:19:55 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: amdgpu_gart.c,v 1.9 2022/07/30 16:55:00 riastradh Exp $");
 
 #include <linux/pci.h>
 #include <linux/vmalloc.h>
@@ -78,6 +78,7 @@ static int amdgpu_gart_dummy_page_init(s
 {
 #ifdef __NetBSD__
 	int rsegs;
+	void *p;
 	int error;
 
 	/* XXX Can this be called more than once??  */
@@ -89,6 +90,12 @@ static int amdgpu_gart_dummy_page_init(s
 	if (error)
 		goto fail0;
 	KASSERT(rsegs == 1);
+	error = bus_dmamem_map(adev->ddev->dmat, &adev->dummy_page_seg, 1,
+	    PAGE_SIZE, &p, BUS_DMA_WAITOK);
+	if (error)
+		goto fail1;
+	memset(p, 0, PAGE_SIZE);
+	bus_dmamem_unmap(adev->ddev->dmat, p, PAGE_SIZE);
 	error = bus_dmamap_create(adev->ddev->dmat, PAGE_SIZE, 1, PAGE_SIZE, 0,
 	    BUS_DMA_WAITOK, &adev->dummy_page_map);
 	if (error)

Reply via email to