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;
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to