drm/linux: Increase coverage of the page protection APIs
authorFrançois Tigeot <ftigeot@wolfpond.org>
Sun, 16 Sep 2018 07:28:44 +0000 (09:28 +0200)
committerFrançois Tigeot <ftigeot@wolfpond.org>
Sun, 16 Sep 2018 07:28:44 +0000 (09:28 +0200)
sys/dev/drm/include/asm/pgtable.h
sys/dev/drm/include/asm/pgtable_types.h
sys/dev/drm/include/linux/highmem.h

index 3ef03f8..832e4a2 100644 (file)
@@ -31,4 +31,9 @@
 
 #include <asm/pgtable_types.h>
 
+static inline pgprot_t pgprot_noncached(pgprot_t prot)
+{
+       return (prot | _PAGE_CACHE_UC_MINUS);
+}
+
 #endif /* _ASM_PGTABLE_H_ */
index c804ef0..1f45169 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015-2016 François Tigeot
+ * Copyright (c) 2015-2018 François Tigeot <ftigeot@wolfpond.org>
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
 #define _PAGE_RW       X86_PG_RW
 #define _PAGE_PWT      X86_PG_NC_PWT
 #define _PAGE_PCD      X86_PG_NC_PCD
+#define _PAGE_ACCESSED X86_PG_A
+#define _PAGE_DIRTY    X86_PG_M
 #define _PAGE_PAT      X86_PG_PTE_PAT
+#define _PAGE_GLOBAL   X86_PG_G
+#define _PAGE_NX       X86_PG_NX
 
-#define PAGE_KERNEL 0  /* XXX: doesn't mean anything */
+#define _PAGE_CACHE_WC         _PAGE_PWT
+#define _PAGE_CACHE_UC_MINUS   _PAGE_PCD
+
+#define __PAGE_KERNEL_EXEC                                             \
+       (_PAGE_PRESENT | _PAGE_RW | _PAGE_DIRTY | _PAGE_ACCESSED | _PAGE_GLOBAL)
+#define __PAGE_KERNEL  (__PAGE_KERNEL_EXEC | _PAGE_NX)
+
+#define PAGE_KERNEL    __PAGE_KERNEL
+
+static inline pgprot_t
+pgprot_writecombine(pgprot_t prot)
+{
+       return (prot | _PAGE_CACHE_WC);
+}
 
 #endif /* _ASM_PGTABLE_TYPES_H_ */
index f87dca6..65af143 100644 (file)
@@ -58,6 +58,12 @@ static inline void *kmap_atomic(struct page *pg)
        return (void *)PHYS_TO_DMAP(VM_PAGE_TO_PHYS( (struct vm_page *)pg ));
 }
 
+static inline void *
+kmap_atomic_prot(struct page *pg, pgprot_t prot)
+{
+       return kmap_atomic(pg);
+}
+
 static inline void kunmap_atomic(void *vaddr)
 {
        /* Nothing to do on systems with a direct memory map */