Date: Sat, 12 Jun 2021 14:01:09 GMT From: Andrew Turner <andrew@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Subject: git: b96893a48979 - stable/13 - Clean up early arm64 pmap code Message-ID: <202106121401.15CE19KX022308@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=b96893a489796750b1515cc46c725928e023dfd2 commit b96893a489796750b1515cc46c725928e023dfd2 Author: Andrew Turner <andrew@FreeBSD.org> AuthorDate: 2021-05-20 06:52:15 +0000 Commit: Andrew Turner <andrew@FreeBSD.org> CommitDate: 2021-06-12 01:21:55 +0000 Clean up early arm64 pmap code 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. Reviewed by: kib, markj Sponsored by: Innovate UK Differential Revision: https://reviews.freebsd.org/D30357 (cherry picked from commit e779604f1d4e5fd0cdf3a9d1bb756b168f97b39c) --- 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(-) diff --git a/sys/arm64/arm64/locore.S b/sys/arm64/arm64/locore.S index c62a2a5bd626..48dd794116cd 100644 --- a/sys/arm64/arm64/locore.S +++ b/sys/arm64/arm64/locore.S @@ -756,10 +756,6 @@ ENTRY(abort) b abort END(abort) - .align 3 -init_pt_va: - .quad pagetable /* XXX: Keep page tables VA */ - .section .init_pagetable, "aw", %nobits .align PAGE_SHIFT /* @@ -792,8 +788,6 @@ pagetable_end: el2_pagetable: .space PAGE_SIZE - .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 d4047fc84096..efe6bdd3d034 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 -= count; } -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 = (pd_entry_t *)l1pt; - *l1_slot = (va >> L1_SHIFT) & Ln_ADDR_MASK; - - /* Check locore has used a table L1 map */ - KASSERT((l1[*l1_slot] & ATTR_DESCR_MASK) == L1_TABLE, - ("Invalid bootstrap L1 table")); - /* Find the address of the L2 table */ - l2 = (pt_entry_t *)init_pt_va; - *l2_slot = 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 = pmap_early_page_idx(l1pt, va, &l1_slot, &l2_slot); + vm_paddr_t pa_page; - return ((l2[l2_slot] & ~ATTR_MASK) + (va & L2_OFFSET)); + pa_page = arm64_address_translate_s1e1r(va) & PAR_PA_MASK; + return (pa_page | (va & PAR_LOW_MASK)); } 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; #endif
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202106121401.15CE19KX022308>