From nobody Sat Oct 4 21:05:28 2025 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 26B352F83D4; Wed, 13 Aug 2025 12:01:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1755086489; cv=none; b=Sq6gJzoIXnL0VWbFM1mLF50uqfKcjhAb8PhxSmTOjPKlOSs9bUA/cch97AyTy0T2HhY2iWpqjd7WWgRGnivgeH/ONSjubp9bUPg1fQG5GI9xI/TyVuwkgeoq5xRubZ6P4s9W0Su+Y5tkyCc+Lor+n9qTB2hYDx7MyAmgbMi2EP8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1755086489; c=relaxed/simple; bh=9zV77nEha+AzTcKTwOahPqFnp3HlP+R5XSNSAHflQ6U=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=X/13ajld9ZZ+zPp5dsj2OFqOEHfeNAS7ILqH6m9MizO7u5Ozs+Jlh0eFvnWQIKPDruEgyAT8RUk/hFZOezz3Ii/GIa8q5WTqs+Npel21P0w+R8UQ1OffiailGSDLXd9fIapwAT9NoNfxtRK25LxOhWZVdeLQ/raRT5U3OTomkUU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 8F69B14BF; Wed, 13 Aug 2025 05:01:19 -0700 (PDT) Received: from e129823.cambridge.arm.com (e129823.arm.com [10.1.197.6]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 2DA733F5A1; Wed, 13 Aug 2025 05:01:24 -0700 (PDT) From: Yeoreum Yun To: catalin.marinas@arm.com, will@kernel.org, broonie@kernel.org, oliver.upton@linux.dev, anshuman.khandual@arm.com, robh@kernel.org, james.morse@arm.com, mark.rutland@arm.com, joey.gouly@arm.com, Dave.Martin@arm.com, ahmed.genidi@arm.com, kevin.brodsky@arm.com, scott@os.amperecomputing.com, mbenes@suse.cz, james.clark@linaro.org, frederic@kernel.org, rafael@kernel.org, pavel@kernel.org, ryan.roberts@arm.com, suzuki.poulose@arm.com Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, kvmarm@lists.linux.dev, Yeoreum Yun , Marc Zyngier Subject: [PATCH v3 1/5] arm64: make SCTLR2_EL1 accessible Date: Wed, 13 Aug 2025 13:01:14 +0100 Message-Id: <20250813120118.3953541-2-yeoreum.yun@arm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250813120118.3953541-1-yeoreum.yun@arm.com> References: <20250813120118.3953541-1-yeoreum.yun@arm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" When the kernel runs at EL1, and yet is booted at EL2, HCRX_EL2.SCTLR2En must be set to avoid trapping SCTLR2_EL1 accesses from EL1 to EL2. Ensure this bit is set at the point of initialising EL2. Signed-off-by: Yeoreum Yun Reviewed-by: Marc Zyngier --- arch/arm64/include/asm/el2_setup.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/arch/arm64/include/asm/el2_setup.h b/arch/arm64/include/asm/el= 2_setup.h index 46033027510c..d755b4d46d77 100644 --- a/arch/arm64/include/asm/el2_setup.h +++ b/arch/arm64/include/asm/el2_setup.h @@ -57,9 +57,15 @@ /* Enable GCS if supported */ mrs_s x1, SYS_ID_AA64PFR1_EL1 ubfx x1, x1, #ID_AA64PFR1_EL1_GCS_SHIFT, #4 - cbz x1, .Lset_hcrx_\@ + cbz x1, .Lskip_hcrx_GCSEn_\@ orr x0, x0, #HCRX_EL2_GCSEn =20 +.Lskip_hcrx_GCSEn_\@: + mrs_s x1, SYS_ID_AA64MMFR3_EL1 + ubfx x1, x1, #ID_AA64MMFR3_EL1_SCTLRX_SHIFT, #4 + cbz x1, .Lset_hcrx_\@ + orr x0, x0, HCRX_EL2_SCTLR2En + .Lset_hcrx_\@: msr_s SYS_HCRX_EL2, x0 .Lskip_hcrx_\@: --=20 LEVI:{C3F47F37-75D8-414A-A8BA-3980EC8A46D7}