[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
This commit is contained in:
Leandro Lupori 2019-07-10 13:36:17 +00:00
parent 01f1fff003
commit 8b55f9f853

View File

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