From nobody Sat Jan 15 00:51:47 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 CAB6F1951997; Sat, 15 Jan 2022 00:51:49 +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 4JbKPJ3fsYz4kSf; Sat, 15 Jan 2022 00:51:48 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1642207908; 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=aNjarcZzQy5rbImmwySo7qM5AK2FjPxbCOoPnCrJO8g=; b=OjKqtLpmxGP4Be5/IRbImc0BBpx/NhdET36GsGo2j66iggasy4OtBglrEqNyO7T2BXTOWC njcFJOxF4tysqyQHJPk4Vebj0ZuwktUkY8mYfbsQXZGUVl9+R6CjILNwegJxVpxpuHM2L0 1h9Ddb+KfcZ4qFQWE7CAQyM8L/Uhy8ibTx7VNC3sGnIRjKmclauxwuHAwdGmkpRTILkj2w OylJWiwyeTjq0keK/7Ez1sTARpigKJh6un56/hn5MnCFnCHRMFdsd4czXOjX4h4TEnCHvI 1B147fOHII3sF6ncDo+/NeNk27GpBGwcytlMhyNAmCXcdwUZxJm2Lodns4IR5Q== 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 E06321DCB6; Sat, 15 Jan 2022 00:51:47 +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 20F0pld1031350; Sat, 15 Jan 2022 00:51:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 20F0plJf031349; Sat, 15 Jan 2022 00:51:47 GMT (envelope-from git) Date: Sat, 15 Jan 2022 00:51:47 GMT Message-Id: <202201150051.20F0plJf031349@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: fa8285570bdd - stable/13 - amd64 pmap: simplify vtopte() and vtopde() 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: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: fa8285570bdd55226b2e8aeed009e6f2c52ff17e Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1642207908; 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=aNjarcZzQy5rbImmwySo7qM5AK2FjPxbCOoPnCrJO8g=; b=FfWzB0cLYqFQmi/veJGf7KaMCuKMJ9a5EmjZwjJAXItz2Ls5xpx5+EEsscshOinfkjI+rO 7uqjX/VefrWumxjFuzzEHglprSc/Bwym4mgRsKF8OuAUCf+P3wgTnisu0VVZMbMQ1T66Ed qYbHCAfIPm3ZEtD1rZ32gFlEYHpJmVHdDl5uY8+7VQAI4jS16d8fCfnXTPoDQVyPcoAu92 oFnATtnZUzD2NTB+w2ycI6Y2VNQ8Zp5EkfmZRKOV5Y+osjsAep9m4eQKft+LGcQlmB1HKE CcUi2b+WQTCq+eEuc9++OrcJCvXi6mGRme4KymJEfeTpu4P2baHoGASzphJ9jA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1642207908; a=rsa-sha256; cv=none; b=ScKYtMxlW2x+7LFMEzgK5GcavR6OIujROUfXerG6MgTETfWC7JKn9asljVpKCmZRiHyKQj +WDOvw7X08wd/dTnmDBr1/obS8QyLx1Nc8AeXCPeSVYaQC/dpHoaibUoCytPsrtDvqjOxb Eyfrf71PQ+py+IXbWrnTHW++u8wmsxXX3NBDPmv4PcyMkZ4SyZH7TPlWj/FIJYfgLIPTJr UOHyBqwyX43khDdlFspm/4hfecRFUiadkasi2h4qOz9pW/MftgClqtCDH8vLWke2TE0XI/ +QKsF4ovH4darWlbTFt0gZURRfeKXBJ/SZ4Cr1bDHDFMe7cgyYaSde45Hgjjfg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=fa8285570bdd55226b2e8aeed009e6f2c52ff17e commit fa8285570bdd55226b2e8aeed009e6f2c52ff17e Author: Konstantin Belousov AuthorDate: 2022-01-05 00:26:12 +0000 Commit: Konstantin Belousov CommitDate: 2022-01-14 18:11:02 +0000 amd64 pmap: simplify vtopte() and vtopde() (cherry picked from commit 720a892ac60fc1fa7c784edc40f188c93ac7e0b7) --- sys/amd64/amd64/pmap.c | 39 +++++++++++++++++---------------------- 1 file changed, 17 insertions(+), 22 deletions(-) diff --git a/sys/amd64/amd64/pmap.c b/sys/amd64/amd64/pmap.c index 9f405baaa007..9119775afb0d 100644 --- a/sys/amd64/amd64/pmap.c +++ b/sys/amd64/amd64/pmap.c @@ -1504,40 +1504,28 @@ pmap_pt_page_count_adj(pmap_t pmap, int count) } } +pt_entry_t vtoptem __read_mostly = (1ul << (NPTEPGSHIFT + NPDEPGSHIFT + + NPDPEPGSHIFT + NPML4EPGSHIFT)) - 1; +pt_entry_t *PTmap __read_mostly = P4Tmap; + PMAP_INLINE pt_entry_t * vtopte(vm_offset_t va) { - u_int64_t mask; - KASSERT(va >= VM_MAXUSER_ADDRESS, ("vtopte on a uva/gpa 0x%0lx", va)); - if (la57) { - mask = ((1ul << (NPTEPGSHIFT + NPDEPGSHIFT + NPDPEPGSHIFT + - NPML4EPGSHIFT + NPML5EPGSHIFT)) - 1); - return (P5Tmap + ((va >> PAGE_SHIFT) & mask)); - } else { - mask = ((1ul << (NPTEPGSHIFT + NPDEPGSHIFT + NPDPEPGSHIFT + - NPML4EPGSHIFT)) - 1); - return (P4Tmap + ((va >> PAGE_SHIFT) & mask)); - } + return (PTmap + ((va >> PAGE_SHIFT) & vtoptem)); } +pd_entry_t vtopdem __read_mostly = (1ul << (NPDEPGSHIFT + NPDPEPGSHIFT + + NPML4EPGSHIFT)) - 1; +pd_entry_t *PDmap __read_mostly = P4Dmap; + static __inline pd_entry_t * vtopde(vm_offset_t va) { - u_int64_t mask; - KASSERT(va >= VM_MAXUSER_ADDRESS, ("vtopde on a uva/gpa 0x%0lx", va)); - if (la57) { - mask = ((1ul << (NPDEPGSHIFT + NPDPEPGSHIFT + - NPML4EPGSHIFT + NPML5EPGSHIFT)) - 1); - return (P5Dmap + ((va >> PDRSHIFT) & mask)); - } else { - mask = ((1ul << (NPDEPGSHIFT + NPDPEPGSHIFT + - NPML4EPGSHIFT)) - 1); - return (P4Dmap + ((va >> PDRSHIFT) & mask)); - } + return (PDmap + ((va >> PDRSHIFT) & vtopdem)); } static u_int64_t @@ -2207,6 +2195,13 @@ pmap_bootstrap_la57(void *arg __unused) */ v_pml5[PML5PML5I] = KPML5phys | X86_PG_RW | X86_PG_V | pg_nx; + vtoptem = (1ul << (NPTEPGSHIFT + NPDEPGSHIFT + NPDPEPGSHIFT + + NPML4EPGSHIFT + NPML5EPGSHIFT)) - 1; + PTmap = P5Tmap; + vtopdem = (1ul << (NPDEPGSHIFT + NPDPEPGSHIFT + + NPML4EPGSHIFT + NPML5EPGSHIFT)) - 1; + PDmap = P5Dmap; + kernel_pmap->pm_cr3 = KPML5phys; kernel_pmap->pm_pmltop = v_pml5; pmap_pt_page_count_adj(kernel_pmap, 1);