git: e79989d8233b - stable/13 - LinuxKPI: Add more #ifdef VM_MEMATTR_WRITE_COMBINING guards
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sun, 10 Oct 2021 13:38:16 UTC
The branch stable/13 has been updated by jrtc27:
URL: https://cgit.FreeBSD.org/src/commit/?id=e79989d8233bf4732a5a1d904e3de7c67d8220cd
commit e79989d8233bf4732a5a1d904e3de7c67d8220cd
Author: Jessica Clarke <jrtc27@FreeBSD.org>
AuthorDate: 2021-10-03 18:34:40 +0000
Commit: Jessica Clarke <jrtc27@FreeBSD.org>
CommitDate: 2021-10-10 13:36:53 +0000
LinuxKPI: Add more #ifdef VM_MEMATTR_WRITE_COMBINING guards
One of the three uses is already guarded; this guards the remaining ones
to support architectures like riscv that do not provide write-combining,
and is needed to build drm-kmod on riscv.
Reviewed by: hselasky, manu
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D31999
(cherry picked from commit 8167c92f65bc20145467b3b98c842cde57736900)
---
sys/compat/linuxkpi/common/include/linux/io.h | 4 ++++
sys/compat/linuxkpi/common/include/linux/page.h | 4 ++++
2 files changed, 8 insertions(+)
diff --git a/sys/compat/linuxkpi/common/include/linux/io.h b/sys/compat/linuxkpi/common/include/linux/io.h
index 0104eea90ace..074417b892f9 100644
--- a/sys/compat/linuxkpi/common/include/linux/io.h
+++ b/sys/compat/linuxkpi/common/include/linux/io.h
@@ -411,8 +411,12 @@ void *_ioremap_attr(vm_paddr_t phys_addr, unsigned long size, int attr);
#define ioremap(addr, size) \
_ioremap_attr((addr), (size), VM_MEMATTR_UNCACHEABLE)
#endif
+#ifdef VM_MEMATTR_WRITE_COMBINING
#define ioremap_wc(addr, size) \
_ioremap_attr((addr), (size), VM_MEMATTR_WRITE_COMBINING)
+#else
+#define ioremap_wc(addr, size) ioremap_nocache(addr, size)
+#endif
#define ioremap_wb(addr, size) \
_ioremap_attr((addr), (size), VM_MEMATTR_WRITE_BACK)
void iounmap(void *addr);
diff --git a/sys/compat/linuxkpi/common/include/linux/page.h b/sys/compat/linuxkpi/common/include/linux/page.h
index c2dbab769c2a..a09ae439266e 100644
--- a/sys/compat/linuxkpi/common/include/linux/page.h
+++ b/sys/compat/linuxkpi/common/include/linux/page.h
@@ -76,8 +76,12 @@ pgprot2cachemode(pgprot_t prot)
#define clear_page(page) memset(page, 0, PAGE_SIZE)
#define pgprot_noncached(prot) \
(((prot) & VM_PROT_ALL) | cachemode2protval(VM_MEMATTR_UNCACHEABLE))
+#ifdef VM_MEMATTR_WRITE_COMBINING
#define pgprot_writecombine(prot) \
(((prot) & VM_PROT_ALL) | cachemode2protval(VM_MEMATTR_WRITE_COMBINING))
+#else
+#define pgprot_writecombine(prot) pgprot_noncached(prot)
+#endif
#undef PAGE_MASK
#define PAGE_MASK (~(PAGE_SIZE-1))