From nobody Tue Mar 19 22:17:22 2024 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 4TzmLB4sD0z5FbgJ; Tue, 19 Mar 2024 22:17:22 +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 4TzmLB4J6Lz4Bs6; Tue, 19 Mar 2024 22:17:22 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1710886642; 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=F+5VsW31ZpgPsCUHoG3aVit4Rz0qE6V4a8DwhkArc0I=; b=bYvepibluiFZPnzGzH/NMGZc/MUKZDQ2eZ/4wF/nGTeBNN82cEu4NWkzlQAJBTeIT+edpb TxUdpXjIsT90+f9G0IMlu3el9J5BBNbuVM6efW6D2rrubpzkDSt3O66NX202LS1j0c/i/v HlcuBB8NynuUflwaL6hEeTKA3UXMX5U8bXdwnEwMxweqH1rnTK7jmT/n2IoCANCoFmiWIu bzOdbW9a9i4NwPlIDQsMLipigzrzePXNCUmY7IEyC5IX6orwbRopqW/A8wHl7PP2sfLcH+ Fssue0bWFzj00nw8jpUuo9hUQUQ5N+fwmCa0wFZWK63SkLtj5nxuYaIbhIdeVw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1710886642; a=rsa-sha256; cv=none; b=kHllffJgT1Q+g3EoC9CQqrI7H1S13pxmBjFxAElVRxRnaSs2lr4jNiHOTJnwOwBK+HQolT 5lEzDiXGKNJXZxnmsl5X7ZRFfdwRxQqwJHWDmcucNYaDqQoldGte1ihpmB7fBSAMcw8d/N xJtl+TPuhk+QSsWk/JxKobFmx+eQ8KmWvsaRD/fHuknSGEu7XVZqY7o2ggDdWhb2yvlM6a 1nuGFGKltcZYVRvGFJOOQ6QaUi5jwA8gAsB5JwegDCr0htScSvyyfuf/O46Wznjchtr1lG hG73Is5XK8XBOsnff21V4YRGCtp7cgj8GNm3+aiAebhV9ardFBj6s8GinR1CNQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1710886642; 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=F+5VsW31ZpgPsCUHoG3aVit4Rz0qE6V4a8DwhkArc0I=; b=T55/X6ZZtAr+Eg56J8XC9xrPdbw19Ff19BXlFhVGiLyrstNHnGJplzfTVkR2WUXTsXjy02 sMC5d61cqtcak74dtTG2FBg7Nj4owo1FIPBnq3mH0H8HcpSBYe23QuFCsR7c+KdgeeDnlx TwynHx0nvNRjpBnrxkZAwd414QtkQ0ebhNgm3lt3Rbtzv7fesaV40Wg9RINUr8qd4Bgoqg aoYRaC1xF6O/f5GZTg9JlSgJE3misiJpYm4NAGKwue8v2q40w+5ZUADwlAr8cQ84ZhP0nt Gp1xNFbLPhBCmJy/iRn6khEtlgLCqRw/CPMmGsuQwWiXnGPiJQ7qh4w1RPDlcA== 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 4TzmLB3vZyzPmk; Tue, 19 Mar 2024 22:17:22 +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 42JMHMWZ077777; Tue, 19 Mar 2024 22:17:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 42JMHMq0077774; Tue, 19 Mar 2024 22:17:22 GMT (envelope-from git) Date: Tue, 19 Mar 2024 22:17:22 GMT Message-Id: <202403192217.42JMHMq0077774@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Colin Percival Subject: git: a1e516a731e3 - main - arm64: Move curthread setup earlier 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: cperciva X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a1e516a731e3d45e10dab65bb8ccb0484f316d55 Auto-Submitted: auto-generated The branch main has been updated by cperciva: URL: https://cgit.FreeBSD.org/src/commit/?id=a1e516a731e3d45e10dab65bb8ccb0484f316d55 commit a1e516a731e3d45e10dab65bb8ccb0484f316d55 Author: Isaac Cilia Attard AuthorDate: 2024-03-13 18:06:19 +0000 Commit: Colin Percival CommitDate: 2024-03-19 22:16:48 +0000 arm64: Move curthread setup earlier In 469cfa3c30ee cperciva added TSLOG profiling to link_elf_ireloc. This requires curthread to be read when the kernel linker is invoked, but it hadn't yet been initialized. On amd64 this was harmless since [gs:0] was readable; but on arm64 this broke since [x18] was not readable. Move the curthread (and associated PCPU) setup earlier on arm64 in order to allow TSLOG to work there. Fixes: 469cfa3c30ee ("tslog: Annotate some early boot functions") Differential Revision: https://reviews.freebsd.org/D44317 --- sys/arm64/arm64/machdep.c | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/sys/arm64/arm64/machdep.c b/sys/arm64/arm64/machdep.c index 50b2cd15df3f..d566a8e2298c 100644 --- a/sys/arm64/arm64/machdep.c +++ b/sys/arm64/arm64/machdep.c @@ -920,6 +920,22 @@ initarm(struct arm64_bootparams *abp) update_special_regs(0); + /* Set the pcpu data, this is needed by pmap_bootstrap */ + pcpup = &pcpu0; + pcpu_init(pcpup, 0, sizeof(struct pcpu)); + + /* + * Set the pcpu pointer with a backup in tpidr_el1 to be + * loaded when entering the kernel from userland. + */ + __asm __volatile( + "mov x18, %0 \n" + "msr tpidr_el1, %0" :: "r"(pcpup)); + + /* locore.S sets sp_el0 to &thread0 so no need to set it here. */ + PCPU_SET(curthread, &thread0); + PCPU_SET(midr, get_midr()); + link_elf_ireloc(kmdp); #ifdef FDT try_load_dtb(kmdp); @@ -952,22 +968,6 @@ initarm(struct arm64_bootparams *abp) physmem_exclude_region(efifb->fb_addr, efifb->fb_size, EXFLAG_NOALLOC); - /* Set the pcpu data, this is needed by pmap_bootstrap */ - pcpup = &pcpu0; - pcpu_init(pcpup, 0, sizeof(struct pcpu)); - - /* - * Set the pcpu pointer with a backup in tpidr_el1 to be - * loaded when entering the kernel from userland. - */ - __asm __volatile( - "mov x18, %0 \n" - "msr tpidr_el1, %0" :: "r"(pcpup)); - - /* locore.S sets sp_el0 to &thread0 so no need to set it here. */ - PCPU_SET(curthread, &thread0); - PCPU_SET(midr, get_midr()); - /* Do basic tuning, hz etc */ init_param1();