Merge branches 'pnp', 'pm-cpuidle' and 'pm-cpufreq'
[firefly-linux-kernel-4.4.55.git] / drivers / gpu / drm / drm_cache.c
index a6b690626a6b0563e026e9217859cc2505aadb76..9a62d7a53553d3a54f45d0ef0cbc1291de84fc08 100644 (file)
@@ -32,6 +32,7 @@
 #include <drm/drmP.h>
 
 #if defined(CONFIG_X86)
+#include <asm/smp.h>
 
 /*
  * clflushopt is an unordered instruction which needs fencing with mfence or
@@ -64,12 +65,6 @@ static void drm_cache_flush_clflush(struct page *pages[],
                drm_clflush_page(*pages++);
        mb();
 }
-
-static void
-drm_clflush_ipi_handler(void *null)
-{
-       wbinvd();
-}
 #endif
 
 void
@@ -82,7 +77,7 @@ drm_clflush_pages(struct page *pages[], unsigned long num_pages)
                return;
        }
 
-       if (on_each_cpu(drm_clflush_ipi_handler, NULL, 1) != 0)
+       if (wbinvd_on_all_cpus())
                printk(KERN_ERR "Timed out waiting for cache flush.\n");
 
 #elif defined(__powerpc__)
@@ -121,7 +116,7 @@ drm_clflush_sg(struct sg_table *st)
                return;
        }
 
-       if (on_each_cpu(drm_clflush_ipi_handler, NULL, 1) != 0)
+       if (wbinvd_on_all_cpus())
                printk(KERN_ERR "Timed out waiting for cache flush.\n");
 #else
        printk(KERN_ERR "Architecture has no drm_cache.c support\n");
@@ -144,7 +139,7 @@ drm_clflush_virt_range(void *addr, unsigned long length)
                return;
        }
 
-       if (on_each_cpu(drm_clflush_ipi_handler, NULL, 1) != 0)
+       if (wbinvd_on_all_cpus())
                printk(KERN_ERR "Timed out waiting for cache flush.\n");
 #else
        printk(KERN_ERR "Architecture has no drm_cache.c support\n");