aboutsummaryrefslogtreecommitdiff
path: root/sys/compat/linuxkpi/common/include
diff options
context:
space:
mode:
authorHans Petter Selasky <hselasky@FreeBSD.org>2019-09-02 08:34:45 +0000
committerHans Petter Selasky <hselasky@FreeBSD.org>2019-09-02 08:34:45 +0000
commit4d83500fda1b67342c81b58ad7ef9738325b83a4 (patch)
tree3aee393f1d92f681f2be3d7ace85a1b37927abec /sys/compat/linuxkpi/common/include
parentf6549df685bf3d620a1e76d45107ee8b831ab4e2 (diff)
downloadsrc-4d83500fda1b67342c81b58ad7ef9738325b83a4.tar.gz
src-4d83500fda1b67342c81b58ad7ef9738325b83a4.zip
Use DEVICE memory instead of UNCACHEABLE on aarch64 in ioremap() in the LinuxKPI.
This fixes system hangs on reading device registers on aarch64. Tested with: Marvell MACCHIATObin (Armada8k) + mlx4en, amdgpu Submitted by: Greg V <greg@unrelenting.technology> Differential Revision: https://reviews.freebsd.org/D20789 MFC after: 1 week Sponsored by: Mellanox Technologies
Notes
Notes: svn path=/head/; revision=351693
Diffstat (limited to 'sys/compat/linuxkpi/common/include')
-rw-r--r--sys/compat/linuxkpi/common/include/linux/io.h17
1 files changed, 13 insertions, 4 deletions
diff --git a/sys/compat/linuxkpi/common/include/linux/io.h b/sys/compat/linuxkpi/common/include/linux/io.h
index 8dc0308a5e7d..5cffe9b080e3 100644
--- a/sys/compat/linuxkpi/common/include/linux/io.h
+++ b/sys/compat/linuxkpi/common/include/linux/io.h
@@ -396,16 +396,25 @@ void *_ioremap_attr(vm_paddr_t phys_addr, unsigned long size, int attr);
#define _ioremap_attr(...) NULL
#endif
+#ifdef VM_MEMATTR_DEVICE
+#define ioremap_nocache(addr, size) \
+ _ioremap_attr((addr), (size), VM_MEMATTR_DEVICE)
+#define ioremap_wt(addr, size) \
+ _ioremap_attr((addr), (size), VM_MEMATTR_DEVICE)
+#define ioremap(addr, size) \
+ _ioremap_attr((addr), (size), VM_MEMATTR_DEVICE)
+#else
#define ioremap_nocache(addr, size) \
_ioremap_attr((addr), (size), VM_MEMATTR_UNCACHEABLE)
-#define ioremap_wc(addr, size) \
- _ioremap_attr((addr), (size), VM_MEMATTR_WRITE_COMBINING)
-#define ioremap_wb(addr, size) \
- _ioremap_attr((addr), (size), VM_MEMATTR_WRITE_BACK)
#define ioremap_wt(addr, size) \
_ioremap_attr((addr), (size), VM_MEMATTR_WRITE_THROUGH)
#define ioremap(addr, size) \
_ioremap_attr((addr), (size), VM_MEMATTR_UNCACHEABLE)
+#endif
+#define ioremap_wc(addr, size) \
+ _ioremap_attr((addr), (size), VM_MEMATTR_WRITE_COMBINING)
+#define ioremap_wb(addr, size) \
+ _ioremap_attr((addr), (size), VM_MEMATTR_WRITE_BACK)
void iounmap(void *addr);
#define memset_io(a, b, c) memset((a), (b), (c))