From nobody Tue Sep 27 14:03:08 2022 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 4McLth36SZz4d4Mg; Tue, 27 Sep 2022 14:03:08 +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 4McLth2Jdmz3YP3; Tue, 27 Sep 2022 14:03:08 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1664287388; 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=q+NDHOwugvpkI39bsqyEKH1mf6y/9h0jtOyNOpL7wQA=; b=gPGWupUEV2Z1LPTkiSfdx9KxmuHVcElApKIj+LVpoyPhorUEQHuEyUxg7T8BT7+AdboEab L6WkofkcLlra2iRQUycjXEkTnU8vCKI2H0JzTQru0grzgNbORcJPjkwaKM97HuRbOyp/VQ QSrxG3RR1R+lWyjAXVE6sn3M1wZmcjiJVpDd3iw+PxB5iYsoFChtrosowE6bfNR3noWYfy dQfsHmJVMXPmH7C/FMiOIUC/ZScJ8JliCUeVgIGA4gX6741zvmfy24xzTRhf1dfwatiftU 2IUZH8MVgjtPT2aJegA3sdi3GF6LSDUqT30TxhBFdD+mfoT1JcynqmsU8aB4eQ== 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 4McLth1LT8z18FR; Tue, 27 Sep 2022 14:03:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 28RE38Mk028232; Tue, 27 Sep 2022 14:03:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 28RE387S028231; Tue, 27 Sep 2022 14:03:08 GMT (envelope-from git) Date: Tue, 27 Sep 2022 14:03:08 GMT Message-Id: <202209271403.28RE387S028231@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Andrew Turner Subject: git: 8da12732344d - main - Remove unneeded variables in the arm64 pmap bootstrap 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: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@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/main X-Git-Reftype: branch X-Git-Commit: 8da12732344dc9b58a3855c2cf68980a73c4a9b0 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1664287388; 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=q+NDHOwugvpkI39bsqyEKH1mf6y/9h0jtOyNOpL7wQA=; b=SKDCicG7Zrv8WpIcUO/Fld8etleLY4UsaDfDr0jL+jc17Sw2QJfezCXZGcC5WXgwiISb01 7eFLPREoZkvf/TT5Yv7zkEqI8sOZS8OQN9HEWXK6YS3HcPqEtEPcrU3B2uebntY3IyrFJ/ auWrLyAdsoQ575M3r7t3koqwCCCyBjxK4QGE1ADcWFmvPJzBgThZ2gU5pT0jTAUTvlJpd2 Q1VdVtEMrahHYLvX0bZFjFiUTWZc5RqQ6kdfE1xlCPrFwvwCY8dlOwcndWEutv3+6iGlgn 5PoUh+4yZpVp2Pvz0eiaRSaMAwQLIMh6pb1fHT6hEuyKQ6STD+Jxau0Ja9oQnw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1664287388; a=rsa-sha256; cv=none; b=Tzr20KyozlhWCHtG0Yn0xzqiGD4Iq2t4TmWAyTlHLar20zkisCFAIHKyClAFCpGuP1ZBoD Qg28jvku9I8R49O1deRQ2xV/6wBuAj+gcfDf7Xrdhi3mh6kU4lZKu4PtxMu/irVfxRFdcN 0CfL0g6C6Fb9YAwyisjNwvW5h0WUMQkpsaJ0A4j6G2PEAxlZIzGMwZy3tdVp6mr6u+dymG Xw0Vi6IHcJN/IUPzgrOesCRcf562Cr4VfNCOnO/gt8S6tGnyZQnUtcJ0CujhN9wvG8+FAo 0WWJXp8PjXTCJ3oryogfzavyQAcJNHWmLl5V/pTckiqFHlcvtK8ItB7n5ZKAdw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=8da12732344dc9b58a3855c2cf68980a73c4a9b0 commit 8da12732344dc9b58a3855c2cf68980a73c4a9b0 Author: Andrew Turner AuthorDate: 2022-09-26 14:26:40 +0000 Commit: Andrew Turner CommitDate: 2022-09-27 13:47:30 +0000 Remove unneeded variables in the arm64 pmap bootstrap These are now unneeded after cleaning up the pmap bootstrap process. Remove them and the variables that set them. Sponsored by: The FreeBSD Foundation --- sys/arm64/arm64/genassym.c | 2 -- sys/arm64/arm64/locore.S | 6 ----- sys/arm64/arm64/machdep.c | 3 +-- sys/arm64/arm64/pmap.c | 54 +++++++++++++++++---------------------------- sys/arm64/include/machdep.h | 2 -- sys/arm64/include/pmap.h | 2 +- 6 files changed, 22 insertions(+), 47 deletions(-) diff --git a/sys/arm64/arm64/genassym.c b/sys/arm64/arm64/genassym.c index 4741cf579467..bd359699eca9 100644 --- a/sys/arm64/arm64/genassym.c +++ b/sys/arm64/arm64/genassym.c @@ -41,10 +41,8 @@ __FBSDID("$FreeBSD$"); ASSYM(BOOTPARAMS_SIZE, roundup2(sizeof(struct arm64_bootparams), STACKALIGNBYTES + 1)); ASSYM(BP_MODULEP, offsetof(struct arm64_bootparams, modulep)); -ASSYM(BP_KERN_L1PT, offsetof(struct arm64_bootparams, kern_l1pt)); ASSYM(BP_KERN_DELTA, offsetof(struct arm64_bootparams, kern_delta)); ASSYM(BP_KERN_STACK, offsetof(struct arm64_bootparams, kern_stack)); -ASSYM(BP_KERN_L0PT, offsetof(struct arm64_bootparams, kern_l0pt)); 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 518c6c812aa9..059b6fd0fe1c 100644 --- a/sys/arm64/arm64/locore.S +++ b/sys/arm64/arm64/locore.S @@ -133,10 +133,6 @@ virtdone: /* Backup the module pointer */ mov x1, x0 - /* Make the page table base a virtual address */ - sub x26, x26, x29 - sub x24, x24, x29 - sub sp, sp, #BOOTPARAMS_SIZE mov x0, sp @@ -144,12 +140,10 @@ virtdone: neg x29, x29 str x1, [x0, #BP_MODULEP] - str x26, [x0, #BP_KERN_L1PT] str x29, [x0, #BP_KERN_DELTA] adrp x25, initstack add x25, x25, :lo12:initstack str x25, [x0, #BP_KERN_STACK] - str x24, [x0, #BP_KERN_L0PT] str x27, [x0, #BP_KERN_TTBR0] str x23, [x0, #BP_BOOT_EL] diff --git a/sys/arm64/arm64/machdep.c b/sys/arm64/arm64/machdep.c index 46773c1911b4..be6b289b0489 100644 --- a/sys/arm64/arm64/machdep.c +++ b/sys/arm64/arm64/machdep.c @@ -820,8 +820,7 @@ initarm(struct arm64_bootparams *abp) pan_setup(); /* Bootstrap enough of pmap to enter the kernel proper */ - pmap_bootstrap(abp->kern_l0pt, abp->kern_l1pt, - KERNBASE - abp->kern_delta, lastaddr - KERNBASE); + pmap_bootstrap(KERNBASE - abp->kern_delta, 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 396a01f96da7..ba2e3cc3392f 100644 --- a/sys/arm64/arm64/pmap.c +++ b/sys/arm64/arm64/pmap.c @@ -1057,9 +1057,8 @@ pmap_bootstrap_l3_page(struct pmap_bootstrap_state *state, int i) MPASS(state->va == (state->pa - dmap_phys_base + DMAP_MIN_ADDRESS)); } -static vm_offset_t -pmap_bootstrap_dmap(vm_offset_t kern_l1, vm_paddr_t min_pa, - vm_offset_t freemempos) +static void +pmap_bootstrap_dmap(vm_paddr_t min_pa) { int i; @@ -1067,8 +1066,6 @@ pmap_bootstrap_dmap(vm_offset_t kern_l1, vm_paddr_t min_pa, dmap_phys_max = 0; dmap_max_addr = 0; - bs_state.freemempos = freemempos; - for (i = 0; i < (physmap_idx * 2); i += 2) { bs_state.pa = physmap[i] & ~L3_OFFSET; bs_state.va = bs_state.pa - dmap_phys_base + DMAP_MIN_ADDRESS; @@ -1120,48 +1117,38 @@ pmap_bootstrap_dmap(vm_offset_t kern_l1, vm_paddr_t min_pa, } cpu_tlb_flushID(); - - return (bs_state.freemempos); } -static vm_offset_t -pmap_bootstrap_l2(vm_offset_t l1pt, vm_offset_t va, vm_offset_t l2_start) +static void +pmap_bootstrap_l2(vm_offset_t va) { KASSERT((va & L1_OFFSET) == 0, ("Invalid virtual address")); /* Leave bs_state.pa as it's only needed to bootstrap blocks and pages*/ bs_state.va = va; - bs_state.freemempos = l2_start; for (; bs_state.va < VM_MAX_KERNEL_ADDRESS; bs_state.va += L1_SIZE) pmap_bootstrap_l1_table(&bs_state); - - return (bs_state.freemempos); } -static vm_offset_t -pmap_bootstrap_l3(vm_offset_t l1pt, vm_offset_t va, vm_offset_t l3_start) +static void +pmap_bootstrap_l3(vm_offset_t va) { KASSERT((va & L2_OFFSET) == 0, ("Invalid virtual address")); /* Leave bs_state.pa as it's only needed to bootstrap blocks and pages*/ bs_state.va = va; - bs_state.freemempos = l3_start; for (; bs_state.va < VM_MAX_KERNEL_ADDRESS; bs_state.va += L2_SIZE) pmap_bootstrap_l2_table(&bs_state); - - return (bs_state.freemempos); } /* * Bootstrap the system enough to run with virtual memory. */ void -pmap_bootstrap(vm_offset_t l0pt, vm_offset_t l1pt, vm_paddr_t kernstart, - vm_size_t kernlen) +pmap_bootstrap(vm_paddr_t kernstart, vm_size_t kernlen) { - vm_offset_t freemempos; vm_offset_t dpcpu, msgbufpv; vm_paddr_t start_pa, pa, min_pa; uint64_t kern_delta; @@ -1173,14 +1160,14 @@ pmap_bootstrap(vm_offset_t l0pt, vm_offset_t l1pt, vm_paddr_t kernstart, kern_delta = KERNBASE - kernstart; - printf("pmap_bootstrap %lx %lx %lx\n", l1pt, kernstart, kernlen); - printf("%lx\n", l1pt); + 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 = (pd_entry_t *)l0pt; + kernel_pmap_store.pm_l0 = pagetable_l0_ttbr1; PMAP_LOCK_INIT(kernel_pmap); - kernel_pmap->pm_l0_paddr = l0pt - kern_delta; + kernel_pmap->pm_l0_paddr = + pmap_early_vtophys((vm_offset_t)kernel_pmap_store.pm_l0); kernel_pmap->pm_cookie = COOKIE_FROM(-1, INT_MIN); kernel_pmap->pm_stage = PM_STAGE1; kernel_pmap->pm_levels = 4; @@ -1204,11 +1191,11 @@ pmap_bootstrap(vm_offset_t l0pt, vm_offset_t l1pt, vm_paddr_t kernstart, min_pa = physmap[i]; } - freemempos = KERNBASE + kernlen; - freemempos = roundup2(freemempos, PAGE_SIZE); + bs_state.freemempos = KERNBASE + kernlen; + bs_state.freemempos = roundup2(bs_state.freemempos, PAGE_SIZE); /* Create a direct map region early so we can use it for pa -> va */ - freemempos = pmap_bootstrap_dmap(l1pt, min_pa, freemempos); + pmap_bootstrap_dmap(min_pa); bs_state.dmap_valid = true; /* * We only use PXN when we know nothing will be executed from it, e.g. @@ -1223,16 +1210,15 @@ pmap_bootstrap(vm_offset_t l0pt, vm_offset_t l1pt, vm_paddr_t kernstart, * loader allocated the first and only l2 page table page used to map * the kernel, preloaded files and module metadata. */ - freemempos = pmap_bootstrap_l2(l1pt, KERNBASE + L1_SIZE, freemempos); + pmap_bootstrap_l2(KERNBASE + L1_SIZE); /* And the l3 tables for the early devmap */ - freemempos = pmap_bootstrap_l3(l1pt, - VM_MAX_KERNEL_ADDRESS - (PMAP_MAPDEV_EARLY_SIZE), freemempos); + pmap_bootstrap_l3(VM_MAX_KERNEL_ADDRESS - (PMAP_MAPDEV_EARLY_SIZE)); cpu_tlb_flushID(); #define alloc_pages(var, np) \ - (var) = freemempos; \ - freemempos += (np * PAGE_SIZE); \ + (var) = bs_state.freemempos; \ + bs_state.freemempos += (np * PAGE_SIZE); \ memset((char *)(var), 0, ((np) * PAGE_SIZE)); /* Allocate dynamic per-cpu area. */ @@ -1244,14 +1230,14 @@ pmap_bootstrap(vm_offset_t l0pt, vm_offset_t l1pt, vm_paddr_t kernstart, msgbufp = (void *)msgbufpv; /* Reserve some VA space for early BIOS/ACPI mapping */ - preinit_map_va = roundup2(freemempos, L2_SIZE); + preinit_map_va = roundup2(bs_state.freemempos, L2_SIZE); virtual_avail = preinit_map_va + PMAP_PREINIT_MAPPING_SIZE; virtual_avail = roundup2(virtual_avail, L1_SIZE); virtual_end = VM_MAX_KERNEL_ADDRESS - (PMAP_MAPDEV_EARLY_SIZE); kernel_vm_end = virtual_avail; - pa = pmap_early_vtophys(freemempos); + pa = pmap_early_vtophys(bs_state.freemempos); physmem_exclude_region(start_pa, pa - start_pa, EXFLAG_NOALLOC); diff --git a/sys/arm64/include/machdep.h b/sys/arm64/include/machdep.h index 45ff0065930a..112390bb27ef 100644 --- a/sys/arm64/include/machdep.h +++ b/sys/arm64/include/machdep.h @@ -33,10 +33,8 @@ struct arm64_bootparams { vm_offset_t modulep; - vm_offset_t kern_l1pt; /* L1 page table for the kernel */ uint64_t kern_delta; vm_offset_t kern_stack; - vm_offset_t kern_l0pt; /* L1 page table for the kernel */ vm_paddr_t kern_ttbr0; int boot_el; /* EL the kernel booted from */ int pad; diff --git a/sys/arm64/include/pmap.h b/sys/arm64/include/pmap.h index 55388b845aed..4792543e0af4 100644 --- a/sys/arm64/include/pmap.h +++ b/sys/arm64/include/pmap.h @@ -174,7 +174,7 @@ extern vm_offset_t virtual_end; #define pmap_vm_page_alloc_check(m) void pmap_activate_vm(pmap_t); -void pmap_bootstrap(vm_offset_t, vm_offset_t, vm_paddr_t, vm_size_t); +void pmap_bootstrap(vm_paddr_t, 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);