git: b3407b54d386 - stable/13 - LinuxKPI: Implement clflush_cache_range()

From: Vladimir Kondratyev <wulf_at_FreeBSD.org>
Date: Sat, 22 Jan 2022 19:36:19 UTC
The branch stable/13 has been updated by wulf:

URL: https://cgit.FreeBSD.org/src/commit/?id=b3407b54d38697cae7d6707d828c785e0cf92852

commit b3407b54d38697cae7d6707d828c785e0cf92852
Author:     Vladimir Kondratyev <wulf@FreeBSD.org>
AuthorDate: 2021-11-15 15:06:50 +0000
Commit:     Vladimir Kondratyev <wulf@FreeBSD.org>
CommitDate: 2022-01-22 19:34:36 +0000

    LinuxKPI: Implement clflush_cache_range()
    
    Required by drm-kmod 5.7
    
    MFC after:      1 week
    Reviewed by:    hselasky, manu
    Differential Revision:  https://reviews.freebsd.org/D33289
    
    (cherry picked from commit db562aeff7755a1128165cc0fbf8252756004847)
---
 sys/compat/linuxkpi/common/include/linux/page.h | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/sys/compat/linuxkpi/common/include/linux/page.h b/sys/compat/linuxkpi/common/include/linux/page.h
index 7cdaf01dce03..ed1b562dba43 100644
--- a/sys/compat/linuxkpi/common/include/linux/page.h
+++ b/sys/compat/linuxkpi/common/include/linux/page.h
@@ -119,6 +119,13 @@ lkpi_clflushopt(unsigned long addr)
 }
 #define	clflush(x)	clflush((unsigned long)(x))
 #define	clflushopt(x)	lkpi_clflushopt((unsigned long)(x))
+
+static inline void
+clflush_cache_range(void *addr, unsigned int size)
+{
+	pmap_force_invalidate_cache_range((vm_offset_t)addr,
+	    (vm_offset_t)addr + size);
+}
 #endif
 
 #endif	/* _LINUX_PAGE_H_ */