From patchwork Sat Feb 3 13:00:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 196303 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:9bc1:b0:106:209c:c626 with SMTP id op1csp1013336dyc; Sat, 3 Feb 2024 05:19:52 -0800 (PST) X-Google-Smtp-Source: AGHT+IGftNx2AB+clO7zRpQxi8mVDoP8cf7nKRY6a0f4Js7Zl2zInvyHs1Hf7k7OvIAo8uCF1u+2 X-Received: by 2002:a6b:c301:0:b0:7bf:cfc2:1619 with SMTP id t1-20020a6bc301000000b007bfcfc21619mr8300061iof.6.1706966392627; Sat, 03 Feb 2024 05:19:52 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706966392; cv=pass; d=google.com; s=arc-20160816; b=eweaWtGbMNYIuDqGKY+8Rsl50AercvofC3ycCDAtJMxu5hkZyh7/h4J39TSOuXGGE9 tJx8wNOdbnuqqgaMvyezEX7suRvW2Cqw+EtKNMoMxiE/Rbky1MSiax0LwgLhjOpF/jN3 7N8RdqTWEMwwNIg0fceuwWftdf4B0UHNQBpRDjxpNdOOpz7LZFKHeyeoW65n+nkWLHTf aO7dm5sOxeE9LFYSC08dgkSoxhQUu2Hv2zaI0Q0jjehO/bmkZpGMFEBaUm3li8P+4DWO GJcSl9tRoENxPS8f+E0JAqxjj9yoc5q+LLG9zE9cDuFQkjm+CcHEuxCZTdscq83ERGmA vvnA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :subject:date:from:dkim-signature; bh=HH7Cf7/K2wEfvzQqk4EqozsBGRNBfYYliYt3834lprY=; fh=glwWOPj80/gzRru6umfXGIpi93az1pqZAiEKPUAinaA=; b=OT01joSg52bcRJ8iOW6yTtJomfNSF8Vtsu7N4hXuZta1fXLizwZyvxCYbPfWBsNbSw 6mA082UqRwr0yHD+WoKKL2SIwEEsJAeB/SsH9yw3a9cqCyZG3WXW2yfYc4CxL1uoYC9I jMBedw+1W9UZ31IZT6DhHQmskMoIKYPK47MO/chTsrXGVNzn7tZmnu93CD1cdBjt9h++ HgZKSLnbWIFB2CMHijJKnqosKpE0Ku1F5w/3ZHGKVnH5/9O2saH/0cX7tjPbywNO8P1C 5qF1bbQ0xjI+ilkMZ+pt4n9gAWwqzqgYj1FkEAy7jRifwqy1fTBinato/Z08npsFUIjz 2CUw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=OAcGWw6b; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-51097-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-51097-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org X-Forwarded-Encrypted: i=1; AJvYcCUpH4eEUly3Xf7RiRj3GBbF5D4hH7LEnGUHWUv6VVDK0CIKpF1vxwk14o+ul0GwIUmFhvtw2JqKVDV21eYocOZ5uSdYvg== Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id y33-20020a634961000000b005d8e2f56d7bsi3218344pgk.864.2024.02.03.05.19.52 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 03 Feb 2024 05:19:52 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-51097-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=OAcGWw6b; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-51097-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-51097-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 3D4AAB26E20 for ; Sat, 3 Feb 2024 13:02:09 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0ED275EE9E; Sat, 3 Feb 2024 13:01:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="OAcGWw6b" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3D2405DF31 for ; Sat, 3 Feb 2024 13:01:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706965287; cv=none; b=G/XoWUP9lgEE7uf3kDu4E8oaArW3M5utc3heZmLj0AVVx0myk9unuomzs11+WmqY4DGP+6xucJQdCRlwcjdEg9bxz4MEYYKYnregGyZSE6gx25mUh4I2VUl+Y+q5VC3JJMw/8OQ+Ji4U0WAc6dV77jkCXzzW2NqBxXE9pDVLd0U= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706965287; c=relaxed/simple; bh=WYAnHqfh3wc9ALgAbEUHjU8HQPMdcTokUkC4neL2YMY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=TsDlC2jxkxjGUXRqg2PD33f60ORzT+TiuUp7QCgaA++FNrH9kB+VDMtyUrtGxXo/tUYrvPrYUoBRj0sZjLIwRFc5wDDIrb81WXhC1/sHX1yLF54kpVo6Zg+bTNim7Oq7S6FcVw36wAYdwRU43p0upS6H4moRF1+c47vt+wRhu7Y= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=OAcGWw6b; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 61C37C433F1; Sat, 3 Feb 2024 13:01:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1706965286; bh=WYAnHqfh3wc9ALgAbEUHjU8HQPMdcTokUkC4neL2YMY=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=OAcGWw6b+tKUCj4Q377dOFpF7STHZVNvqfUkyXTA2ysBn2YSoUwb/AZrXbLrw5dlc nizLkVJ/AB1XG5lU0OkCOfWtlw6AzoeHR+khV6mtYcJ+wuGv2ssgxN9AUCxRi2uOAK ZXiLEvWZneAR2MYGywMhKDpfu5SrYL8NMer/HQGNWM5NSnhzuK9iZun9h9+A/D1SwT F+FyAgLYI9HPt8JvSIky1P2loBRB7bRikq26UDtKflHQ23OxS9QBMo//TYOOTMNh4Q so87FS1bPJz6LfqZXQVqBOAP/f9o9lkRJ23oTW7C06GnndYhrPdHl2lIs16PLh7SiJ Td7YiWkxEr2Zw== From: Mark Brown Date: Sat, 03 Feb 2024 13:00:40 +0000 Subject: [PATCH v2 1/2] arm64/sme: Restore SMCR on exit from suspend Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240203-arm64-sme-resume-v2-1-a1fbaddc4425@kernel.org> References: <20240203-arm64-sme-resume-v2-0-a1fbaddc4425@kernel.org> In-Reply-To: <20240203-arm64-sme-resume-v2-0-a1fbaddc4425@kernel.org> To: Catalin Marinas , Will Deacon Cc: Dave Martin , Jackson Cooper-Driver , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Mark Brown X-Mailer: b4 0.13-dev-a684c X-Developer-Signature: v=1; a=openpgp-sha256; l=2862; i=broonie@kernel.org; h=from:subject:message-id; bh=WYAnHqfh3wc9ALgAbEUHjU8HQPMdcTokUkC4neL2YMY=; b=owEBbQGS/pANAwAKASTWi3JdVIfQAcsmYgBlvjkT4aXhtj2CXSu9FybDljHxn75/w4PZuyUtMHq8 5JNnjk+JATMEAAEKAB0WIQSt5miqZ1cYtZ/in+ok1otyXVSH0AUCZb45EwAKCRAk1otyXVSH0KvAB/ 4p6ZI3LJRELdmOTD9CJIEHYV2hSnM8GWKgCbf0qVwltqR5PUoAEAybmvK8z5CALDug3oOu96fr2ucZ 2WyGJJHflFpa6vswKo75XB5/UqQsqk6TVtnJMIlfy2zVgcuck7xVFNbu94vkXdIjO/oNZ3/65lEDQA pUIVXfzo5VACviPzWlj6VMiod0YQyaB1dlQYZltzpB3oOeY9rBuYlFajhb0dFDC/Ll0s0Wr83/kHXg phoPtN8/K2Q8SAgLD4AOXKsU+xWTQ64sc+HcVEQWfFdz0h836fPeG438rraqLStyUi8B+TgDi5nXEb m/T5LTZui/D2SJwL0F30oTzI0STmMt X-Developer-Key: i=broonie@kernel.org; a=openpgp; fpr=3F2568AAC26998F9E813A1C5C3F436CA30F5D8EB X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1789883992148267062 X-GMAIL-MSGID: 1789883992148267062 The fields in SMCR_EL1 reset to an architecturally UNKNOWN value. Since we do not otherwise manage the traps configured in this register at runtime we need to reconfigure them after a suspend in case nothing else was kind enough to preserve them for us. The vector length will be restored as part of restoring the SME state for the next SME using task. Fixes: a1f4ccd25cc2 (arm64/sme: Provide Kconfig for SME) Reported-by: Jackson Cooper-Driver Signed-off-by: Mark Brown --- arch/arm64/include/asm/fpsimd.h | 2 ++ arch/arm64/kernel/fpsimd.c | 14 ++++++++++++++ arch/arm64/kernel/suspend.c | 3 +++ 3 files changed, 19 insertions(+) diff --git a/arch/arm64/include/asm/fpsimd.h b/arch/arm64/include/asm/fpsimd.h index 50e5f25d3024..7780d343ef08 100644 --- a/arch/arm64/include/asm/fpsimd.h +++ b/arch/arm64/include/asm/fpsimd.h @@ -386,6 +386,7 @@ extern void sme_alloc(struct task_struct *task, bool flush); extern unsigned int sme_get_vl(void); extern int sme_set_current_vl(unsigned long arg); extern int sme_get_current_vl(void); +extern void sme_suspend_exit(void); /* * Return how many bytes of memory are required to store the full SME @@ -421,6 +422,7 @@ static inline int sme_max_vl(void) { return 0; } static inline int sme_max_virtualisable_vl(void) { return 0; } static inline int sme_set_current_vl(unsigned long arg) { return -EINVAL; } static inline int sme_get_current_vl(void) { return -EINVAL; } +static inline void sme_suspend_exit(void) { } static inline size_t sme_state_size(struct task_struct const *task) { diff --git a/arch/arm64/kernel/fpsimd.c b/arch/arm64/kernel/fpsimd.c index a5dc6f764195..8d2a5824d5d3 100644 --- a/arch/arm64/kernel/fpsimd.c +++ b/arch/arm64/kernel/fpsimd.c @@ -1311,6 +1311,20 @@ void __init sme_setup(void) get_sme_default_vl()); } +void sme_suspend_exit(void) +{ + u64 smcr = 0; + + if (!system_supports_sme()) + return; + + if (system_supports_fa64()) + smcr |= SMCR_ELx_FA64; + + write_sysreg_s(smcr, SYS_SMCR_EL1); + write_sysreg_s(0, SYS_SMPRI_EL1); +} + #endif /* CONFIG_ARM64_SME */ static void sve_init_regs(void) diff --git a/arch/arm64/kernel/suspend.c b/arch/arm64/kernel/suspend.c index eca4d0435211..eaaff94329cd 100644 --- a/arch/arm64/kernel/suspend.c +++ b/arch/arm64/kernel/suspend.c @@ -12,6 +12,7 @@ #include #include #include +#include #include #include #include @@ -80,6 +81,8 @@ void notrace __cpu_suspend_exit(void) */ spectre_v4_enable_mitigation(NULL); + sme_suspend_exit(); + /* Restore additional feature-specific configuration */ ptrauth_suspend_exit(); } From patchwork Sat Feb 3 13:00:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 196297 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:9bc1:b0:106:209c:c626 with SMTP id op1csp1003900dyc; Sat, 3 Feb 2024 05:02:18 -0800 (PST) X-Google-Smtp-Source: AGHT+IHB5m2J6eFj5FvqFIUm/wx8yh5wLkq6GmXUa/rv1QNzquZfb2B0nUyUl976E25eSeA2fI95 X-Received: by 2002:a05:6214:248f:b0:68c:499f:f803 with SMTP id gi15-20020a056214248f00b0068c499ff803mr1633363qvb.30.1706965338803; Sat, 03 Feb 2024 05:02:18 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706965338; cv=pass; d=google.com; s=arc-20160816; b=TFQGubL5XVRYpfS8+8PJmIfLKSFGpE7AjcDKFH/LRG63I27iRSCFIfa8WA/r90gHH9 4RUPN921rBspdxb5cIuZ1KCTGaajtD2B0fGifWxbLxs2DcBQA7kZiQSYYTYvw5C879CE 4aPQATPZK2uY8Lhr37kndlhZ1RkwAy6a0oexpr+J52XD99J5l0kYaE6XSdGXg0tc9uv6 VULSuwRqFsxwdlxeAishDgaDms3rjxIaEUWpr/XDgBWTAHVbWgYI5I20LuBM3ex6gnmp ftCxKqr+c4g8HrzqrGF4Gcl6FEDD103P9AKTYzqIUx/jK251bvCMEKnYLIrQt/EuBmdm 70Kg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :subject:date:from:dkim-signature; bh=I3EuBAqhoVY3arqxnqkAhPRPYi1UKYqs4tDEnjae4W0=; fh=xuXPgdopCkvZxgrfr8M1nGajb2EtF85daABcokY0Dqg=; b=QsVpPu+DkqSTRPbjg06dO8f3cbnzKwyBw6rJJkAjx90i6Ap+Syl9ME/vkfnqqnYCMk NcWzlcJB4jnACtYv/E2MNXyFIjqMK/5cQn4ztRSRreLeN+FxtC0gjJ/m7kWeRaId2qVv q+nG1B4jTWubDj6d9oIrGBymbcytIgjIho7jZpmg1IwVxpYOXdke/pUJblfvdpBKv88C 8SNzu2N++3I90KI7WIzs5Qnyqi9UH7DFNkvFNlxwaOGkwdChnJrhQFiyGkHYVG3Ighdj 82ng8IZB1cAntVte708IuwLCiPKkalZZNZAN90gYdbaFKSHXVLDMTYS4hUWF2zO4X/BS +5Dw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=uZgat+VU; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-51098-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-51098-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org X-Forwarded-Encrypted: i=1; AJvYcCWRWSutPn5TXuzhOu8263dDRjHPiGgH97OwlQ6FugJi4Ef9aUDzjGpX4mWpT78zzCMPq33wtNSv/UN8Cz8EkUWF5iOMkA== Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id s28-20020a05620a16bc00b00785600855a0si1947384qkj.17.2024.02.03.05.02.18 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 03 Feb 2024 05:02:18 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-51098-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=uZgat+VU; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-51098-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-51098-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 3C8761C22DD7 for ; Sat, 3 Feb 2024 13:02:17 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D40C95D72F; Sat, 3 Feb 2024 13:01:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="uZgat+VU" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1A15F5EE8D for ; Sat, 3 Feb 2024 13:01:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706965289; cv=none; b=hbZ57OCrcnzwxMJRiMdFxrV2rF6U+X7MKk/F4FeXBxrQOnsT/ORAtnxY2N4wQ0an578sN/YkUtZ432eCZREuGbhQNfpsnURYewWEue95d+kVTDPY0lWsWeP7lSER7jxdQgKU6xl5i9fqUoAb9nFFlCvrPSzrk4pm4hE8/y8WJNw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706965289; c=relaxed/simple; bh=EAbTSMPbYo7NkFe23hvp0C1Clui1JNxdOmENIj9lOq4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=E+awT27poWxCZyJwkFiZ3EcXa2VMVLwhqqNjalVAoDLqYb0n6PduQQgFjyTmI0SFLCF0/G/kkzi/huvH2v/ULWflYxzdev2DiB5RhPExIhY7IG8kdF10BnndTJ6PSBV4yups2Ag3u0EJ4KtmmeiWeXUdQ8Kw1otUCYRjE/+DLG8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=uZgat+VU; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 39AFCC433C7; Sat, 3 Feb 2024 13:01:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1706965288; bh=EAbTSMPbYo7NkFe23hvp0C1Clui1JNxdOmENIj9lOq4=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=uZgat+VUsmUDt+Vq9NXQ25ez0yXRmsrdTc785RA0TkxNDWysZzktZrhq+DvZBQehS 07g9F6qjE9YwLzI3x9kyMI/K+qN22xn05WvQ30rztoXp6xCUGc4yoKJMB5VNreR3f3 jntral71coziR4sPoD0J7Z1M+BaWDcm9r22tGVv/e3XJ4U6bvM71YSJeTlf0Ifkp5d 2CzSOWNtFC+hoEZ/M1z33nLa3Vetjy56LWqGyiQAJmxE09RLyGiPOabhPzpIktTTpm 96udRKseP9jOyeood8fNEVx5FnPpvWD5G1zTuC2Onx+4nPceecdNwHIIFat/TcoJ0L 7NrZhNO/gkMfQ== From: Mark Brown Date: Sat, 03 Feb 2024 13:00:41 +0000 Subject: [PATCH v2 2/2] arm64/sme: Restore SMCR_EL1.EZT0 on exit from suspend Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240203-arm64-sme-resume-v2-2-a1fbaddc4425@kernel.org> References: <20240203-arm64-sme-resume-v2-0-a1fbaddc4425@kernel.org> In-Reply-To: <20240203-arm64-sme-resume-v2-0-a1fbaddc4425@kernel.org> To: Catalin Marinas , Will Deacon Cc: Dave Martin , Jackson Cooper-Driver , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Mark Brown X-Mailer: b4 0.13-dev-a684c X-Developer-Signature: v=1; a=openpgp-sha256; l=986; i=broonie@kernel.org; h=from:subject:message-id; bh=EAbTSMPbYo7NkFe23hvp0C1Clui1JNxdOmENIj9lOq4=; b=owEBbQGS/pANAwAKASTWi3JdVIfQAcsmYgBlvjkTOxfeXqJXIwfA+1GogU8KWgiTC8jUf6+WEHcU OzK/j2iJATMEAAEKAB0WIQSt5miqZ1cYtZ/in+ok1otyXVSH0AUCZb45EwAKCRAk1otyXVSH0BBuB/ 4yB73VEdmQiV/eD2xRwFIagUQD/ROfRHWYDTG+vdDY6evFGYyp+o5jMal0EBnScrQhAtiw5/n0c+0T 98naJhKjgE+s923Ed6S3yhb2n7K5HoYTMx3JQABL+vO+yD1TH+e8R6X6ZOATxZHRG/sC3oe53o6t22 thdMDzT2+2Q51RhxgQ1TYuNp36N9Kw4KPUi1skupgKFdislUvyfxpBF7QQbGyBv+A2bMLvcZLfdiwE X2LNyCYfP0AunHT4tht1Cg7jscj/j0/DHX3VSkAKL07ZCmNVjV4XkAsESTRGkTkFrlcxSos+3bbLWX /npT0r/lQlsn6radcopiLw84Z5Ie5e X-Developer-Key: i=broonie@kernel.org; a=openpgp; fpr=3F2568AAC26998F9E813A1C5C3F436CA30F5D8EB X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1789882887068635805 X-GMAIL-MSGID: 1789882887068635805 The fields in SMCR_EL1 reset to an architecturally UNKNOWN value. Since we do not otherwise manage the traps configured in this register at runtime we need to reconfigure them after a suspend in case nothing else was kind enough to preserve them for us. Do so for SMCR_EL1.EZT0. Fixes: d4913eee152d (arm64/sme: Add basic enumeration for SME2) Reported-by: Jackson Cooper-Driver Signed-off-by: Mark Brown --- arch/arm64/kernel/fpsimd.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/arm64/kernel/fpsimd.c b/arch/arm64/kernel/fpsimd.c index 8d2a5824d5d3..7a7c056f0647 100644 --- a/arch/arm64/kernel/fpsimd.c +++ b/arch/arm64/kernel/fpsimd.c @@ -1320,6 +1320,8 @@ void sme_suspend_exit(void) if (system_supports_fa64()) smcr |= SMCR_ELx_FA64; + if (system_supports_sme2()) + smcr |= SMCR_ELx_EZT0; write_sysreg_s(smcr, SYS_SMCR_EL1); write_sysreg_s(0, SYS_SMPRI_EL1);