mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-07-23 23:32:14 +00:00
drm/ttm: consolidate cache flushing code in one place.
This merges the TTM and drm cache flushing into one file in the drm core. Signed-off-by: Dave Airlie <airlied@redhat.com>
This commit is contained in:
parent
50f153036c
commit
c9c97b8c75
3 changed files with 82 additions and 74 deletions
|
@ -45,25 +45,58 @@ drm_clflush_page(struct page *page)
|
|||
clflush(page_virtual + i);
|
||||
kunmap_atomic(page_virtual, KM_USER0);
|
||||
}
|
||||
#endif
|
||||
|
||||
static void drm_cache_flush_clflush(struct page *pages[],
|
||||
unsigned long num_pages)
|
||||
{
|
||||
unsigned long i;
|
||||
|
||||
mb();
|
||||
for (i = 0; i < num_pages; i++)
|
||||
drm_clflush_page(*pages++);
|
||||
mb();
|
||||
}
|
||||
|
||||
static void
|
||||
drm_clflush_ipi_handler(void *null)
|
||||
{
|
||||
wbinvd();
|
||||
}
|
||||
#elif !defined(__powerpc__)
|
||||
static void drm_cache_ipi_handler(void *dummy)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
void
|
||||
drm_clflush_pages(struct page *pages[], unsigned long num_pages)
|
||||
{
|
||||
|
||||
#if defined(CONFIG_X86)
|
||||
if (cpu_has_clflush) {
|
||||
unsigned long i;
|
||||
|
||||
mb();
|
||||
for (i = 0; i < num_pages; ++i)
|
||||
drm_clflush_page(*pages++);
|
||||
mb();
|
||||
|
||||
drm_cache_flush_clflush(pages, num_pages);
|
||||
return;
|
||||
}
|
||||
|
||||
wbinvd();
|
||||
if (on_each_cpu(drm_clflush_ipi_handler, NULL, 1) != 0)
|
||||
printk(KERN_ERR "Timed out waiting for cache flush.\n");
|
||||
|
||||
#elif defined(__powerpc__)
|
||||
unsigned long i;
|
||||
for (i = 0; i < num_pages; i++) {
|
||||
struct page *page = pages[i];
|
||||
void *page_virtual;
|
||||
|
||||
if (unlikely(page == NULL))
|
||||
continue;
|
||||
|
||||
page_virtual = kmap_atomic(page, KM_USER0);
|
||||
flush_dcache_range((unsigned long)page_virtual,
|
||||
(unsigned long)page_virtual + PAGE_SIZE);
|
||||
kunmap_atomic(page_virtual, KM_USER0);
|
||||
}
|
||||
#else
|
||||
if (on_each_cpu(drm_clflush_ipi_handler, NULL, 1) != 0)
|
||||
printk(KERN_ERR "Timed out waiting for drm cache flush\n");
|
||||
#endif
|
||||
}
|
||||
EXPORT_SYMBOL(drm_clflush_pages);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue