From nobody Tue Mar 1 14:39:58 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 958D019DAB78; Tue, 1 Mar 2022 14:39:59 +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 4K7Kf64L0Yz3FwC; Tue, 1 Mar 2022 14:39:58 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1646145599; 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=Jd+CXIIUyp21HXEbfD07oK1mU5ELXH5i+w3R6ML9vt0=; b=g5BFApelmzu+ZV3JzryFdeORQSuMcQLqutQ7kiZ6c1uf1aVnZvAo63Rvj+N2NyQp5WM6/X Cx6mXAsX3OEIHNm+mCRc8RkybMX7SL7ud28UQd/QLhVnJ9vjcbiXjhaA1aChRvWqc2ZHMP k1B+u7eYxNcRmOALvaSmhdFpVBdz++xohuie8BTHEzq569f36LeI7JgSZN7PxCLZaP345H L4hSPS9UK4QdN8gDtwylti7Dq95hgk0RR9seudV5bKDNkviyzAXOmHG/GBa/pdPwgnOsUt yP0zymNhMWp6oKB2ZYJLV2UmucWzc1zqrBlNrq9oMDX/oL8339EWk4h5gVo3lQ== 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 483B9115B1; Tue, 1 Mar 2022 14:39:58 +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 221EdwGM038554; Tue, 1 Mar 2022 14:39:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 221Edwa2038553; Tue, 1 Mar 2022 14:39:58 GMT (envelope-from git) Date: Tue, 1 Mar 2022 14:39:58 GMT Message-Id: <202203011439.221Edwa2038553@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 82f4e0d0f064 - main - riscv: Rename struct pmap's pm_l1 field to pm_top 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: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 82f4e0d0f06456f2d070d2e0692a8f318f4eb90b Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1646145599; 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=Jd+CXIIUyp21HXEbfD07oK1mU5ELXH5i+w3R6ML9vt0=; b=GVYi6m0IaNTIacK/kKpzE7qpoFEG05u29QIg6+OmzKASf/cF6lWh9OdeJQ9wLD9Nqz+WPv XO0KTBU9GfYhNMyrhs+IuHhFwCtrEoGmOc7gjyTe1DunJWpXBmt5hAP30RDWlL5c2oWioW A3rNGahYytuCpWIxo6hpTnyw5PiX91NGe6Sofsepe4a6OpO+GsZPZ9WMFYujEq/fLP9iTq BQ5SJlH5SWWXnjMGU+y0XRW+rk3II+OHEPyys3sgimptcftxcaFqxyFiyfEz/Pq9kACs/2 YrBwhUUATM1e/MibcGvVKoEfdgQZH24yYrq7d524o9BW0QWOGG7wZHB//9ijlA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1646145599; a=rsa-sha256; cv=none; b=l/Y1J0Pf85aIGsOSgXe2iyLp3RoaYXn6DOwmNFpFfNxs5mVq2kHyIb58mnZqZAJLXR5019 4HfZVcCRNOrR4FUXbjrXEgGizhJQFZDXEd8urdZpggOqMgJMDo26sO0FAVpWVaGhOqjHmz zvESjfDMum2fOcEj88Yv1hHaO8fPWnkGizgnB/l2XcRQW9Ett/b1dRDed9VmAcAU2n9de9 MOMY9xqKWFpKMbVWLi3YcNCZ+9jrdWHNcJ9fSifoo6O04eAWqH9p6ShiooTYC+fZUHvsdz ZZTF9XUkUmNrJTAoruKevLd1/Nmayolmn4fue50qh7PwP/FPXdKeM9lyf9Cmmg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=82f4e0d0f06456f2d070d2e0692a8f318f4eb90b commit 82f4e0d0f06456f2d070d2e0692a8f318f4eb90b Author: Mark Johnston AuthorDate: 2022-03-01 14:03:30 +0000 Commit: Mark Johnston CommitDate: 2022-03-01 14:39:43 +0000 riscv: Rename struct pmap's pm_l1 field to pm_top In SV48 mode, the top-level page will be an L0 page rather than an L1 page. Rename the field accordingly. No functional change intended. Reviewed by: alc, jhb MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D34270 --- sys/riscv/include/pmap.h | 2 +- sys/riscv/riscv/pmap.c | 37 +++++++++++++++++-------------------- 2 files changed, 18 insertions(+), 21 deletions(-) diff --git a/sys/riscv/include/pmap.h b/sys/riscv/include/pmap.h index 0ef221ed2393..40f99befade1 100644 --- a/sys/riscv/include/pmap.h +++ b/sys/riscv/include/pmap.h @@ -80,7 +80,7 @@ struct pv_addr { struct pmap { struct mtx pm_mtx; struct pmap_statistics pm_stats; /* pmap statictics */ - pd_entry_t *pm_l1; + pd_entry_t *pm_top; /* top-level page table page */ u_long pm_satp; /* value for SATP register */ cpuset_t pm_active; /* active on cpus */ TAILQ_HEAD(,pv_chunk) pm_pvchunk; /* list of mappings in pmap */ diff --git a/sys/riscv/riscv/pmap.c b/sys/riscv/riscv/pmap.c index 0ccb31b9deb0..545d77f808c7 100644 --- a/sys/riscv/riscv/pmap.c +++ b/sys/riscv/riscv/pmap.c @@ -353,7 +353,7 @@ pmap_l1(pmap_t pmap, vm_offset_t va) KASSERT(VIRT_IS_VALID(va), ("%s: malformed virtual address %#lx", __func__, va)); - return (&pmap->pm_l1[pmap_l1_index(va)]); + return (&pmap->pm_top[pmap_l1_index(va)]); } static __inline pd_entry_t * @@ -442,7 +442,7 @@ pmap_distribute_l1(struct pmap *pmap, vm_pindex_t l1index, mtx_lock(&allpmaps_lock); LIST_FOREACH(user_pmap, &allpmaps, pm_list) { - l1 = &user_pmap->pm_l1[l1index]; + l1 = &user_pmap->pm_top[l1index]; pmap_store(l1, entry); } mtx_unlock(&allpmaps_lock); @@ -572,7 +572,7 @@ pmap_bootstrap(vm_offset_t l1pt, vm_paddr_t kernstart, vm_size_t kernlen) printf("pmap_bootstrap %lx %lx %lx\n", l1pt, kernstart, kernlen); /* Set this early so we can use the pagetable walking functions */ - kernel_pmap_store.pm_l1 = (pd_entry_t *)l1pt; + kernel_pmap_store.pm_top = (pd_entry_t *)l1pt; PMAP_LOCK_INIT(kernel_pmap); rw_init(&pvh_global_lock, "pmap pv global"); @@ -1205,8 +1205,8 @@ pmap_pinit0(pmap_t pmap) PMAP_LOCK_INIT(pmap); bzero(&pmap->pm_stats, sizeof(pmap->pm_stats)); - pmap->pm_l1 = kernel_pmap->pm_l1; - pmap->pm_satp = SATP_MODE_SV39 | (vtophys(pmap->pm_l1) >> PAGE_SHIFT); + pmap->pm_top = kernel_pmap->pm_top; + pmap->pm_satp = SATP_MODE_SV39 | (vtophys(pmap->pm_top) >> PAGE_SHIFT); CPU_ZERO(&pmap->pm_active); pmap_activate_boot(pmap); } @@ -1214,18 +1214,15 @@ pmap_pinit0(pmap_t pmap) int pmap_pinit(pmap_t pmap) { - vm_paddr_t l1phys; - vm_page_t l1pt; + vm_paddr_t topphys; + vm_page_t mtop; - /* - * allocate the l1 page - */ - l1pt = vm_page_alloc_noobj(VM_ALLOC_WIRED | VM_ALLOC_ZERO | + mtop = vm_page_alloc_noobj(VM_ALLOC_WIRED | VM_ALLOC_ZERO | VM_ALLOC_WAITOK); - l1phys = VM_PAGE_TO_PHYS(l1pt); - pmap->pm_l1 = (pd_entry_t *)PHYS_TO_DMAP(l1phys); - pmap->pm_satp = SATP_MODE_SV39 | (l1phys >> PAGE_SHIFT); + topphys = VM_PAGE_TO_PHYS(mtop); + pmap->pm_top = (pd_entry_t *)PHYS_TO_DMAP(topphys); + pmap->pm_satp = SATP_MODE_SV39 | (topphys >> PAGE_SHIFT); bzero(&pmap->pm_stats, sizeof(pmap->pm_stats)); @@ -1239,10 +1236,10 @@ pmap_pinit(pmap_t pmap) LIST_INSERT_HEAD(&allpmaps, pmap, pm_list); for (size_t i = pmap_l1_index(VM_MIN_KERNEL_ADDRESS); i < pmap_l1_index(VM_MAX_KERNEL_ADDRESS); i++) - pmap->pm_l1[i] = kernel_pmap->pm_l1[i]; + pmap->pm_top[i] = kernel_pmap->pm_top[i]; for (size_t i = pmap_l1_index(DMAP_MIN_ADDRESS); i < pmap_l1_index(DMAP_MAX_ADDRESS); i++) - pmap->pm_l1[i] = kernel_pmap->pm_l1[i]; + pmap->pm_top[i] = kernel_pmap->pm_top[i]; mtx_unlock(&allpmaps_lock); vm_radix_init(&pmap->pm_root); @@ -1303,7 +1300,7 @@ _pmap_alloc_l3(pmap_t pmap, vm_pindex_t ptepindex, struct rwlock **lockp) vm_pindex_t l1index; l1index = ptepindex - NUL2E; - l1 = &pmap->pm_l1[l1index]; + l1 = &pmap->pm_top[l1index]; KASSERT((pmap_load(l1) & PTE_V) == 0, ("%s: L1 entry %#lx is valid", __func__, pmap_load(l1))); @@ -1317,7 +1314,7 @@ _pmap_alloc_l3(pmap_t pmap, vm_pindex_t ptepindex, struct rwlock **lockp) pd_entry_t *l1, *l2; l1index = ptepindex >> (L1_SHIFT - L2_SHIFT); - l1 = &pmap->pm_l1[l1index]; + l1 = &pmap->pm_top[l1index]; if (pmap_load(l1) == 0) { /* recurse for allocating page dir */ if (_pmap_alloc_l3(pmap, NUL2E + l1index, @@ -1437,7 +1434,7 @@ pmap_release(pmap_t pmap) LIST_REMOVE(pmap, pm_list); mtx_unlock(&allpmaps_lock); - m = PHYS_TO_VM_PAGE(DMAP_TO_PHYS((vm_offset_t)pmap->pm_l1)); + m = PHYS_TO_VM_PAGE(DMAP_TO_PHYS((vm_offset_t)pmap->pm_top)); vm_page_unwire_noq(m); vm_page_free(m); } @@ -4729,7 +4726,7 @@ sysctl_kmaps(SYSCTL_HANDLER_ARGS) else if (i == pmap_l1_index(VM_MIN_KERNEL_ADDRESS)) sbuf_printf(sb, "\nKernel map:\n"); - l1e = kernel_pmap->pm_l1[i]; + l1e = kernel_pmap->pm_top[i]; if ((l1e & PTE_V) == 0) { sysctl_kmaps_dump(sb, &range, sva); sva += L1_SIZE;