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 AA4D0C433EF for ; Thu, 2 Jun 2022 09:47:07 +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:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=0XEqUYoEdTtf9p4BoCxyGNSngW/+W96fLmtnShH7QZo=; b=ja3k1Sd0C8xFbm I4Cs9INYu5DUcDDi+cawpSmfpw7xwgZY7HNSZpi88VxwC4Y30zH1C4WTlP8E6QbegJeOLSTrdkVSs a/oA5X1cwClhIHAfNEuqO2FdIz8MK+fJYMElXnYezOABzoevvfXhAbpI9r6xUiAgPWc54DN3h26kl BJNtKtxvtIeqd0+UfJLXqI9+ENOoVI6ZbAC11xmaHZoCEAUApvcoDF77NHwRXsvBHlCE951iJF6Zz 7IVy8lJm4ChnQoU5rNNNTu58Oeh+J7yI0K9FO85LkCMp3Rx1NqrEW6YiczdpCdqVxtmqW13N6MWBM Xm0cTS2b7wpAZGQAMjXg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nwhOr-002YDn-J0; Thu, 02 Jun 2022 09:45:53 +0000 Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nwhOo-002YCl-Ds for linux-arm-kernel@lists.infradead.org; Thu, 02 Jun 2022 09:45:51 +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 dfw.source.kernel.org (Postfix) with ESMTPS id 9F1EE613F9; Thu, 2 Jun 2022 09:45:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 09206C385A5; Thu, 2 Jun 2022 09:45:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1654163149; bh=47m97EZ2K2eHrgXHD18O6HS2KQ10Pc1hT3FZsrOqbQU=; h=From:To:Cc:Subject:Date:From; b=unxlXSqfg5kg3937IQe4oElWJEuEN7qjkV+ZnwOhDfHhvPumwv/9gAq1j3xj5pyvE arvX3WhsFU6SCr8KCr79/qTYSBNzLr7VlCOvdCRSxtOKpHr9lGxYX2gC4OtupgorgA uNjzOh4CP3TV4cB6HCQ8Cnq9+MgJneDf+AeJJe1wJZSeYq22K8puOXepl4Ry0cCOEm 5gONjz6HV8m0NEu0AMUBJyTgntlnr8q6S13A1HYUgNxtZTNrhQ2W5W67WPN66BbSnS y0ixAsc1UTyEPz+qteHS4NQ3ka0tVfeX3nnPxaZ6A3+Wj/fgPLnHHFhF8zeM0OjJmZ TCjsBMdRD1h3g== From: Mark Brown To: Catalin Marinas , Will Deacon Cc: linux-arm-kernel@lists.infradead.org, Mark Brown , kernel test robot Subject: [PATCH] arm64/sme: Fix EFI save/restore Date: Thu, 2 Jun 2022 11:45:44 +0200 Message-Id: <20220602094544.3303367-1-broonie@kernel.org> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220602_024550_558729_C09D73AC X-CRM114-Status: GOOD ( 12.32 ) 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 The EFI save/restore code is confused. When saving the check for saving FFR is inverted due to confusion with the streaming mode check, and when restoring we check if we need to restore FFR by checking the percpu efi_sm_state without the required wrapper rather than based on the combination of FA64 support and streaming mode. Fixes: e0838f6373e5 ("arm64/sme: Save and restore streaming mode over EFI runtime calls") Reported-by: kernel test robot Signed-off-by: Mark Brown --- Compile tested only at this point. arch/arm64/kernel/fpsimd.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/arch/arm64/kernel/fpsimd.c b/arch/arm64/kernel/fpsimd.c index 819979398127..3c66a061ff6f 100644 --- a/arch/arm64/kernel/fpsimd.c +++ b/arch/arm64/kernel/fpsimd.c @@ -1916,10 +1916,11 @@ void __efi_fpsimd_begin(void) if (system_supports_sme()) { svcr = read_sysreg_s(SYS_SVCR); - if (!system_supports_fa64()) - ffr = svcr & SVCR_SM_MASK; + __this_cpu_write(efi_sm_state, + svcr & SVCR_SM_MASK); - __this_cpu_write(efi_sm_state, ffr); + if (!system_supports_fa64()) + ffr = !(svcr & SVCR_SM_MASK); } sve_save_state(sve_state + sve_ffr_offset(sve_max_vl()), @@ -1965,7 +1966,7 @@ void __efi_fpsimd_end(void) 0, SVCR_SM_MASK); if (!system_supports_fa64()) - ffr = efi_sm_state; + ffr = false; } } -- 2.30.2 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel