Date: Thu, 28 Jun 2018 21:27:34 +0000 (UTC) From: John Baldwin <jhb@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r335783 - head/sys/mips/malta Message-ID: <201806282127.w5SLRY5l067880@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: jhb Date: Thu Jun 28 21:27:34 2018 New Revision: 335783 URL: https://svnweb.freebsd.org/changeset/base/335783 Log: Support 2GB of memory on Malta systems with FreeBSD/mips. When 2GB of memory is enabled for QEMU's Malta emulation, the physical memory ends at an address of 2^32 - 1. This causes an integer overflow to zero when computing the upper bound of the second phys_avail[] range. As a result, FreeBSD/mips kernels were only using the first 256MB of RAM and ignoring the remaining 1.75GB. To work around this, truncate the extended memory size to 2GB minus one page for 32-bit mips kernels. Sponsored by: DARPA / AFRL Differential Revision: https://reviews.freebsd.org/D16027 Modified: head/sys/mips/malta/malta_machdep.c Modified: head/sys/mips/malta/malta_machdep.c ============================================================================== --- head/sys/mips/malta/malta_machdep.c Thu Jun 28 21:26:14 2018 (r335782) +++ head/sys/mips/malta/malta_machdep.c Thu Jun 28 21:27:34 2018 (r335783) @@ -344,6 +344,15 @@ platform_start(__register_t a0, __register_t a1, __re printf("memsize = %llu (0x%08x)\n", (unsigned long long) memsize, memsize); printf("ememsize = %llu\n", (unsigned long long) ememsize); + +#ifdef __mips_o32 + /* + * For O32 phys_avail[] can't address memory beyond 2^32, + * so cap extended memory to 2GB minus one page. + */ + if (ememsize >= 2ULL * 1024 * 1024 * 1024) + ememsize = 2ULL * 1024 * 1024 * 1024 - PAGE_SIZE; +#endif } /*
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201806282127.w5SLRY5l067880>