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
This commit is contained in:
hselasky 2019-09-02 08:34:45 +00:00
parent 9e15cb9d49
commit f2d1759c50

View File

@ -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))