git: 8167c92f65bc - main - LinuxKPI: Add more #ifdef VM_MEMATTR_WRITE_COMBINING guards
Jessica Clarke
jrtc27 at FreeBSD.org
Sun Oct 3 18:36:49 UTC 2021
The branch main has been updated by jrtc27:
URL: https://cgit.FreeBSD.org/src/commit/?id=8167c92f65bc20145467b3b98c842cde57736900
commit 8167c92f65bc20145467b3b98c842cde57736900
Author: Jessica Clarke <jrtc27 at FreeBSD.org>
AuthorDate: 2021-10-03 18:34:40 +0000
Commit: Jessica Clarke <jrtc27 at FreeBSD.org>
CommitDate: 2021-10-03 18:34:40 +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
---
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 ca7365419e22..0c3d456d6ec0 100644
--- a/sys/compat/linuxkpi/common/include/linux/page.h
+++ b/sys/compat/linuxkpi/common/include/linux/page.h
@@ -83,8 +83,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))
More information about the dev-commits-src-main
mailing list