Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 10 Jul 2019 13:36:17 +0000 (UTC)
From:      Leandro Lupori <luporl@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r349885 - head/sys/powerpc/pseries
Message-ID:  <201907101336.x6ADaH84085635@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: luporl
Date: Wed Jul 10 13:36:17 2019
New Revision: 349885
URL: https://svnweb.freebsd.org/changeset/base/349885

Log:
  [PPC64] pseries: fix realmaxaddr calculation
  
  On POWER9/pseries, QEMU passes several regions of memory,
  instead of a single region containing all memory, as the
  code was expecting.
  
  Reviewed by:	jhibbits
  Differential Revision:	https://reviews.freebsd.org/D20857

Modified:
  head/sys/powerpc/pseries/platform_chrp.c

Modified: head/sys/powerpc/pseries/platform_chrp.c
==============================================================================
--- head/sys/powerpc/pseries/platform_chrp.c	Wed Jul 10 13:35:01 2019	(r349884)
+++ head/sys/powerpc/pseries/platform_chrp.c	Wed Jul 10 13:36:17 2019	(r349885)
@@ -140,8 +140,15 @@ chrp_attach(platform_t plat)
 	if (!(mfmsr() & PSL_HV)) {
 		struct mem_region *phys, *avail;
 		int nphys, navail;
+		vm_offset_t off;
+
 		mem_regions(&phys, &nphys, &avail, &navail);
-		realmaxaddr = phys[0].mr_size;
+
+		realmaxaddr = 0;
+		for (i = 0; i < nphys; i++) {
+			off = phys[i].mr_start + phys[i].mr_size;
+			realmaxaddr = MAX(off, realmaxaddr);
+		}
 
 		pmap_mmu_install("mmu_phyp", BUS_PROBE_SPECIFIC);
 		cpu_idle_hook = phyp_cpu_idle;



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