Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 10 Nov 2018 02:37:57 +0000 (UTC)
From:      Justin Hibbits <jhibbits@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r340312 - head/sys/powerpc/aim
Message-ID:  <201811100237.wAA2bvdT085066@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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.



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