Received: by 2002:a05:7412:d1aa:b0:fc:a2b0:25d7 with SMTP id ba42csp979596rdb; Tue, 30 Jan 2024 04:43:16 -0800 (PST) X-Google-Smtp-Source: AGHT+IGxqv8U/Yk8+f65+43K/f0HIn+wIXfJxJzWzlqFalgAesi6hLlbw7X73ieeiwvf+GbN7cfq X-Received: by 2002:aa7:cd42:0:b0:55f:1c6a:79fb with SMTP id v2-20020aa7cd42000000b0055f1c6a79fbmr2662272edw.16.1706618595669; Tue, 30 Jan 2024 04:43:15 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706618595; cv=pass; d=google.com; s=arc-20160816; b=dlanyl+MBNxo8J5C4GreZnqUJngR7CdHEfPKQRI53Ef270V+9ony4KmI02ih/jiuzu Y3xd6ZY0AZSNYtnC0uRaRDZq7dCnQ3cpeJFPY77ba3vL94tfF3f/qGq15UTDI+ZuWHfO NqN3/5ARwAS5b2c3J6dN8tNw+bfxavRJ76ioi/4KGbLyq9uVMPFLNEbuzX5AebeZbtwp jjEKw7Pr8iF8LLnGJPhnkFlyABZ2w5L8XEZY7GOD2gfU2RJktSkVVybOZTk8cfgFOwxL B9nWgdy3Z+ikGYpVw3pJuvUkUqooDJ8DUiTaRy2CDCk+NpihZiwHjN9e8qRl207zTHNJ 4DWA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=ECQxt8IlGXLNcpC9GkZveegfE6EJkhQK0ZTbL8Cs544=; fh=P3hOhnDFNTU1CcDoxqiBijaV8RLw5aqbWrKCsacJ0kI=; b=BgN51i2nLkOnYTI83w+EcYvBZTW6/78WGqk/tmoS8UeB9Ns2sn5Xm0BoAs7DOYn6OA ZVDmGgj0o8VoiBg+LJSNe0cUc/0Dp5HWEl+phOTfv/vIoZczZWnqth3DbeZA9Aj/klMD HO+fCWmLhhQRMi2fxXeEh5iLSH+iSm1Kvk5bRXwCw49VYuTmXipVYOP0F1QIYcKEuINi L/9xNL/8IgdtY9OpUSVhdXxMF6jN2T4YjLpMCEhWOiQHB2Z4+v42akCeCeJiIYHi84yp aMeERvJQ9g9rzbHLIIwevg0ISRcIOIpBvcfQP+vi8iO4lgc/HbvZ09/Fpd/N6MuB+qoa EtKA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=YuKu+O33; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-44623-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-44623-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id 3-20020a508743000000b0055e35b635dbsi3979411edv.619.2024.01.30.04.43.15 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Jan 2024 04:43:15 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-44623-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=YuKu+O33; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-44623-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-44623-linux.lists.archive=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 am.mirrors.kernel.org (Postfix) with ESMTPS id 6DAFF1F214BD for ; Tue, 30 Jan 2024 12:43:15 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 25CA56BB57; Tue, 30 Jan 2024 12:42:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="YuKu+O33" 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 5021A6BB3B for ; Tue, 30 Jan 2024 12:42:19 +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=1706618539; cv=none; b=NbEYJQJz5dDtD9Uy3rQ9yu3zSngNdTsVi1qlvDUnQms1fSLk7M79xNgtoMGrlQqzqYEv7JXYd3gBXtWtoX1OxXVoBvM46NW/MTrw9SExtUi0CJd9LZM3q861nOX1wdsQF1zyKBur2MdaU8MZlc8a01jf887JUFFLejE3+QM7cPM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706618539; c=relaxed/simple; bh=Eql80OFLBFbtt9dtLg6qGZK/NtoMpoPp+MJNrnweddM=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=si1Uw0PPpoyLL0iIFhOLKNRyqXfRwYxCj0pAcT3aVHRRC3+yHxIWAPED19a1M6jvMNCX25i+bWNMN8H8GqraiIBZoMriEGw+tB1JSYQLV2RTeLgGOidV2IufvdqCDbtfHKDf8Kn70ap9HNkcdl3EjlgpYrdotFEnn8MpTjndNrg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=YuKu+O33; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 14434C43394; Tue, 30 Jan 2024 12:42:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1706618538; bh=Eql80OFLBFbtt9dtLg6qGZK/NtoMpoPp+MJNrnweddM=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=YuKu+O339o6awlBPWH5DcVtAHfNXbvuLDKOJa8IQlG9tw+MjLSZ7DtDoe1C02MlkR VK7beEcRjpOmy0OfHI69zV8uw3XoprCvgKQJel0pBCyVlzJQxJai9nCwEj3YIp4xsW ffy53pR9BfBpninfPJUuuE65Ca8uQI/giF8X846bzzj++L33tDh/MQwlgTrZbGM5NJ gOPYJdhYYmM/bycf4ahfnywmIYOIn/cKW7ivFWH5+TEvuUKofjTJmy/AidmuMSaybl PG2lJnxb9BRgzcvcyoHPXl6f0lEGVFUQXr5hdU6aUJw2gI4+hNN+NnH7nUd3hl64vl tK9z2ly5ANUUA== Date: Tue, 30 Jan 2024 12:42:13 +0000 From: Mark Brown To: Dave Martin Cc: Catalin Marinas , Will Deacon , Jackson Cooper-Driver , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/2] arm64/sme: Restore SMCR on exit from suspend Message-ID: <65973ce3-a316-40a4-bad4-fbc99bccff12@sirena.org.uk> References: <20240130-arm64-sme-resume-v1-0-0e60ebba18df@kernel.org> <20240130-arm64-sme-resume-v1-1-0e60ebba18df@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="k0mhTPwGrUaa4/vP" Content-Disposition: inline In-Reply-To: X-Cookie: 1 bulls, 3 cows. --k0mhTPwGrUaa4/vP Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Tue, Jan 30, 2024 at 10:53:42AM +0000, Dave Martin wrote: > On Tue, Jan 30, 2024 at 12:02:48AM +0000, Mark Brown wrote: Sorry, didn't see these bits due to the large block of quoted text. > > + if (system_supports_fa64()) > > + smcr |= SMCR_ELx_FA64; > This seems to silently duplicate logic present in cpufeatures.c. > Would it be cleaner to save/restore this register explicitly across > suspend, once cpufeatures has initialised it? I was unsure about that, I could go either way. All the register save and restore is currently done in assembler which felt like it was doing things too early so I went with this instead. > Or this could be factored somehow, but dumbly saving/restoring it is > probably simpler (?) Yes, I keep thinking about doing that but factoring out is annoying since there's also the KVM case where we don't always want to base the decision about the settings on the cpufeature detection. > > + write_sysreg_s(smcr, SYS_SMCR_EL1); > Is there an ISB or equivalent somewhere on this path? > Can we blow up when trying to restore SME state (e.g., ZT0) before we > enter userspace for the first time, if the firmware left the SME regs > inaccessible? I concluded when I wrote this that there was but I confess I can't remember where exactly now. --k0mhTPwGrUaa4/vP Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAABCgAdFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAmW47qQACgkQJNaLcl1U h9DwhAf9EzbjO8QDLngdgs/w1U8tbbLzYccixDancPw6pIBneMEiM2dV8XYztDob QiRsSxX4UXsGBCJJH/RhI1jFcWVOVS3XilPcDaci7If2OGMHfhafi5DFUmFSE24z XFgNxZvDs81+CyBvMI+AKb2sXIN5YnxbKRQFcII8sJA0HgmJI46XlLo+XTXOsliq +R2QuphM+6bmkWynrD5lQfVloSz8VGk4jQBott06irR1Aan/Yh0Kat8XaGNZOuFx 75a7WKfDkx0OGJe7tOvNHGfq3okG71/oZGzOYdACF0GkpRkRb/8ZzGM9pvkvjN8b X0bqQlvC/heUdIVctGsrjHf9a0vk5Q== =Mb4u -----END PGP SIGNATURE----- --k0mhTPwGrUaa4/vP--