From owner-svn-src-all@freebsd.org Thu Jun 28 21:27:35 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8DF9F1027C4B; Thu, 28 Jun 2018 21:27:35 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3A7F88F53A; Thu, 28 Jun 2018 21:27:35 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1BBB317BA3; Thu, 28 Jun 2018 21:27:35 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w5SLRYQ1067881; Thu, 28 Jun 2018 21:27:34 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w5SLRY5l067880; Thu, 28 Jun 2018 21:27:34 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201806282127.w5SLRY5l067880@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Thu, 28 Jun 2018 21:27:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r335783 - head/sys/mips/malta X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: head/sys/mips/malta X-SVN-Commit-Revision: 335783 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Jun 2018 21:27:35 -0000 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 } /*