diff options
-rw-r--r-- | drivers/gpu/drm/nouveau/core/os.h | 20 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/nouveau_bo.c | 8 |
2 files changed, 26 insertions, 2 deletions
diff --git a/drivers/gpu/drm/nouveau/core/os.h b/drivers/gpu/drm/nouveau/core/os.h index d0ced94ca54c..fc84a258f910 100644 --- a/drivers/gpu/drm/nouveau/core/os.h +++ b/drivers/gpu/drm/nouveau/core/os.h @@ -21,6 +21,7 @@ #include <linux/interrupt.h> #include <linux/log2.h> #include <linux/pm_runtime.h> +#include <asm/cacheflush.h> #include <asm/unaligned.h> @@ -38,4 +39,23 @@ #endif /* def __BIG_ENDIAN else */ #endif /* !ioread32_native */ +#if defined(__arm__) + +static inline void +nv_cpu_cache_flush_area(void *va, size_t size) +{ + phys_addr_t pa = virt_to_phys(va); + __cpuc_flush_dcache_area(va, size); + outer_flush_range(pa, pa + size); +} + +#else + +static inline void +nv_cpu_cache_flush_area(void *va, size_t size) +{ +} + +#endif /* defined(__arm__) */ + #endif diff --git a/drivers/gpu/drm/nouveau/nouveau_bo.c b/drivers/gpu/drm/nouveau/nouveau_bo.c index 1464c1cb2c7a..28e3daef0a5a 100644 --- a/drivers/gpu/drm/nouveau/nouveau_bo.c +++ b/drivers/gpu/drm/nouveau/nouveau_bo.c @@ -437,8 +437,10 @@ nouveau_bo_wr16(struct nouveau_bo *nvbo, unsigned index, u16 val) mem = &mem[index]; if (is_iomem) iowrite16_native(val, (void __force __iomem *)mem); - else + else { *mem = val; + nv_cpu_cache_flush_area(mem, 2); + } } u32 @@ -461,8 +463,10 @@ nouveau_bo_wr32(struct nouveau_bo *nvbo, unsigned index, u32 val) mem = &mem[index]; if (is_iomem) iowrite32_native(val, (void __force __iomem *)mem); - else + else { *mem = val; + nv_cpu_cache_flush_area(mem, 4); + } } static struct ttm_tt * |