Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 14 Sep 2019 13:32:54 +0000 (UTC)
From:      Hans Petter Selasky <hselasky@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org
Subject:   svn commit: r352328 - stable/12/sys/compat/linuxkpi/common/include/linux
Message-ID:  <201909141332.x8EDWs2T039540@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: hselasky
Date: Sat Sep 14 13:32:54 2019
New Revision: 352328
URL: https://svnweb.freebsd.org/changeset/base/352328

Log:
  MFC r351693:
  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
  Sponsored by:	Mellanox Technologies

Modified:
  stable/12/sys/compat/linuxkpi/common/include/linux/io.h
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/compat/linuxkpi/common/include/linux/io.h
==============================================================================
--- stable/12/sys/compat/linuxkpi/common/include/linux/io.h	Sat Sep 14 13:32:13 2019	(r352327)
+++ stable/12/sys/compat/linuxkpi/common/include/linux/io.h	Sat Sep 14 13:32:54 2019	(r352328)
@@ -356,16 +356,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?201909141332.x8EDWs2T039540>