[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1322579369-26954-1-git-send-email-daniel.vetter@ffwll.ch>
Date: Tue, 29 Nov 2011 16:09:28 +0100
From: Daniel Vetter <daniel.vetter@...ll.ch>
To: intel-gfx@...ts.freedesktop.org
Cc: dri-devel@...ts.freedesktop.org, linux-kernel@...r.kernel.org,
Daniel Vetter <daniel.vetter@...ll.ch>, stable@...nel.org
Subject: [PATCH 1/2] drm: add helper to clflush a virtual address range
Useful when the page is already mapped to copy date in/out.
For -stable because the next patch (fixing phys obj pwrite) needs this
little helper function.
Cc: stable@...nel.org
Cc: dri-devel@...ts.freedesktop.org
Signed-off-by: Daniel Vetter <daniel.vetter@...ll.ch>
---
drivers/gpu/drm/drm_cache.c | 23 +++++++++++++++++++++++
include/drm/drmP.h | 1 +
2 files changed, 24 insertions(+), 0 deletions(-)
diff --git a/drivers/gpu/drm/drm_cache.c b/drivers/gpu/drm/drm_cache.c
index 5928653..c7c8f6b 100644
--- a/drivers/gpu/drm/drm_cache.c
+++ b/drivers/gpu/drm/drm_cache.c
@@ -98,3 +98,26 @@ drm_clflush_pages(struct page *pages[], unsigned long num_pages)
#endif
}
EXPORT_SYMBOL(drm_clflush_pages);
+
+void
+drm_clflush_virt_range(char *addr, unsigned long length)
+{
+#if defined(CONFIG_X86)
+ if (cpu_has_clflush) {
+ char *end = addr + length;
+ mb();
+ for (; addr < end; addr += boot_cpu_data.x86_clflush_size)
+ clflush(addr);
+ clflush(end - 1);
+ mb();
+ return;
+ }
+
+ if (on_each_cpu(drm_clflush_ipi_handler, NULL, 1) != 0)
+ printk(KERN_ERR "Timed out waiting for cache flush.\n");
+#else
+ printk(KERN_ERR "Architecture has no drm_cache.c support\n");
+ WARN_ON_ONCE(1);
+#endif
+}
+EXPORT_SYMBOL(drm_clflush_virt_range);
diff --git a/include/drm/drmP.h b/include/drm/drmP.h
index 1f9e951..ededdd0 100644
--- a/include/drm/drmP.h
+++ b/include/drm/drmP.h
@@ -1331,6 +1331,7 @@ extern int drm_authmagic(struct drm_device *dev, void *data,
/* Cache management (drm_cache.c) */
void drm_clflush_pages(struct page *pages[], unsigned long num_pages);
+void drm_clflush_virt_range(char *addr, unsigned long length);
/* Locking IOCTL support (drm_lock.h) */
extern int drm_lock(struct drm_device *dev, void *data,
--
1.7.7.3
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists