From c031b4b01e16c47ef801e99d3b7b9e8e03f4dc31 Mon Sep 17 00:00:00 2001 From: Andrew Turner Date: Sat, 13 May 2017 13:01:15 +0000 Subject: [PATCH] Add the VM_MEMATTR_WRITE_THROUGH memory type to arm64 and use it to support VM_MEMATTR_WRITE_COMBINING in the kernel. This fixes a bug where Xorg would use write back cached memory for its graphics buffers. This would produce artifacts on the screen as cachelines were written to memory. MFC after: 1 week Sponsored by: DARPA, AFRL --- sys/arm64/include/vm.h | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/sys/arm64/include/vm.h b/sys/arm64/include/vm.h index 182313ef5d5c..dac13980060e 100644 --- a/sys/arm64/include/vm.h +++ b/sys/arm64/include/vm.h @@ -30,9 +30,15 @@ #define _MACHINE_VM_H_ /* Memory attribute configuration. */ -#define VM_MEMATTR_DEVICE 0 -#define VM_MEMATTR_UNCACHEABLE 1 -#define VM_MEMATTR_WRITE_BACK 2 +#define VM_MEMATTR_DEVICE 0 +#define VM_MEMATTR_UNCACHEABLE 1 +#define VM_MEMATTR_WRITE_BACK 2 +#define VM_MEMATTR_WRITE_THROUGH 3 + +#ifdef _KERNEL +/* If defined vmstat will try to use both of these in a switch statement */ +#define VM_MEMATTR_WRITE_COMBINING VM_MEMATTR_WRITE_THROUGH +#endif #define VM_MEMATTR_DEFAULT VM_MEMATTR_WRITE_BACK