svn commit: r340312 - head/sys/powerpc/aim

Justin Hibbits jhibbits at FreeBSD.org
Sat Nov 10 02:37:58 UTC 2018


Author: jhibbits
Date: Sat Nov 10 02:37:56 2018
New Revision: 340312
URL: https://svnweb.freebsd.org/changeset/base/340312

Log:
  powerpc: Use MAX() macro instead of max() inline function to calculate Maxmem
  
  Maxmem is the highest address for physical memory in the system.  It's
  measured in pages which, since max() returns a u_int, should allow for up to
  2^44 bytes of memory addressable by the system.  However, on POWER9 systems
  at least, memory addressed by additional socketed CPUs begins at addresses
  far above the 2^44 mark, causing issues with memory accesses and DMA, when
  memory is addressed on the auxiliary CPUs.  Use the MAX() macro instead,
  which doesn't convert arguments, so retains Maxmem and all calculations as
  its defined long type (64-bit on powerpc64), keeping the maximum address
  correct.
  
  Submitted by:	mmacy

Modified:
  head/sys/powerpc/aim/mmu_oea64.c

Modified: head/sys/powerpc/aim/mmu_oea64.c
==============================================================================
--- head/sys/powerpc/aim/mmu_oea64.c	Sat Nov 10 01:58:37 2018	(r340311)
+++ head/sys/powerpc/aim/mmu_oea64.c	Sat Nov 10 02:37:56 2018	(r340312)
@@ -939,7 +939,7 @@ moea64_late_bootstrap(mmu_t mmup, vm_offset_t kernelst
 	 */
 	Maxmem = 0;
 	for (i = 0; phys_avail[i + 2] != 0; i += 2)
-		Maxmem = max(Maxmem, powerpc_btop(phys_avail[i + 1]));
+		Maxmem = MAX(Maxmem, powerpc_btop(phys_avail[i + 1]));
 
 	/*
 	 * Initialize MMU.


More information about the svn-src-all mailing list