Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 2 Sep 2019 08:34:45 +0000 (UTC)
From:      Hans Petter Selasky <hselasky@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r351693 - head/sys/compat/linuxkpi/common/include/linux
Message-ID:  <201909020834.x828YjNo086477@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: hselasky
Date: Mon Sep  2 08:34:45 2019
New Revision: 351693
URL: https://svnweb.freebsd.org/changeset/base/351693

Log:
  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

Modified:
  head/sys/compat/linuxkpi/common/include/linux/io.h

Modified: head/sys/compat/linuxkpi/common/include/linux/io.h
==============================================================================
--- head/sys/compat/linuxkpi/common/include/linux/io.h	Mon Sep  2 08:31:18 2019	(r351692)
+++ head/sys/compat/linuxkpi/common/include/linux/io.h	Mon Sep  2 08:34:45 2019	(r351693)
@@ -396,16 +396,25 @@ void *_ioremap_attr(vm_paddr_t phys_addr, unsigned lon
 #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))



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201909020834.x828YjNo086477>