From patchwork Tue Feb 13 23:06:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 200734 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:bc8a:b0:106:860b:bbdd with SMTP id dn10csp872299dyb; Tue, 13 Feb 2024 15:37:41 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCX/WeKID+X9Cta/w+WJVpb7KZc4B32bAlhy9XEETHjQ4I/7jTJJM+rXfPpQD//B7pqf1u/2xqTAD6m35m1QosZMU2J6kA== X-Google-Smtp-Source: AGHT+IEVOP6LTTLPeHn0BHr6PWvJV4lbAZ/nRD333AQTU8fYe5FVKDoJZK3ZEDOd+uMoLxYTiCM/ X-Received: by 2002:a05:6a20:9f96:b0:19e:9b9c:fc2f with SMTP id mm22-20020a056a209f9600b0019e9b9cfc2fmr1276915pzb.32.1707867461695; Tue, 13 Feb 2024 15:37:41 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707867461; cv=pass; d=google.com; s=arc-20160816; b=K/HzOqhBvMWyMoKZk3jY7MFGXrDiJHdvtBZ70S5ZNygSyglPTGSqDgYWkeRT84u1Kp kU5Bq6ccLJRfVLN86tLlCQRRaGh5MN8dbES09Cqjx0HvbIO3j98KjHY67B85SL6gp/bA 4MzfOYXTHBV4kx0KYcj1kW+Olb2qx2pQYeST2/59b/XFGNvvpk0KpYXSQmZi9QnYnCvN cObXNhVYr6HmkazSesw+HwXe8uBSdkngU+RoNXdhS3CauEEK94ayJmaZjIvdTc41AN9d Wxa3XiEmArBBhdykn2vhDlZyLxv3MATSgoL/fNqFwDqeIMHE4e40DLR+P5jDcJ0H199P pN3Q== 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=Ps7gokUNravTCwo3C2yzrBkuoam6D8prxT/BS+xPP5Y=; fh=S6+X5aVE9nNwZSpOIf05bcJnNq7eYpwh+ociA8BG4H0=; b=DiKw86oqWgal9yH/XIuVNCjtUdLjLsgvXCzlHGOviaTbBNoHbUfBUq7mt1D0a0+sq1 ExtxwdKkQmg/pDl08E65xOZ1Cw8paaQqvkVZJaoFHn9bLqEkJJnySLvGhH0U+FRxVcYJ NUsrdhr73ebpkE4RAi/i/WAvt5UjXZ2Aozt6qk8rk9p2TXJFioDEaAZncyEKqy6bih6O jvi67YShmjniRuVmQwqFtKfmPGj73aqxcVaatoiPc+chwhcDYhn5DHsRqMwb/3qSoVcB YatTkWgNtsXInK9HjGDDCVGvmwmK9pIqvsC4JcwyjTNTx1M3+TXeRVKdxvJRyA2I20kn Gzcg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ID2Wjs2t; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-64506-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-64506-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org X-Forwarded-Encrypted: i=2; AJvYcCU97JSj4f4+m5IZ5rib8HfUwGkgz5/+SmOLsMo9McnCeP1vTSIaCsw5U+8LDXd2owYjhnxxnlhA+/xGqFEudBzjGNwhPQ== Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id ee15-20020a17090afc4f00b0029705da75absi124420pjb.125.2024.02.13.15.37.41 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Feb 2024 15:37:41 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-64506-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ID2Wjs2t; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-64506-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-64506-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 0C888B22E73 for ; Tue, 13 Feb 2024 23:08:08 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1C3AA63404; Tue, 13 Feb 2024 23:07:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="ID2Wjs2t" 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 7373B63099 for ; Tue, 13 Feb 2024 23:07:16 +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=1707865636; cv=none; b=g0yapNqrIj6KKjPWmmF8Hj71D0G2uoOsTLm7dRqkw2ubi0T68+9hUGsCRnSFOyaVQ/tAdq29i53Gkkp/6BQxCRBOFG78f0eO5ffGcMixvYcbozO8bfGdHQJWMPcgquX1AObMkwRhqabclh5/fLGM2o3J1ljJzZAnYfrNNOjjFG0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707865636; c=relaxed/simple; bh=n9u10ZS5tf3bLwSljOa4a7bDya4v/AV3Y3EVY8udHHE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=pIXMDarrOgaM4HSXhGjX0hv2BAjCVI34gncgPwr0Df0ul9NeAkC66nQRRoEJF0dTq4efHkox4ULXwc5/uSnnMRBm4sfrO06it/UeL6OrIQIIicagEUtm+NxVfoRHEN4cDcdmAoA9axCHIICi7JdkpIJNQ3ggFpBH4+VRmuMfuMQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=ID2Wjs2t; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8F077C43394; Tue, 13 Feb 2024 23:07:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1707865636; bh=n9u10ZS5tf3bLwSljOa4a7bDya4v/AV3Y3EVY8udHHE=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=ID2Wjs2tRPxkGyK0RXHRa2GKVKZNd3QngdWE6h/uBwXLUCp7Oop3zt/6AU5zeen/3 ZnmJ1RijSO+Q4YgB7YzDLvy3/HUZC5XW7/EPzrWHnmKtQZVlEAT3O/0NMvhBnR29CU ETxfyssW2eXN0y3eBymg+7npKEgMTwvL7LhKHwOs3C0G9j+kk6weVBufhoUxQH5VWN hPUSIxFswmcQF/bIPHWMDfB/Yl5UIwkK81YeWOetfmpyjKcMfIFGrGh2uMA3AWRhCz Gy4JEaR/wBjZJQswRvSb7YmualUZcg6LXW0PkQYddb03zDpfdy6XRSgR0ZGpuPUJ/n eqfXMUwG5UOjw== From: Mark Brown Date: Tue, 13 Feb 2024 23:06:32 +0000 Subject: [PATCH v3 1/2] arm64/sme: Restore SME registers 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: <20240213-arm64-sme-resume-v3-1-17e05e493471@kernel.org> References: <20240213-arm64-sme-resume-v3-0-17e05e493471@kernel.org> In-Reply-To: <20240213-arm64-sme-resume-v3-0-17e05e493471@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=2876; i=broonie@kernel.org; h=from:subject:message-id; bh=n9u10ZS5tf3bLwSljOa4a7bDya4v/AV3Y3EVY8udHHE=; b=owEBbQGS/pANAwAKASTWi3JdVIfQAcsmYgBly/YeT8Zv2qklmd6Z20IViy+bBIDojKavlqTywPM7 QnEOhbqJATMEAAEKAB0WIQSt5miqZ1cYtZ/in+ok1otyXVSH0AUCZcv2HgAKCRAk1otyXVSH0Eq1B/ wKayaPsmBI/+hGRSWdTXUxHsD37OXQcSNtsqAu77CQIX0HoROXuvQckQ51Ot80fWvOSZ7fo2kUYvO1 mVkodiqvR9a4v4gHsmad1dIzf61oB3X9tImInXXMvVqvPUtJWzr474R4HWroKD31tzP/kGI6D7OZR5 gC6z9hNLTsnRtS/gpy8z2KWo/nVirBNp2VOgZ0zlxvJlgiijnTE9mB0fgBv1DVoWsSejlxBQyVDPLi 7zYCVN9UVw9J1PuI0kjPk5qrs4cf1X3LwqoWU0ws4I9qjb+NRPrjikhMmQ9myItS/2kC1E+oeTj/h4 mG5SJT+HoDgYMzOzF5BxhoYcm3kgf5 X-Developer-Key: i=broonie@kernel.org; a=openpgp; fpr=3F2568AAC26998F9E813A1C5C3F436CA30F5D8EB X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790828831878014931 X-GMAIL-MSGID: 1790828831878014931 The fields in SMCR_EL1 and SMPRI_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 Tue Feb 13 23:06:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 200735 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:bc8a:b0:106:860b:bbdd with SMTP id dn10csp872483dyb; Tue, 13 Feb 2024 15:38:10 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVZ+Q3BYl06fxkIqStx12hKeH4dcU4Ty4Gzl0FZbftZHrFHkC86bq8TqQpcy3hq90p4rC5izN/XkIiHw5/s4oflWVfEkA== X-Google-Smtp-Source: AGHT+IF6szP7psvGDt9jIUvt+f8hreqE7Qn7pjssUiCI0WfsKPhGmuGYqI+ocE0gyKp36AxBtKVF X-Received: by 2002:a05:6a00:2daa:b0:6e0:6c89:e308 with SMTP id fb42-20020a056a002daa00b006e06c89e308mr785265pfb.3.1707867489940; Tue, 13 Feb 2024 15:38:09 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707867489; cv=pass; d=google.com; s=arc-20160816; b=cRt1rbTcnoVj0fZGb7HnAfUOPFhUIW+0I+apt3luRb5y859f2xXfwfIQVRhLNu2DNn l3WqD5SJzzrADLzrk+JB7z/8QwV0pQ7uP9Zoib+gAO3eGYKFk0WQ41cCDiI2YlPcryjO tYgk85bnrkKJ0GjnIu3iPasOPz/H9LuQF+wqzQUzhXiA9EXV55VYVDTBLU0rhEkWlEnR OplW4XTCChnj1rz3980PXArTUlcC3DK6/gOBt0zvjW7j29ZH5hkEnGHHhlx3xANTTw/S pAbdXwDdfo790+94ShUGQP4aNNfakWHto4oU8uCrxzCyknTD1pQznzZLIoM02Jwy1/wx SFig== 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=rvy4n2J7CQvr8uAoyWFklZLG3ce3Zq8THza+MTAJGsY=; b=R9Nis2mjldp7Q2syCXzF1cAvLZP9xlBH5GQ61ZzhupIwEh6Mz6vnuNg9D/euuY18xx TLudfK/M5VST4iEPq3KIno8thcwJKcRbDPGFLpYCjtheo4QnKd9ef1oWWPYLTb97vm0D rT67XUblaVR3Mx8WJNHwx0fdKwE1OLxoDuse3qEY/0BzY/s5hdSndNxOlJGTmAp96V7F +Jwq6+cQVyVXE40ppV79KBlw7eEhPEA7BwxLkz+SMYzeiNWybE05xUW5k8ByKvBBlBcO zKWet16M1RmK6OL4mvNRbtQkKhb95HPP3Zw4mOiHaQ2jo+CstWH/IurG8qhdRBlv3hmk rkhg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=hAJ8LHag; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-64507-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-64507-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org X-Forwarded-Encrypted: i=2; AJvYcCUgCvkuIslICx+H7/9F+fDJbfi2kaGevnOkIrwXUXwaH/clmM0Vbu4SaSEPxlv9ZsZLjPGwTaOd1TB3dcXVpRRFpcwReg== Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id p21-20020a637415000000b005dc528d603bsi2623345pgc.675.2024.02.13.15.38.09 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Feb 2024 15:38:09 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-64507-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=hAJ8LHag; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-64507-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-64507-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 7509FB236A2 for ; Tue, 13 Feb 2024 23:08:26 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CB5A9634FA; Tue, 13 Feb 2024 23:07:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="hAJ8LHag" 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 44CDB633E9 for ; Tue, 13 Feb 2024 23:07:17 +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=1707865638; cv=none; b=oZ48Ja3Dkav+Qhyx0cV/38KCkBczeLC/gRnfsU4o1NwhqpYL+aHqIeF1JC4dgseohOysJriTfJMF19PrdCnEtNW6ejmGTOu9ga+7B7tkWsVTSkBVDsTKfpF2thP5ofBVDr1OQplWZ3XgjB5RYv8vNDNUZX0Vd6WqFzzrSyVkGwU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707865638; c=relaxed/simple; bh=EAbTSMPbYo7NkFe23hvp0C1Clui1JNxdOmENIj9lOq4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=eyOlYLjqqxsstEnv/9LWjL3xh0Mecp+YYQbUPMDMXxgFgos+Tm/ziDnmfUrvJf3S1tKVsnbMKCvyBGj/fqyWwG0w+29oIBHpUgBrlfofTSKRBr+bdzE2vMol5bX7g8r1c+YN+uuYMjigKx1AKiTmlES2uuARFlJA7a+OW7tHVgs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=hAJ8LHag; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 61A2EC43399; Tue, 13 Feb 2024 23:07:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1707865637; bh=EAbTSMPbYo7NkFe23hvp0C1Clui1JNxdOmENIj9lOq4=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=hAJ8LHaghvkkxiqweYcM+tjPbcoozyj5+8nI1gtLU/uVOCVrHD7A9LBc0o/34npev SK1vQzANlK3ndNgpc/RLlEWZi8l46QgqfgZAATTea1mP2gJWG7LpxoM9M/AQX/bZdh KU/1RK7GCoTOG17RZJl40JGHJO5ReH1kycxLs5ax9hg/0utXfaaJVgfLGDeu4/JX9K VsKAt4OVe3KZpNIG88AnBijgOFUlG0qECnDyIFqig/6TWlYOaQn2kOwM99tqWnQhic w7xb1AG+v4dSLu/NxhQMaqLNVVI1fDRdZrpcIbNVanXzZcSHdhHjbRSCVN92jJw5sX k4P3ED7ZIg1zA== From: Mark Brown Date: Tue, 13 Feb 2024 23:06:33 +0000 Subject: [PATCH v3 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: <20240213-arm64-sme-resume-v3-2-17e05e493471@kernel.org> References: <20240213-arm64-sme-resume-v3-0-17e05e493471@kernel.org> In-Reply-To: <20240213-arm64-sme-resume-v3-0-17e05e493471@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/pANAwAKASTWi3JdVIfQAcsmYgBly/Yf2kx5jbZv4Nhm4KK9MO6SBlZ5G5dJiR7zhNs8 y2ljCYqJATMEAAEKAB0WIQSt5miqZ1cYtZ/in+ok1otyXVSH0AUCZcv2HwAKCRAk1otyXVSH0OLCB/ wIv2Gm5BjBWurapN1ify5+sQprymBHlpMubMEOS4g3KPoR522jMOGZh3OxMw/l0X3TiSza46yYr7Cr OH5chMq2fJnNrbOsO/jsBLE2wiHdLCdI8AYmlBmKRVJijQU486QLCnKVckNHph9svDlQIx8GPzCp3N JeR3Q+L2salvs5LqJO2jnCsrC9iVQqPaU4nozI4eWcSvRkHWf+51QK7Viy8blrlXZP4irrh3XobJRI o9uwhnXaNwGPnd0V31PDawbO190djWiylohffo0Xba5PSGDus/4gvqmE+1OizjoTi1P7NN3GZoDZqa fVhSQTM57RcDXbF8TuKZo+6p03+e26 X-Developer-Key: i=broonie@kernel.org; a=openpgp; fpr=3F2568AAC26998F9E813A1C5C3F436CA30F5D8EB X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790828860988870386 X-GMAIL-MSGID: 1790828860988870386 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);