From nobody Mon Jan 10 14:37:31 2022 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id C39B51946A9A; Mon, 10 Jan 2022 14:37:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4JXbyM3lq4z3MWP; Mon, 10 Jan 2022 14:37:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 60B3A26D33; Mon, 10 Jan 2022 14:37:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 20AEbVTr080073; Mon, 10 Jan 2022 14:37:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 20AEbVpT080072; Mon, 10 Jan 2022 14:37:31 GMT (envelope-from git) Date: Mon, 10 Jan 2022 14:37:31 GMT Message-Id: <202201101437.20AEbVpT080072@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Leandro Lupori Subject: git: c930d356a3a1 - stable/13 - powerpc64: fix the calculation of Maxmem List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: luporl X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: c930d356a3a1d08a1b300edf5fd14334fe65f6a1 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1641825451; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=ky1zYWrQk9+YYZuh0WXY+anRZX59Y17Dn5UEQaGoF+M=; b=LY9jZzMv7MIL0nVKzbtCLABvuKeiwxndesuzf7WV2SoAH3SDb7MtSREyFtonrkJbKspcLH vt4cs2RNUN+xi63YA3CeKV18oRnijfacVhfgFpUHf0m9hTUw3nWEuB8i0H7d2uDM2X11nX rFnxu1yZ2L/gYh6G/+Y9XtJCC2LcJ4tv/vnZyfMNR+xFv/u4iwMvCmpmbq8sOGeeoHHQl7 c5+WanSTSLYbbJAELmocR0vEm4eGBfNX9JjAYvfkbajBq9IJQnKaryyawnOuLza/OcYwO6 byMwTQeC62TWunoEigHl6p4/a4CyJ1QslKzE6MxzrNGsQMhrvkXRJKzSGYMtEQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1641825451; a=rsa-sha256; cv=none; b=cJMWa4XdX3qce4tHkcx1ZLyB2xgW/4G9sMhDRVrv9OV0LjHqBIuPWoN2P1pjiLEBZgUuSy Vvfa6PrDX4NyW9hBvGfS3sNboV5k/CjHKVef9rkKXXbAuexrAJ3bT0InIcHFtiT0RShdiG xLR3xAcTooEOjlwb4CvJLSSXT3JlcapRHLXdFh1NfZ66PE0vfYwneVAE1E2frblqpI45Bo 0cgT5p2vil1AHS+/m4BoDX8qZKg7kwiMMbU7OfF1W2bSBvpAhZ74iEyiHyJkyZUHxXTFij C5uWOGc5QFOvoJn2odn+uDQIDLGwE3GqhurkL8++Q202JDpipTKV2PJb+hE7uw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by luporl: URL: https://cgit.FreeBSD.org/src/commit/?id=c930d356a3a1d08a1b300edf5fd14334fe65f6a1 commit c930d356a3a1d08a1b300edf5fd14334fe65f6a1 Author: Leandro Lupori AuthorDate: 2021-12-15 11:49:47 +0000 Commit: Leandro Lupori CommitDate: 2022-01-10 14:36:56 +0000 powerpc64: fix the calculation of Maxmem The calculation of Maxmem was skipping the last phys_avail segment, because of a wrong stop condition. This was detected when using QEMU/PowerNV with Radix MMU and low memory (2G). In this case opal_pci would allocate a DMA window that was too small to cover all physical memory, resulting in reading all zeroes from disk when using memory that was not inside the allocated window. Reviewed by: jhibbits Sponsored by: Instituto de Pesquisas Eldorado (eldorado.org.br) Differential Revision: https://reviews.freebsd.org/D33449 (cherry picked from commit a076e2060c07307e7416759075db71f23de722c0) --- sys/powerpc/aim/mmu_oea64.c | 2 +- sys/powerpc/aim/mmu_radix.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/powerpc/aim/mmu_oea64.c b/sys/powerpc/aim/mmu_oea64.c index 41771c3650f3..1abf65ab35b3 100644 --- a/sys/powerpc/aim/mmu_oea64.c +++ b/sys/powerpc/aim/mmu_oea64.c @@ -1165,7 +1165,7 @@ moea64_late_bootstrap(vm_offset_t kernelstart, vm_offset_t kernelend) * Calculate the last available physical address. */ Maxmem = 0; - for (i = 0; phys_avail[i + 2] != 0; i += 2) + for (i = 0; phys_avail[i + 1] != 0; i += 2) Maxmem = MAX(Maxmem, powerpc_btop(phys_avail[i + 1])); /* diff --git a/sys/powerpc/aim/mmu_radix.c b/sys/powerpc/aim/mmu_radix.c index 333fa234fb4b..da32b66334a0 100644 --- a/sys/powerpc/aim/mmu_radix.c +++ b/sys/powerpc/aim/mmu_radix.c @@ -2055,7 +2055,7 @@ mmu_radix_late_bootstrap(vm_offset_t start, vm_offset_t end) * vm_page_array (upper bound). */ Maxmem = 0; - for (i = 0; phys_avail[i + 2] != 0; i += 2) + for (i = 0; phys_avail[i + 1] != 0; i += 2) Maxmem = MAX(Maxmem, powerpc_btop(phys_avail[i + 1])); /*