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 755A8C43334 for ; Fri, 24 Jun 2022 13:45:39 +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=knHOpi7kM2N6ruNM67O3l1GE0ngE4T8RY+Wu/8P8/r4=; b=UXq0bJoCF8e4vX rEPnExSIKJ/8QIJk/zYotogrAolmckoYO4HiBnicn3ZSJMYVYpZa4MrqS21cYujkdnM6TDaNdbLrn mTb9K3XetP1ocBuXgJc6No3Aa8ad+Hxlh+iXAwHX3uqxcuD10kKnADk3xcm80ehgtu5JcQwI/nAQJ wn4ZhVAuLvqa1ObdpBy1874qvnZDPkUMr+4tc/dWkliBhYFhyKGMG8AXnHdlXmQ+Z74FUrjPd2GRX UWStj9fMMbJEF1/pguD8CdJFgsBRj4nZSAsr5nu4/57FTF5RON4v/ImjjFkK0Pp9BG6r55+UXWQGb MRdeM7YLYToVY5WO2+vA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1o4jbp-002Rjb-RX; Fri, 24 Jun 2022 13:44:29 +0000 Received: from dfw.source.kernel.org ([139.178.84.217]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1o4jbm-002Riv-Ur for linux-arm-kernel@lists.infradead.org; Fri, 24 Jun 2022 13:44:28 +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 81FEB61F65; Fri, 24 Jun 2022 13:44:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E530DC3411C; Fri, 24 Jun 2022 13:44:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1656078266; bh=d/7xcp10vx9TBZJoeAwXtRDU9mJVLZaDaTXk8NlNlO8=; h=From:To:Cc:Subject:Date:From; b=uHK1bKNPYGIeww2OdmKYuUna13HISzj6q95EP597lyM/9/WqfGy/FURgulJRip37d aX3ex1c98sKXCYhOsmY77feUogjVZrL5TvRPAxOGv+bu/WDzIORL4cl2NOBIDrDe00 dlYEk+BCAf4r2YDgiW/En9//5rWRG176mjwan6kQsQ4RjDVuUuVPegK/RDaf9mZH1z aWfhSElT2DB8A+mIRpnKCWq4jCRYkr11ENbgqpog4fBfTlG+y4f9oTvrLVn6T7Drlz PgNh/hH4pp/ccw+z6SMn2C1MqiyrUS70wu1sgmapRz8KIimxXZKlz0T3JFl+ID0/xM 7idubwPoEEZyw== From: Mark Brown To: Will Deacon , Catalin Marinas Cc: linux-arm-kernel@lists.infradead.org, Mark Brown Subject: [PATCH v2] arm64/signal: Clean up SVE/SME feature checking inconsistency Date: Fri, 24 Jun 2022 14:44:14 +0100 Message-Id: <20220624134415.343417-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-20220624_064427_069066_6D1D0BFD X-CRM114-Status: GOOD ( 16.47 ) 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 Currently when restoring signal state we check to see if SVE is supported in restore_sigframe() but check to see if SVE is supported inside restore_sve_fpsimd_context(). This makes no real difference since SVE is always supported in systems with SME but looks a bit untidy and makes things slightly harder to follow, move the SVE check next to the SME one in restore_sve_fpsimd_context(). Signed-off-by: Mark Brown --- v2: - Add a stub restore_sve_fpsimd_context() to hopefully fix an allnoconfig issue, I can't reproduce locally. arch/arm64/kernel/signal.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/arch/arm64/kernel/signal.c b/arch/arm64/kernel/signal.c index b0980fbb6bc7..6b6a79806e82 100644 --- a/arch/arm64/kernel/signal.c +++ b/arch/arm64/kernel/signal.c @@ -280,6 +280,9 @@ static int restore_sve_fpsimd_context(struct user_ctxs *user) vl = task_get_sme_vl(current); } else { + if (!system_supports_sve()) + return -EINVAL; + vl = task_get_sve_vl(current); } @@ -342,9 +345,13 @@ static int restore_sve_fpsimd_context(struct user_ctxs *user) #else /* ! CONFIG_ARM64_SVE */ -/* Turn any non-optimised out attempts to use these into a link error: */ +static int restore_sve_fpsimd_context(struct user_ctxs *user) +{ + return 0; +} + +/* Turn any non-optimised out attempts to use this into a link error: */ extern int preserve_sve_context(void __user *ctx); -extern int restore_sve_fpsimd_context(struct user_ctxs *user); #endif /* ! CONFIG_ARM64_SVE */ @@ -649,14 +656,10 @@ static int restore_sigframe(struct pt_regs *regs, if (!user.fpsimd) return -EINVAL; - if (user.sve) { - if (!system_supports_sve()) - return -EINVAL; - + if (user.sve) err = restore_sve_fpsimd_context(&user); - } else { + else err = restore_fpsimd_context(user.fpsimd); - } } if (err == 0 && system_supports_sme() && user.za) -- 2.30.2 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel