From owner-svn-src-all@freebsd.org Wed May 20 17:33:12 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 29C9B2DFA43; Wed, 20 May 2020 17:33:12 +0000 (UTC) (envelope-from markj@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 "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49S0G00HC3z4VGt; Wed, 20 May 2020 17:33:12 +0000 (UTC) (envelope-from markj@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 04D721FA66; Wed, 20 May 2020 17:33:12 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 04KHXBkZ053017; Wed, 20 May 2020 17:33:11 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 04KHXBLF053016; Wed, 20 May 2020 17:33:11 GMT (envelope-from markj@FreeBSD.org) Message-Id: <202005201733.04KHXBLF053016@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Wed, 20 May 2020 17:33:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r361285 - stable/12/sys/arm64/arm64 X-SVN-Group: stable-12 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: stable/12/sys/arm64/arm64 X-SVN-Commit-Revision: 361285 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.33 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: Wed, 20 May 2020 17:33:12 -0000 Author: markj Date: Wed May 20 17:33:11 2020 New Revision: 361285 URL: https://svnweb.freebsd.org/changeset/base/361285 Log: MFC r360690: Simplify arm64's pmap_bootstrap() a bit. Modified: stable/12/sys/arm64/arm64/pmap.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/arm64/arm64/pmap.c ============================================================================== --- stable/12/sys/arm64/arm64/pmap.c Wed May 20 17:27:54 2020 (r361284) +++ stable/12/sys/arm64/arm64/pmap.c Wed May 20 17:33:11 2020 (r361285) @@ -779,9 +779,7 @@ void pmap_bootstrap(vm_offset_t l0pt, vm_offset_t l1pt, vm_paddr_t kernstart, vm_size_t kernlen) { - u_int l1_slot, l2_slot; - pt_entry_t *l2; - vm_offset_t va, freemempos; + vm_offset_t freemempos; vm_offset_t dpcpu, msgbufpv; vm_paddr_t start_pa, pa, min_pa; uint64_t kern_delta; @@ -807,7 +805,7 @@ pmap_bootstrap(vm_offset_t l0pt, vm_offset_t l1pt, vm_ * Find the minimum physical address. physmap is sorted, * but may contain empty ranges. */ - for (i = 0; i < (physmap_idx * 2); i += 2) { + for (i = 0; i < physmap_idx * 2; i += 2) { if (physmap[i] == physmap[i + 1]) continue; if (physmap[i] <= min_pa) @@ -820,38 +818,14 @@ pmap_bootstrap(vm_offset_t l0pt, vm_offset_t l1pt, vm_ /* Create a direct map region early so we can use it for pa -> va */ freemempos = pmap_bootstrap_dmap(l1pt, min_pa, freemempos); - va = KERNBASE; start_pa = pa = KERNBASE - kern_delta; /* - * Read the page table to find out what is already mapped. - * This assumes we have mapped a block of memory from KERNBASE - * using a single L1 entry. + * Create the l2 tables up to VM_MAX_KERNEL_ADDRESS. We assume that the + * loader allocated the first and only l2 page table page used to map + * the kernel, preloaded files and module metadata. */ - l2 = pmap_early_page_idx(l1pt, KERNBASE, &l1_slot, &l2_slot); - - /* Sanity check the index, KERNBASE should be the first VA */ - KASSERT(l2_slot == 0, ("The L2 index is non-zero")); - - /* Find how many pages we have mapped */ - for (; l2_slot < Ln_ENTRIES; l2_slot++) { - if ((l2[l2_slot] & ATTR_DESCR_MASK) == 0) - break; - - /* Check locore used L2 blocks */ - KASSERT((l2[l2_slot] & ATTR_DESCR_MASK) == L2_BLOCK, - ("Invalid bootstrap L2 table")); - KASSERT((l2[l2_slot] & ~ATTR_MASK) == pa, - ("Incorrect PA in L2 table")); - - va += L2_SIZE; - pa += L2_SIZE; - } - - va = roundup2(va, L1_SIZE); - - /* Create the l2 tables up to VM_MAX_KERNEL_ADDRESS */ - freemempos = pmap_bootstrap_l2(l1pt, va, freemempos); + freemempos = pmap_bootstrap_l2(l1pt, KERNBASE + L1_SIZE, freemempos); /* And the l3 tables for the early devmap */ freemempos = pmap_bootstrap_l3(l1pt, VM_MAX_KERNEL_ADDRESS - (PMAP_MAPDEV_EARLY_SIZE), freemempos);