lkml.org 
[lkml]   [2011]   [Nov]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 06/13] drm: add helper to clflush a virtual address range
    Date
    Useful when the page is already mapped to copy date in/out.

    Cc: dri-devel@lists.freedesktop.org
    Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.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 0e3bd5b..502771a 100644
    --- a/drivers/gpu/drm/drm_cache.c
    +++ b/drivers/gpu/drm/drm_cache.c
    @@ -97,3 +97,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 43538b6..a082640 100644
    --- a/include/drm/drmP.h
    +++ b/include/drm/drmP.h
    @@ -1328,6 +1328,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.6.4


    \
     
     \ /
      Last update: 2011-11-06 20:19    [W:0.039 / U:0.484 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site