Commit 89754df8 authored by Michael Cheng's avatar Michael Cheng Committed by Matt Roper

drm/i915/: Re-work clflush_write32

Use drm_clflush_virt_range instead of clflushopt and remove the memory
barrier, since drm_clflush_virt_range takes care of that.

v2(Michael Cheng): Use sizeof(*addr) instead of sizeof(addr) to get the
		   actual size of the page. Thanks to Matt Roper for
		   pointing this out.
Signed-off-by: default avatarMichael Cheng <michael.cheng@intel.com>
Reviewed-by: default avatarMatt Roper <matthew.d.roper@intel.com>
Signed-off-by: default avatarMatt Roper <matthew.d.roper@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20220321223819.72833-5-michael.cheng@intel.com
parent 92b0cba4
...@@ -1322,10 +1322,8 @@ static void *reloc_vaddr(struct i915_vma *vma, ...@@ -1322,10 +1322,8 @@ static void *reloc_vaddr(struct i915_vma *vma,
static void clflush_write32(u32 *addr, u32 value, unsigned int flushes) static void clflush_write32(u32 *addr, u32 value, unsigned int flushes)
{ {
if (unlikely(flushes & (CLFLUSH_BEFORE | CLFLUSH_AFTER))) { if (unlikely(flushes & (CLFLUSH_BEFORE | CLFLUSH_AFTER))) {
if (flushes & CLFLUSH_BEFORE) { if (flushes & CLFLUSH_BEFORE)
clflushopt(addr); drm_clflush_virt_range(addr, sizeof(*addr));
mb();
}
*addr = value; *addr = value;
...@@ -1337,7 +1335,7 @@ static void clflush_write32(u32 *addr, u32 value, unsigned int flushes) ...@@ -1337,7 +1335,7 @@ static void clflush_write32(u32 *addr, u32 value, unsigned int flushes)
* to ensure ordering of clflush wrt to the system. * to ensure ordering of clflush wrt to the system.
*/ */
if (flushes & CLFLUSH_AFTER) if (flushes & CLFLUSH_AFTER)
clflushopt(addr); drm_clflush_virt_range(addr, sizeof(*addr));
} else } else
*addr = value; *addr = value;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment