From nobody Wed Dec 15 11:57:39 2021 X-Original-To: dev-commits-src-all@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 DB57818F413E; Wed, 15 Dec 2021 11:57:39 +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 4JDYdv4MjXz3J5m; Wed, 15 Dec 2021 11:57:39 +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 759F21B7DD; Wed, 15 Dec 2021 11:57:39 +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 1BFBvdUV035495; Wed, 15 Dec 2021 11:57:39 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1BFBvdxs035494; Wed, 15 Dec 2021 11:57:39 GMT (envelope-from git) Date: Wed, 15 Dec 2021 11:57:39 GMT Message-Id: <202112151157.1BFBvdxs035494@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Leandro Lupori Subject: git: a076e2060c07 - main - powerpc64: fix the calculation of Maxmem List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@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/main X-Git-Reftype: branch X-Git-Commit: a076e2060c07307e7416759075db71f23de722c0 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1639569459; 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=hAFVWXQ4lkSc4JdOTW/XIsH9UzTRrkf1lHrosVGFFww=; b=Qi5ws+fhbtp1Pe8TkLr7oAIjlUKdze9a69oAAVNGMIAWo4wBke6QeJ31iMEMjK+vdXCBd+ R2WheyklsdU4oFQYDuO8jir0I+0Gaul0YnRXAhGlpQyRlOqy7O8sQ3Ns9yGuXjiggh1XE/ iOHXJWiNEFuN/TslP+s9kHunv1XXgukzJ85Ez4NrSJS5BB8n13vIRCmcEquKjPqchguOml oEdZ5wPCJGkLA9cqvZgg6Th1nwx8SGXJZ/aTV9SqtmO7JzQECC1SP5uJrU+QW8jCm/pKZe cIJZ5sC5obXy0u0zKs8nnUh9uj9CwlB7zuZ3GbkdQQ4I3/27xbF7BZcRKyy6KA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1639569459; a=rsa-sha256; cv=none; b=ZlZWoKhR4CTLEJFoHyCL1nJxPbdpaaTEWXogEleSOciPGeNOBaROGFsm9ZpZIKa4GnEGkb zBB9nvKBmOCR3fG/McDO0TP8vvUgbxoY7VeO6uWRkrHXiKNBnnkrCw93MSUJoe29jTNA95 MECkiGBrn6semIL7lgyDnpik7UM1W4xrpR0JflepEsrWknP5yiw/Aynq/tRill2MbLfmHB OriXtOOkvl/FcNJf+MFdASjZumDMiOKCEaEG4A+jmdotAG9ywBTr5BMN6SbM6kVH1P+Uli Cej71iy2Q96k099FJeyC91+BY8EltA1ZA+T7Z9Kx3ZRcKKw2lBCWpI8N/yzxdQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by luporl: URL: https://cgit.FreeBSD.org/src/commit/?id=a076e2060c07307e7416759075db71f23de722c0 commit a076e2060c07307e7416759075db71f23de722c0 Author: Leandro Lupori AuthorDate: 2021-12-15 11:49:47 +0000 Commit: Leandro Lupori CommitDate: 2021-12-15 11:49:47 +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 MFC after: 2 weeks --- 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 728f388ffb08..b3a4a225126f 100644 --- a/sys/powerpc/aim/mmu_oea64.c +++ b/sys/powerpc/aim/mmu_oea64.c @@ -1162,7 +1162,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 420a7a227c10..788bd7f22a0a 100644 --- a/sys/powerpc/aim/mmu_radix.c +++ b/sys/powerpc/aim/mmu_radix.c @@ -2066,7 +2066,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])); /*