From nobody Tue Sep 27 12:56:16 2022 X-Original-To: dev-commits-src-main@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 4McKPY1BsCz4cwbZ; Tue, 27 Sep 2022 12:56:17 +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 4McKPX23vKz3Nvy; Tue, 27 Sep 2022 12:56:16 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1664283376; 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=zdz7MhVBCBMfVwsAXrNaYp3wDkCot4/S57V3BN/x4rU=; b=at+r2UuYKHPeJGouutNLxgrMU14cpPNkT0zdVdjGMbd9N4Kod41ns6K9kOWTg8m9XTlqwl 3Fq009H5P+EYype/RVVTEeIO1cTqfHqe6LiQ24/5gZHhHj55nZHeKDgpo1yVj5DOiE4qFK NnZsTL/oMe7rvvWa7z0KOpPXmzR5zJo+BoWF/z8sBYtcPN9hkdN51JJemwxKcLL7P7p1w4 KJPp9M3vcKsmQDFPK3WZ4xL/4slFOuBe/4eJEjwk7sm+T4hxfl+iEjFyJQlh4cjrxB9gpb lOZyb/tE6/msNN8JhydusSHyMDGfPtBJm1xCBtghWzlht6eGQd0KrZ7I87Dl4Q== 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 4McKPX18Nlz16x4; Tue, 27 Sep 2022 12:56:16 +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 28RCuGTS041449; Tue, 27 Sep 2022 12:56:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 28RCuGD3041448; Tue, 27 Sep 2022 12:56:16 GMT (envelope-from git) Date: Tue, 27 Sep 2022 12:56:16 GMT Message-Id: <202209271256.28RCuGD3041448@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Andrew Turner Subject: git: ca7e6d7c295e - main - Remove duplicate arm64 pmap bootstrap code List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: andrew X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ca7e6d7c295e77337d12a4c31fa7dadde0086fa1 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1664283376; 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=zdz7MhVBCBMfVwsAXrNaYp3wDkCot4/S57V3BN/x4rU=; b=edPsr5XbjNpuYfjR6+xsT8M1YRl6h5GFSo3FP3DHrZpTrLVVEQ1w0+AGjEOZnvQam1q/tZ s0FW9UPF2twLhInejZ5k7Abn4/L9xbmHEYL1oHM/l7sIhX6YooFTCrJRgXyVBM2qBSAY0f nAbwqyy2sFVvS/7MpBaeOQHmOZdvBWyaLXJKpSEhwimxaTQP5CPlXx27SP8lekYhFjVzgf r7cng6hElUezCYcXAQTWpUydDz6TRPuA7ITos4AdVn53Bw+HBhPlDLvrmy9Sow7ncxmTh+ loFrXhW3wXs89PC2rVUTWlJFTSUCotwNrNInaYH1/VhFP5lrxmoVL598VEl+ZQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1664283376; a=rsa-sha256; cv=none; b=Dk/Q3Kdml7mtB1+L3Zd7Gt8aIFYhTUWOE+Zt/jkEAsHGk/woIXMbEL7KsehJQsaitYH9v1 PBuz0O+QdsJaSXBINLO1HoxJ4WZXoTon0LMSqmVlB7hjL4KStdLt31VFzpBeVp8LyrKRLw JJbXxLKn1vLHHhbngSf9IKqfATo/b7leoAOqq7QGkQG/i1CanVWhh4A0KDioUSPyvjaeji 8Hqd2q4NLX9OwiXgWilkOBpTL3nOjXVJFGUPU6YMKZNggy0GcW+SJHR1wjZtcqFqxPvnZX bgZP8QnksQq+10zMtTOSE/3XiLM570ycMpEuDNsWY+CoxKJLcZEwxNUx5dqrMg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=ca7e6d7c295e77337d12a4c31fa7dadde0086fa1 commit ca7e6d7c295e77337d12a4c31fa7dadde0086fa1 Author: Andrew Turner AuthorDate: 2022-09-26 14:18:50 +0000 Commit: Andrew Turner CommitDate: 2022-09-27 12:26:29 +0000 Remove duplicate arm64 pmap bootstrap code The table bootstrap functions can now be used for non-DMAP uses. Use them for all early page table creation. Sponsored by: The FreeBSD Foundation --- sys/arm64/arm64/pmap.c | 53 ++++++++++++-------------------------------------- 1 file changed, 12 insertions(+), 41 deletions(-) diff --git a/sys/arm64/arm64/pmap.c b/sys/arm64/arm64/pmap.c index a31e95ba6f32..396a01f96da7 100644 --- a/sys/arm64/arm64/pmap.c +++ b/sys/arm64/arm64/pmap.c @@ -1127,60 +1127,31 @@ pmap_bootstrap_dmap(vm_offset_t kern_l1, vm_paddr_t min_pa, static vm_offset_t pmap_bootstrap_l2(vm_offset_t l1pt, vm_offset_t va, vm_offset_t l2_start) { - vm_offset_t l2pt; - vm_paddr_t pa; - pd_entry_t *l1; - u_int l1_slot; - KASSERT((va & L1_OFFSET) == 0, ("Invalid virtual address")); - l1 = (pd_entry_t *)l1pt; - l1_slot = pmap_l1_index(va); - l2pt = l2_start; + /* Leave bs_state.pa as it's only needed to bootstrap blocks and pages*/ + bs_state.va = va; + bs_state.freemempos = l2_start; - for (; va < VM_MAX_KERNEL_ADDRESS; l1_slot++, va += L1_SIZE) { - KASSERT(l1_slot < Ln_ENTRIES, ("Invalid L1 index")); + for (; bs_state.va < VM_MAX_KERNEL_ADDRESS; bs_state.va += L1_SIZE) + pmap_bootstrap_l1_table(&bs_state); - pa = pmap_early_vtophys(l2pt); - pmap_store(&l1[l1_slot], - (pa & ~Ln_TABLE_MASK) | L1_TABLE); - l2pt += PAGE_SIZE; - } - - /* Clean the L2 page table */ - memset((void *)l2_start, 0, l2pt - l2_start); - - return l2pt; + return (bs_state.freemempos); } static vm_offset_t pmap_bootstrap_l3(vm_offset_t l1pt, vm_offset_t va, vm_offset_t l3_start) { - vm_offset_t l3pt; - vm_paddr_t pa; - pd_entry_t *l2; - u_int l2_slot; - KASSERT((va & L2_OFFSET) == 0, ("Invalid virtual address")); - l2 = pmap_l2(kernel_pmap, va); - l2 = (pd_entry_t *)rounddown2((uintptr_t)l2, PAGE_SIZE); - l2_slot = pmap_l2_index(va); - l3pt = l3_start; + /* Leave bs_state.pa as it's only needed to bootstrap blocks and pages*/ + bs_state.va = va; + bs_state.freemempos = l3_start; - for (; va < VM_MAX_KERNEL_ADDRESS; l2_slot++, va += L2_SIZE) { - KASSERT(l2_slot < Ln_ENTRIES, ("Invalid L2 index")); + for (; bs_state.va < VM_MAX_KERNEL_ADDRESS; bs_state.va += L2_SIZE) + pmap_bootstrap_l2_table(&bs_state); - pa = pmap_early_vtophys(l3pt); - pmap_store(&l2[l2_slot], - (pa & ~Ln_TABLE_MASK) | ATTR_S1_UXN | L2_TABLE); - l3pt += PAGE_SIZE; - } - - /* Clean the L2 page table */ - memset((void *)l3_start, 0, l3pt - l3_start); - - return l3pt; + return (bs_state.freemempos); } /*