Module Name:    src
Committed By:   jmcneill
Date:           Sun Jan 19 12:03:27 UTC 2020

Modified Files:
        src/sys/external/bsd/drm2/dist/include/drm: drm_cache.h
        src/sys/external/bsd/drm2/include/drm: drm_os_netbsd.h

Log Message:
Disable the use of WC memory on Arm and Arm64. From Linux:

 * The DRM driver stack is designed to work with cache coherent devices
 * only, but permits an optimization to be enabled in some cases, where
 * for some buffers, both the CPU and the GPU use uncached mappings,
 * removing the need for DMA snooping and allocation in the CPU caches.
 *
 * The use of uncached GPU mappings relies on the correct implementation
 * of the PCIe NoSnoop TLP attribute by the platform, otherwise the GPU
 * will use cached mappings nonetheless. On x86 platforms, this does not
 * seem to matter, as uncached CPU mappings will snoop the caches in any
 * case. However, on ARM and arm64, enabling this optimization on a
 * platform where NoSnoop is ignored results in loss of coherency, which
 * breaks correct operation of the device. Since we have no way of
 * detecting whether NoSnoop works or not, just disable this
 * optimization entirely for ARM and arm64.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 \
    src/sys/external/bsd/drm2/dist/include/drm/drm_cache.h
cvs rdiff -u -r1.15 -r1.16 \
    src/sys/external/bsd/drm2/include/drm/drm_os_netbsd.h

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/include/drm/drm_cache.h
diff -u src/sys/external/bsd/drm2/dist/include/drm/drm_cache.h:1.2 src/sys/external/bsd/drm2/dist/include/drm/drm_cache.h:1.3
--- src/sys/external/bsd/drm2/dist/include/drm/drm_cache.h:1.2	Mon Aug 27 04:58:37 2018
+++ src/sys/external/bsd/drm2/dist/include/drm/drm_cache.h	Sun Jan 19 12:03:27 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: drm_cache.h,v 1.2 2018/08/27 04:58:37 riastradh Exp $	*/
+/*	$NetBSD: drm_cache.h,v 1.3 2020/01/19 12:03:27 jmcneill Exp $	*/
 
 /**************************************************************************
  *
@@ -43,6 +43,8 @@ static inline bool drm_arch_can_wc_memor
 	return false;
 #elif defined(CONFIG_MIPS) && defined(CONFIG_CPU_LOONGSON3)
 	return false;
+#elif defined(CONFIG_ARM) || defined(CONFIG_ARM64)
+	return false;
 #else
 	return true;
 #endif

Index: src/sys/external/bsd/drm2/include/drm/drm_os_netbsd.h
diff -u src/sys/external/bsd/drm2/include/drm/drm_os_netbsd.h:1.15 src/sys/external/bsd/drm2/include/drm/drm_os_netbsd.h:1.16
--- src/sys/external/bsd/drm2/include/drm/drm_os_netbsd.h:1.15	Tue Nov  5 23:29:28 2019
+++ src/sys/external/bsd/drm2/include/drm/drm_os_netbsd.h	Sun Jan 19 12:03:27 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: drm_os_netbsd.h,v 1.15 2019/11/05 23:29:28 jmcneill Exp $	*/
+/*	$NetBSD: drm_os_netbsd.h,v 1.16 2020/01/19 12:03:27 jmcneill Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -41,6 +41,14 @@
 #define	CONFIG_X86_PAT	1
 #endif
 
+#if defined(__arm__)
+#define CONFIG_ARM	1
+#endif
+
+#if defined(__aarch64__)
+#define CONFIG_ARM64	1
+#endif
+
 /*
  * Nothing meaningfully depends on this; defining this avoids patching
  * away some conditionalization in drmP.h.

Reply via email to