From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A548AC52D7B for ; Tue, 13 Aug 2024 10:08:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=iOBzKEdS6bB9O1TtWOotv3Zyl6GPZR6pShmyp7TSaAM=; b=l0XMGG/NyN3CteWUeEO2bfqi88 FZPBbO5HO9B2k7/kz+2CvljlQfSlX36wZhmYnnRAco5iCDNcpT0RxPVRnjufQkVXc7erZH3RJXLNg DkJR1uqv4RKLGglvVDhIlQsX3UwPWuUmpDEYO2qSso4KowI6nTqvZSlKlccERll+NYvL0Dsw+vxci OLwbgPMO0FFWcMsaHla3QE+rGfOhbjTULScI+hAnbh3q+iJpPakkNaNGn/Ktc72LiNjQjakeGcPoC 3KnekchymPfWILXi5loSaOxHOyw8QeJsw8c2rI0PaYjr7Juj45cFiioe7O/EQQer2fFFM442rH0t6 sqmsLZoA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sdoSQ-00000003HCd-1RC2; Tue, 13 Aug 2024 10:08:50 +0000 Received: from dfw.source.kernel.org ([139.178.84.217]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sdoQ2-00000003GNd-01Yi for linux-arm-kernel@lists.infradead.org; Tue, 13 Aug 2024 10:06:24 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 40B9C614D1; Tue, 13 Aug 2024 10:06:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E70CDC4AF09; Tue, 13 Aug 2024 10:06:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1723543580; bh=AfD3pkKeWkAMQNzJlwdw56rA+nl7NWbqVY/PrOBr0/8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=S/Hi5ZNC78ltWMqK0mAd5O7HNDtZZBwrjd1jvjh8237CL3RI65HcB7Gz6vN9WTso7 0iZZabJNBIUJ4qip/2xrJfsJ1LQUVN8TMxCU90L3efm7DZANppgHjGFLtCsqmEGExk yIsh0XBw92zGGFqVyb/eIOQGp4WjHYOPeeym3rOZyNZWZWoCLCIwagLIarQEtLrVeJ yPpSOPxTHvCyWBpVVOxoZJb0dzT9A2eU3A5QuKDVlF5DMkwJT962KB8Dp0cqN0v31k W93rMUdw8o9/N4YHFt+Dr3l7RYxHViFxloK4QxBQ2kmIdnLojRymGVHraVhbROVGgT Iekbgqt8usv6g== Received: from sofa.misterjones.org ([185.219.108.64] helo=valley-girl.lan) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1sdoPy-003INM-Vi; Tue, 13 Aug 2024 11:06:19 +0100 From: Marc Zyngier To: kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org, kvm@vger.kernel.org Cc: James Morse , Suzuki K Poulose , Oliver Upton , Zenghui Yu , Joey Gouly , Alexandru Elisei , Anshuman Khandual , Przemyslaw Gaj Subject: [PATCH v3 03/18] arm64: Add system register encoding for PSTATE.PAN Date: Tue, 13 Aug 2024 11:05:25 +0100 Message-Id: <20240813100540.1955263-4-maz@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240813100540.1955263-1-maz@kernel.org> References: <20240813100540.1955263-1-maz@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org, kvm@vger.kernel.org, james.morse@arm.com, suzuki.poulose@arm.com, oliver.upton@linux.dev, yuzenghui@huawei.com, joey.gouly@arm.com, alexandru.elisei@arm.com, anshuman.khandual@arm.com, pgaj@cadence.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240813_030622_167153_601369BC X-CRM114-Status: GOOD ( 12.36 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Although we already have the primitives to set PSTATE.PAN with an immediate, we don't have a way to read the current state nor set it ot an arbitrary value (i.e. we can generally save/restore it). Thankfully, all that is missing for this is the definition for the PAN pseudo system register, here named SYS_PSTATE_PAN. Signed-off-by: Marc Zyngier --- arch/arm64/include/asm/sysreg.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/arm64/include/asm/sysreg.h b/arch/arm64/include/asm/sysreg.h index d9d5e07f768d..a2787091d5a0 100644 --- a/arch/arm64/include/asm/sysreg.h +++ b/arch/arm64/include/asm/sysreg.h @@ -109,6 +109,9 @@ #define set_pstate_ssbs(x) asm volatile(SET_PSTATE_SSBS(x)) #define set_pstate_dit(x) asm volatile(SET_PSTATE_DIT(x)) +/* Register-based PAN access, for save/restore purposes */ +#define SYS_PSTATE_PAN sys_reg(3, 0, 4, 2, 3) + #define __SYS_BARRIER_INSN(CRm, op2, Rt) \ __emit_inst(0xd5000000 | sys_insn(0, 3, 3, (CRm), (op2)) | ((Rt) & 0x1f)) -- 2.39.2