From nobody Sun Jul 23 05:35:02 2023 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 4R7sSQ3sgwz4nYWx; Sun, 23 Jul 2023 05:35:02 +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 4R7sSQ3NVDz3xqR; Sun, 23 Jul 2023 05:35:02 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1690090502; 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=zRPz1P0P4L6Ps6LP6kzXa2gq4NbwDYQFe1iIlPM75wg=; b=K2hFCRseXn/RwPjceUJAt/oz8MWGX/p8WSUmMd38iipnFBXuBIC06v9fCbrbKV4FJ2fNX/ tJNolJ8vwEZ/q7W0c6hmTkWp7/twGEZMd3n4CDdhoIPqRR5s+K0m5Hm0oqEt7npOQt1NV+ tWbfZLU6aZSOlhWeMFjbRSUaydoEVeriHmPQKKYMjeDuequFHLHaLqYs//E523HxJcgNya dG8X1NK+Lq0rHGcaKwb9/S34SlWka5hfuVZEVNcvq3aJtxcaX3IMQGU7wt2xGWmIZKLffa nIJXQXfZCHbmH+S/PkK/MKO5iHdeI7HNzDZadBammpkk1blxeMLx8S9eS3Ff9Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1690090502; 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=zRPz1P0P4L6Ps6LP6kzXa2gq4NbwDYQFe1iIlPM75wg=; b=nZKY8+RU+UYohuYYtslDkePtpJ0OY5lEdmN/dYww5QFK3y9BfZjBijaqsR8x5/8dw4EdUZ WapUBgiVqzJn/GRcuSnLjThr3NKkQgzEiZpu1F8ww3Rynt9UtdZ7qGxr+3ath3tP1fqYTE WfZLnmgnkkICoJM/dyNX5ZkkdR7JvnnbyVMwl05Pg6qVOeCrUUWqnRpMW1QtPU6eX3ymgI Up/DT7uIoZtfPsN/GeP72p3a29aE5L3U10KO5mgET4kd4l+QmIJF9seY33UXtMwGPc0W9g eEi+AtX5K6xBTFHwgomOafqQinwK2mlN9cTcwnbB0ouFHb1/IQzfFZvalNOp5Q== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1690090502; a=rsa-sha256; cv=none; b=llBG8Trh5NKi2G7TGV+60d+H4UEqf6m4WJA9UGuUOKbXxa+cWZL87zC98eYBLdmBrfeSvf 2LPfVAS+PNVBL27UhKQmm8Cdi3lCRvcFJWDVjcG8XK39WeTGk1eEH3KqP9sfmcEbSj7Q1M +Xlk04rp6NsixKhbtwhFj+cM7JeZLjIG/BTns1alk8k4Pjy3/vVkahVS0KDGtkahb7Ux3g AbFM+X6u7mIup6KJcKIhEcFrpA59z/Fv/8jDNKCDkzVKNnBqa4+O3Z/b0BTFIPEyrBEnxo 2HzKtbj+1iMEZ3ly+/+eDpW4Q3xkLfu3g7IQe2RS9usugISZtegYIytZrQgrjg== 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 4R7sSQ27fszPNF; Sun, 23 Jul 2023 05:35:02 +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 36N5Z2lU083478; Sun, 23 Jul 2023 05:35:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 36N5Z2HT083477; Sun, 23 Jul 2023 05:35:02 GMT (envelope-from git) Date: Sun, 23 Jul 2023 05:35:02 GMT Message-Id: <202307230535.36N5Z2HT083477@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alan Cox Subject: git: 0aebcfc9f4d6 - main - arm64 pmap: Eliminate some duplication of code 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: alc X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 0aebcfc9f4d642a8bef95504dc928fab78af33bf Auto-Submitted: auto-generated The branch main has been updated by alc: URL: https://cgit.FreeBSD.org/src/commit/?id=0aebcfc9f4d642a8bef95504dc928fab78af33bf commit 0aebcfc9f4d642a8bef95504dc928fab78af33bf Author: Alan Cox AuthorDate: 2023-07-22 17:41:49 +0000 Commit: Alan Cox CommitDate: 2023-07-23 05:34:17 +0000 arm64 pmap: Eliminate some duplication of code pmap_unmapbios() can simply call pmap_kremove_device() rather than duplicating its code. While I'm here, add a comment to pmap_kremove_device() explaining its proper use, and fix a whitespace issue. MFC after: 1 week --- sys/arm64/arm64/pmap.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/sys/arm64/arm64/pmap.c b/sys/arm64/arm64/pmap.c index b2591437b3b3..dfed0142f273 100644 --- a/sys/arm64/arm64/pmap.c +++ b/sys/arm64/arm64/pmap.c @@ -2032,6 +2032,13 @@ pmap_kremove(vm_offset_t va) pmap_s1_invalidate_page(kernel_pmap, va, true); } +/* + * Remove the specified range of mappings from the kernel address space. + * + * Should only be applied to mappings that were created by pmap_kenter() or + * pmap_kenter_device(). Nothing about this function is actually specific + * to device mappings. + */ void pmap_kremove_device(vm_offset_t sva, vm_size_t size) { @@ -2039,7 +2046,7 @@ pmap_kremove_device(vm_offset_t sva, vm_size_t size) vm_offset_t va; KASSERT((sva & L3_OFFSET) == 0, - ("pmap_kremove_device: Invalid virtual address")); + ("pmap_kremove_device: Invalid virtual address")); KASSERT((size & PAGE_MASK) == 0, ("pmap_kremove_device: Mapping is not page-sized")); @@ -6550,7 +6557,7 @@ void pmap_unmapbios(void *p, vm_size_t size) { struct pmap_preinit_mapping *ppim; - vm_offset_t offset, tmpsize, va, va_trunc; + vm_offset_t offset, va, va_trunc; pd_entry_t *pde; pt_entry_t *l2; int i, lvl, l2_blocks, block; @@ -6600,14 +6607,8 @@ pmap_unmapbios(void *p, vm_size_t size) size = round_page(offset + size); va = trunc_page(va); - pde = pmap_pde(kernel_pmap, va, &lvl); - KASSERT(pde != NULL, - ("pmap_unmapbios: Invalid page entry, va: 0x%lx", va)); - KASSERT(lvl == 2, ("pmap_unmapbios: Invalid level %d", lvl)); - /* Unmap and invalidate the pages */ - for (tmpsize = 0; tmpsize < size; tmpsize += PAGE_SIZE) - pmap_kremove(va + tmpsize); + pmap_kremove_device(va, size); kva_free(va, size); }