Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/external/bsd/drm2/drm Draft sparc cache flushing.



details:   https://anonhg.NetBSD.org/src/rev/e29fc531cd94
branches:  trunk
changeset: 366420:e29fc531cd94
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Mon Aug 27 15:29:19 2018 +0000

description:
Draft sparc cache flushing.

diffstat:

 sys/external/bsd/drm2/drm/drm_cache.c |  63 +++++++++++++++++++++++++++++++++-
 1 files changed, 61 insertions(+), 2 deletions(-)

diffs (84 lines):

diff -r 622816bd44cb -r e29fc531cd94 sys/external/bsd/drm2/drm/drm_cache.c
--- a/sys/external/bsd/drm2/drm/drm_cache.c     Mon Aug 27 15:29:08 2018 +0000
+++ b/sys/external/bsd/drm2/drm/drm_cache.c     Mon Aug 27 15:29:19 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: drm_cache.c,v 1.11 2018/08/27 15:24:27 riastradh Exp $ */
+/*     $NetBSD: drm_cache.c,v 1.12 2018/08/27 15:29:19 riastradh Exp $ */
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: drm_cache.c,v 1.11 2018/08/27 15:24:27 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: drm_cache.c,v 1.12 2018/08/27 15:29:19 riastradh Exp $");
 
 #include <sys/param.h>
 #include <sys/types.h>
@@ -174,6 +174,65 @@
                asm volatile ("clflush %0" : : "m" (*(const char *)va));
 }
 
+#elif defined(__sparc__) || defined(__sparc64__)
+
+#ifdef __sparc64__
+#include <sparc64/sparc64/cache.h>
+#else
+#include <sparc/sparc/cache.h>
+#endif
+
+static bool
+drm_md_clflush_finegrained_p(void)
+{
+       return true;
+}
+
+static void
+drm_md_clflush_all(void)
+{
+       panic("don't know how to flush entire cache on sparc64");
+}
+
+static void
+drm_md_clflush_begin(void)
+{
+       membar_Sync();          /* unsure if needed */
+}
+
+static void
+drm_md_clflush_commit(void)
+{
+       membar_Sync();          /* unsure if needed */
+}
+
+static void
+drm_md_clflush_page(struct page *page)
+{
+#ifdef __sparc64__
+       paddr_t pa = VM_PAGE_TO_PHYS(&page->p_vmp);
+
+       cache_flush_phys(pa, PAGE_SIZE, 0);
+#else
+       void *const vaddr = kmap_atomic(page);
+
+       cache_flush(vaddr, PAGE_SIZE);
+
+       kunmap_atomic(vaddr);
+#endif
+}
+
+static void
+drm_md_clflush_virt_range(const void *ptr, size_t nbytes)
+{
+#ifdef __sparc64__
+       /* XXX Mega-kludge -- doesn't seem to be a way to flush by vaddr.  */
+       blast_dcache();
+#else
+       cache_flush(ptr, nbytes);
+#endif
+}
+
 #elif defined(__powerpc__)
 
 static bool



Home | Main Index | Thread Index | Old Index