From nobody Mon Mar 14 14:46:15 2022 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 8B77F1A2732A; Mon, 14 Mar 2022 14:46:16 +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 4KHK9M3nT9z3hSs; Mon, 14 Mar 2022 14:46:15 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1647269175; 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=Vzq8Rb2SivfM6Ymk4L5+kyLy4sg+F+8zgeOEJwlTV3Q=; b=RagpDzxEDqkEW5S2Yq06e78MUKJG40giAh+6BCRIaWTVS74T+2/Ko/QOwFFMaPT+ovA0is xcczdH2A7HpdSt6nx+prk/hAzqd7AH/qtB48E9rl6c6tZrjhkzwqsSkYVA5Q2UnZV/kluH Gy6QrLCtt4cOqYaMQaSvtisSViMiZjP2/fSYbZZcmrwoaIu6Z1mHPAI77Yc1yQVZfKHIiH l9aKJIY7jEgXxmZro+zgHAwqmfoxkReRViknTfa+EeBpxqHJaOfqAXLnMKD7qPL8Cf3uaj EFqy8MIVIAfVpmnAzJ4EIlieluWgfIfvgLZzuf0m+qgyn8u3jfX5cR8UCW4OHQ== 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 2A8997413; Mon, 14 Mar 2022 14:46:15 +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 22EEkFQI052078; Mon, 14 Mar 2022 14:46:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 22EEkFIs052077; Mon, 14 Mar 2022 14:46:15 GMT (envelope-from git) Date: Mon, 14 Mar 2022 14:46:15 GMT Message-Id: <202203141446.22EEkFIs052077@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 536a8230b435 - stable/13 - riscv: Handle four-level page tables in various pmap traversal routines 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: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 536a8230b4355d86629827d0718ddc66fb1d65a3 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1647269175; 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=Vzq8Rb2SivfM6Ymk4L5+kyLy4sg+F+8zgeOEJwlTV3Q=; b=EgadPqd13LlMQ5tFI4d5zO+2jvjEtKuBbKcZtNj9uxfpmTvUUJvsS9940S6Y++V14FPYcT gQ+iPfgYjYaqNitWHhSEQ8wEiuvwXRe+HnM29ahSJyizcFGRd6NFgavrGHjrYeX1c638PC n3LsPCfaPEp213DzezKpNTVo9GniEekt5MjlQdZW8BaS2D/y+Yq5EeHfNRulzTZMRKdx+P VxRDvo3y1hF3mKDS5VxbUp7OcpvRE5rzomP2f3jZ9WSRAXB1J9InT097QM//vGIN2s8ydl W6CHjyHwpB4axtSahe4Mzu2a/aHJATg3vRYIiAcquVW+ISSwHwAVtg4Ex4UIqA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1647269175; a=rsa-sha256; cv=none; b=aGTCCBtmivLvhMKmDOb12U9sOtWtkxYsjpE/TSIEL6U2fzXWPSYJkL+GI649Mu2dEFqLDx ynVShJFcqTbRBNXFnBc4iA5eIULEeXpuFloHeNNZ+qrJyEm2ZDKsL+SH2pKVz9SyH6d7zb S9z6NpFpnnjBdTXd9gSEAz3iIgZPQtA5OIfd1vuH39uy6ogq7kSupaWaBfaoTdMiDmVJ8d gIj+XQ1eh0YWV6g+DDhvOVebPnPx9uFZZlvvA594YBGyooob1kwYe5rdsGgGWLYoA27J+Z F0fyaSLZww3KkAkrROffxeIhHW1eIDtPYffq2/zbwb08wNywE6e/XpU94Lcj2w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=536a8230b4355d86629827d0718ddc66fb1d65a3 commit 536a8230b4355d86629827d0718ddc66fb1d65a3 Author: Mark Johnston AuthorDate: 2022-03-01 14:06:42 +0000 Commit: Mark Johnston CommitDate: 2022-03-14 14:45:45 +0000 riscv: Handle four-level page tables in various pmap traversal routines Reviewed by: jhb Sponsored by: The FreeBSD Foundation (cherry picked from commit 1321117200de1d1796adad856f7e04a66850e992) --- sys/riscv/riscv/pmap.c | 48 ++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 42 insertions(+), 6 deletions(-) diff --git a/sys/riscv/riscv/pmap.c b/sys/riscv/riscv/pmap.c index 71957b235e70..8aa99d52f2c9 100644 --- a/sys/riscv/riscv/pmap.c +++ b/sys/riscv/riscv/pmap.c @@ -2187,7 +2187,7 @@ pmap_remove(pmap_t pmap, vm_offset_t sva, vm_offset_t eva) struct spglist free; struct rwlock *lock; vm_offset_t va, va_next; - pd_entry_t *l1, *l2, l2e; + pd_entry_t *l0, *l1, *l2, l2e; pt_entry_t *l3; /* @@ -2206,7 +2206,19 @@ pmap_remove(pmap_t pmap, vm_offset_t sva, vm_offset_t eva) if (pmap->pm_stats.resident_count == 0) break; - l1 = pmap_l1(pmap, sva); + if (pmap_mode == PMAP_MODE_SV48) { + l0 = pmap_l0(pmap, sva); + if (pmap_load(l0) == 0) { + va_next = (sva + L0_SIZE) & ~L0_OFFSET; + if (va_next < sva) + va_next = eva; + continue; + } + l1 = pmap_l0_to_l1(l0, sva); + } else { + l1 = pmap_l1(pmap, sva); + } + if (pmap_load(l1) == 0) { va_next = (sva + L1_SIZE) & ~L1_OFFSET; if (va_next < sva) @@ -2357,7 +2369,7 @@ pmap_remove_all(vm_page_t m) void pmap_protect(pmap_t pmap, vm_offset_t sva, vm_offset_t eva, vm_prot_t prot) { - pd_entry_t *l1, *l2, l2e; + pd_entry_t *l0, *l1, *l2, l2e; pt_entry_t *l3, l3e, mask; vm_page_t m, mt; vm_paddr_t pa; @@ -2383,7 +2395,19 @@ pmap_protect(pmap_t pmap, vm_offset_t sva, vm_offset_t eva, vm_prot_t prot) resume: PMAP_LOCK(pmap); for (; sva < eva; sva = va_next) { - l1 = pmap_l1(pmap, sva); + if (pmap_mode == PMAP_MODE_SV48) { + l0 = pmap_l0(pmap, sva); + if (pmap_load(l0) == 0) { + va_next = (sva + L0_SIZE) & ~L0_OFFSET; + if (va_next < sva) + va_next = eva; + continue; + } + l1 = pmap_l0_to_l1(l0, sva); + } else { + l1 = pmap_l1(pmap, sva); + } + if (pmap_load(l1) == 0) { va_next = (sva + L1_SIZE) & ~L1_OFFSET; if (va_next < sva) @@ -3334,7 +3358,7 @@ void pmap_unwire(pmap_t pmap, vm_offset_t sva, vm_offset_t eva) { vm_offset_t va_next; - pd_entry_t *l1, *l2, l2e; + pd_entry_t *l0, *l1, *l2, l2e; pt_entry_t *l3, l3e; bool pv_lists_locked; @@ -3342,7 +3366,19 @@ pmap_unwire(pmap_t pmap, vm_offset_t sva, vm_offset_t eva) retry: PMAP_LOCK(pmap); for (; sva < eva; sva = va_next) { - l1 = pmap_l1(pmap, sva); + if (pmap_mode == PMAP_MODE_SV48) { + l0 = pmap_l0(pmap, sva); + if (pmap_load(l0) == 0) { + va_next = (sva + L0_SIZE) & ~L0_OFFSET; + if (va_next < sva) + va_next = eva; + continue; + } + l1 = pmap_l0_to_l1(l0, sva); + } else { + l1 = pmap_l1(pmap, sva); + } + if (pmap_load(l1) == 0) { va_next = (sva + L1_SIZE) & ~L1_OFFSET; if (va_next < sva)