From nobody Mon Feb 19 16:45:29 2024 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 4TdpLf0Fzpz5C9Nm; Mon, 19 Feb 2024 16:45:30 +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 4TdpLd5QSZz4c2y; Mon, 19 Feb 2024 16:45:29 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1708361129; 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=eSJ5FBOYLCcpH0ocosWQ/1LtcKFZSO9KEUL92C7FZRU=; b=TdP1o2BkpaNgsb7JJI5+KQSCIIESDmRbnFUoyRBCi+znYumpNdyw2X4dply7+CFvSnftlL R1heRHap0h+akt8JAm/SaK8gdzYd5v2be++B5FWvcyYPGwL+3ixIzdQGj9/LlXCFzqscQF 4EUAACzJhVmCguwIngK9uW98NX2ZBSrJfjHsSyGhdFXL4KoKncXKtEbFDINl+lBRfRTeaG 3JaNb0C8Ssblz57XMQrzvR7hpmws3Ic8vK9CThNMIpdFrfpv6RV1sfZkmB/zYtNdJcVFhw D1npRzOYwRiGSnEK0rnSDVA1iISar2xCipwNCVrtt2u87FnxV7wROmlXXXLhtQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1708361129; 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=eSJ5FBOYLCcpH0ocosWQ/1LtcKFZSO9KEUL92C7FZRU=; b=aFBOrvpHTKngj2PA5Lmn4bQodOAiEI5SPDNWDFt7Pn8TksacpKFvPFgehvCekWp4mbdien kr/bc+bvVdruQxk5rYbQa7vjZl0Mj4Kpotnty0iAJ2J/TzNTs/bdmuFR0Tv2gjUduig+rk et8mELQ5XyAkv5tH2JFyZcO/qjkNrYcKQka0AO7WlWymvZoefBaVgQVEi73uLn8gdQUMz3 2h//IgFBRgyfcKwendzE+GwmCLLtuoVl7IV/NhvFkmmJe1DQG2HXF1jpobQmGcaiKvpKeZ g9D3GAscyJd4RjuMA8j8dA2OEYQecCtHvPaICtaezGDqxa1C4a53ih+cOBKxgw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1708361129; a=rsa-sha256; cv=none; b=O/ZU7/LAwN38P8Q2gKXG0UK8eawZoC6ZThXsqsm9/Kkt7nawoUZbuVNsTyVXCnfy4kjAh+ Gbodj8k7vnmV+mgF4ricrA48vbRE+gxeZXiOWzQXjK7AZcyakSZVWY67pl4/d20VAbwEM6 SgNzUwKtpOkWG/Watc/2mIGX35LH4Y8vgeyQiEjkgG9jxkwpQHSMoMoTD3VVzRDgkyQRSX 5yEFbO+HV8x0D8ClW0i37wYoC9VtHjtQC/RmAASq+V9kjgizx6hhaeywcbfXJD3OjAHUO8 LwoN+CaV/FWI8tV89+S9RAbxsRAC63fT36+wQNQbTP6AmJMmdNlbhxR05iIyfQ== 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 4TdpLd4XMgzjQD; Mon, 19 Feb 2024 16:45:29 +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 41JGjTM7096534; Mon, 19 Feb 2024 16:45:29 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 41JGjTpJ096531; Mon, 19 Feb 2024 16:45:29 GMT (envelope-from git) Date: Mon, 19 Feb 2024 16:45:29 GMT Message-Id: <202402191645.41JGjTpJ096531@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Andrew Turner Subject: git: a46059e45f4a - stable/14 - arm64: Make kern_delta unneeded in the boot params 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: andrew X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: a46059e45f4a6c3001468774e10af9d41c9f4966 Auto-Submitted: auto-generated The branch stable/14 has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=a46059e45f4a6c3001468774e10af9d41c9f4966 commit a46059e45f4a6c3001468774e10af9d41c9f4966 Author: Andrew Turner AuthorDate: 2023-11-13 15:29:30 +0000 Commit: Andrew Turner CommitDate: 2024-02-19 13:17:09 +0000 arm64: Make kern_delta unneeded in the boot params Use pmap_early_vtophys to translate from a virtual to physical where we were previously using the calculated delta. This means that, while we still calculate it, we don't need to pass it to initarm or either pmap bootstrap functions. While here remove an unneeded printf that indirectly used it or was related to the previous printf. Sponsored by: Arm Ltd Differential Revision: https://reviews.freebsd.org/D42567 (cherry picked from commit ba31362694fe465b88a025ac7c35ad7f378efc86) (cherry picked from commit f3a83b3a6257ea0fd5aba66ff42218350228b321) --- sys/arm64/arm64/genassym.c | 1 - sys/arm64/arm64/locore.S | 15 ++++----------- sys/arm64/arm64/machdep.c | 2 +- sys/arm64/arm64/pmap.c | 12 +++--------- sys/arm64/include/machdep.h | 1 - sys/arm64/include/pmap.h | 2 +- 6 files changed, 9 insertions(+), 24 deletions(-) diff --git a/sys/arm64/arm64/genassym.c b/sys/arm64/arm64/genassym.c index 0fb00d8aceba..d4970177ab71 100644 --- a/sys/arm64/arm64/genassym.c +++ b/sys/arm64/arm64/genassym.c @@ -40,7 +40,6 @@ ASSYM(BOOTPARAMS_SIZE, roundup2(sizeof(struct arm64_bootparams), STACKALIGNBYTES + 1)); ASSYM(BP_MODULEP, offsetof(struct arm64_bootparams, modulep)); -ASSYM(BP_KERN_DELTA, offsetof(struct arm64_bootparams, kern_delta)); ASSYM(BP_KERN_STACK, offsetof(struct arm64_bootparams, kern_stack)); ASSYM(BP_KERN_TTBR0, offsetof(struct arm64_bootparams, kern_ttbr0)); ASSYM(BP_BOOT_EL, offsetof(struct arm64_bootparams, boot_el)); diff --git a/sys/arm64/arm64/locore.S b/sys/arm64/arm64/locore.S index f36ee5e75185..ee3404958789 100644 --- a/sys/arm64/arm64/locore.S +++ b/sys/arm64/arm64/locore.S @@ -82,11 +82,10 @@ ENTRY(_start) msr contextidr_el1, xzr /* Get the virt -> phys offset */ - bl get_virt_delta + bl get_load_phys_addr /* * At this point: - * x29 = PA - VA * x28 = Our physical load address */ @@ -141,11 +140,7 @@ virtdone: sub sp, sp, #BOOTPARAMS_SIZE mov x0, sp - /* Negate the delta so it is VA -> PA */ - neg x29, x29 - str x1, [x0, #BP_MODULEP] - str x29, [x0, #BP_KERN_DELTA] adrp x25, initstack add x25, x25, :lo12:initstack str x25, [x0, #BP_KERN_STACK] @@ -367,11 +362,9 @@ LENTRY(drop_to_el1) LEND(drop_to_el1) /* - * Get the delta between the physical address we were loaded to and the - * virtual address we expect to run from. This is used when building the - * initial page table. + * Get the physical address the kernel was loaded at. */ -LENTRY(get_virt_delta) +LENTRY(get_load_phys_addr) /* Load the physical address of virt_map */ adrp x29, virt_map add x29, x29, :lo12:virt_map @@ -387,7 +380,7 @@ LENTRY(get_virt_delta) .align 3 virt_map: .quad virt_map -LEND(get_virt_delta) +LEND(get_load_phys_addr) /* * This builds the page tables containing the identity map, and the kernel diff --git a/sys/arm64/arm64/machdep.c b/sys/arm64/arm64/machdep.c index 7aa20357acf4..01896c15e650 100644 --- a/sys/arm64/arm64/machdep.c +++ b/sys/arm64/arm64/machdep.c @@ -957,7 +957,7 @@ initarm(struct arm64_bootparams *abp) pan_setup(); /* Bootstrap enough of pmap to enter the kernel proper */ - pmap_bootstrap(KERNBASE - abp->kern_delta, lastaddr - KERNBASE); + pmap_bootstrap(lastaddr - KERNBASE); /* Exclude entries needed in the DMAP region, but not phys_avail */ if (efihdr != NULL) exclude_efi_map_entries(efihdr); diff --git a/sys/arm64/arm64/pmap.c b/sys/arm64/arm64/pmap.c index d9d224f44fb6..b372295d5d43 100644 --- a/sys/arm64/arm64/pmap.c +++ b/sys/arm64/arm64/pmap.c @@ -1258,22 +1258,16 @@ pmap_bootstrap_allocate_kasan_l2(vm_paddr_t start_pa, vm_paddr_t end_pa, * Bootstrap the system enough to run with virtual memory. */ void -pmap_bootstrap(vm_paddr_t kernstart, vm_size_t kernlen) +pmap_bootstrap(vm_size_t kernlen) { vm_offset_t dpcpu, msgbufpv; vm_paddr_t start_pa, pa, min_pa; - uint64_t kern_delta; int i; /* Verify that the ASID is set through TTBR0. */ KASSERT((READ_SPECIALREG(tcr_el1) & TCR_A1) == 0, ("pmap_bootstrap: TCR_EL1.A1 != 0")); - kern_delta = KERNBASE - kernstart; - - printf("pmap_bootstrap %lx %lx\n", kernstart, kernlen); - printf("%lx\n", (KERNBASE >> L1_SHIFT) & Ln_ADDR_MASK); - /* Set this early so we can use the pagetable walking functions */ kernel_pmap_store.pm_l0 = pagetable_l0_ttbr1; PMAP_LOCK_INIT(kernel_pmap); @@ -1288,7 +1282,7 @@ pmap_bootstrap(vm_paddr_t kernstart, vm_size_t kernlen) kernel_pmap->pm_asid_set = &asids; /* Assume the address we were loaded to is a valid physical address */ - min_pa = KERNBASE - kern_delta; + min_pa = pmap_early_vtophys(KERNBASE); physmap_idx = physmem_avail(physmap, nitems(physmap)); physmap_idx /= 2; @@ -1316,7 +1310,7 @@ pmap_bootstrap(vm_paddr_t kernstart, vm_size_t kernlen) */ bs_state.table_attrs &= ~TATTR_PXN_TABLE; - start_pa = pa = KERNBASE - kern_delta; + start_pa = pa = pmap_early_vtophys(KERNBASE); /* * Create the l2 tables up to VM_MAX_KERNEL_ADDRESS. We assume that the diff --git a/sys/arm64/include/machdep.h b/sys/arm64/include/machdep.h index 026a64e0a350..80cb28bcfbeb 100644 --- a/sys/arm64/include/machdep.h +++ b/sys/arm64/include/machdep.h @@ -31,7 +31,6 @@ struct arm64_bootparams { vm_offset_t modulep; - uint64_t kern_delta; vm_offset_t kern_stack; vm_paddr_t kern_ttbr0; uint64_t hcr_el2; diff --git a/sys/arm64/include/pmap.h b/sys/arm64/include/pmap.h index e7d23dfb2844..4b4d47ccc7af 100644 --- a/sys/arm64/include/pmap.h +++ b/sys/arm64/include/pmap.h @@ -144,7 +144,7 @@ extern vm_offset_t virtual_end; #define pmap_vm_page_alloc_check(m) void pmap_activate_vm(pmap_t); -void pmap_bootstrap(vm_paddr_t, vm_size_t); +void pmap_bootstrap(vm_size_t); int pmap_change_attr(vm_offset_t va, vm_size_t size, int mode); int pmap_change_prot(vm_offset_t va, vm_size_t size, vm_prot_t prot); void pmap_kenter(vm_offset_t sva, vm_size_t size, vm_paddr_t pa, int mode);