From patchwork Thu Sep 30 18:11:07 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 514927 Delivered-To: patch@linaro.org Received: by 2002:a02:606e:0:0:0:0:0 with SMTP id d46csp35987jaf; Thu, 30 Sep 2021 11:15:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz4vXkju1PDRmUq4zM+YnYui5Tuc+aSa9FQr9tmRaa1msoMwbDcvXrPxLNq942rwGkuJrcR X-Received: by 2002:a17:907:2131:: with SMTP id qo17mr815787ejb.224.1633025741544; Thu, 30 Sep 2021 11:15:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633025741; cv=none; d=google.com; s=arc-20160816; b=fPgzxwqSfoAcPG4RZcG1YibE9jAauF8XDjaFJC634OadYm5D0uNnxr3h69R3BbwqRa Pu6xCbzBD5glWG6yDceEyjwF1Ht8XoOvesjF7/7j9x34uOqsmRduohlBXUhzsOX4qeS3 PCa4nem0zYXdMOb+nf+mzJ0KFobs9bprq7OsbdZ7vOB7bE8MEVEgWaZDeTVE6uQt/6XD JR5yHg9g3ex80c3jsMMld0zh8WIgfy57cLvcXYEibppGOvD9yejORQE54+lgiozCfInR xL6YDZp4rvSbebNFUOF8wd3tcj6sWnl95R8s40W8QO4DZ0DzE+bVsukq0p02EIaapcl3 kLbw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=n8b1NQ4vbCnP7qoZ8MY/75YwK5d+q+SYClaNa62me5Q=; b=g18zutUgb8aB0xZs/cgH7DRJRowi8TIdO7UDJX6NNxu0P9R4bsPdGJZeFj/k3+HN2J lxBoKbhiQ+qwWpe4R6o1Q50hIufTqwOhF3po5J2sw9xSgfj5GY7BRhf0ng9ObnZ0pIMe oPQ02c8gg0TH91kmkDE5FWlXcBH60GegI/EbPw5aj51UlzXzRr2FEywBiowLX219Wi3O ZKoAyF1kUYtHERbKR+AGvhCRgGO0VP91pGyDfn4yx0P+ULobTO+Ubx8DwBGWlI1D7ZiW VCYUfTXzl2XMm5qLDXx/kiU2rAVhqabH/OHcreI7AK0ZdjN/VPnGHA9JqzDRkRAkwnHS oJMg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="I8jjt/rY"; spf=pass (google.com: domain of linux-kselftest-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kselftest-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ga1si4939846ejc.128.2021.09.30.11.15.41; Thu, 30 Sep 2021 11:15:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kselftest-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="I8jjt/rY"; spf=pass (google.com: domain of linux-kselftest-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kselftest-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353312AbhI3SRX (ORCPT + 5 others); Thu, 30 Sep 2021 14:17:23 -0400 Received: from mail.kernel.org ([198.145.29.99]:56294 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353145AbhI3SRX (ORCPT ); Thu, 30 Sep 2021 14:17:23 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id AAEC461A02; Thu, 30 Sep 2021 18:15:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1633025740; bh=l6+JWYoEZiST/b/oaay4qqKgTm5vYAcRw9QxR4U0kzE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=I8jjt/rYrg5E4Enptp8AGKSB2Hfu/b/N0w7SgXzQAQe+T7MF2et1Q9Z2Ax/kIQQco jMdXDp6Pczo+JZeabtikNyYRDl4k7D7032m3h1rxgrkaaADglUer8Xq+pC7X1jxJ4D OiS15xTiX+TJQjlaSWwQtBBo3N0/rVYINs8iwY9G7XvK4hJKk0vXxviykmyxFBBScy LnxQ0SegM2iH1P964k5k8psawWt4OPaY9rVWru1c18KBFyVagwrjN/zfzVC4eKqB+r r0PUUZTZXiNlHP7oJ94wA6RQvVRoHolcol52w+HvFwSqmnacQ7XxTaY4YUVpuctQCF pXYV/tIsWZWaA== From: Mark Brown To: Catalin Marinas , Will Deacon , Shuah Khan , Shuah Khan Cc: Alan Hayward , Luis Machado , Salil Akerkar , Basant Kumar Dwivedi , Szabolcs Nagy , linux-arm-kernel@lists.infradead.org, linux-kselftest@vger.kernel.org, Mark Brown Subject: [PATCH v1 01/38] arm64/fp: Reindent fpsimd_save() Date: Thu, 30 Sep 2021 19:11:07 +0100 Message-Id: <20210930181144.10029-2-broonie@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210930181144.10029-1-broonie@kernel.org> References: <20210930181144.10029-1-broonie@kernel.org> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1862; h=from:subject; bh=l6+JWYoEZiST/b/oaay4qqKgTm5vYAcRw9QxR4U0kzE=; b=owEBbQGS/pANAwAKASTWi3JdVIfQAcsmYgBhVf3C1BuzGrlbEpHu7U8KsHvx+MmjgKFRL5Kp84rp kIS632uJATMEAAEKAB0WIQSt5miqZ1cYtZ/in+ok1otyXVSH0AUCYVX9wgAKCRAk1otyXVSH0JaAB/ 9B8LMpzFTruHCiTRLoZzXZuJZnXFBOjNlZ4sIRJ0lIfkRAbatV9tVaksXwZPJA9m1Ow4OY9guqujQp zQKLGF1pRnGobo2Maci8Sdm4miIBpIHciTzTqlsIiD+uCFS5zAZGT9aChH54/9e9tJsjIInwbSJqU1 MV1EEOBMdvqDH2xakIRPwFccJwhY1Ldlltc86kwWJCP5vicaQlcvJd1xEbOSCj1WTcKEU2yhMvNvgm BC2J4VU0erRkSHYEH1zDk8AYm4tfI5kBo+0PsXkBaxePENR0IoCfaDT4R65L5y+BG7dVxXzkaNgmXi Vl/m652RTMWBBZYREq+Ji5CNIGvHU/ X-Developer-Key: i=broonie@kernel.org; a=openpgp; fpr=3F2568AAC26998F9E813A1C5C3F436CA30F5D8EB Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org Currently all the active code in fpsimd_save() is inside a check for TIF_FOREIGN_FPSTATE. Reduce the indentation level by changing to return from the function if TIF_FOREIGN_FPSTATE is set. Signed-off-by: Mark Brown --- arch/arm64/kernel/fpsimd.c | 38 ++++++++++++++++++++------------------ 1 file changed, 20 insertions(+), 18 deletions(-) -- 2.20.1 diff --git a/arch/arm64/kernel/fpsimd.c b/arch/arm64/kernel/fpsimd.c index ff4962750b3d..995f8801602b 100644 --- a/arch/arm64/kernel/fpsimd.c +++ b/arch/arm64/kernel/fpsimd.c @@ -308,24 +308,26 @@ static void fpsimd_save(void) WARN_ON(!system_supports_fpsimd()); WARN_ON(!have_cpu_fpsimd_context()); - if (!test_thread_flag(TIF_FOREIGN_FPSTATE)) { - if (IS_ENABLED(CONFIG_ARM64_SVE) && - test_thread_flag(TIF_SVE)) { - if (WARN_ON(sve_get_vl() != last->sve_vl)) { - /* - * Can't save the user regs, so current would - * re-enter user with corrupt state. - * There's no way to recover, so kill it: - */ - force_signal_inject(SIGKILL, SI_KERNEL, 0, 0); - return; - } - - sve_save_state((char *)last->sve_state + - sve_ffr_offset(last->sve_vl), - &last->st->fpsr); - } else - fpsimd_save_state(last->st); + if (test_thread_flag(TIF_FOREIGN_FPSTATE)) + return; + + if (IS_ENABLED(CONFIG_ARM64_SVE) && + test_thread_flag(TIF_SVE)) { + if (WARN_ON(sve_get_vl() != last->sve_vl)) { + /* + * Can't save the user regs, so current would + * re-enter user with corrupt state. + * There's no way to recover, so kill it: + */ + force_signal_inject(SIGKILL, SI_KERNEL, 0, 0); + return; + } + + sve_save_state((char *)last->sve_state + + sve_ffr_offset(last->sve_vl), + &last->st->fpsr); + } else { + fpsimd_save_state(last->st); } }