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 8CC7FC433EF for ; Mon, 21 Feb 2022 19:26:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Nyh6Sa9t/hJsgkTdsQuPKgCQdbPJ0M/HxKHvA4Yf67E=; b=elOTpnGQsjGEyV R7CVYDJ8RzvLWR7IhfR3pjQoUSBeTqtI4hBGZfDtuBNIYz4kudKhPqNdyvZ0Coy7JrqOUTcRoZPGI cHxKU6TWTuFjy4MWOiH5mkY1nxUnH3d37HJxs3KGAmfidyOyMiHSFyqpOGwhrFnDdwRYq+/AqyMUg O551LKRE4XZ9RrYgRCLgv9r6pQwuy2Lm8SSLrh4FSQSglwrwq+hbxiNFsVZyaIL45N2DwuPO164Do hP/9URoljbjE7feybX9eneTLwP/XvMYINfE7ZGbGYBRPvbzciNm7nhuTE0WUwUZZuk7vKa6bFHXGj E9X7dN/ukgm2Eo6XJcDg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nMEJ6-00749x-BW; Mon, 21 Feb 2022 19:25:12 +0000 Received: from ams.source.kernel.org ([2604:1380:4601:e00::1]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nMEJ1-00749C-Uv for linux-arm-kernel@lists.infradead.org; Mon, 21 Feb 2022 19:25:09 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 94CADB816F9; Mon, 21 Feb 2022 19:25:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 54FC6C340F1; Mon, 21 Feb 2022 19:25:02 +0000 (UTC) Date: Mon, 21 Feb 2022 19:24:59 +0000 From: Catalin Marinas To: Mark Brown Cc: Will Deacon , Marc Zyngier , Shuah Khan , Shuah Khan , Alan Hayward , Luis Machado , Salil Akerkar , Basant Kumar Dwivedi , Szabolcs Nagy , James Morse , Alexandru Elisei , Suzuki K Poulose , linux-arm-kernel@lists.infradead.org, linux-kselftest@vger.kernel.org, kvmarm@lists.cs.columbia.edu Subject: Re: [PATCH v11 10/40] arm64/sme: Basic enumeration support Message-ID: References: <20220207152109.197566-1-broonie@kernel.org> <20220207152109.197566-11-broonie@kernel.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220221_112508_306993_16E83D8C X-CRM114-Status: GOOD ( 33.37 ) 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: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Mon, Feb 21, 2022 at 03:01:03PM +0000, Mark Brown wrote: > On Mon, Feb 21, 2022 at 02:32:38PM +0000, Catalin Marinas wrote: > > On Mon, Feb 07, 2022 at 03:20:39PM +0000, Mark Brown wrote: > > > +/* > > > + * This must be called after sme_kernel_enable(), we rely on the > > > + * feature table being sorted to ensure this. > > > + */ > > > +void fa64_kernel_enable(const struct arm64_cpu_capabilities *__always_unused p) > > > +{ > > > + /* Allow use of FA64 */ > > > + write_sysreg_s(read_sysreg_s(SYS_SMCR_EL1) | SMCR_ELx_FA64_MASK, > > > + SYS_SMCR_EL1); > > > +} > > > + > > > +#endif /* CONFIG_ARM64_SVE */ > > > I think instead of worrying about the order, we could check the > > sanitised register value in sme_kernel_enable() and set the FA64 bit. > > There's going to be a ordering/clarity issue whatever way round we do it > - the FA64 feature bit is in a different feature register to the main > SME feature bitfield and it's not as abundantly clear as might be ideal > that it will have been sanitised when we're getting callbacks for the > main SME feature, there's an awful lot of sharp edges with this code. > Having things this way round felt more idiomatic to me. You may want to add a comment in the cpu_feature[] array that it should be placed after SME. > > Also to me 'fa64_kernel_enable' somehow implies that the kernel cares > > about FA64 for itself but AFAICT we never run the kernel in streaming > > mode. > > We do run the kernel in streaming mode - entering the kernel through a > syscall or preemption will not change the streaming mode state, and we > need to be in streaming mode in order to save or restore the register > state for streaming mode. In particular we need FA64 enabled for EL1 in > order to context switch FFR when in streaming mode, without it we'll > generate an exception when we execute the rdffr or wrffr. We don't do > any real floating point work in streaming mode but we absolutely need to > run in streaming mode and only exit streaming mode when restoring a > context where it is disabled, when using floating point in the kernel or > when idling the CPU. So, IIUC, for Linux it is mandatory that FEAT_SME_FA64 is supported, otherwise we won't be able to enable SME. Does the architecture say this feature as optional? Which A64 instructions are not available if FA64 is disabled? I hope it's only the SVE ones but I thought we can still do load/store of the state even with FA64 disabled. Anyway, if we can't even context switch without FA64 while in streaming mode, I think we should move the check in the main SME .matches function and enable it in sme_kernel_enable(), no need for an additional feature. I think we should also update booting.rst to require that the FA64 is enabled at EL2 and EL3. -- Catalin _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel