From nobody Fri Dec 13 21:38:00 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 4Y92kc2vqDz5g9pJ; Fri, 13 Dec 2024 21:38:00 +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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Y92kc2RgYz4drQ; Fri, 13 Dec 2024 21:38:00 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1734125880; 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=8YCp2/13aWvy3/ehhMU2CHBTZqzU0U1vJLfIhApN13c=; b=mncqBo76ECyk+fC+gTn8RhGzAVbvrzk/pxA/JySRDqV0vtIMHx0GH/NCd+t9DiIKJj5hnF +oi8y2jau5mhPLR2eVmPM6TxZMyfvx+Ej3ZL7e1eE5iFe2pUCISZ/X1PrvtAOM3ZXpPee3 rR4dLQ+wVh2YCbTICvAjovyeJ93PALaLZ3rOOHmgdBwk5UqzrY8b9lDCqGewtLlfnhG7VR FQ9Zk2niqJL5MdR0hKCvetvP6cYUIwchTgeftIBJoOWDE/lURz+VUOVD+cUC4ht0NcNNWJ O8YqT1aMa00rWKlIw386pTU/jgADT2XTzbphuFt7ewGQ+MfFNvzPdd1Nj0bU5A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1734125880; 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=8YCp2/13aWvy3/ehhMU2CHBTZqzU0U1vJLfIhApN13c=; b=ePT74kzXXS9Zgyd6ugxu5S6Z/teDoSafCnISX6wHNj35OQkDS7Td1aq20umIEQqMMFbzss H1s5vum8SpyqtlDyD2H2+2gewpQup26KLRFc3hqiEQtBvxsE1jq0aQz2N33FjUVQju4wl8 9Bl81mA6KEYNNZjD3r4kCSVtyykJrsY2QUlFy4CqPfd7Low+fAuKEMabV32wRwb5B4PfhS Mf69ehVmoLgOjA8L8iuEnC2kOdWgQV9jRQ32obDtsi+YuARoCYk4sFfK2FiYpRubnHssV7 e9MSH/kEME23Smb2ZVQ6vAizyNa9DTXDc97cAFe0USo0OpZx8IHC0Vqnm2hc3w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1734125880; a=rsa-sha256; cv=none; b=mdoTDmxATunGTleb1dRbWsob72m5o4+cSZj4kj6EWoITcYpqGwETHE/PRi8/8geVlbJrjX YUoZolsLMjbuEXO6R1qGJg2POvrusGCVoZspfmwb3e6nhfd+D/PyyDodQ1wOljwq2ChtN0 HibDwUouxdibpyQs0PWIbe/jbkqzYDNERLd1JT/R3izFCej2n3rrOh6GhUCDm7qTJ5g3cn mTO4H/Li7QSuMdJBDs4qBP+nDqj2LHFQmzsm9guAnqJXJExG/XMX23R95sxp0EiGmGxXup RXoZgI0sqFZtEIr6bKpbtDDOS/G5oQyn5Gb5bawWbt5w6zM/sH+DV6R/7huYZg== 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 4Y92kc22npztpH; Fri, 13 Dec 2024 21:38:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 4BDLc08a061877; Fri, 13 Dec 2024 21:38:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 4BDLc0bK061874; Fri, 13 Dec 2024 21:38:00 GMT (envelope-from git) Date: Fri, 13 Dec 2024 21:38:00 GMT Message-Id: <202412132138.4BDLc0bK061874@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Jessica Clarke Subject: git: 9aed7107bbfb - stable/12 - mips: Extract HWREna configuration and call from APs 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: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jrtc27 X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 9aed7107bbfbe9f919b547d68e9cd228a1a1852c Auto-Submitted: auto-generated The branch stable/12 has been updated by jrtc27: URL: https://cgit.FreeBSD.org/src/commit/?id=9aed7107bbfbe9f919b547d68e9cd228a1a1852c commit 9aed7107bbfbe9f919b547d68e9cd228a1a1852c Author: Jessica Clarke AuthorDate: 2024-12-13 21:37:00 +0000 Commit: Jessica Clarke CommitDate: 2024-12-13 21:37:51 +0000 mips: Extract HWREna configuration and call from APs The intent of mips_get_identity is to perform any feature detection and corresponding global system configuration, but currently it is also abused to set HWREna.UL on the BSP when available, with APs being left unconfigured. Extract that part out into its own function that gets called after mips_get_identity on the BSP, and call it on the APs from smp_init_secondary. This is a direct commit to stable/13 as mips no longer exists in main. Reviewed by: jhibbits Differential Revision: https://reviews.freebsd.org/D48064 (cherry picked from commit 8176157d69b89a811f997cbbe490dfd57595f264) --- sys/mips/include/md_var.h | 1 + sys/mips/mips/cpu.c | 21 ++++++++++++++++++--- sys/mips/mips/mp_machdep.c | 3 +++ 3 files changed, 22 insertions(+), 3 deletions(-) diff --git a/sys/mips/include/md_var.h b/sys/mips/include/md_var.h index 0150e6acd354..cca58e5cd1b3 100644 --- a/sys/mips/include/md_var.h +++ b/sys/mips/include/md_var.h @@ -72,6 +72,7 @@ void mips_wait(void); void mips_vector_init(void); void mips_cpu_init(void); +void mips_hwrena_init(void); void mips_pcpu0_init(void); void mips_proc0_init(void); void mips_postboot_fixup(void); diff --git a/sys/mips/mips/cpu.c b/sys/mips/mips/cpu.c index 0f8583dbd40a..37acb0d5effa 100644 --- a/sys/mips/mips/cpu.c +++ b/sys/mips/mips/cpu.c @@ -192,10 +192,11 @@ mips_get_identity(struct mips_cpuinfo *cpuinfo) /* Check to see if UserLocal register is implemented. */ if (cfg3 & MIPS_CONFIG3_ULR) { - /* UserLocal register is implemented, enable it. */ + /* + * UserLocal register is implemented, enable it later in + * mips_hwrena_init. + */ cpuinfo->userlocal_reg = true; - tmp = mips_rd_hwrena(); - mips_wr_hwrena(tmp | MIPS_HWRENA_UL); } else { /* * UserLocal register is not implemented. Patch @@ -327,11 +328,25 @@ mips_get_identity(struct mips_cpuinfo *cpuinfo) #endif } +void +mips_hwrena_init(void) +{ + uint32_t reg; + + reg = mips_rd_hwrena(); + + if (cpuinfo.userlocal_reg) + reg |= MIPS_HWRENA_UL; + + mips_wr_hwrena(reg); +} + void mips_cpu_init(void) { platform_cpu_init(); mips_get_identity(&cpuinfo); + mips_hwrena_init(); num_tlbentries = cpuinfo.tlb_nentries; mips_wr_wired(0); tlb_invalidate_all(); diff --git a/sys/mips/mips/mp_machdep.c b/sys/mips/mips/mp_machdep.c index 1a5a023db381..0bf0981ecaae 100644 --- a/sys/mips/mips/mp_machdep.c +++ b/sys/mips/mips/mp_machdep.c @@ -54,6 +54,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include struct pcb stoppcbs[MAXCPU]; @@ -278,6 +279,8 @@ void smp_init_secondary(u_int32_t cpuid) { + mips_hwrena_init(); + /* TLB */ mips_wr_wired(0); tlb_invalidate_all();