From owner-dev-commits-src-main@freebsd.org Sat May 29 08:03:07 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 203D563C164; Sat, 29 May 2021 08:03:07 +0000 (UTC) (envelope-from andrew@freebsd.org) Received: from fry.fubar.geek.nz (fry.fubar.geek.nz [139.59.165.16]) by mx1.freebsd.org (Postfix) with ESMTP id 4FsYvZ4Vznz4R8l; Sat, 29 May 2021 08:03:06 +0000 (UTC) (envelope-from andrew@freebsd.org) Received: from [192.168.42.21] (cpc91232-cmbg18-2-0-cust554.5-4.cable.virginm.net [82.2.126.43]) by fry.fubar.geek.nz (Postfix) with ESMTPSA id 9FF114E6D9; Sat, 29 May 2021 08:02:58 +0000 (UTC) Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.20\)) Subject: Re: git: e779604f1d4e - main - Clean up early arm64 pmap code From: Andrew Turner X-Priority: 3 (Normal) In-Reply-To: <424236367.2001.1621851607455@localhost> Date: Sat, 29 May 2021 09:02:57 +0100 Cc: "dev-commits-src-all@freebsd.org" , "src-committers@freebsd.org" , "dev-commits-src-main@freebsd.org" Message-Id: <994489C4-45DA-49A9-ACC8-FF2CF04D2F4A@freebsd.org> References: <424236367.2001.1621851607455@localhost> To: Ronald Klop X-Mailer: Apple Mail (2.3445.104.20) X-Rspamd-Queue-Id: 4FsYvZ4Vznz4R8l X-Spamd-Bar: / Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [0.00 / 15.00]; local_wl_from(0.00)[freebsd.org]; ASN(0.00)[asn:14061, ipnet:139.59.160.0/20, country:US] Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.34 X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 29 May 2021 08:03:07 -0000 Other than simplifying the code it also helps downstream in CheriBSD = where init_pt_va could be different sizes based on the kernel = configuration. Rather than changing the size of this variable it=E2=80=99s= easier to just ask the hardware to perform the translation. Andrew > On 24 May 2021, at 11:20, Ronald Klop wrote: >=20 > Hi, >=20 > Out of curiosity. What is the expected gain? (Next to simplicity of = the code of course.) >=20 > Ronald >=20 > Van: Andrew Turner > Datum: 24 mei 2021 11:44 > Aan: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, = dev-commits-src-main@FreeBSD.org > Onderwerp: git: e779604f1d4e - main - Clean up early arm64 pmap code >=20 > The branch main has been updated by andrew: >=20 > URL: = https://cgit.FreeBSD.org/src/commit/?id=3De779604f1d4e5fd0cdf3a9d1bb756b16= 8f97b39c = >=20 > commit e779604f1d4e5fd0cdf3a9d1bb756b168f97b39c > Author: Andrew Turner > AuthorDate: 2021-05-20 06:52:15 +0000 > Commit: Andrew Turner > CommitDate: 2021-05-24 09:22:19 +0000 >=20 > Clean up early arm64 pmap code > =20 > Early in the arm64 pmap code we need to translate between a = virtual > address and a physical address. Rather than manually walking the = page > table we can ask the hardware to do it for us. > =20 > Reviewed by: kib, markj > Sponsored by: Innovate UK > Differential Revision: https://reviews.freebsd.org/D30357 = > --- > sys/arm64/arm64/locore.S | 6 ------ > sys/arm64/arm64/pmap.c | 28 +++------------------------- > sys/arm64/include/vmparam.h | 1 - > 3 files changed, 3 insertions(+), 32 deletions(-) >=20 > diff --git a/sys/arm64/arm64/locore.S b/sys/arm64/arm64/locore.S > index f5e6bbd604a5..472a052e9903 100644 > --- a/sys/arm64/arm64/locore.S > +++ b/sys/arm64/arm64/locore.S > @@ -735,10 +735,6 @@ ENTRY(abort) > b abort > END(abort) > =20 > - .align 3 > -init_pt_va: > - .quad pagetable /* XXX: Keep page tables VA */ > - > .section .init_pagetable, "aw", %nobits > .align PAGE_SHIFT > /* > @@ -773,8 +769,6 @@ pagetable_end: > el2_pagetable: > .space PAGE_SIZE > =20 > - .globl init_pt_va > - > .align 4 > initstack: > .space (PAGE_SIZE * KSTACK_PAGES) > diff --git a/sys/arm64/arm64/pmap.c b/sys/arm64/arm64/pmap.c > index a3be232a56bf..bc5d228af5ad 100644 > --- a/sys/arm64/arm64/pmap.c > +++ b/sys/arm64/arm64/pmap.c > @@ -742,35 +742,13 @@ pmap_resident_count_dec(pmap_t pmap, int count) > pmap->pm_stats.resident_count -=3D count; > } > =20 > -static pt_entry_t * > -pmap_early_page_idx(vm_offset_t l1pt, vm_offset_t va, u_int *l1_slot, > - u_int *l2_slot) > -{ > - pt_entry_t *l2; > - pd_entry_t *l1; > - > - l1 =3D (pd_entry_t *)l1pt; > - *l1_slot =3D (va >> L1_SHIFT) & Ln_ADDR_MASK; > - > - /* Check locore has used a table L1 map */ > - KASSERT((l1[*l1_slot] & ATTR_DESCR_MASK) =3D=3D L1_TABLE, > - ("Invalid bootstrap L1 table")); > - /* Find the address of the L2 table */ > - l2 =3D (pt_entry_t *)init_pt_va; > - *l2_slot =3D pmap_l2_index(va); > - > - return (l2); > -} > - > static vm_paddr_t > pmap_early_vtophys(vm_offset_t l1pt, vm_offset_t va) > { > - u_int l1_slot, l2_slot; > - pt_entry_t *l2; > - > - l2 =3D pmap_early_page_idx(l1pt, va, &l1_slot, &l2_slot); > + vm_paddr_t pa_page; > =20 > - return ((l2[l2_slot] & ~ATTR_MASK) + (va & L2_OFFSET)); > + pa_page =3D arm64_address_translate_s1e1r(va) & PAR_PA_MASK; > + return (pa_page | (va & PAR_LOW_MASK)); > } > =20 > static vm_offset_t > diff --git a/sys/arm64/include/vmparam.h b/sys/arm64/include/vmparam.h > index 4a90c7711e01..a42c68d52887 100644 > --- a/sys/arm64/include/vmparam.h > +++ b/sys/arm64/include/vmparam.h > @@ -228,7 +228,6 @@ extern vm_paddr_t dmap_phys_base; > extern vm_paddr_t dmap_phys_max; > extern vm_offset_t dmap_max_addr; > extern vm_offset_t vm_max_kernel_address; > -extern vm_offset_t init_pt_va; > =20 > #endif > =20 > _______________________________________________ > dev-commits-src-all@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all = > To unsubscribe, send any mail to = "dev-commits-src-all-unsubscribe@freebsd.org" >=20 >=20 >=20