summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/gpu/drm/drm_cache.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/gpu/drm/drm_cache.c b/drivers/gpu/drm/drm_cache.c
index 9a62d7a53553..6743ff7dccfa 100644
--- a/drivers/gpu/drm/drm_cache.c
+++ b/drivers/gpu/drm/drm_cache.c
@@ -130,11 +130,12 @@ drm_clflush_virt_range(void *addr, unsigned long length)
{
#if defined(CONFIG_X86)
if (cpu_has_clflush) {
+ const int size = boot_cpu_data.x86_clflush_size;
void *end = addr + length;
+ addr = (void *)(((unsigned long)addr) & -size);
mb();
- for (; addr < end; addr += boot_cpu_data.x86_clflush_size)
+ for (; addr < end; addr += size)
clflushopt(addr);
- clflushopt(end - 1);
mb();
return;
}