From nobody Fri Jun 14 18:02:26 2024 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 4W16Yt3C1Vz5PGFx; Fri, 14 Jun 2024 18:02:26 +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 4W16Yt2QXmz46tq; Fri, 14 Jun 2024 18:02:26 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1718388146; 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=uRW+ASm8bB6vDT1vqIsIVkWL77yE+5PLcUYE6UdwScc=; b=FsXzNEWa7D8322Ud34Pdkgf1iwg5ZHkQKpVCiMXV8mdxKJsH+LDdBXbI92YiTsJkebaamG FXJABcQgXn7lzJyE6gKBKW6/JgEUpV63/A8OXXW7oMTBQWejTutBkrFAjOQdYnPMMmELno 3wVJmOEUChslWtYEHEtlosTLsQu5cscWoFimiRxpus6ZyW78zV2rW16WTrFkHK1I9DWMMe 7CP9udtkZpl3gQ94yIa4SfvLujAevpA6gEd3PIknIALQiWCU/+55l0Y/2ddb5LFFPftNmA n6c2V0Xd/9lfKFCpBr6ZpiisJDzp3MALxSyNkmOhMQLP/siuIZQkC/74aYc+UA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1718388146; a=rsa-sha256; cv=none; b=Tq/PtOz0zC2qG6jArkQPeqGiHumMovUCKWbdPKs0Pd9oAFMVdfL7iE8ZN3w920zZqVF93r BKXU7TZBJssC264ZnfyDSKgsN7BrWAh5GbwBSgcxEoKAjm0IcyKpkB2tWXDARtgQNOq8AS TXBAtu+gfS3PuUg0FPc6MtObN0p+Wddsg2bmN9nnVNfo8vYMwLPLkAVXlvBKSP7GXAYV+3 ruowe0FNboYJazoWNiAIqaPFnHE6hKBo7X+8/7LyiTPwJDo8bnRmy4RvgeE8H0clp1mnUT 0wA9H4eEw07zG7crrd/iwA5WZoEWSxWZMN7x1e8w3oy1AxjAqpP9TfG1+W9TDQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1718388146; 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=uRW+ASm8bB6vDT1vqIsIVkWL77yE+5PLcUYE6UdwScc=; b=ms2Q9FQfcl42ULNihrPHFxgFNGEmyUq6qE+a739dVePhU0jR/k00n7SNBL/wyhDvlcr+hm 8yM+hFTDAAlTBhp4qWVQ840ekHGBw5oDi362G6RJvDLEkR+EhNnpQuI30zZbdIMvm/MeOs 1kFvkPbyiPtDcpneF1WAf8sNJ5+E/Ndrpfw6Uqeo67o/Uj9GvhbuBL7SbkqnAxmXO+ocF6 61jkDF4t/utGMJBJDHgo7mCKSJjzeJDqC8C3B/L2+2z145NpOsppvbV32dR2tRRwI/4PL/ nYbbWXplj1zoizrqVr22eDpxbLrMTxxRYgiUAo/7POtuYFRmuCEecXr+2xEnFA== 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 4W16Yt2222zWDP; Fri, 14 Jun 2024 18:02:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 45EI2Qif052996; Fri, 14 Jun 2024 18:02:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 45EI2Qqu052993; Fri, 14 Jun 2024 18:02:26 GMT (envelope-from git) Date: Fri, 14 Jun 2024 18:02:26 GMT Message-Id: <202406141802.45EI2Qqu052993@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mitchell Horne Subject: git: 3ff981587ff8 - main - riscv: Don't handle missing kernel L3 pages 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: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mhorne X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 3ff981587ff8f05c06092d05edcc50f1ede1bbd6 Auto-Submitted: auto-generated The branch main has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=3ff981587ff8f05c06092d05edcc50f1ede1bbd6 commit 3ff981587ff8f05c06092d05edcc50f1ede1bbd6 Author: Mitchell Horne AuthorDate: 2023-11-24 17:21:51 +0000 Commit: Mitchell Horne CommitDate: 2024-06-14 18:02:05 +0000 riscv: Don't handle missing kernel L3 pages This code path should never be hit, if it does it means we did not bootstrap correctly. Turn it into a panic like we do on amd64 and arm64. Reviewed by: markj, jhb Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D45326 --- sys/riscv/riscv/pmap.c | 43 +++++-------------------------------------- 1 file changed, 5 insertions(+), 38 deletions(-) diff --git a/sys/riscv/riscv/pmap.c b/sys/riscv/riscv/pmap.c index 8176975b049c..1902f1f4009b 100644 --- a/sys/riscv/riscv/pmap.c +++ b/sys/riscv/riscv/pmap.c @@ -2911,14 +2911,13 @@ pmap_enter(pmap_t pmap, vm_offset_t va, vm_page_t m, vm_prot_t prot, u_int flags, int8_t psind) { struct rwlock *lock; - pd_entry_t *l1, *l2, l2e; + pd_entry_t *l2, l2e; pt_entry_t new_l3, orig_l3; pt_entry_t *l3; pv_entry_t pv; - vm_paddr_t opa, pa, l2_pa, l3_pa; - vm_page_t mpte, om, l2_m, l3_m; - pt_entry_t entry; - pn_t l2_pn, l3_pn, pn; + vm_paddr_t opa, pa; + vm_page_t mpte, om; + pn_t pn; int rv; bool nosleep; @@ -2990,39 +2989,7 @@ pmap_enter(pmap_t pmap, vm_offset_t va, vm_page_t m, vm_prot_t prot, } l3 = pmap_l3(pmap, va); } else { - l3 = pmap_l3(pmap, va); - /* TODO: This is not optimal, but should mostly work */ - if (l3 == NULL) { - if (l2 == NULL) { - l2_m = vm_page_alloc_noobj(VM_ALLOC_WIRED | - VM_ALLOC_ZERO); - if (l2_m == NULL) - panic("pmap_enter: l2 pte_m == NULL"); - - l2_pa = VM_PAGE_TO_PHYS(l2_m); - l2_pn = (l2_pa / PAGE_SIZE); - - l1 = pmap_l1(pmap, va); - entry = (PTE_V); - entry |= (l2_pn << PTE_PPN0_S); - pmap_store(l1, entry); - pmap_distribute_l1(pmap, pmap_l1_index(va), entry); - l2 = pmap_l1_to_l2(l1, va); - } - - l3_m = vm_page_alloc_noobj(VM_ALLOC_WIRED | - VM_ALLOC_ZERO); - if (l3_m == NULL) - panic("pmap_enter: l3 pte_m == NULL"); - - l3_pa = VM_PAGE_TO_PHYS(l3_m); - l3_pn = (l3_pa / PAGE_SIZE); - entry = (PTE_V); - entry |= (l3_pn << PTE_PPN0_S); - pmap_store(l2, entry); - l3 = pmap_l2_to_l3(l2, va); - } - pmap_invalidate_page(pmap, va); + panic("pmap_enter: missing L3 table for kernel va %#lx", va); } orig_l3 = pmap_load(l3);