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 C00C5C43334 for ; Fri, 24 Jun 2022 17:22:14 +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=m8Rk66jFCf4gXF3ZNek7lavj/fKr64ajZ9nRhhUOwnE=; b=hVf2VxJ+v8A/kU q8gROpEUQyxESNUBGiH3VzEJ7WSwsBbQNIFjVdGZKW8mwT+VcNaAGMZCkdEkrYfaFD6hA6wPEZWFg W1DDPHvfmjHGt+1rSigQ2uwe7dQGSp9K93s0oN/fy0ZE8ffy+/w1jP9TFbMCS85kEGlmE/zGZHS3o PTwazxCgUdKGNbr7HBaLzaUMKTyvps1z1QoRh0IA7zTmkjZrgqoACf6ApW70LfAL1QahYVlGSG757 Auc9DmGSB+nS+2Vmhb2+xhh8lGcnM6rVEGzHd6SMq8HydXOFDshmPNDqiaYLp/IuVc/Rjb5RCUFOX 4YBNzpvpAFAAj6CA8Waw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1o4mze-003CyT-Pc; Fri, 24 Jun 2022 17:21:19 +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 1o4mza-003Cwt-5K for linux-arm-kernel@lists.infradead.org; Fri, 24 Jun 2022 17:21:15 +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 64AF360B33; Fri, 24 Jun 2022 17:21:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0F823C34114; Fri, 24 Jun 2022 17:21:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1656091272; bh=1SidRqMI04EVbOwa/ovZJpZRohtBewMFA+jMo2qZBX8=; h=From:To:Cc:Subject:Date:From; b=HkCbUh6236BZoG4q1Ce13jmWyYyWtGSS70o5DKEl/wxUekbqFQzx3YPrzcecVq6PZ dlWbT9Aq9Q3A3XecJpxvQpK6yMjJUyeFEbw5mT+qWHrV6SXjvdGsNgDZ+mZBPxM2eF XkRMVLgQfhsfzfM1fX2W4GICmXbleeiaY1U8ADDcUhrwptMKxhVrGIouTrPtHDs3IG XURMaPCsAxyxebjhCxxDU0AsUOQgXYmNgE6/lucorXOeujbIvreqiYhS+Up4NUa178 X/KMNWeKKws/dN6szyNiwRoelieThZIVzVoxM4snGDx6gWKh7qmPeiXjDGSr9baYER 6Eln7UldK3p3w== From: Mark Brown To: Will Deacon , Catalin Marinas Cc: linux-arm-kernel@lists.infradead.org, Mark Brown Subject: [PATCH v3] arm64/signal: Clean up SVE/SME feature checking inconsistency Date: Fri, 24 Jun 2022 18:21:08 +0100 Message-Id: <20220624172108.555000-1-broonie@kernel.org> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2125; h=from:subject; bh=1SidRqMI04EVbOwa/ovZJpZRohtBewMFA+jMo2qZBX8=; b=owEBbQGS/pANAwAKASTWi3JdVIfQAcsmYgBitfJsHQl3DlxR9B4+9cnYtxrCd3ZVIA/0o+E4EhFk +Dq0mECJATMEAAEKAB0WIQSt5miqZ1cYtZ/in+ok1otyXVSH0AUCYrXybAAKCRAk1otyXVSH0JyXB/ 9NPDMrCwLJSpvvrG5pOrVMpOM7uqpaWX4bLbPvKTS1l0GAxs1BAFqjMayTgLFHOlJy030npxpyLpqz J4qFy6L4kJ6A9QLjP3S6uqOk2+axNQWQ6bDOuMIvdr78E/DFOTmVjc535Hr9ax9l8SwTRZjI8PKXKR m9rCGUl5WiIipN0gVnxM2MHBeE8yk4evUyzGtDvf7agWIbaG8poq1DHO8vspOOGU7h+CK7fZ7JMxP+ MUNJRGacsxfFc5noH1misZMdt5Ki7FoAotF/vVpyrV3PrmbGf1xaDALBG1fFFjXeO3Kt+aS5UDPFdd /Brk+YayO+69YxSNvjwQO20PEQj07R X-Developer-Key: i=broonie@kernel.org; a=openpgp; fpr=3F2568AAC26998F9E813A1C5C3F436CA30F5D8EB X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220624_102114_344976_14799296 X-CRM114-Status: GOOD ( 16.50 ) 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 --- v3: - Make stub function WARN and error if it ever ends up being called. v2: - Add a stub restore_sve_fpsimd_context() to hopefully fix an allnoconfig issue, I can't reproduce locally. arch/arm64/kernel/signal.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/arch/arm64/kernel/signal.c b/arch/arm64/kernel/signal.c index b0980fbb6bc7..3e6d0352d7d3 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,14 @@ 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) +{ + WARN_ON_ONCE(1); + return -EINVAL; +} + +/* 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 +657,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